Skip to content

Commit b09ad16

Browse files
author
Kirill V. Lyadvinsky
committed
Fix lint warnings & add make target for publishing
1 parent 4283145 commit b09ad16

File tree

5 files changed

+43
-22
lines changed

5 files changed

+43
-22
lines changed

.pylintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[TYPECHECK]
2+
ignored-classes=Header
3+
4+
[SIMILARITIES]
5+
6+
# Minimum lines number of a similarity.
7+
min-similarity-lines=20
8+
9+
[MISCELLANEOUS]
10+
# List of note tags to take in consideration, separated by a comma.
11+
notes=FIXME,XXX

Makefile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
.PHONY: init test clean coverage lint
1+
.PHONY: test clean coverage lint distclean
2+
3+
PYTHON ?= python3
24

35
test:
4-
python3 -m unittest discover -v -b
6+
$(PYTHON) -m unittest discover -v -b
57

68
clean:
7-
rm -rf test/*.pyc
8-
rm -rf zxtools/*.pyc
9-
rm -rf test/__pycache__
10-
rm -rf zxtools/__pycache__
11-
rm -rf zxtools.egg-info
9+
rm -rf dist/ build/ *.egg-info
1210
rm -rf coverage.xml
11+
find . -name '__pycache__' | xargs rm -rf
12+
13+
distclean: clean
1314

1415
coverage:
1516
coverage run --source zxtools setup.py test
16-
coverage report -m
17+
coverage report -m --fail-under=90
1718

1819
lint:
1920
pylint zxtools -f parseable -r n
21+
22+
release: clean lint coverage clean
23+
$(PYTHON) setup.py sdist bdist_wheel upload
24+

zxtools/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Licensed under the BSD 3-Clause license.
88
# See LICENSE file in the project root for full license information.
99
#
10+
""" Global contants is here"""
1011

11-
__version__ = '1.0.22'
12+
__version__ = '1.0.23'
1213
CHUNK_SIZE = 512 * 1024 # 512 KBytes

zxtools/hobeta.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626

2727
def hobeta_help(*parsed_args):
28+
"""Shows help"""
2829
print(
2930
"Hobeta file has the following format:\n"
3031
"(this is according to http://speccy.info/Hobeta)\n"

zxtools/zeus2txt.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@
2020

2121

2222
def show_info(*parsed_args):
23+
"""Show some statistic about Zeus file"""
24+
# TODO Implement this function
2325
return parsed_args
2426

2527

2628
def read_file(src_file):
29+
"""Read source file for future processing"""
2730
with src_file:
2831
while True:
2932
chunk = src_file.read(CHUNK_SIZE)
3033
if chunk:
31-
for b in chunk:
32-
yield b
34+
for byte in chunk:
35+
yield byte
3336
else:
3437
break
3538

@@ -61,10 +64,10 @@ def convert_file(parsed_args):
6164
strnum = 0
6265
cur_buffer = ""
6366
cur_line = io.StringIO()
64-
for b in read_file(parsed_args.zeus_file):
67+
for cur_char in read_file(parsed_args.zeus_file):
6568
if process_string:
66-
cur_buffer += "0x%02X " % b
67-
if not b: # End of string
69+
cur_buffer += "0x%02X " % cur_char
70+
if not cur_char: # End of string
6871
process_string = False
6972
strnum_lo = False, 0
7073
cur_str = cur_line.getvalue()
@@ -76,25 +79,25 @@ def convert_file(parsed_args):
7679
print(file=output)
7780
continue
7881
if tab:
79-
print(" "*b, end="", file=cur_line)
82+
print(" "*cur_char, end="", file=cur_line)
8083
tab = False
8184
continue
82-
if b == 0x0A:
85+
if cur_char == 0x0A:
8386
tab = True
8487
continue
85-
if b < ASM_FIRST_TOKEN: # Printable character
86-
print(chr(b), end="", file=cur_line)
88+
if cur_char < ASM_FIRST_TOKEN: # Printable character
89+
print(chr(cur_char), end="", file=cur_line)
8790
continue
8891
try:
89-
print(ASM_META[b-ASM_FIRST_TOKEN], end="", file=cur_line)
92+
print(ASM_META[cur_char-ASM_FIRST_TOKEN], end="", file=cur_line)
9093
except IndexError:
9194
logger.warning("Token not defined: 0x%02X (%d), at line %05d. "
92-
"Skipped.", b, b, strnum)
95+
"Skipped.", cur_char, cur_char, strnum)
9396
else:
9497
if not strnum_lo[0]:
95-
strnum_lo = True, b
98+
strnum_lo = True, cur_char
9699
else:
97-
strnum = strnum_lo[1] + b*256
100+
strnum = strnum_lo[1] + cur_char*256
98101
if strnum == 0xFFFF: # End of file
99102
print(file=output)
100103
break

0 commit comments

Comments
 (0)