autopep8: F841 undefined name
Special cases:
- `long` and `unicode` no longer exist in python 3. I added a "# noqa"
comment to avoid warnings.
- `cmp` method no longer exist in python 3. It was used in the
`test/unittest_analyze.py` file in the __cmp__ method. It appears that
when this method is removed, all the tests are still valid. Therefore I
dropped it.
--- a/rql/nodes.py Wed Feb 13 19:01:27 2019 +0100
+++ b/rql/nodes.py Wed Feb 13 19:10:43 2019 +0100
@@ -49,8 +49,8 @@
timedelta: 'Interval',
}
if sys.version_info < (3,):
- ETYPE_PYOBJ_MAP[long] = 'Int'
- ETYPE_PYOBJ_MAP[unicode] = 'String'
+ ETYPE_PYOBJ_MAP[long] = 'Int' # noqa
+ ETYPE_PYOBJ_MAP[unicode] = 'String' # noqa
KEYWORD_MAP = {'NOW': datetime.now,
'TODAY': date.today}
--- a/rql/parser_main.py Wed Feb 13 19:01:27 2019 +0100
+++ b/rql/parser_main.py Wed Feb 13 19:10:43 2019 +0100
@@ -24,6 +24,7 @@
if __name__ == '__main__':
from sys import argv
+ from rql.parser import Hercule, HerculeScanner
parser = Hercule(HerculeScanner(argv[1]))
e_types = {}
--- a/test/unittest_analyze.py Wed Feb 13 19:01:27 2019 +0100
+++ b/test/unittest_analyze.py Wed Feb 13 19:10:43 2019 +0100
@@ -26,10 +26,6 @@
class ERSchema(object):
- def __cmp__(self, other):
- other = getattr(other, 'type', other)
- return cmp(self.type, other)
-
def __hash__(self):
return hash(self.type)
--- a/test/unittest_nodes.py Wed Feb 13 19:01:27 2019 +0100
+++ b/test/unittest_nodes.py Wed Feb 13 19:10:43 2019 +0100
@@ -46,7 +46,7 @@
def test_int(self):
self.assertEqual(nodes.etype_from_pyobj(0), 'Int')
if sys.version_info < (3,):
- l = long
+ l = long # noqa
self.assertEqual(nodes.etype_from_pyobj(l('1L')), 'Int')
def test_float(self):
--- a/tox.ini Wed Feb 13 19:01:27 2019 +0100
+++ b/tox.ini Wed Feb 13 19:10:43 2019 +0100
@@ -11,7 +11,7 @@
basepython = python3
deps =
flake8
-commands = flake8 {posargs:--ignore=E501,E741,F403,F405,F811,F821,E123,E226,W503,E241,W504,E126,E121}
+commands = flake8 {posargs:--ignore=E501,E741,F403,F405,F811,E123,E226,W503,E241,W504,E126,E121}
[pytest]
python_files = *test_*.py