Code style fixes (flake8)

This commit is contained in:
Salvador E. Tropea 2020-10-17 12:03:06 -03:00
parent 4538163e7e
commit 2d55859782
4 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,5 @@
from mymacros import macros, document # noqa: F401 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"]: with step_expansion["dump"]:
@ -19,9 +19,9 @@ class d(object):
self.at1 = 4.5 self.at1 = 4.5
""" documenting d.at1 """ # <--- Not covered? """ documenting d.at1 """ # <--- Not covered?
print("a = "+str(a)+" # "+_help_a) # noqa: F821 print("a = "+str(a)+" # "+_help_a) # noqa: F821
print("b = "+str(b)+" # "+_help_b) # noqa: F821 print("b = "+str(b)+" # "+_help_b) # noqa: F821
print("c = "+str(c)+" # "+_help_c) # noqa: F821 print("c = "+str(c)+" # "+_help_c) # noqa: F821
e = d() e = d()
print("e.at1 = "+str(e.at1)+" # "+e._help_at1) # noqa: F821 print("e.at1 = "+str(e.at1)+" # "+e._help_at1) # noqa: F821

View File

@ -47,7 +47,7 @@ def document(tree, **kw):
else: else:
target = Name(id=doc_id, ctx=Store()) target = Name(id=doc_id, ctx=Store())
help_str = s.value 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) tree[n] = Assign(targets=[target], value=help_str)
# Copy the line number from the original docstring # Copy the line number from the original docstring
copy_location(target, s) copy_location(target, s)

View File

@ -19,7 +19,9 @@ from .bom.bom import do_bom
from .var_kibom import KiBoM from .var_kibom import KiBoM
from .fil_base import BaseFilter, apply_exclude_filter, apply_fitted_filter, apply_fixed_filter, reset_filters from .fil_base import BaseFilter, apply_exclude_filter, apply_fitted_filter, apply_fixed_filter, reset_filters
from . import log 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__) logger = log.get_logger(__name__)
VALID_STYLES = {'modern-blue', 'modern-green', 'modern-red', 'classic'} VALID_STYLES = {'modern-blue', 'modern-green', 'modern-red', 'classic'}
@ -37,7 +39,6 @@ class BoMColumns(Optionable):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self._unkown_is_error = True self._unkown_is_error = True
# with step_expansion:
with document: with document:
self.field = '' self.field = ''
""" Name of the field to use for this column """ """ Name of the field to use for this column """

View File

@ -45,7 +45,7 @@ prev_dir = os.path.dirname(prev_dir)
if prev_dir not in sys.path: if prev_dir not in sys.path:
sys.path.insert(0, prev_dir) 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, 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' POS_DIR = 'positiondir'
@ -472,6 +472,8 @@ def test_pcbdraw_fail():
ctx.clean_up() 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(): def test_import_fail():
ctx = context.TestContext('test_import_fail', '3Rs', 'pre_and_position', POS_DIR) ctx = context.TestContext('test_import_fail', '3Rs', 'pre_and_position', POS_DIR)
# Create a read only cache entry that we should delete # 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_file, stat.S_IREAD)
os.chmod(cache_dir, stat.S_IREAD | stat.S_IEXEC) os.chmod(cache_dir, stat.S_IREAD | stat.S_IEXEC)
try: try:
# mcpyrate: not a problem # mcpyrate: not a problem, for Python 3.8.6
ret_code = 0 ret_code = 0
# mcpy: # mcpy:
# ret_code = WRONG_INSTALL # ret_code = WRONG_INSTALL