@staticmethod
def looks_like_spam(title: str, description: str) -> bool:
return (
- 'marketplace' in description
- or 'national-marketplace' in description
- or re.search('[Ww]eed', title) is not None
- or re.search('[Cc]annabis', title) is not None
- or re.search('[Cc]annabis', description) is not None
- or 'THC' in title
- or re.search('[Tt]op.[Rr]ated', title) is not None
- or re.search('[Ll]ose [Ww]eight', title) is not None
- or re.search('[Ll]ose [Ww]eight', description) is not None
+ description is not None
+ and title is not None
+ and (
+ 'marketplace' in description
+ or 'national-marketplace' in description
+ or re.search('[Ww]eed', title) is not None
+ or re.search('[Cc]annabis', title) is not None
+ or re.search('[Cc]annabis', description) is not None
+ or 'THC' in title
+ or re.search('[Tt]op.[Rr]ated', title) is not None
+ or re.search('[Ll]ose [Ww]eight', title) is not None
+ or re.search('[Ll]ose [Ww]eight', description) is not None
+ )
)
def item_is_interesting_for_headlines(