فهرست منبع

Merge pull request #23317 from lupoDharkael/py-none

Dont use equality operators with None singleton in python files
Rémi Verschelde 6 سال پیش
والد
کامیت
8650793eac
9فایلهای تغییر یافته به همراه15 افزوده شده و 15 حذف شده
  1. 2 2
      SConstruct
  2. 1 1
      doc/tools/doc_merge.py
  3. 4 4
      doc/tools/makerst.py
  4. 2 2
      gles_builders.py
  5. 1 1
      methods.py
  6. 2 2
      platform/android/detect.py
  7. 1 1
      platform/iphone/detect.py
  8. 1 1
      platform/osx/detect.py
  9. 1 1
      platform/uwp/detect.py

+ 2 - 2
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:]]

+ 1 - 1
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):

+ 4 - 4
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")

+ 2 - 2
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()

+ 1 - 1
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):

+ 2 - 2
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:

+ 1 - 1
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'

+ 1 - 1
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:

+ 1 - 1
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