mypy: Enable redundant-expr error.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-26 13:41:24 -07:00
parent e747d3b712
commit 95b33b83b5
3 changed files with 6 additions and 3 deletions

View file

@ -36,6 +36,7 @@ warn_return_any = false
# Enable optional errors.
enable_error_code = [
"redundant-self",
"redundant-expr",
"truthy-bool",
"truthy-iterable",
"unused-awaitable",

View file

@ -14,7 +14,7 @@ import sys
import time
import urllib.parse
from html.parser import HTMLParser
from typing import Any, Dict, List, Tuple
from typing import Any, Dict, List, Optional, Tuple
import feedparser
@ -225,7 +225,9 @@ for feed_url in feed_urls:
for entry in data.entries:
entry_hash = compute_entry_hash(entry)
# An entry has either been published or updated.
entry_time: Tuple[int, int] = entry.get("published_parsed", entry.get("updated_parsed"))
entry_time: Optional[Tuple[int, int]] = entry.get(
"published_parsed", entry.get("updated_parsed")
)
if (
entry_time is not None
and (time.time() - calendar.timegm(entry_time)) > OLDNESS_THRESHOLD * 60 * 60 * 24

View file

@ -152,7 +152,7 @@ class SalesforceHandler:
for command_keyword in command["commands"]:
if content.startswith(command_keyword):
args = content.replace(command_keyword, "").strip()
if args is not None and args != "":
if args != "":
if "callback" in command.keys():
return command["callback"](args, self.sf, command)
else: