From 6ba7e611f173173f428d138f3e918c0ef0c8e902 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Thu, 24 May 2018 12:47:52 -0700 Subject: [PATCH 01/18] #12 added updated test envs --- .travis.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 34694b5..c3feaaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,9 @@ matrix: python: "2.7" env: TRAVIS_PYTHON_VERSION="2.7" dist: trusty + - os: linux + python: "3.2" + env: TRAVIS_PYTHON_VERSION="3.2" - os: linux python: "3.3" env: TRAVIS_PYTHON_VERSION="3.3" @@ -44,11 +47,11 @@ matrix: python: "3.8-dev" env: TRAVIS_PYTHON_VERSION="3.8" - os: linux - python: "pypy" # PyPy2 2.5.0 + python: "pypy2.7-5.8.0" - os: linux - python: "pypy3" + python: "pypy3.5-5.8.0" - os: linux - python: "pypy-5.3.1" + python: "pypy3.5-6.0" - os: linux python: "nightly" # currently points to 3.7-dev env: TRAVIS_PYTHON_VERSION="3.7-dev" @@ -67,6 +70,12 @@ matrix: - os: osx osx_image: xcode9 language: generic + - os: osx + osx_image: xcode9.2 + language: generic + - os: osx + osx_image: xcode9.3 + language: generic allow_failures: - os: linux python: "nightly" # currently points to 3.7-dev @@ -94,7 +103,11 @@ matrix: - os: linux python: "pypy3" - os: linux - python: "pypy-5.3.1" + python: "pypy3.5-5.8.0" + - os: linux + python: "pypy2.7-5.8.0" + - os: linux + python: "pypy3.5-6.0" - os: linux python: "nightly" # currently points to 3.7-dev env: TRAVIS_PYTHON_VERSION="3.7-dev" From c0cd48f85cc81f02a930a3f500828175e681228e Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Thu, 24 May 2018 12:53:14 -0700 Subject: [PATCH 02/18] updated badges --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f8ffe7..b274868 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ By default this template will assume that the Travis CI Service and Circle-CI Se [![Appveyor](https://ci.appveyor.com/api/projects/status/6gggp1wpbnnjokm4/branch/master?svg=true)](https://ci.appveyor.com/project/reactive-firewall/python-repo/branch/master) [![Python 3](https://pyup.io/repos/github/reactive-firewall/python-repo/python-3-shield.svg)](https://pyup.io/repos/github/reactive-firewall/PiAP-python-tools/) [![Updates](https://pyup.io/repos/github/reactive-firewall/python-repo/shield.svg)](https://pyup.io/repos/github/reactive-firewall/python-repo/) -[![Dependency Status](https://gemnasium.com/badges/github.com/reactive-firewall/python-repo.svg)](https://gemnasium.com/github.com/reactive-firewall/python-repo) -[![Dependency Status](https://www.versioneye.com/user/projects/59cc1dc1368b0831e6126dc6/badge.svg?style=flat-round)](https://www.versioneye.com/user/projects/59cc1dc1368b0831e6126dc6) +![Size](https://img.shields.io/github/languages/code-size/reactive-firewall/python-repo.svg) [![Test Coverage](https://api.codeclimate.com/v1/badges/f76f4e7e2eae6bff9b6a/test_coverage)](https://codeclimate.com/github/reactive-firewall/python-repo/test_coverage) [![code coverage](https://codecov.io/gh/reactive-firewall/python-repo/branch/master/graph/badge.svg)](https://codecov.io/gh/reactive-firewall/python-repo/branch/master/) [![Coverage Status](https://coveralls.io/repos/github/reactive-firewall/python-repo/badge.svg?branch=master)](https://coveralls.io/github/reactive-firewall/python-repo?branch=master) @@ -25,10 +24,10 @@ By default this template will assume that the Travis CI Service and Circle-CI Se ### Stable: [![status](https://travis-ci.org/reactive-firewall/python-repo.svg?branch=stable)](https://travis-ci.org/reactive-firewall/python-repo) [![CircleCI](https://circleci.com/gh/reactive-firewall/python-repo/tree/stable.svg?style=svg)](https://circleci.com/gh/reactive-firewall/python-repo/tree/stable) +[![Appveyor](https://ci.appveyor.com/api/projects/status/6gggp1wpbnnjokm4/branch/stable?svg=true)](https://ci.appveyor.com/project/reactive-firewall/python-repo/branch/stable) [![code coverage](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/graph/badge.svg)](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/) [![code coverage](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/graph/badge.svg)](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/) [![Coverage Status](https://coveralls.io/repos/github/reactive-firewall/python-repo/badge.svg?branch=stable)](https://coveralls.io/github/reactive-firewall/python-repo?branch=stable) -[![Dependency Status](https://www.versioneye.com/user/projects/59cc1dce368b083214208a72/badge.svg?style=flat-round)](https://www.versioneye.com/user/projects/59cc1dce368b083214208a72) # How do I use this to create a new project repo? From 60a9de1600079c7f4ed7c2a7c0d7fab947abefeb Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Thu, 24 May 2018 23:51:57 -0700 Subject: [PATCH 03/18] python 3.2 syntax fix - little hope for this --- pythonrepo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 26f9d1c..4b79680 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -41,7 +41,7 @@ import pythonrepo as pythonrepo -if __name__ in u'__main__': +if __name__ in '__main__': if pythonrepo.__name__ is None: raise ImportError(str("Failed to open pythonrepo")) pythonrepo.main(sys.argv[1:]) From 464c5514a4e7321937bb63574b23604f77bba776 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 00:16:14 -0700 Subject: [PATCH 04/18] more fixes for python 3.2 - with just as little hope --- tests/profiling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profiling.py b/tests/profiling.py index 53d4368..984c6e3 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -173,7 +173,7 @@ def main(argv=None): raise NotImplementedError("CRITICAL - test profiling main() not implemented. yet?") -if __name__ in u'__main__': +if __name__ in '__main__': try: exit(main(sys.argv[1:])) except Exception: From dac72119675e108737d1e4970dc67c0e04e36f6b Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 01:46:47 -0700 Subject: [PATCH 05/18] added bypass for python 3.2 extras support - little hope this will work --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3feaaf..1b8d5a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -174,19 +174,20 @@ script: - mv -vf ".coverall.Lasting.45678.12345" .coverage 2>/dev/null || true after_failure: - - coverage combine 2>/dev/null || true - - coverage xml 2>/dev/null || true + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage" ; else coverage combine 2>/dev/null || true ; fi ; + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage xml" ; else coverage xml 2>/dev/null || true ; fi ; + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov 2>/dev/null || true ; fi ; - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; - - codecov 2>/dev/null || true + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov 2>/dev/null || true ; fi ; - make clean 2>/dev/nul || true after_success: - - coverage combine || true - - coverage xml || true + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage" ; else coverage combine 2>/dev/null || true ; fi ; + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage xml" ; else coverage xml 2>/dev/null || true ; fi ; - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; - - codecov || true + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov || true ; fi ; - travis_retry python3 -m pip install python-coveralls || python3 -m pip install python-coveralls || true ; - - coveralls 2>/dev/null || true + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else coveralls 2>/dev/null || true ; fi ; - travis_wait 35 curl --url "https://scan.coverity.com/download/linux64?token=${COVERTY_TOKEN}&project=reactive-firewall%2Fpython-repo" -o coverity_tool.tgz || true - travis_wait tar xzf coverity_tool.tgz || true - rm -fr cov-int || true From 6157d69a254f72151a4c66bcc3fe35ab8c2efb7b Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 13:47:49 -0700 Subject: [PATCH 06/18] #12 another workaround for python 3.2 - again little hope --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b8d5a7..d9d6616 100644 --- a/.travis.yml +++ b/.travis.yml @@ -166,7 +166,7 @@ before_script: script: - make clean ; - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP make test" ; else make test || exit $? ; fi ; - - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP codecov" ; else codecov || exit $? ; fi ; + - if [ $TRAVIS_OS_NAME == osx ] || [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov || exit $? ; fi ; - cp -vf .coverage ".coverall.Lasting.45678.12345" 2>/dev/null || true - make clean || exit $? ; - make test-tox || exit $? ; @@ -177,14 +177,14 @@ after_failure: - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage" ; else coverage combine 2>/dev/null || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage xml" ; else coverage xml 2>/dev/null || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov 2>/dev/null || true ; fi ; - - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; + - if [ $TRAVIS_OS_NAME == osx ] || [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov 2>/dev/null || true ; fi ; - make clean 2>/dev/nul || true after_success: - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage" ; else coverage combine 2>/dev/null || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage xml" ; else coverage xml 2>/dev/null || true ; fi ; - - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; + - if [ $TRAVIS_OS_NAME == osx ] || [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov || true ; fi ; - travis_retry python3 -m pip install python-coveralls || python3 -m pip install python-coveralls || true ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else coveralls 2>/dev/null || true ; fi ; From d658409562d169bfd239910c90c17e93eeb10223 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 14:18:25 -0700 Subject: [PATCH 07/18] #12 yet another workaround for python 3.2 - still no hope --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d9d6616..b17497d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -169,7 +169,7 @@ script: - if [ $TRAVIS_OS_NAME == osx ] || [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov || exit $? ; fi ; - cp -vf .coverage ".coverall.Lasting.45678.12345" 2>/dev/null || true - make clean || exit $? ; - - make test-tox || exit $? ; + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP make test-tox" ; else make test-tox || exit $? ; fi ; - make clean ; - mv -vf ".coverall.Lasting.45678.12345" .coverage 2>/dev/null || true From e4c2410b2c7dd7fa16538c2d86ca90b9dd29deef Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 22:10:34 -0700 Subject: [PATCH 08/18] Changes to be committed: modified: .coveragerc - [x] fixed regression (see #12) modified: pythonrepo/__init__.py - [x] bummped version to 1.1.0 for 2018 modified: tests/test_usage.py - [x] #14 fixed code style --- .coveragerc | 2 +- pythonrepo/__init__.py | 6 +++--- tests/test_usage.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.coveragerc b/.coveragerc index 501f84f..9562565 100644 --- a/.coveragerc +++ b/.coveragerc @@ -19,7 +19,7 @@ exclude_lines = except OSError # Don't complain if non-runnable code isn't run: - if __name__ in u'__main__': + if __name__ in '__main__': ignore_errors = True diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 4b79680..e7f4d9b 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017, Kendrick Walls +# Copyright (c) 2017-2018, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ # limitations under the License. -__version__ = """1.0.1""" -"""This is version 1.0.1 of pythonrepo Template""" +__version__ = """1.1.0""" +"""This is version 1.1.0 of pythonrepo Template""" try: import sys diff --git a/tests/test_usage.py b/tests/test_usage.py index 6390f63..8b1ac41 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -21,7 +21,7 @@ import unittest import subprocess import sys -import profiling as profiling +import tests.profiling as profiling def getPythonCommand(): From 3120acbedc596b9e12fd0a7c0895b6995d49b966 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 22:14:52 -0700 Subject: [PATCH 09/18] Changes to be committed: modified: tests/test_usage.py - [x] #15 fixed subtle default issue --- tests/test_usage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index 8b1ac41..78db7b0 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -51,11 +51,12 @@ def getPythonCommand(): return str(thepython) -def checkPythonCommand(args=[None], stderr=None): +def checkPythonCommand(args=None, stderr=None): """Function for backend subprocess check_output command like testing with coverage support""" theOutput = None try: if args is None or args is [None]: + args = [None] theOutput = subprocess.check_output(["exit 1 ; #"]) else: if str("coverage ") in args[0]: From 06b4cc1e3795cecb310cf82cad6b6807d7c202b4 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 22:16:38 -0700 Subject: [PATCH 10/18] Changes to be committed: modified: tests/test_usage.py - [x] #19 Fixed by casting to string --- tests/test_usage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index 78db7b0..f2277ac 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -59,7 +59,7 @@ def checkPythonCommand(args=None, stderr=None): args = [None] theOutput = subprocess.check_output(["exit 1 ; #"]) else: - if str("coverage ") in args[0]: + if str("coverage ") in str(args[0]): if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") if str("{} -m coverage ").format(str(sys.executable)) in str(args[0]): From b9568c3d4646c3d3c8599ce4a7d6467224025e15 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 22:21:27 -0700 Subject: [PATCH 11/18] Changes to be committed: modified: tests/test_usage.py - [x] #16 Fixed subtle default value --- tests/test_usage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index f2277ac..e49e44b 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -86,9 +86,11 @@ def checkPythonCommand(args=None, stderr=None): @profiling.do_cprofile -def timePythonCommand(args=[None], stderr=None): +def timePythonCommand(args=None, stderr=None): """Function for backend subprocess check_output command with support for coverage and profiling.""" + if args is None: + args = [None] return checkPythonCommand(args, stderr) From 54ba49538941cf346de68c01919c86e052064abf Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 22:24:11 -0700 Subject: [PATCH 12/18] #18 Fixed by cating to string and #17 fixed subtle default value --- tests/test_usage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index e49e44b..e8bb980 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -94,14 +94,15 @@ def timePythonCommand(args=None, stderr=None): return checkPythonCommand(args, stderr) -def checkPythonErrors(args=[None], stderr=None): +def checkPythonErrors(args=None, stderr=None): """Function like checkPythonCommand, but with error passing.""" theOutput = None try: if args is None or args is [None]: + args = [None] theOutput = subprocess.check_output(["exit 1 ; #"]) else: - if str("coverage ") in args[0]: + if str("coverage ") in str(args[0]): import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") From 5cfc231612dcaf082640ab2c29dcf76e282bfd4c Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 23:06:03 -0700 Subject: [PATCH 13/18] #20 fixed import style --- pythonrepo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index e7f4d9b..3608f2f 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -38,7 +38,7 @@ from . import pythonrepo as pythonrepo except Exception as importErr: del importErr - import pythonrepo as pythonrepo + import pythonrepo.pythonrepo as pythonrepo if __name__ in '__main__': From 3399e152a142e8937e0f8b72c730009054ea41b4 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 25 May 2018 23:11:08 -0700 Subject: [PATCH 14/18] #21 fixed subtle default --- pythonrepo/pythonrepo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index dc44e85..37b6932 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -103,8 +103,10 @@ def parseArgs(arguments=None): return parser.parse_known_args(arguments) -def useTool(tool, arguments=[None]): +def useTool(tool, arguments=None): """Handler for launching the functions.""" + if arguments is None: + arguments = [None] if tool is None: return None if tool in TASK_OPTIONS.keys(): From 092effdabbedf1cfbbd54a4b1630a1571e175ccf Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sat, 26 May 2018 00:14:53 -0700 Subject: [PATCH 15/18] #22 fixed 8 Maintainability issues in tests\profiling.py --- tests/profiling.py | 49 ++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/tests/profiling.py b/tests/profiling.py index 984c6e3..6dfab1d 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -3,7 +3,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017, Kendrick Walls +# Copyright (c) 2017-2018, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -31,35 +31,16 @@ try: import os - if os.__name__ is None: - raise NotImplementedError("OMG! We could not import the os. We're like in the matrix!") -except Exception as err: - raise ImportError(err) - exit(3) - - -try: import sys - if sys.__name__ is None: - raise NotImplementedError("OMG! We could not import the sys. We're like in the matrix!") -except Exception as err: - raise ImportError(err) - exit(3) - - -try: import time - if time.__name__ is None: - raise NotImplementedError("OMG! We could not import time. We're like in the speed-force!") -except Exception as err: - raise ImportError(err) - exit(3) - - -try: import cProfile - if cProfile.__name__ is None: - raise NotImplementedError("OMG! We could not import cProfile. ABORT!") + for keyModule in [os, sys, time, cProfile]: + if keyModule.__name__ is None: + raise NotImplementedError( + str("OMG! We could not import the {}!").format( + str(keyModule) + ) + ) except Exception as err: raise ImportError(err) exit(3) @@ -106,7 +87,6 @@ def __enter__(self): def __exit__(self, type, value, traceback): self.checkpoint(str("finished")) - pass def do_time_profile(func, timer_name="time_profile"): @@ -144,6 +124,8 @@ def profiled_func(*args, **kwargs): from line_profiler import LineProfiler def do_profile(follow=[]): + if follow is None: + follow = [] def inner(func): def profiled_func(*args, **kwargs): try: @@ -159,8 +141,10 @@ def profiled_func(*args, **kwargs): return inner except ImportError: - def do_profile(follow=[]): + def do_profile(follow=None): "Helpful if you accidentally leave in production!" + if follow is None: + follow = [] def inner(func): def nothing(*args, **kwargs): return func(*args, **kwargs) @@ -174,9 +158,10 @@ def main(argv=None): if __name__ in '__main__': + exitcode = 3 try: - exit(main(sys.argv[1:])) - except Exception: - exit(3) + exitcode = main(sys.argv[1:]) + finaly: + exit(exitcode) From a9640005efdbc3a0b3d6a581d2da25ad9decbf07 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sat, 26 May 2018 00:15:36 -0700 Subject: [PATCH 16/18] #22 fixed 8 Maintainability issues in tests\profiling.py --- tests/profiling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profiling.py b/tests/profiling.py index 6dfab1d..f0a8efb 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -161,7 +161,7 @@ def main(argv=None): exitcode = 3 try: exitcode = main(sys.argv[1:]) - finaly: + finally: exit(exitcode) From a17c0a20204b9c929a99a77a9498555894ad83a7 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sat, 26 May 2018 00:16:20 -0700 Subject: [PATCH 17/18] #22 fixed 8 Maintainability issues in tests\profiling.py regression --- tests/profiling.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/profiling.py b/tests/profiling.py index f0a8efb..435508b 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -126,6 +126,7 @@ def profiled_func(*args, **kwargs): def do_profile(follow=[]): if follow is None: follow = [] + def inner(func): def profiled_func(*args, **kwargs): try: @@ -145,6 +146,7 @@ def do_profile(follow=None): "Helpful if you accidentally leave in production!" if follow is None: follow = [] + def inner(func): def nothing(*args, **kwargs): return func(*args, **kwargs) From 6ca62f4b2437c3c9b66865148283b42e4d1f0645 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sat, 26 May 2018 00:20:19 -0700 Subject: [PATCH 18/18] #22 fixed 8 Maintainability issues in tests\profiling.py regression part 2 --- tests/profiling.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/profiling.py b/tests/profiling.py index 435508b..0c55245 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -43,7 +43,6 @@ ) except Exception as err: raise ImportError(err) - exit(3) try: @@ -123,7 +122,7 @@ def profiled_func(*args, **kwargs): try: # noqa from line_profiler import LineProfiler - def do_profile(follow=[]): + def do_profile(follow=None): if follow is None: follow = []