Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def __check_for_party(self, user_list):
party_column = []
# iterate through each user account
for user in user_list:
# iterate trough all parties
for party in self.__cfg.get('parties'):
res = "unknown"
# Check first all abbreviations
# We don't do lower here because that could result to false positive
for abbr in party['abbrs']:
if abbr in user.description or abbr in user.screen_name:
res = party['abbrs'][0]
# Check now if the party twitter screen name is referenced
if res == "unknown":
if user.description is not None \
and party['twitter'] is not None\
and len(party['twitter']) > 0:
if party['twitter'].lower() in user.description.lower():
res = party['abbrs'][0]
# We are exiting here the party list iterations in
# case we found a result
if res != "unknown":
return party_column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment