# HG changeset patch
# User Anton Shestakov <a...@dwimlabs.net>
# Date 1507042260 -28800
#      Tue Oct 03 22:51:00 2017 +0800
# Node ID 1353e4a44cebc36ba8e1caf67804b2ca6a8a8239
# Parent  2d42bd025754427cae1ba18f43a64c692d9c67dd
legacy: rename lookup_errors to not be in all caps (flake8 warning)

flake8 has a plugin, pep8-naming, which is not installed by default, but is
used if available, no extra config required. This plugin checks names of
variables, classes, functions and so on against PEP-8, and it complained about
this variable:

  N806 variable in function should be lowercase

Since this isn't a module-level constant, but just a helper variable used only
in one function, it's fine to just rename it.

With this error gone, flake8 output (used plugins: mccabe, naming, pycodestyle,
pyflakes) is totally clean.

diff --git a/hgext3rd/evolve/legacy.py b/hgext3rd/evolve/legacy.py
--- a/hgext3rd/evolve/legacy.py
+++ b/hgext3rd/evolve/legacy.py
@@ -129,16 +129,16 @@ def cmddebugconvertobsolete(ui, repo):
                     del oldmark['reason']  # unused until then
                     oldobject = str(oldmark.pop('object'))
                     oldsubjects = [str(s) for s in oldmark.pop('subjects', [])]
-                    LOOKUP_ERRORS = (error.RepoLookupError, error.LookupError)
+                    lookup_errors = (error.RepoLookupError, error.LookupError)
                     if len(oldobject) != 40:
                         try:
                             oldobject = repo[oldobject].node()
-                        except LOOKUP_ERRORS:
+                        except lookup_errors:
                             pass
                     if any(len(s) != 40 for s in oldsubjects):
                         try:
                             oldsubjects = [repo[s].node() for s in oldsubjects]
-                        except LOOKUP_ERRORS:
+                        except lookup_errors:
                             pass
 
                     oldmark['date'] = '%i %i' % tuple(oldmark['date'])
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to