File size: 485 Bytes
34c32eb | 1 2 3 4 5 6 7 8 9 10 | import re
def reference(value,fallback):
text=' '.join(str(value or '').split())
if not text or re.fullmatch(r'(?:s[123]_.+|R\d+|L\d+-\d+|H1-\d+)',text):return fallback
text=re.sub(r'#\d+\s*','',text).strip()
if not text:return fallback
return text if text.lower().startswith(('the ','this ','that ','your ')) else 'the '+text
def rejection(item=None,target=None):
return 'You cannot use '+reference(item,'this item')+' on '+reference(target,'this object')+'.'
|