Skip to content

Commit c219138

Browse files
committed
fixup! fix(python): 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.
1 parent 8379b04 commit c219138

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

bolt/docs/generate_doc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def parse_bolt_options(output):
4545
cleaned_line = line.strip()
4646

4747
if cleaned_line.casefold() in map(str.casefold, section_headers):
48-
if prev_section != None: # Save last option from prev section
48+
if prev_section is not None: # Save last option from prev section
4949
add_info(sections, current_section, option, description)
5050
option, description = None, []
5151

@@ -76,7 +76,7 @@ def parse_bolt_options(output):
7676
description = [descr]
7777
if option.startswith("--print") or option.startswith("--time"):
7878
current_section = "BOLT printing options:"
79-
elif prev_section != None:
79+
elif prev_section is not None:
8080
current_section = prev_section
8181
continue
8282

bolt/test/perf2bolt/lit.local.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import shutil
22

3-
if shutil.which("perf") != None:
3+
if shutil.which("perf") is not None:
44
config.available_features.add("perf")

clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ bool IdentifierNamingCheck::isParamInMainLikeFunction(
10711071
if (!IsIntType(FDecl->parameters()[0]->getType()))
10721072
return false;
10731073
MainType Type = IsCharPtrPtr(FDecl->parameters()[1]->getType());
1074-
if (Type == None)
1074+
if (Type is None)
10751075
return false;
10761076
if (FDecl->getNumParams() == 3 &&
10771077
IsCharPtrPtr(FDecl->parameters()[2]->getType()) != Type)

lldb/bindings/interface/SBBreakpointDocstrings.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ TestBreakpointIgnoreCount.py),::
3939
#lldbutil.print_stacktraces(process)
4040
from lldbutil import get_stopped_thread
4141
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
42-
self.assertTrue(thread != None, 'There should be a thread stopped due to breakpoint')
42+
self.assertTrue(thread is not None, 'There should be a thread stopped due to breakpoint')
4343
frame0 = thread.GetFrameAtIndex(0)
4444
frame1 = thread.GetFrameAtIndex(1)
4545
frame2 = thread.GetFrameAtIndex(2)

lldb/bindings/interface/SBDataExtensions.i

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ STRING_EXTENSION_OUTSIDE(SBData)
4040
lldbtarget = lldbdict['target']
4141
else:
4242
lldbtarget = None
43-
if target == None and lldbtarget != None and lldbtarget.IsValid():
43+
if target is None and lldbtarget is not None and lldbtarget.IsValid():
4444
target = lldbtarget
45-
if ptr_size == None:
45+
if ptr_size is None:
4646
if target and target.IsValid():
4747
ptr_size = target.addr_size
4848
else:
4949
ptr_size = 8
50-
if endian == None:
50+
if endian is None:
5151
if target and target.IsValid():
5252
endian = target.byte_order
5353
else:
5454
endian = lldbdict['eByteOrderLittle']
55-
if size == None:
55+
if size is None:
5656
if value > 2147483647:
5757
size = 8
5858
elif value < -2147483648:

polly/lib/External/isl/interface/python.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static void print_persistent_callback_failure_check(int indent,
347347
printf(fmt, 0);
348348
printf(", '%s') and ", callback_name.c_str());
349349
printf(fmt, 0);
350-
printf(".%s['exc_info'] != None:\n", callback_name.c_str());
350+
printf(".%s['exc_info'] is not None:\n", callback_name.c_str());
351351
print_indent(indent, " exc_info = ");
352352
printf(fmt, 0);
353353
printf(".%s['exc_info'][0]\n", callback_name.c_str());

polly/test/lit.site.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ config.extra_paths = "@POLLY_TEST_EXTRA_PATHS@".split(";")
1414
## Check the current platform with regex
1515
import re
1616
EAT_ERR_ON_X86 = ' '
17-
if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') == None) :
17+
if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') is None) :
1818
EAT_ERR_ON_X86 = '|| echo \"error is eaten\"'
1919

2020
for arch in config.targets_to_build.split():

utils/bazel/configure.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _extract_cmake_settings(repository_ctx, llvm_cmake):
110110
# Skip if `CMAKE_CXX_STANDARD` is set with
111111
# `LLVM_REQUIRED_CXX_STANDARD`.
112112
# Then `v` will not be desired form, like "${...} CACHE"
113-
if c[k] != None:
113+
if c[k] is not None:
114114
continue
115115

116116
# Pick up 1st word as the value.
@@ -160,7 +160,7 @@ def _llvm_configure_impl(repository_ctx):
160160
repository_ctx,
161161
"cmake/Modules/LLVMVersion.cmake",
162162
)
163-
version = {k: v for k, v in version.items() if v != None}
163+
version = {k: v for k, v in version.items() if v is not None}
164164
vars.update(version)
165165

166166
_write_dict_to_file(

0 commit comments

Comments
 (0)