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:
pieces = data.split("|")
if not len(pieces) == 4:
if len(pieces) != 4:
state = "UNKNOWN"
ret = 3
data = "Results file malformed"

View File

@ -63,12 +63,12 @@ def split_for_id_and_class(element: str) -> List[str]:
if ch == "}":
outside_braces = True
if ch == " " and outside_braces:
if not s == "":
if s != "":
lst.append(s)
s = ""
else:
s += ch
if not s == "":
if s != "":
lst.append(s)
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:
html = f.read()
phtml = pretty_print_html(tokens, fn)
if not html.split("\n") == phtml.split("\n"):
if html.split("\n") != phtml.split("\n"):
if fix:
print(GREEN + f"Automatically fixing indentation for {fn}" + ENDC)
with open(fn, "w") as f:

View File

@ -1756,9 +1756,8 @@ class MarkdownListPreprocessor(markdown.preprocessors.Preprocessor):
fence_str = m.group("fence")
lang: Optional[str] = m.group("lang")
is_code = lang not in ("quote", "quoted")
has_open_fences = not len(open_fences) == 0
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

View File

@ -2030,7 +2030,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings): # type
allowed_bot_types = []
if (
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 += [
@ -3070,7 +3070,7 @@ class Draft(models.Model):
to = []
for r in get_display_recipient(self.recipient):
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"])
return {
"id": self.id,

View File

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