Tunned flake8 and removed all unfiltered warnings and errors
This commit is contained in:
parent
bf0aae66dd
commit
ba22eae5b8
|
|
@ -0,0 +1,4 @@
|
|||
[flake8]
|
||||
ignore = E402, E226, E126, W504
|
||||
max-line-length = 127
|
||||
max-complexity = 20
|
||||
|
|
@ -13,6 +13,7 @@ jobs:
|
|||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container: setsoft/kicad_auto:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
@ -29,8 +30,8 @@ jobs:
|
|||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
# exit-zero treats all errors as warnings.
|
||||
flake8 . --count --exit-zero --statistics
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest
|
||||
|
|
|
|||
5
Makefile
5
Makefile
|
|
@ -3,6 +3,11 @@
|
|||
deb:
|
||||
fakeroot dpkg-buildpackage -uc -b
|
||||
|
||||
lint:
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
flake8 . --count --statistics
|
||||
|
||||
deb_clean:
|
||||
fakeroot debian/rules clean
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
__author__ ='John Beard, Salvador E. Tropea'
|
||||
__copyright__='Copyright 2018-2020, INTI/John Beard/Salvador E. Tropea'
|
||||
__credits__ =['Salvador E. Tropea','John Beard']
|
||||
__license__ ='GPL v3+'
|
||||
__email__ ='salvador@inti.gob.ar'
|
||||
__status__ ='beta'
|
||||
__author__ = 'John Beard, Salvador E. Tropea'
|
||||
__copyright__ = 'Copyright 2018-2020, INTI/John Beard/Salvador E. Tropea'
|
||||
__credits__ = ['Salvador E. Tropea', 'John Beard']
|
||||
__license__ = 'GPL v3+'
|
||||
__email__ = 'salvador@inti.gob.ar'
|
||||
__status__ = 'beta'
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
|
@ -42,8 +42,8 @@ def main():
|
|||
'or `all`')
|
||||
group.add_argument('-v', '--verbose', action='store_true',
|
||||
help='show debugging information')
|
||||
parser.add_argument('--version','-V',action='version',
|
||||
version='%(prog)s '+__version__+' - '+
|
||||
parser.add_argument('--version', '-V', action='version',
|
||||
version='%(prog)s '+__version__+' - ' +
|
||||
__copyright__+' - License: '+__license__)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
|
@ -59,7 +59,7 @@ def main():
|
|||
elif len(board_files) > 1:
|
||||
board_file = board_files[0]
|
||||
logger.warning('More than one PCB file found in current directory.\n'
|
||||
' Using '+board_file+ ' if you want to use another use -b option.')
|
||||
' Using '+board_file+' if you want to use another use -b option.')
|
||||
else:
|
||||
logger.error('No PCB file found (*.kicad_pcb), use -b to specify one.')
|
||||
sys.exit(misc.EXIT_BAD_ARGS)
|
||||
|
|
@ -77,7 +77,7 @@ def main():
|
|||
elif len(plot_configs) > 1:
|
||||
plot_config = plot_configs[0]
|
||||
logger.warning('More than one config file found in current directory.\n'
|
||||
' Using '+plot_config+ ' if you want to use another use -c option.')
|
||||
' Using '+plot_config+' if you want to use another use -c option.')
|
||||
else:
|
||||
logger.error('No config file found (*.kiplot.yaml), use -c to specify one.')
|
||||
sys.exit(misc.EXIT_BAD_ARGS)
|
||||
|
|
@ -104,15 +104,15 @@ def main():
|
|||
sys.exit(misc.EXIT_BAD_CONFIG)
|
||||
|
||||
if args.list:
|
||||
logger.info('\npre-flight:\n'
|
||||
'run_erc: '+str(cfg.run_erc)+'\n'
|
||||
'run_drc: '+str(cfg.run_drc)+'\n'
|
||||
'update_xml: '+str(cfg.update_xml)+'\n')
|
||||
logger.info('Outputs:')
|
||||
for op in cfg.outputs:
|
||||
logger.info('%s (%s) [%s]' % (op.name, op.description,
|
||||
op.options.type))
|
||||
sys.exit(0)
|
||||
logger.info('\npre-flight:\n'
|
||||
'run_erc: '+str(cfg.run_erc)+'\n'
|
||||
'run_drc: '+str(cfg.run_drc)+'\n'
|
||||
'update_xml: '+str(cfg.update_xml)+'\n')
|
||||
logger.info('Outputs:')
|
||||
for op in cfg.outputs:
|
||||
logger.info('%s (%s) [%s]' % (op.name, op.description,
|
||||
op.options.type))
|
||||
sys.exit(0)
|
||||
|
||||
# Set up the plotter and do it
|
||||
plotter = kiplot.Plotter(cfg)
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ class Plotter(object):
|
|||
conv = 1.0
|
||||
if to.units == 'millimeters':
|
||||
conv = 1.0 / pcbnew.IU_PER_MM
|
||||
else: # to.units == 'inches':
|
||||
else: # to.units == 'inches':
|
||||
conv = 0.001 / pcbnew.IU_PER_MILS
|
||||
|
||||
# Format all strings
|
||||
|
|
@ -559,7 +559,7 @@ class Plotter(object):
|
|||
if to.format.lower() == 'ascii':
|
||||
self._do_position_plot_ascii(board, plot_ctrl, output, columns,
|
||||
modules, maxlengths)
|
||||
else: # if to.format.lower() == 'csv':
|
||||
else: # if to.format.lower() == 'csv':
|
||||
self._do_position_plot_csv(board, plot_ctrl, output, columns,
|
||||
modules)
|
||||
|
||||
|
|
|
|||
50
setup.py
50
setup.py
|
|
@ -14,32 +14,32 @@ here = os.path.abspath(os.path.dirname(__file__))
|
|||
# Import the README and use it as the long-description.
|
||||
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
|
||||
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||
long_description = '\n' + f.read()
|
||||
long_description = '\n' + f.read()
|
||||
about = {}
|
||||
with open(os.path.join(here, NAME, '__version__.py')) as f:
|
||||
exec(f.read(), about)
|
||||
exec(f.read(), about)
|
||||
|
||||
setup(name=NAME,
|
||||
version=about['__version__'],
|
||||
description=DESCRIPTION,
|
||||
long_description=long_description,
|
||||
# long_description_content_type='text/markdown',
|
||||
author=AUTHOR,
|
||||
author_email=EMAIL,
|
||||
url=URL,
|
||||
packages=[NAME],
|
||||
package_dir={NAME: NAME},
|
||||
scripts=['src/kiplot'],
|
||||
# install_requires=['pyyaml'],
|
||||
classifiers = ['Development Status :: 3 - Alpha',
|
||||
'Environment :: Console',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||
'Natural Language :: English',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)',
|
||||
],
|
||||
platforms = 'POSIX',
|
||||
license = 'GPL-3.0'
|
||||
)
|
||||
version=about['__version__'],
|
||||
description=DESCRIPTION,
|
||||
long_description=long_description,
|
||||
# long_description_content_type='text/markdown',
|
||||
author=AUTHOR,
|
||||
author_email=EMAIL,
|
||||
url=URL,
|
||||
packages=[NAME],
|
||||
package_dir={NAME: NAME},
|
||||
scripts=['src/kiplot'],
|
||||
# install_requires=['pyyaml'],
|
||||
classifiers=['Development Status :: 3 - Alpha',
|
||||
'Environment :: Console',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||
'Natural Language :: English',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)',
|
||||
],
|
||||
platforms='POSIX',
|
||||
license='GPL-3.0',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -25,12 +25,15 @@ def expect_file_at(filename):
|
|||
|
||||
assert(os.path.isfile(filename))
|
||||
|
||||
|
||||
def get_pos_top_filename(board_name):
|
||||
return board_name + '-top.pos'
|
||||
|
||||
|
||||
def get_pos_bot_filename(board_name):
|
||||
return board_name + '-bottom.pos'
|
||||
|
||||
|
||||
def get_pos_both_filename(board_name):
|
||||
return board_name + '-both.pos'
|
||||
|
||||
|
|
@ -40,7 +43,7 @@ def expect_position(pos_data, side, ref, x, y, expected, inches=False):
|
|||
Check if a component is or isn't in the file
|
||||
"""
|
||||
|
||||
#expr = rb'^'+ref.encode()+rb'\s+\S+\s+\S+\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+(\S+)$'
|
||||
# expr = rb'^'+ref.encode()+rb'\s+\S+\s+\S+\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+(\S+)$'
|
||||
expr = rb'^'+ref.encode()+rb'\s+\S+\s+\S+\s+([-\d\.]+)\s+([-\d\.]+)\s+([-\d\.]+)\s+(\S+)\s*$'
|
||||
|
||||
m = re.search(expr, pos_data, re.MULTILINE)
|
||||
|
|
@ -58,13 +61,12 @@ def expect_position(pos_data, side, ref, x, y, expected, inches=False):
|
|||
assert(abs(float(x) - float(m.group(1))) < 0.001)
|
||||
assert(abs(float(y) + float(m.group(2))) < 0.001)
|
||||
assert(side == m.group(4).decode())
|
||||
#logging.debug(ref+' '+str(x)+' '+str(y)+' -> '+m.group(1).decode()+' '+m.group(2).decode()+' '+m.group(3).decode()+' '+m.group(4).decode())
|
||||
# logging.debug(ref+' '+str(x)+' '+str(y)+' -> '+m.group(1).decode()+' '+m.group(2).decode()+' '+m.group(3).decode()+
|
||||
# ' '+m.group(4).decode())
|
||||
else:
|
||||
assert(m is None)
|
||||
|
||||
|
||||
|
||||
|
||||
def get_mmapped_data(filename):
|
||||
|
||||
with open(filename) as fo:
|
||||
|
|
@ -100,7 +102,6 @@ def test_3Rs_position():
|
|||
ctx.clean_up()
|
||||
|
||||
|
||||
|
||||
def test_3Rs_position_unified():
|
||||
|
||||
ctx = plotting_test_utils.KiPlotTestContext('3Rs_position_unified')
|
||||
|
|
@ -124,7 +125,6 @@ def test_3Rs_position_unified():
|
|||
ctx.clean_up()
|
||||
|
||||
|
||||
|
||||
def test_3Rs_position_unified_th():
|
||||
|
||||
ctx = plotting_test_utils.KiPlotTestContext('3Rs_position_unified_th')
|
||||
|
|
@ -175,4 +175,3 @@ def test_3Rs_position_inches():
|
|||
expect_position(bot, 'bottom', 'R3', 110, 45, False, True)
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,11 @@ def expect_file_at(filename):
|
|||
def get_gerber_filename(board_name, layer_slug, ext='.gbr'):
|
||||
return board_name + '-' + layer_slug + ext
|
||||
|
||||
|
||||
def get_gerber_job_filename(board_name):
|
||||
return board_name + '-job.gbrjob'
|
||||
|
||||
|
||||
def find_gerber_aperture(s, ap_desc):
|
||||
|
||||
m = re.search(rb'%AD(.*)' + ap_desc + rb'\*%', s)
|
||||
|
|
@ -95,11 +97,11 @@ def test_2layer():
|
|||
# The gerber job file
|
||||
job_file = os.path.join(gbr_dir,
|
||||
get_gerber_job_filename(ctx.board_name))
|
||||
expect_file_at(f_cu_gbr)
|
||||
expect_file_at(job_file)
|
||||
|
||||
f_cu_data = get_mmapped_data(f_cu_gbr)
|
||||
|
||||
ap_ids = expect_gerber_has_apertures(f_cu_data, [
|
||||
expect_gerber_has_apertures(f_cu_data, [
|
||||
rb"C,0.200000",
|
||||
rb"R,2.000000X2.000000",
|
||||
rb"C,1.000000"])
|
||||
|
|
|
|||
Loading…
Reference in New Issue