[llvm] fix(bolt/**.py): fix comparison to None (PR #94012)
Eisuke Kawashima via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 12:24:57 PDT 2024
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/94012
from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations):
> Comparisons to singletons like None should always be done with is or is not, never the equality operators.
>From 2f729e9157289410ca0022b468c73fc66bb3aa88 Mon Sep 17 00:00:00 2001
From: Eisuke Kawashima <e-kwsm at users.noreply.github.com>
Date: Sat, 11 May 2024 23:57:11 +0900
Subject: [PATCH] fix(bolt/**.py): fix comparison to None
from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations):
> Comparisons to singletons like None should always be done with is or
> is not, never the equality operators.
---
bolt/docs/generate_doc.py | 4 ++--
bolt/test/perf2bolt/lit.local.cfg | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bolt/docs/generate_doc.py b/bolt/docs/generate_doc.py
index d8829daf677b4..763dc00b44ca3 100644
--- a/bolt/docs/generate_doc.py
+++ b/bolt/docs/generate_doc.py
@@ -45,7 +45,7 @@ def parse_bolt_options(output):
cleaned_line = line.strip()
if cleaned_line.casefold() in map(str.casefold, section_headers):
- if prev_section != None: # Save last option from prev section
+ if prev_section is not None: # Save last option from prev section
add_info(sections, current_section, option, description)
option, description = None, []
@@ -76,7 +76,7 @@ def parse_bolt_options(output):
description = [descr]
if option.startswith("--print") or option.startswith("--time"):
current_section = "BOLT printing options:"
- elif prev_section != None:
+ elif prev_section is not None:
current_section = prev_section
continue
diff --git a/bolt/test/perf2bolt/lit.local.cfg b/bolt/test/perf2bolt/lit.local.cfg
index 05f41ff333b0e..4ee9ad08cc78a 100644
--- a/bolt/test/perf2bolt/lit.local.cfg
+++ b/bolt/test/perf2bolt/lit.local.cfg
@@ -1,4 +1,4 @@
import shutil
-if shutil.which("perf") != None:
+if shutil.which("perf") is not None:
config.available_features.add("perf")
\ No newline at end of file
More information about the llvm-commits
mailing list