From edcca5f7ad2ba92b3e04fb153f7db55c08593469 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Sat, 27 Oct 2018 01:18:15 +0200 Subject: [PATCH] Dont use equality operators with None singleton in python files --- SConstruct | 4 ++-- doc/tools/doc_merge.py | 2 +- doc/tools/makerst.py | 8 ++++---- gles_builders.py | 4 ++-- methods.py | 2 +- platform/android/detect.py | 4 ++-- platform/iphone/detect.py | 2 +- platform/osx/detect.py | 2 +- platform/uwp/detect.py | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/SConstruct b/SConstruct index f8c1c829619..999021e49a0 100644 --- a/SConstruct +++ b/SConstruct @@ -544,7 +544,7 @@ if 'env' in locals(): [os.remove(f) for f in files] def file_list(self): - if self.path == None: + if self.path is None: # Nothing to do return [] # Gather a list of (filename, (size, atime)) within the @@ -569,7 +569,7 @@ if 'env' in locals(): if sum > self.limit: mark = i break - if mark == None: + if mark is None: return [] else: return [x[0] for x in file_stat[mark:]] diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py index 57ac4bdcddf..496d5dcb74b 100644 --- a/doc/tools/doc_merge.py +++ b/doc/tools/doc_merge.py @@ -82,7 +82,7 @@ def find_signal_descr(old_class, name): def find_constant_descr(old_class, name): - if (old_class == None): + if (old_class is None): return None constants = old_class.find("constants") if(constants != None and len(list(constants)) > 0): diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index b3d6d32c26e..7b7cc525478 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -375,7 +375,7 @@ def make_method( event=False, pp=None ): - if (declare or pp == None): + if (declare or pp is None): t = '- ' else: t = "" @@ -405,7 +405,7 @@ def make_method( t += 'void' t += ' ' - if declare or pp == None: + if declare or pp is None: s = '**' + method_data.attrib['name'] + '** ' else: @@ -577,7 +577,7 @@ def make_rst_class(node): make_method(f, name, m, True, True) f.write('\n') d = m.find('description') - if d == None or d.text.strip() == '': + if d is None or d.text.strip() == '': continue f.write(rstize_text(d.text.strip(), name)) f.write("\n\n") @@ -676,7 +676,7 @@ def make_rst_class(node): make_method(f, name, m, True) f.write('\n') d = m.find('description') - if d == None or d.text.strip() == '': + if d is None or d.text.strip() == '': continue f.write(rstize_text(d.text.strip(), name)) f.write("\n\n") diff --git a/gles_builders.py b/gles_builders.py index 1e63a53f1a3..f9fd6d3fa22 100644 --- a/gles_builders.py +++ b/gles_builders.py @@ -59,11 +59,11 @@ def include_file_in_legacygl_header(filename, header_data, depth): included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline) if not included_file in header_data.vertex_included_files and header_data.reading == "vertex": header_data.vertex_included_files += [included_file] - if include_file_in_legacygl_header(included_file, header_data, depth + 1) == None: + if include_file_in_legacygl_header(included_file, header_data, depth + 1) is None: print("Error in file '" + filename + "': #include " + includeline + "could not be found!") elif not included_file in header_data.fragment_included_files and header_data.reading == "fragment": header_data.fragment_included_files += [included_file] - if include_file_in_legacygl_header(included_file, header_data, depth + 1) == None: + if include_file_in_legacygl_header(included_file, header_data, depth + 1) is None: print("Error in file '" + filename + "': #include " + includeline + "could not be found!") line = fs.readline() diff --git a/methods.py b/methods.py index 0cf05751a82..111a2347bef 100644 --- a/methods.py +++ b/methods.py @@ -330,7 +330,7 @@ def split_lib(self, libname, src_list = None, env_lib = None): list = [] lib_list = [] - if src_list == None: + if src_list is None: src_list = getattr(env, libname + "_sources") if type(env_lib) == type(None): diff --git a/platform/android/detect.py b/platform/android/detect.py index 953a2fa6d2a..e4cab2fb23a 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -186,7 +186,7 @@ def configure(env): env.PrependENVPath('PATH', tools_path) ccache_path = os.environ.get("CCACHE") - if ccache_path == None: + if ccache_path is None: env['CC'] = compiler_path + '/clang' env['CXX'] = compiler_path + '/clang++' else: @@ -293,7 +293,7 @@ def configure(env): # Return NDK version string in source.properties (adapted from the Chromium project). def get_ndk_version(path): - if path == None: + if path is None: return None prop_file_path = os.path.join(path, "source.properties") try: diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index b13a1e96435..417571f6f3d 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -87,7 +87,7 @@ def configure(env): s_compiler_path = '$IPHONEPATH/Developer/usr/bin/' ccache_path = os.environ.get("CCACHE") - if ccache_path == None: + if ccache_path is None: env['CC'] = compiler_path + 'clang' env['CXX'] = compiler_path + 'clang++' env['S_compiler'] = s_compiler_path + 'gcc' diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 8a0883eca3c..c5bd64b15cd 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -89,7 +89,7 @@ def configure(env): basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" ccache_path = os.environ.get("CCACHE") - if ccache_path == None: + if ccache_path is None: env['CC'] = basecmd + "cc" env['CXX'] = basecmd + "c++" else: diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 559f23ca5b3..f25b9ba9cd4 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -17,7 +17,7 @@ def can_build(): # building natively on windows! if (os.getenv("VSINSTALLDIR")): - if (os.getenv("ANGLE_SRC_PATH") == None): + if (os.getenv("ANGLE_SRC_PATH") is None): return False return True