From 2d55859782775535a6fc8825f9d7a540d25b1b73 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sat, 17 Oct 2020 12:03:06 -0300 Subject: [PATCH] Code style fixes (flake8) --- experiments/__doc__/coverage_mcpyrate/application.py | 4 ++-- experiments/__doc__/coverage_mcpyrate/mymacros.py | 2 +- kibot/out_bom.py | 5 +++-- tests/test_plot/test_misc.py | 6 ++++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/experiments/__doc__/coverage_mcpyrate/application.py b/experiments/__doc__/coverage_mcpyrate/application.py index 179977f3..94b26d1e 100644 --- a/experiments/__doc__/coverage_mcpyrate/application.py +++ b/experiments/__doc__/coverage_mcpyrate/application.py @@ -1,5 +1,5 @@ from mymacros import macros, document # noqa: F401 -from mcpyrate.debug import macros, step_expansion +from mcpyrate.debug import macros, step_expansion # noqa: F401,F811 with step_expansion["dump"]: @@ -19,9 +19,9 @@ class d(object): self.at1 = 4.5 """ documenting d.at1 """ # <--- Not covered? + print("a = "+str(a)+" # "+_help_a) # noqa: F821 print("b = "+str(b)+" # "+_help_b) # noqa: F821 print("c = "+str(c)+" # "+_help_c) # noqa: F821 e = d() print("e.at1 = "+str(e.at1)+" # "+e._help_at1) # noqa: F821 - diff --git a/experiments/__doc__/coverage_mcpyrate/mymacros.py b/experiments/__doc__/coverage_mcpyrate/mymacros.py index 2430dabb..1a2b9dd3 100644 --- a/experiments/__doc__/coverage_mcpyrate/mymacros.py +++ b/experiments/__doc__/coverage_mcpyrate/mymacros.py @@ -47,7 +47,7 @@ def document(tree, **kw): else: target = Name(id=doc_id, ctx=Store()) help_str = s.value - help_str.s=type_hint+s.value.s + help_str.s = type_hint+s.value.s tree[n] = Assign(targets=[target], value=help_str) # Copy the line number from the original docstring copy_location(target, s) diff --git a/kibot/out_bom.py b/kibot/out_bom.py index 0c31dc57..502570a1 100644 --- a/kibot/out_bom.py +++ b/kibot/out_bom.py @@ -19,7 +19,9 @@ from .bom.bom import do_bom from .var_kibom import KiBoM from .fil_base import BaseFilter, apply_exclude_filter, apply_fitted_filter, apply_fixed_filter, reset_filters from . import log -from .mcpyrate.debug import macros, step_expansion +# To debug the `with document` we can use: +# from .mcpyrate.debug import macros, step_expansion +# with step_expansion: logger = log.get_logger(__name__) VALID_STYLES = {'modern-blue', 'modern-green', 'modern-red', 'classic'} @@ -37,7 +39,6 @@ class BoMColumns(Optionable): def __init__(self): super().__init__() self._unkown_is_error = True - # with step_expansion: with document: self.field = '' """ Name of the field to use for this column """ diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index a5a241b0..f49003dd 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -45,7 +45,7 @@ prev_dir = os.path.dirname(prev_dir) if prev_dir not in sys.path: sys.path.insert(0, prev_dir) from kibot.misc import (EXIT_BAD_ARGS, EXIT_BAD_CONFIG, NO_PCB_FILE, NO_SCH_FILE, EXAMPLE_CFG, WONT_OVERWRITE, CORRUPTED_PCB, - PCBDRAW_ERR, WRONG_INSTALL) + PCBDRAW_ERR) POS_DIR = 'positiondir' @@ -472,6 +472,8 @@ def test_pcbdraw_fail(): ctx.clean_up() +# This test was designed for `mcpy`. +# `mcpyrate` can pass it using Python 3.8.6, but seems to have problems on the docker image def test_import_fail(): ctx = context.TestContext('test_import_fail', '3Rs', 'pre_and_position', POS_DIR) # Create a read only cache entry that we should delete @@ -481,7 +483,7 @@ def test_import_fail(): os.chmod(cache_file, stat.S_IREAD) os.chmod(cache_dir, stat.S_IREAD | stat.S_IEXEC) try: - # mcpyrate: not a problem + # mcpyrate: not a problem, for Python 3.8.6 ret_code = 0 # mcpy: # ret_code = WRONG_INSTALL