Cleaned up prints

This commit is contained in:
Jacob Henry 2018-11-20 21:32:45 -05:00
parent 1b78055d7d
commit fb84e3ddda
3 changed files with 1 additions and 7 deletions

View File

@ -64,7 +64,6 @@ class ClientWrapper(object):
async for t in self.spool_tasks(): async for t in self.spool_tasks():
if DEBUG_MODE: if DEBUG_MODE:
await t await t
print("Handling a message...!")
async def spool_tasks(self) -> AsyncGenerator[asyncio.Task, Any]: async def spool_tasks(self) -> AsyncGenerator[asyncio.Task, Any]:
async for msg in self.async_message_feed(): async for msg in self.async_message_feed():

View File

@ -46,7 +46,6 @@ async def scroll_callback(slack: SlackClient, msg: dict, match: Match) -> None:
query = match.group(1).strip() query = match.group(1).strip()
# Try to get as int or by name # Try to get as int or by name
result = None
try: try:
sn = int(query) sn = int(query)
result = find_by_scroll(sn) result = find_by_scroll(sn)
@ -58,7 +57,7 @@ async def scroll_callback(slack: SlackClient, msg: dict, match: Match) -> None:
result = "Couldn't find brother {}".format(query) result = "Couldn't find brother {}".format(query)
# Respond # Respond
print(slack_util.reply(slack, msg, result)) slack_util.reply(slack, msg, result)
def find_by_scroll(scroll: int) -> Optional[Brother]: def find_by_scroll(scroll: int) -> Optional[Brother]:
@ -95,7 +94,6 @@ async def find_by_name(name: str, threshold: Optional[float] = None) -> Brother:
found, score = process.extractOne(name, all_names) found, score = process.extractOne(name, all_names)
found_index = all_names.index(found) found_index = all_names.index(found)
found_brother = brothers[found_index] found_brother = brothers[found_index]
print(score)
if (not threshold) or score > threshold: if (not threshold) or score > threshold:
return found_brother return found_brother
else: else:

View File

@ -146,17 +146,14 @@ class Hook(AbsHook):
# Fail if pattern invalid # Fail if pattern invalid
match = re.match(self.pattern, msg['text'], flags=re.IGNORECASE) match = re.match(self.pattern, msg['text'], flags=re.IGNORECASE)
if match is None: if match is None:
# print("Missed pattern")
return None return None
# Fail if whitelist defined, and we aren't there # Fail if whitelist defined, and we aren't there
if self.channel_whitelist is not None and msg["channel"] not in self.channel_whitelist: if self.channel_whitelist is not None and msg["channel"] not in self.channel_whitelist:
# print("Missed whitelist")
return None return None
# Fail if blacklist defined, and we are there # Fail if blacklist defined, and we are there
if self.channel_blacklist is not None and msg["channel"] in self.channel_blacklist: if self.channel_blacklist is not None and msg["channel"] in self.channel_blacklist:
# print("Hit blacklist")
return None return None
return self.callback(slack, msg, match) return self.callback(slack, msg, match)