Skip to content

Commit caf2934

Browse files
committed
Minor fixes
Signed-off-by: Andrea Zoppi <texzk@email.it>
1 parent 1500a71 commit caf2934

10 files changed

Lines changed: 31 additions & 23 deletions

File tree

CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
=========
33

4+
0.4.4 (2025-07-04)
5+
------------------
6+
7+
* Removed support for Python 3.7.
8+
* Removed support for Python 3.8.
9+
* Using ``BASED_INT`` for CLI command ``align`` argument ``--modulo``.
10+
* Minor fixes.
11+
12+
413
0.4.3 (2025-06-10)
514
------------------
615

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,7 @@ def read_version():
8181
napoleon_custom_sections = [('Method Groups', 'params_style')]
8282

8383
typehints_document_rtype = False
84+
85+
linkcheck_ignore = [
86+
r'https://developerhelp.microchip.com/xwiki/bin/view/software-tools/ipe/sqtp-file-format-specification/',
87+
]

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ classifiers = [
1313
"Programming Language :: Python",
1414
"Programming Language :: Python :: 3",
1515
"Programming Language :: Python :: 3 :: Only",
16-
"Programming Language :: Python :: 3.7",
17-
"Programming Language :: Python :: 3.8", # adds: typing.Literal
1816
"Programming Language :: Python :: 3.9",
1917
"Programming Language :: Python :: 3.10", # adds: typing.TypeAlias
2018
"Programming Language :: Python :: 3.11", # adds: typing.Self
@@ -38,7 +36,7 @@ dynamic = ["version"]
3836
license = "BSD-2-Clause"
3937
name = "hexrec"
4038
readme = "README.rst"
41-
requires-python = ">= 3.7"
39+
requires-python = ">= 3.9"
4240

4341
[project.optional-dependencies]
4442
testing = ["coverage", "pyelftools", "pytest"]

src/hexrec/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2424
# POSSIBILITY OF SUCH DAMAGE.
2525

26-
__version__ = '0.4.3'
26+
__version__ = '0.4.4'
2727

2828
from .base import convert
2929
from .base import file_types

src/hexrec/formats/asciihex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ def validate_records(
799799
last_data_endex = 0
800800
file_checksum = 0
801801

802-
for index, record in enumerate(records):
802+
for record in records:
803803
record = _cast(AsciiHexRecord, record)
804804
record.validate()
805805
tag = record.tag

src/hexrec/formats/srec.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,9 @@ def get_address_max(self) -> Optional[int]:
220220
r"""Calculates the maximum address.
221221
222222
It calculates the maximum *address* field for the calling tag.
223-
If the *address* field is not supported, it returns ``None``.
224223
225224
Returns:
226-
int: Maximum *address* value, or ``None``.
225+
int: Maximum *address* value.
227226
228227
Examples:
229228
>>> from hexrec import SrecFile
@@ -247,10 +246,9 @@ def get_address_size(self) -> Optional[int]:
247246
r"""Calculates the maximum address size.
248247
249248
It calculates the maximum *address* field size for the calling tag.
250-
If the *address* field is not supported, it returns zero.
251249
252250
Returns:
253-
int: Maximum *address* size, or ``None``.
251+
int: Maximum *address* size.
254252
255253
Examples:
256254
>>> from hexrec import SrecFile
@@ -273,10 +271,9 @@ def get_data_max(self) -> Optional[int]:
273271
r"""Calculates the maximum data size.
274272
275273
It calculates the maximum *data* field size for the calling tag.
276-
If the *data* field is not supported, it returns ``None``.
277274
278275
Returns:
279-
int: Maximum *data* size, or ``None``.
276+
int: Maximum *data* size.
280277
281278
Examples:
282279
>>> from hexrec import SrecFile
@@ -301,7 +298,7 @@ def get_tag_match(self) -> Optional['SrecTag']:
301298
Given *data* or *start address* records, it returns the matching tag.
302299
303300
Returns:
304-
:class:`SrecTag`: Matching tag for *self*, or ``None``
301+
:class:`SrecTag`: Matching tag for *self*, or ``None``.
305302
306303
Examples:
307304
>>> from hexrec import SrecFile

src/hexrec/formats/xtek.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def validate(
496496
class XtekFile(BaseFile):
497497
r"""Tektronix Extended file object."""
498498

499-
FILE_EXT: Sequence[int] = ['.tek', '.xtek']
499+
FILE_EXT: Sequence[str] = ['.tek', '.xtek']
500500

501501
META_KEYS: Sequence[str] = [
502502
'maxdatalen',

src/hexrec/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def read(
338338
start = self._position
339339
if start >= memory.endex:
340340
return b''
341-
endex = None if size < 0 else start + size
341+
endex = None if size is None or size < 0 else start + size
342342
buffer = b''
343343
try:
344344
buffer = memory.view(start=start, endex=endex)

src/hexrec/xxd.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ def _unhexlify(line: AnyBytes) -> Union[AnyBytes, ImmutableMemory]:
132132

133133
line = line.translate(None, b' \t.:\r\n')
134134

135-
if 0x3C in line:
135+
if 0x3C in line: # ord('<')
136136
line = line.replace(b'<', b'-')
137137

138-
if 0x3E in line:
138+
if 0x3E in line: # ord('>')
139139
line = line.replace(b'>', b'-')
140140

141-
if 0x2D in line:
141+
if 0x2D in line: # ord('-')
142142
zeroed = line.replace(b'-', b'0')
143143
chunk = binascii.unhexlify(zeroed)
144144
even = line[::2]
@@ -278,7 +278,7 @@ def xxd_core(
278278
positions found in hexdump.
279279
280280
iseek (int or str):
281-
Starts at ``iseej`` bytes absolute (or relative) input offset.
281+
Starts at ``iseek`` bytes absolute (or relative) input offset.
282282
Without ``iseek`` option, it starts at the current file position.
283283
The prefix is used to compute the offset.
284284
``+`` indicates that the seek is relative to the current input
@@ -398,7 +398,9 @@ def xxd_core(
398398
if match:
399399
# Interpret line contents
400400
groups = match.groupdict()
401-
address = (oseek or 0) + (iseek or 0) + int(groups['address'], 16)
401+
address = oseek or 0
402+
address += iseek or 0
403+
address += int(groups['address'], 16)
402404
data = _unhexlify(groups['data'])
403405
data = data[:cols]
404406

tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@ envlist =
55
clean,
66
docs,
77
check,
8-
{py37,py38,py39,py310,py311,py312,py313,py314,pypy3},
8+
{py39,py310,py311,py312,py313,py314,pypy3},
99
report
1010

1111
requires =
1212
tox >= 4
13-
setuptools >= 61
13+
setuptools >= 77.0.3
1414

1515
skip_missing_interpreters = true
1616

1717

1818
; This is the environment matrix.
1919
[testenv]
2020
basepython =
21-
py37: {env:TOXPYTHON:python3.7}
22-
py38: {env:TOXPYTHON:python3.8}
2321
py39: {env:TOXPYTHON:python3.9}
2422
py310: {env:TOXPYTHON:python3.10}
2523
py311: {env:TOXPYTHON:python3.11}

0 commit comments

Comments
 (0)