ruff: Fix SIM201 Use `… != …` instead of `not … == …`.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-01-17 21:30:35 -05:00 committed by Tim Abbott
parent 25346bde98
commit 7a7513f6e0
6 changed files with 8 additions and 9 deletions

View File

@ -26,7 +26,7 @@ def nagios_from_file(results_file: str, max_time_diff: int = 60 * 2) -> Tuple[in
else: else:
pieces = data.split("|") pieces = data.split("|")
if not len(pieces) == 4: if len(pieces) != 4:
state = "UNKNOWN" state = "UNKNOWN"
ret = 3 ret = 3
data = "Results file malformed" data = "Results file malformed"

View File

@ -63,12 +63,12 @@ def split_for_id_and_class(element: str) -> List[str]:
if ch == "}": if ch == "}":
outside_braces = True outside_braces = True
if ch == " " and outside_braces: if ch == " " and outside_braces:
if not s == "": if s != "":
lst.append(s) lst.append(s)
s = "" s = ""
else: else:
s += ch s += ch
if not s == "": if s != "":
lst.append(s) lst.append(s)
return lst return lst

View File

@ -154,7 +154,7 @@ def validate_indent_html(fn: str, tokens: List[Token], fix: bool) -> bool:
with open(fn) as f: with open(fn) as f:
html = f.read() html = f.read()
phtml = pretty_print_html(tokens, fn) phtml = pretty_print_html(tokens, fn)
if not html.split("\n") == phtml.split("\n"): if html.split("\n") != phtml.split("\n"):
if fix: if fix:
print(GREEN + f"Automatically fixing indentation for {fn}" + ENDC) print(GREEN + f"Automatically fixing indentation for {fn}" + ENDC)
with open(fn, "w") as f: with open(fn, "w") as f:

View File

@ -1756,9 +1756,8 @@ class MarkdownListPreprocessor(markdown.preprocessors.Preprocessor):
fence_str = m.group("fence") fence_str = m.group("fence")
lang: Optional[str] = m.group("lang") lang: Optional[str] = m.group("lang")
is_code = lang not in ("quote", "quoted") is_code = lang not in ("quote", "quoted")
has_open_fences = not len(open_fences) == 0
matches_last_fence = ( matches_last_fence = (
fence_str == open_fences[-1].fence_str if has_open_fences else False fence_str == open_fences[-1].fence_str if open_fences else False
) )
closes_last_fence = not lang and matches_last_fence closes_last_fence = not lang and matches_last_fence

View File

@ -2030,7 +2030,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings): # type
allowed_bot_types = [] allowed_bot_types = []
if ( if (
self.is_realm_admin self.is_realm_admin
or not self.realm.bot_creation_policy == Realm.BOT_CREATION_LIMIT_GENERIC_BOTS or self.realm.bot_creation_policy != Realm.BOT_CREATION_LIMIT_GENERIC_BOTS
): ):
allowed_bot_types.append(UserProfile.DEFAULT_BOT) allowed_bot_types.append(UserProfile.DEFAULT_BOT)
allowed_bot_types += [ allowed_bot_types += [
@ -3070,7 +3070,7 @@ class Draft(models.Model):
to = [] to = []
for r in get_display_recipient(self.recipient): for r in get_display_recipient(self.recipient):
assert not isinstance(r, str) # It will only be a string for streams assert not isinstance(r, str) # It will only be a string for streams
if not r["id"] == self.user_profile_id: if r["id"] != self.user_profile_id:
to.append(r["id"]) to.append(r["id"])
return { return {
"id": self.id, "id": self.id,

View File

@ -263,7 +263,7 @@ def parse_change_event(change_type: str, message: WildValue) -> Optional[EventTy
if not tamed_old: if not tamed_old:
event_type = "set_" + change_type event_type = "set_" + change_type
values["new"] = tamed_new values["new"] = tamed_new
elif not tamed_old == tamed_new: elif tamed_old != tamed_new:
event_type = change_type event_type = change_type
values.update(old=tamed_old, new=tamed_new) values.update(old=tamed_old, new=tamed_new)
else: else: