Bug 1587206 - [lint.flake8] Enable F632 across the tree, r=sylvestre
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 10 Oct 2019 18:50:33 +0000
changeset 497261 2921dbcceadc9adb0f12188f62a8f86bd18b0f93
parent 497260 be910f652c9d38edc8632e98ec382bc3f264e3fb
child 497262 1d6d7e7ddbbd5f7ba324621630a7a7e59db82dfc
push id36681
push usercbrindusan@mozilla.com
push dateFri, 11 Oct 2019 21:50:12 +0000
treeherdermozilla-central@c5e6477c3a24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssylvestre
bugs1587206
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1587206 - [lint.flake8] Enable F632 across the tree, r=sylvestre This ensures we use ==/!= to strings and ints (instead of is/is not). Differential Revision: https://phabricator.services.mozilla.com/D48609
.flake8
js/src/gdb/mozilla/unwind.py
js/src/tests/jstests.py
python/mozrelease/mozrelease/versions.py
taskcluster/taskgraph/test/test_create.py
testing/marionette/client/marionette_driver/gestures.py
testing/mozbase/mozinstall/mozinstall/mozinstall.py
testing/talos/talos/output.py
tools/vcs/mach_commands.py
xpcom/idl-parser/xpidl/xpidl.py
--- a/.flake8
+++ b/.flake8
@@ -88,17 +88,17 @@ exclude =
     tools/crashreporter/*.configure,
     .ycm_extra_conf.py,
 
 # See:
 #   - http://flake8.pycqa.org/en/latest/user/error-codes.html
 #   - http://pep8.readthedocs.io/en/latest/intro.html#configuration
 ignore =
     # These should be triaged and either fixed or moved to the list below.
-    F632, F633, F811, E117, W504, W605, W606,
+    F633, F811, E117, W504, W605, W606,
     # These are intentionally disabled (not necessarily for good reason).
     #   F723: syntax error in type comment
     #       text contains quotes which breaks our custom JSON formatter
     F723, E121, E123, E126, E129, E133, E226, E241, E242, E402, E704, E741, W503,
 
 per-file-ignores =
     ipc/ipdl/*: F403, F405
     # cpp_eclipse has a lot of multi-line embedded XML which exceeds line length
--- a/js/src/gdb/mozilla/unwind.py
+++ b/js/src/gdb/mozilla/unwind.py
@@ -493,17 +493,17 @@ class x64UnwinderState(UnwinderState):
     def unwind_entry_frame_registers(self, sp, unwind_info):
         sp = sp.cast(self.typecache.void_starstar)
         # Skip the "result" push.
         sp = sp + 1
         for reg in self.PUSHED_REGS:
             data = sp.dereference()
             sp = sp + 1
             unwind_info.add_saved_register(reg, data)
-            if reg is "rbp":
+            if reg == "rbp":
                 unwind_info.add_saved_register(self.SP_REGISTER, sp)
 
 
 class SpiderMonkeyUnwinder(Unwinder):
     """The unwinder object.  This provides the "user interface" to the JIT
     unwinder, and also handles constructing or destroying UnwinderState
     objects as needed."""
 
--- a/js/src/tests/jstests.py
+++ b/js/src/tests/jstests.py
@@ -440,17 +440,17 @@ def load_tests(options, requested_paths,
 
     if options.js_shell is None:
         xul_tester = manifest.NullXULInfoTester()
     else:
         if options.xul_info_src is None:
             xul_info = manifest.XULInfo.create(options.js_shell)
         else:
             xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
-            xul_debug = xul_debug.lower() is 'true'
+            xul_debug = xul_debug.lower() == 'true'
             xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
         feature_args = shlex.split(options.feature_args)
         xul_tester = manifest.XULInfoTester(xul_info, options.js_shell, feature_args)
 
     test_dir = dirname(abspath(__file__))
     path_options = PathOptions(test_dir, requested_paths, excluded_paths)
     test_count = manifest.count_tests(test_dir, path_options)
     test_gen = manifest.load_reftests(test_dir, path_options, xul_tester)
--- a/python/mozrelease/mozrelease/versions.py
+++ b/python/mozrelease/mozrelease/versions.py
@@ -26,17 +26,17 @@ class MozillaVersionCompareMixin():
                     LooseModernMozillaVersion(str(other)))
         else:
             # No versions are loose, therefore we can use StrictVersion
             val = StrictVersion.__cmp__(self, other)
         if has_esr.isdisjoint(set(['other', 'self'])) or \
                 has_esr.issuperset(set(['other', 'self'])):
             #  If both had esr string or neither, then cmp() was accurate
             return val
-        elif val is not 0:
+        elif val != 0:
             # cmp is accurate here even if esr is present in only 1 compare, since
             # versions are not equal
             return val
         elif 'other' in has_esr:
             return -1  # esr is not greater than non esr
         return 1  # non esr is greater than esr
 
 
--- a/taskcluster/taskgraph/test/test_create.py
+++ b/taskcluster/taskgraph/test/test_create.py
@@ -50,17 +50,17 @@ class TestCreate(unittest.TestCase):
 
         create.create_tasks(GRAPH_CONFIG, taskgraph, label_to_taskid, {'level': '4'})
 
         for tid, task in self.created_tasks.iteritems():
             self.assertEqual(task['payload'], 'hello world')
             self.assertEqual(task['schedulerId'], 'domain-level-4')
             # make sure the dependencies exist, at least
             for depid in task.get('dependencies', []):
-                if depid is 'decisiontask':
+                if depid == 'decisiontask':
                     # Don't look for decisiontask here
                     continue
                 self.assertIn(depid, self.created_tasks)
 
     def test_create_task_without_dependencies(self):
         "a task with no dependencies depends on the decision task"
         os.environ['TASK_ID'] = 'decisiontask'
         tasks = {
--- a/testing/marionette/client/marionette_driver/gestures.py
+++ b/testing/marionette/client/marionette_driver/gestures.py
@@ -20,17 +20,17 @@ def smooth_scroll(marionette_session, st
     if axis not in ["x", "y"]:
         raise Exception("Axis must be either 'x' or 'y'")
     if direction not in [-1, 0]:
         raise Exception("Direction must either be -1 negative or 0 positive")
     increments = increments or 100
     wait_period = wait_period or 0.05
     scroll_back = scroll_back or False
     current = 0
-    if axis is "x":
+    if axis == "x":
         if direction is -1:
             offset = [-increments, 0]
         else:
             offset = [increments, 0]
     else:
         if direction is -1:
             offset = [0, -increments]
         else:
--- a/testing/mozbase/mozinstall/mozinstall/mozinstall.py
+++ b/testing/mozbase/mozinstall/mozinstall/mozinstall.py
@@ -219,17 +219,17 @@ def uninstall(install_folder):
         uninstall_folder = '%s\\uninstall' % install_folder
         log_file = '%s\\uninstall.log' % uninstall_folder
 
         if os.path.isfile(log_file):
             trbk = None
             try:
                 cmdArgs = ['%s\\uninstall\helper.exe' % install_folder, '/S']
                 result = subprocess.call(cmdArgs)
-                if result is not 0:
+                if result != 0:
                     raise Exception('Execution of uninstaller failed.')
 
                 # The uninstaller spawns another process so the subprocess call
                 # returns immediately. We have to wait until the uninstall
                 # folder has been removed or until we run into a timeout.
                 end_time = time.time() + TIMEOUT_UNINSTALL
                 while os.path.exists(uninstall_folder):
                     time.sleep(1)
--- a/testing/talos/talos/output.py
+++ b/testing/talos/talos/output.py
@@ -152,17 +152,17 @@ class Output(object):
 
                     # mainthread IO is a list of filenames and accesses, we do
                     # not report this as a counter
                     if 'mainthreadio' in name:
                         continue
 
                     # responsiveness has it's own metric, not the mean
                     # TODO: consider doing this for all counters
-                    if 'responsiveness' is name:
+                    if 'responsiveness' == name:
                         subtest = {
                             'name': name,
                             'value': filter.responsiveness_Metric(vals)
                         }
                         counter_subtests.append(subtest)
                         continue
 
                     subtest = {
--- a/tools/vcs/mach_commands.py
+++ b/tools/vcs/mach_commands.py
@@ -100,17 +100,17 @@ class PullRequestImporter(MachCommandBas
         for patch in self._split_patches(pr_patch.content, bug_number, pull_request, reviewer):
             self.log(logging.INFO, 'commit_msg', patch,
                      'Processing commit [{commit_summary}] by [{author}] at [{date}]')
             patch_cmd = subprocess.Popen(['patch', '-p1', '-s'], stdin=subprocess.PIPE,
                                          cwd=target_dir)
             patch_cmd.stdin.write(patch['diff'])
             patch_cmd.stdin.close()
             patch_cmd.wait()
-            if patch_cmd.returncode is not 0:
+            if patch_cmd.returncode != 0:
                 self.log(logging.ERROR, 'commit_fail', {},
                          'Error applying diff from commit via "patch -p1 -s". Aborting...')
                 sys.exit(patch_cmd.returncode)
             self.repository.commit(patch['commit_msg'], patch['author'], patch['date'],
                                    [target_dir])
             self.log(logging.INFO, 'commit_pass', {},
                      'Committed successfully.')
 
--- a/xpcom/idl-parser/xpidl/xpidl.py
+++ b/xpcom/idl-parser/xpidl/xpidl.py
@@ -674,17 +674,17 @@ class Interface(object):
                 if hasattr(member, 'doccomments'):
                     member.doccomments[0:0] = self.doccomments
                     break
             self.doccomments = parent.getName(TypeId(self.name), None).doccomments
 
         if self.attributes.function:
             has_method = False
             for member in self.members:
-                if member.kind is 'method':
+                if member.kind == 'method':
                     if has_method:
                         raise IDLError(
                             "interface '%s' has multiple methods, but marked 'function'" %
                             self.name, self.location)
                     else:
                         has_method = True
 
         parent.setName(self)