From 0befda69703e1599ab712d560984c27b251f1c62 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 11 Apr 2019 10:45:01 -0400 Subject: [PATCH] tools: python: update flake8 rules * Tree-factor location of some *.py files for easy demarcation of areas to exclude. PR-URL: https://github.com/nodejs/node/pull/25614 Reviewed-By: Sakthipriyan Vairamani --- .flake8 | 4 ++-- node.gyp | 8 ++++---- src/inspector/node_inspector.gypi | 2 +- test/fixtures/wpt/.gitignore | 1 + test/fixtures/wpt/encoding/resources/single-byte-raw.py | 3 --- .../fixtures/wpt/encoding/resources/text-plain-charset.py | 3 --- tools/{ => inspector_protocol}/jinja2/AUTHORS | 0 .../jinja2/Jinja2-2.10.tar.gz.md5 | 0 .../jinja2/Jinja2-2.10.tar.gz.sha512 | 0 tools/{ => inspector_protocol}/jinja2/LICENSE | 0 tools/{ => inspector_protocol}/jinja2/OWNERS | 0 tools/{ => inspector_protocol}/jinja2/README.chromium | 0 tools/{ => inspector_protocol}/jinja2/__init__.py | 0 tools/{ => inspector_protocol}/jinja2/_compat.py | 0 tools/{ => inspector_protocol}/jinja2/_identifier.py | 0 tools/{ => inspector_protocol}/jinja2/asyncfilters.py | 0 tools/{ => inspector_protocol}/jinja2/asyncsupport.py | 0 tools/{ => inspector_protocol}/jinja2/bccache.py | 0 tools/{ => inspector_protocol}/jinja2/compiler.py | 0 tools/{ => inspector_protocol}/jinja2/constants.py | 0 tools/{ => inspector_protocol}/jinja2/debug.py | 0 tools/{ => inspector_protocol}/jinja2/defaults.py | 0 tools/{ => inspector_protocol}/jinja2/environment.py | 0 tools/{ => inspector_protocol}/jinja2/exceptions.py | 0 tools/{ => inspector_protocol}/jinja2/ext.py | 0 tools/{ => inspector_protocol}/jinja2/filters.py | 0 tools/{ => inspector_protocol}/jinja2/get_jinja2.sh | 0 tools/{ => inspector_protocol}/jinja2/idtracking.py | 0 tools/{ => inspector_protocol}/jinja2/jinja2.gni | 0 tools/{ => inspector_protocol}/jinja2/lexer.py | 0 tools/{ => inspector_protocol}/jinja2/loaders.py | 0 tools/{ => inspector_protocol}/jinja2/meta.py | 0 tools/{ => inspector_protocol}/jinja2/nativetypes.py | 0 tools/{ => inspector_protocol}/jinja2/nodes.py | 0 tools/{ => inspector_protocol}/jinja2/optimizer.py | 0 tools/{ => inspector_protocol}/jinja2/parser.py | 0 tools/{ => inspector_protocol}/jinja2/runtime.py | 0 tools/{ => inspector_protocol}/jinja2/sandbox.py | 0 tools/{ => inspector_protocol}/jinja2/tests.py | 0 tools/{ => inspector_protocol}/jinja2/utils.py | 0 tools/{ => inspector_protocol}/jinja2/visitor.py | 0 tools/{ => inspector_protocol}/markupsafe/AUTHORS | 0 tools/{ => inspector_protocol}/markupsafe/LICENSE | 0 .../markupsafe/MarkupSafe-0.18.tar.gz.md5 | 0 .../markupsafe/MarkupSafe-0.18.tar.gz.sha512 | 0 tools/{ => inspector_protocol}/markupsafe/OWNERS | 0 tools/{ => inspector_protocol}/markupsafe/README.chromium | 0 tools/{ => inspector_protocol}/markupsafe/__init__.py | 0 tools/{ => inspector_protocol}/markupsafe/_compat.py | 0 tools/{ => inspector_protocol}/markupsafe/_constants.py | 0 tools/{ => inspector_protocol}/markupsafe/_native.py | 0 tools/{ => inspector_protocol}/markupsafe/_speedups.c | 0 .../{ => inspector_protocol}/markupsafe/get_markupsafe.sh | 0 tools/{ => js2c_macros}/check_macros.py | 1 + tools/{ => js2c_macros}/dcheck_macros.py | 0 tools/{ => js2c_macros}/nodcheck_macros.py | 0 {src => tools/js2c_macros}/notrace_macros.py | 0 57 files changed, 9 insertions(+), 13 deletions(-) create mode 100644 test/fixtures/wpt/.gitignore delete mode 100644 test/fixtures/wpt/encoding/resources/single-byte-raw.py delete mode 100644 test/fixtures/wpt/encoding/resources/text-plain-charset.py rename tools/{ => inspector_protocol}/jinja2/AUTHORS (100%) rename tools/{ => inspector_protocol}/jinja2/Jinja2-2.10.tar.gz.md5 (100%) rename tools/{ => inspector_protocol}/jinja2/Jinja2-2.10.tar.gz.sha512 (100%) rename tools/{ => inspector_protocol}/jinja2/LICENSE (100%) rename tools/{ => inspector_protocol}/jinja2/OWNERS (100%) rename tools/{ => inspector_protocol}/jinja2/README.chromium (100%) rename tools/{ => inspector_protocol}/jinja2/__init__.py (100%) rename tools/{ => inspector_protocol}/jinja2/_compat.py (100%) rename tools/{ => inspector_protocol}/jinja2/_identifier.py (100%) rename tools/{ => inspector_protocol}/jinja2/asyncfilters.py (100%) rename tools/{ => inspector_protocol}/jinja2/asyncsupport.py (100%) rename tools/{ => inspector_protocol}/jinja2/bccache.py (100%) rename tools/{ => inspector_protocol}/jinja2/compiler.py (100%) rename tools/{ => inspector_protocol}/jinja2/constants.py (100%) rename tools/{ => inspector_protocol}/jinja2/debug.py (100%) rename tools/{ => inspector_protocol}/jinja2/defaults.py (100%) rename tools/{ => inspector_protocol}/jinja2/environment.py (100%) rename tools/{ => inspector_protocol}/jinja2/exceptions.py (100%) rename tools/{ => inspector_protocol}/jinja2/ext.py (100%) rename tools/{ => inspector_protocol}/jinja2/filters.py (100%) rename tools/{ => inspector_protocol}/jinja2/get_jinja2.sh (100%) rename tools/{ => inspector_protocol}/jinja2/idtracking.py (100%) rename tools/{ => inspector_protocol}/jinja2/jinja2.gni (100%) rename tools/{ => inspector_protocol}/jinja2/lexer.py (100%) rename tools/{ => inspector_protocol}/jinja2/loaders.py (100%) rename tools/{ => inspector_protocol}/jinja2/meta.py (100%) rename tools/{ => inspector_protocol}/jinja2/nativetypes.py (100%) rename tools/{ => inspector_protocol}/jinja2/nodes.py (100%) rename tools/{ => inspector_protocol}/jinja2/optimizer.py (100%) rename tools/{ => inspector_protocol}/jinja2/parser.py (100%) rename tools/{ => inspector_protocol}/jinja2/runtime.py (100%) rename tools/{ => inspector_protocol}/jinja2/sandbox.py (100%) rename tools/{ => inspector_protocol}/jinja2/tests.py (100%) rename tools/{ => inspector_protocol}/jinja2/utils.py (100%) rename tools/{ => inspector_protocol}/jinja2/visitor.py (100%) rename tools/{ => inspector_protocol}/markupsafe/AUTHORS (100%) rename tools/{ => inspector_protocol}/markupsafe/LICENSE (100%) rename tools/{ => inspector_protocol}/markupsafe/MarkupSafe-0.18.tar.gz.md5 (100%) rename tools/{ => inspector_protocol}/markupsafe/MarkupSafe-0.18.tar.gz.sha512 (100%) rename tools/{ => inspector_protocol}/markupsafe/OWNERS (100%) rename tools/{ => inspector_protocol}/markupsafe/README.chromium (100%) rename tools/{ => inspector_protocol}/markupsafe/__init__.py (100%) rename tools/{ => inspector_protocol}/markupsafe/_compat.py (100%) rename tools/{ => inspector_protocol}/markupsafe/_constants.py (100%) rename tools/{ => inspector_protocol}/markupsafe/_native.py (100%) rename tools/{ => inspector_protocol}/markupsafe/_speedups.c (100%) rename tools/{ => inspector_protocol}/markupsafe/get_markupsafe.sh (100%) rename tools/{ => js2c_macros}/check_macros.py (95%) rename tools/{ => js2c_macros}/dcheck_macros.py (100%) rename tools/{ => js2c_macros}/nodcheck_macros.py (100%) rename {src => tools/js2c_macros}/notrace_macros.py (100%) diff --git a/.flake8 b/.flake8 index 859c4d3575daaa..07baf0a8a8aa71 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] -exclude=.git,deps,lib,src,test/fixtures,tools/*_macros.py,tools/gyp,tools/inspector_protocol,tools/jinja2,tools/markupsafe,tools/pip,tools/v8_gypfiles/broken -select=E901,E999,F821,F822,F823 +exclude=.git,deps,lib,src,tools/gyp,tools/inspector_protocol,tools/pip,tools/v8_gypfiles/broken +select=E9,F82 diff --git a/node.gyp b/node.gyp index f23fd42908d250..6e792c907b07cf 100644 --- a/node.gyp +++ b/node.gyp @@ -805,20 +805,20 @@ 'inputs': [ '<@(library_files)', 'config.gypi', - 'tools/check_macros.py' + 'tools/js2c_macros/check_macros.py' ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', ], 'conditions': [ [ 'node_use_dtrace=="false" and node_use_etw=="false"', { - 'inputs': [ 'src/notrace_macros.py' ] + 'inputs': [ 'tools/js2c_macros/notrace_macros.py' ] }], [ 'node_debug_lib=="false"', { - 'inputs': [ 'tools/nodcheck_macros.py' ] + 'inputs': [ 'tools/js2c_macros/nodcheck_macros.py' ] }], [ 'node_debug_lib=="true"', { - 'inputs': [ 'tools/dcheck_macros.py' ] + 'inputs': [ 'tools/js2c_macros/dcheck_macros.py' ] }] ], 'action': [ diff --git a/src/inspector/node_inspector.gypi b/src/inspector/node_inspector.gypi index 2eabd9dd3105fa..6ec85461dda0d7 100644 --- a/src/inspector/node_inspector.gypi +++ b/src/inspector/node_inspector.gypi @@ -97,7 +97,7 @@ 'action': [ 'python', 'tools/inspector_protocol/code_generator.py', - '--jinja_dir', '<@(protocol_tool_path)/..', + '--jinja_dir', '<@(protocol_tool_path)', '--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/', '--config', 'src/inspector/node_protocol_config.json', ], diff --git a/test/fixtures/wpt/.gitignore b/test/fixtures/wpt/.gitignore new file mode 100644 index 00000000000000..f104652b68f212 --- /dev/null +++ b/test/fixtures/wpt/.gitignore @@ -0,0 +1 @@ +*.py diff --git a/test/fixtures/wpt/encoding/resources/single-byte-raw.py b/test/fixtures/wpt/encoding/resources/single-byte-raw.py deleted file mode 100644 index b4a6c90405ec85..00000000000000 --- a/test/fixtures/wpt/encoding/resources/single-byte-raw.py +++ /dev/null @@ -1,3 +0,0 @@ -def main(request, response): - response.headers.set("Content-Type", "text/plain;charset=" + request.GET.first("label")) - response.content = "".join(chr(byte) for byte in xrange(255)) diff --git a/test/fixtures/wpt/encoding/resources/text-plain-charset.py b/test/fixtures/wpt/encoding/resources/text-plain-charset.py deleted file mode 100644 index a1c07e70189bce..00000000000000 --- a/test/fixtures/wpt/encoding/resources/text-plain-charset.py +++ /dev/null @@ -1,3 +0,0 @@ -def main(request, response): - response.headers.set("Content-Type", "text/plain;charset=" + request.GET.first("label")) - response.content = "hello encoding" diff --git a/tools/jinja2/AUTHORS b/tools/inspector_protocol/jinja2/AUTHORS similarity index 100% rename from tools/jinja2/AUTHORS rename to tools/inspector_protocol/jinja2/AUTHORS diff --git a/tools/jinja2/Jinja2-2.10.tar.gz.md5 b/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.md5 similarity index 100% rename from tools/jinja2/Jinja2-2.10.tar.gz.md5 rename to tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.md5 diff --git a/tools/jinja2/Jinja2-2.10.tar.gz.sha512 b/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.sha512 similarity index 100% rename from tools/jinja2/Jinja2-2.10.tar.gz.sha512 rename to tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.sha512 diff --git a/tools/jinja2/LICENSE b/tools/inspector_protocol/jinja2/LICENSE similarity index 100% rename from tools/jinja2/LICENSE rename to tools/inspector_protocol/jinja2/LICENSE diff --git a/tools/jinja2/OWNERS b/tools/inspector_protocol/jinja2/OWNERS similarity index 100% rename from tools/jinja2/OWNERS rename to tools/inspector_protocol/jinja2/OWNERS diff --git a/tools/jinja2/README.chromium b/tools/inspector_protocol/jinja2/README.chromium similarity index 100% rename from tools/jinja2/README.chromium rename to tools/inspector_protocol/jinja2/README.chromium diff --git a/tools/jinja2/__init__.py b/tools/inspector_protocol/jinja2/__init__.py similarity index 100% rename from tools/jinja2/__init__.py rename to tools/inspector_protocol/jinja2/__init__.py diff --git a/tools/jinja2/_compat.py b/tools/inspector_protocol/jinja2/_compat.py similarity index 100% rename from tools/jinja2/_compat.py rename to tools/inspector_protocol/jinja2/_compat.py diff --git a/tools/jinja2/_identifier.py b/tools/inspector_protocol/jinja2/_identifier.py similarity index 100% rename from tools/jinja2/_identifier.py rename to tools/inspector_protocol/jinja2/_identifier.py diff --git a/tools/jinja2/asyncfilters.py b/tools/inspector_protocol/jinja2/asyncfilters.py similarity index 100% rename from tools/jinja2/asyncfilters.py rename to tools/inspector_protocol/jinja2/asyncfilters.py diff --git a/tools/jinja2/asyncsupport.py b/tools/inspector_protocol/jinja2/asyncsupport.py similarity index 100% rename from tools/jinja2/asyncsupport.py rename to tools/inspector_protocol/jinja2/asyncsupport.py diff --git a/tools/jinja2/bccache.py b/tools/inspector_protocol/jinja2/bccache.py similarity index 100% rename from tools/jinja2/bccache.py rename to tools/inspector_protocol/jinja2/bccache.py diff --git a/tools/jinja2/compiler.py b/tools/inspector_protocol/jinja2/compiler.py similarity index 100% rename from tools/jinja2/compiler.py rename to tools/inspector_protocol/jinja2/compiler.py diff --git a/tools/jinja2/constants.py b/tools/inspector_protocol/jinja2/constants.py similarity index 100% rename from tools/jinja2/constants.py rename to tools/inspector_protocol/jinja2/constants.py diff --git a/tools/jinja2/debug.py b/tools/inspector_protocol/jinja2/debug.py similarity index 100% rename from tools/jinja2/debug.py rename to tools/inspector_protocol/jinja2/debug.py diff --git a/tools/jinja2/defaults.py b/tools/inspector_protocol/jinja2/defaults.py similarity index 100% rename from tools/jinja2/defaults.py rename to tools/inspector_protocol/jinja2/defaults.py diff --git a/tools/jinja2/environment.py b/tools/inspector_protocol/jinja2/environment.py similarity index 100% rename from tools/jinja2/environment.py rename to tools/inspector_protocol/jinja2/environment.py diff --git a/tools/jinja2/exceptions.py b/tools/inspector_protocol/jinja2/exceptions.py similarity index 100% rename from tools/jinja2/exceptions.py rename to tools/inspector_protocol/jinja2/exceptions.py diff --git a/tools/jinja2/ext.py b/tools/inspector_protocol/jinja2/ext.py similarity index 100% rename from tools/jinja2/ext.py rename to tools/inspector_protocol/jinja2/ext.py diff --git a/tools/jinja2/filters.py b/tools/inspector_protocol/jinja2/filters.py similarity index 100% rename from tools/jinja2/filters.py rename to tools/inspector_protocol/jinja2/filters.py diff --git a/tools/jinja2/get_jinja2.sh b/tools/inspector_protocol/jinja2/get_jinja2.sh similarity index 100% rename from tools/jinja2/get_jinja2.sh rename to tools/inspector_protocol/jinja2/get_jinja2.sh diff --git a/tools/jinja2/idtracking.py b/tools/inspector_protocol/jinja2/idtracking.py similarity index 100% rename from tools/jinja2/idtracking.py rename to tools/inspector_protocol/jinja2/idtracking.py diff --git a/tools/jinja2/jinja2.gni b/tools/inspector_protocol/jinja2/jinja2.gni similarity index 100% rename from tools/jinja2/jinja2.gni rename to tools/inspector_protocol/jinja2/jinja2.gni diff --git a/tools/jinja2/lexer.py b/tools/inspector_protocol/jinja2/lexer.py similarity index 100% rename from tools/jinja2/lexer.py rename to tools/inspector_protocol/jinja2/lexer.py diff --git a/tools/jinja2/loaders.py b/tools/inspector_protocol/jinja2/loaders.py similarity index 100% rename from tools/jinja2/loaders.py rename to tools/inspector_protocol/jinja2/loaders.py diff --git a/tools/jinja2/meta.py b/tools/inspector_protocol/jinja2/meta.py similarity index 100% rename from tools/jinja2/meta.py rename to tools/inspector_protocol/jinja2/meta.py diff --git a/tools/jinja2/nativetypes.py b/tools/inspector_protocol/jinja2/nativetypes.py similarity index 100% rename from tools/jinja2/nativetypes.py rename to tools/inspector_protocol/jinja2/nativetypes.py diff --git a/tools/jinja2/nodes.py b/tools/inspector_protocol/jinja2/nodes.py similarity index 100% rename from tools/jinja2/nodes.py rename to tools/inspector_protocol/jinja2/nodes.py diff --git a/tools/jinja2/optimizer.py b/tools/inspector_protocol/jinja2/optimizer.py similarity index 100% rename from tools/jinja2/optimizer.py rename to tools/inspector_protocol/jinja2/optimizer.py diff --git a/tools/jinja2/parser.py b/tools/inspector_protocol/jinja2/parser.py similarity index 100% rename from tools/jinja2/parser.py rename to tools/inspector_protocol/jinja2/parser.py diff --git a/tools/jinja2/runtime.py b/tools/inspector_protocol/jinja2/runtime.py similarity index 100% rename from tools/jinja2/runtime.py rename to tools/inspector_protocol/jinja2/runtime.py diff --git a/tools/jinja2/sandbox.py b/tools/inspector_protocol/jinja2/sandbox.py similarity index 100% rename from tools/jinja2/sandbox.py rename to tools/inspector_protocol/jinja2/sandbox.py diff --git a/tools/jinja2/tests.py b/tools/inspector_protocol/jinja2/tests.py similarity index 100% rename from tools/jinja2/tests.py rename to tools/inspector_protocol/jinja2/tests.py diff --git a/tools/jinja2/utils.py b/tools/inspector_protocol/jinja2/utils.py similarity index 100% rename from tools/jinja2/utils.py rename to tools/inspector_protocol/jinja2/utils.py diff --git a/tools/jinja2/visitor.py b/tools/inspector_protocol/jinja2/visitor.py similarity index 100% rename from tools/jinja2/visitor.py rename to tools/inspector_protocol/jinja2/visitor.py diff --git a/tools/markupsafe/AUTHORS b/tools/inspector_protocol/markupsafe/AUTHORS similarity index 100% rename from tools/markupsafe/AUTHORS rename to tools/inspector_protocol/markupsafe/AUTHORS diff --git a/tools/markupsafe/LICENSE b/tools/inspector_protocol/markupsafe/LICENSE similarity index 100% rename from tools/markupsafe/LICENSE rename to tools/inspector_protocol/markupsafe/LICENSE diff --git a/tools/markupsafe/MarkupSafe-0.18.tar.gz.md5 b/tools/inspector_protocol/markupsafe/MarkupSafe-0.18.tar.gz.md5 similarity index 100% rename from tools/markupsafe/MarkupSafe-0.18.tar.gz.md5 rename to tools/inspector_protocol/markupsafe/MarkupSafe-0.18.tar.gz.md5 diff --git a/tools/markupsafe/MarkupSafe-0.18.tar.gz.sha512 b/tools/inspector_protocol/markupsafe/MarkupSafe-0.18.tar.gz.sha512 similarity index 100% rename from tools/markupsafe/MarkupSafe-0.18.tar.gz.sha512 rename to tools/inspector_protocol/markupsafe/MarkupSafe-0.18.tar.gz.sha512 diff --git a/tools/markupsafe/OWNERS b/tools/inspector_protocol/markupsafe/OWNERS similarity index 100% rename from tools/markupsafe/OWNERS rename to tools/inspector_protocol/markupsafe/OWNERS diff --git a/tools/markupsafe/README.chromium b/tools/inspector_protocol/markupsafe/README.chromium similarity index 100% rename from tools/markupsafe/README.chromium rename to tools/inspector_protocol/markupsafe/README.chromium diff --git a/tools/markupsafe/__init__.py b/tools/inspector_protocol/markupsafe/__init__.py similarity index 100% rename from tools/markupsafe/__init__.py rename to tools/inspector_protocol/markupsafe/__init__.py diff --git a/tools/markupsafe/_compat.py b/tools/inspector_protocol/markupsafe/_compat.py similarity index 100% rename from tools/markupsafe/_compat.py rename to tools/inspector_protocol/markupsafe/_compat.py diff --git a/tools/markupsafe/_constants.py b/tools/inspector_protocol/markupsafe/_constants.py similarity index 100% rename from tools/markupsafe/_constants.py rename to tools/inspector_protocol/markupsafe/_constants.py diff --git a/tools/markupsafe/_native.py b/tools/inspector_protocol/markupsafe/_native.py similarity index 100% rename from tools/markupsafe/_native.py rename to tools/inspector_protocol/markupsafe/_native.py diff --git a/tools/markupsafe/_speedups.c b/tools/inspector_protocol/markupsafe/_speedups.c similarity index 100% rename from tools/markupsafe/_speedups.c rename to tools/inspector_protocol/markupsafe/_speedups.c diff --git a/tools/markupsafe/get_markupsafe.sh b/tools/inspector_protocol/markupsafe/get_markupsafe.sh similarity index 100% rename from tools/markupsafe/get_markupsafe.sh rename to tools/inspector_protocol/markupsafe/get_markupsafe.sh diff --git a/tools/check_macros.py b/tools/js2c_macros/check_macros.py similarity index 95% rename from tools/check_macros.py rename to tools/js2c_macros/check_macros.py index 2baf0d7f419573..f24d47c9ee40bf 100644 --- a/tools/check_macros.py +++ b/tools/js2c_macros/check_macros.py @@ -1,3 +1,4 @@ +# flake8: noqa macro CHECK(x) = do { if (!(x)) (process._rawDebug("CHECK: x == true"), process.abort()) } while (0); macro CHECK_EQ(a, b) = CHECK((a) === (b)); macro CHECK_GE(a, b) = CHECK((a) >= (b)); diff --git a/tools/dcheck_macros.py b/tools/js2c_macros/dcheck_macros.py similarity index 100% rename from tools/dcheck_macros.py rename to tools/js2c_macros/dcheck_macros.py diff --git a/tools/nodcheck_macros.py b/tools/js2c_macros/nodcheck_macros.py similarity index 100% rename from tools/nodcheck_macros.py rename to tools/js2c_macros/nodcheck_macros.py diff --git a/src/notrace_macros.py b/tools/js2c_macros/notrace_macros.py similarity index 100% rename from src/notrace_macros.py rename to tools/js2c_macros/notrace_macros.py