Skip to content

Commit 17acd75

Browse files
authored
Merge pull request #27 from Mathics3/flake8
Make flake8 clean
2 parents 299974a + 831a52e commit 17acd75

File tree

7 files changed

+74
-17
lines changed

7 files changed

+74
-17
lines changed

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# import os
1414
# import sys
1515
# sys.path.insert(0, os.path.abspath('.'))
16-
import mathics_scanner
1716

1817
# -- Project information -----------------------------------------------------
1918

mathics_scanner/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,22 @@
2929
FileLineFeeder,
3030
MultiLineFeeder,
3131
)
32+
33+
__all__ = [
34+
FileLineFeeder,
35+
IncompleteSyntaxError,
36+
InvalidSyntaxError,
37+
LineFeeder,
38+
MultiLineFeeder,
39+
ScanError,
40+
SingleLineFeeder,
41+
Token,
42+
Tokeniser,
43+
TranslateError,
44+
__version__,
45+
aliased_characters,
46+
is_symbol_name,
47+
named_characters,
48+
replace_unicode_with_wl,
49+
replace_wl_with_plain_text,
50+
]

mathics_scanner/data/characters.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

mathics_scanner/prescanner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ def try_parse_base(self, start_shift: int, end_shift: int, base: int) -> None:
8080
except ValueError:
8181
pass # result remains None
8282
if result is None:
83-
l = end - start
84-
if l == 2:
83+
last = end - start
84+
if last == 2:
8585
self.feeder.message("Syntax", "sntoct2")
86-
elif l == 3:
86+
elif last == 3:
8787
self.feeder.message("Syntax", "sntoct1")
88-
elif l == 4:
88+
elif last == 4:
8989
self.feeder.message("Syntax", "snthex")
9090
else:
9191
raise ValueError()

setup.cfg

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
11
[metadata]
22
description_file = README.rst
3+
4+
# Recommended flake8 settings while editing zoom, we use Black for the final
5+
# linting/say in how code is formatted
6+
#
7+
# pip install flake8 flake8-bugbear
8+
#
9+
# This will warn/error on things that black does not fix, on purpose.
10+
11+
# This config file MUST be ASCII to prevent weird flake8 dropouts
12+
13+
[flake8]
14+
# max-line-length setting: NO we do not want everyone writing 120-character lines!
15+
# We are setting the maximum line length big here because there are longer
16+
# lines allowed by black in some cases that are forbidden by flake8. Since
17+
# black has the final say about code formatting issues, this setting is here to
18+
# make sure that flake8 doesn't fail the build on longer lines allowed by
19+
# black.
20+
max-line-length = 120
21+
max-complexity = 12
22+
select = E,F,W,C,B,B9
23+
ignore =
24+
# E123 closing bracket does not match indentation of opening bracket's line
25+
E123
26+
# E203 whitespace before ':' (Not PEP8 compliant, Python Black)
27+
E203
28+
# E501 line too long (82 > 79 characters) (replaced by B950 from flake8-bugbear,
29+
# https://github.com/PyCQA/flake8-bugbear)
30+
E501
31+
# W503 line break before binary operator (Not PEP8 compliant, Python Black)
32+
W503
33+
# W504 line break after binary operator (Not PEP8 compliant, Python Black)
34+
W504
35+
# C901 function too complex - since many of zz9 functions are too complex with a lot
36+
# of if branching
37+
C901
38+
# module level import not at top of file. This is too restrictive. Can't even have a
39+
# docstring higher.
40+
E402
41+
per-file-ignores =
42+
# These are config files. The `c` variable them is injected not defined.
43+
pow/ansible/roles/jupyterhub/templates/jupyterhub_config*.py:F821
44+
# Ignore some errors in files that are stolen from other projects to avoid lots
45+
# of merge problems later .
46+
pow/ansible/roles/webtier/files/supervisor_httpgroupok.py:E126,E128,E222,E225,E226,E261,E301,E302,E305,F841,E201,E202
47+
silhouette/src/silhouette/gprof2dot.py:E711,E713,E741,F401
48+
# Ignore undefined name errors in "expectation" test Python code.
49+
# These files get exec'd in an environment that defines the variables.
50+
server/tests/files/expectations/*.py:F821

setup.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ def read(*rnames):
4646
return open(osp.join(get_srcdir(), *rnames)).read()
4747

4848

49-
# stores __version__ in the current namespace
50-
exec(
51-
compile(
52-
open("mathics_scanner/version.py").read(), "mathics_scanner/version.py", "exec"
53-
)
54-
)
49+
from mathics_scanner.version import __version__
5550

5651
# Get/set __version__ and long_description from files
5752
long_description = read("README.rst") + "\n"

test/test_table_consistency.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ def test_roundtrip():
1919
for k, v in yaml_data.items():
2020
if v["has-unicode-inverse"]:
2121
uni = v["unicode-equivalent"]
22-
try:
23-
wl = v["wl-unicode"]
24-
except:
25-
import pdb
26-
27-
pdb.set_trace()
22+
wl = v["wl-unicode"]
2823
assert (
2924
unicode_to_wl(wl_to_unicode(wl)) == wl
3025
), f"key {k} unicode {uni}, {wl_to_unicode(uni)}"

0 commit comments

Comments
 (0)