From 68001a7346015e706aa73c8b74eb2c2dc27aa6c2 Mon Sep 17 00:00:00 2001 From: Ritwik Sharma Date: Fri, 14 Dec 2018 21:42:34 +0530 Subject: [PATCH 1/4] Add unreadable_python_inputs --- pytype/tools/analyze_project/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pytype/tools/analyze_project/main.py b/pytype/tools/analyze_project/main.py index 4eab45f4c..9873ea332 100755 --- a/pytype/tools/analyze_project/main.py +++ b/pytype/tools/analyze_project/main.py @@ -75,12 +75,15 @@ def main(): import_graph = importlab.graph.ImportGraph.create( env, conf.inputs, trim=True) unreadable_inputs = conf.inputs & import_graph.unreadable_files - assert not unreadable_inputs, '\n '.join( + unreadable_python_inputs = {file for file in unreadable_inputs if file.endswith('.py')} + assert not unreadable_python_inputs, '\n '.join( ['Unparseable in Python %s:' % conf.python_version] + - sorted(unreadable_inputs)) + sorted(unreadable_python_inputs)) except Exception as e: # pylint: disable=broad-except logging.critical('Cannot parse input files:\n%s', str(e)) sys.exit(1) + + conf.inputs -= unreadable_inputs if args.tree: print('Source tree:') From 768a811acf5cb71248064668ab3eb6fce596a7c2 Mon Sep 17 00:00:00 2001 From: Ritwik Sharma Date: Sat, 15 Dec 2018 22:08:27 +0530 Subject: [PATCH 2/4] Change file to filename --- pytype/tools/analyze_project/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytype/tools/analyze_project/main.py b/pytype/tools/analyze_project/main.py index 9873ea332..a7905512d 100755 --- a/pytype/tools/analyze_project/main.py +++ b/pytype/tools/analyze_project/main.py @@ -75,14 +75,14 @@ def main(): import_graph = importlab.graph.ImportGraph.create( env, conf.inputs, trim=True) unreadable_inputs = conf.inputs & import_graph.unreadable_files - unreadable_python_inputs = {file for file in unreadable_inputs if file.endswith('.py')} + unreadable_python_inputs = {filename for filename in unreadable_inputs if filename.endswith('.py')} assert not unreadable_python_inputs, '\n '.join( ['Unparseable in Python %s:' % conf.python_version] + sorted(unreadable_python_inputs)) except Exception as e: # pylint: disable=broad-except logging.critical('Cannot parse input files:\n%s', str(e)) sys.exit(1) - + conf.inputs -= unreadable_inputs if args.tree: From cbfdad1d4cb8951edddf6576c494bcee47920771 Mon Sep 17 00:00:00 2001 From: Ritwik Sharma Date: Sat, 15 Dec 2018 22:25:53 +0530 Subject: [PATCH 3/4] Clean code Remove str(e) --- pytype/tools/analyze_project/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytype/tools/analyze_project/main.py b/pytype/tools/analyze_project/main.py index a7905512d..529cbba05 100755 --- a/pytype/tools/analyze_project/main.py +++ b/pytype/tools/analyze_project/main.py @@ -80,7 +80,7 @@ def main(): ['Unparseable in Python %s:' % conf.python_version] + sorted(unreadable_python_inputs)) except Exception as e: # pylint: disable=broad-except - logging.critical('Cannot parse input files:\n%s', str(e)) + logging.critical('Cannot parse input files:%s') sys.exit(1) conf.inputs -= unreadable_inputs From b325a2bb8998dcac1e5db9a19b555240f19eed24 Mon Sep 17 00:00:00 2001 From: Rebecca Chen Date: Mon, 17 Dec 2018 11:25:07 -0800 Subject: [PATCH 4/4] Update unparseable inputs logging line --- pytype/tools/analyze_project/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytype/tools/analyze_project/main.py b/pytype/tools/analyze_project/main.py index 529cbba05..4010c66dd 100755 --- a/pytype/tools/analyze_project/main.py +++ b/pytype/tools/analyze_project/main.py @@ -80,7 +80,7 @@ def main(): ['Unparseable in Python %s:' % conf.python_version] + sorted(unreadable_python_inputs)) except Exception as e: # pylint: disable=broad-except - logging.critical('Cannot parse input files:%s') + logging.critical('Cannot parse input files:\n%s', e) sys.exit(1) conf.inputs -= unreadable_inputs