Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/workflows/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13" ]
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13" ]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13" ]
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13" ]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13" ]
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13" ]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -252,7 +252,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -291,9 +291,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# reduced matrix because the autoformatter was having issues with python 3.8 so we will
# limit this to modern versions of python only
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ build-backend = "setuptools.build_meta"
[project]
name = "peakrdl-python"
dynamic = ["version"]
requires-python = ">=3.7"
requires-python = ">=3.9"
dependencies = [
"systemrdl-compiler>=1.25.0",
"jinja2",
"asynctest;python_version<'3.8'",
"typing-extensions;python_version<'3.11'"
]

Expand All @@ -27,8 +26,6 @@ classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
2 changes: 1 addition & 1 deletion src/peakrdl_python/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

Variables that describes the peakrdl-python Package
"""
__version__ = "0.9.3"
__version__ = "0.9.4"
93 changes: 37 additions & 56 deletions src/peakrdl_python/lib/async_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,12 @@ async def _read(self, start_entry: int, number_entries: int) -> List[int]:
read_callback = self._callbacks.read_callback

if read_block_callback is not None:
# python 3.7 doesn't have the callback defined as protocol so mypy doesn't recognise
# the arguments in the call back functions
addr = self.address_lookup(entry=start_entry)
data_read = \
await read_block_callback(addr=addr, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width, # type: ignore[call-arg]
length=number_entries) # type: ignore[call-arg]
await read_block_callback(addr=addr,
width=self.width,
accesswidth=self.width,
length=number_entries)

if isinstance(self._callbacks, AsyncCallbackSet):
if not isinstance(data_read, List):
Expand All @@ -204,11 +202,10 @@ async def _read(self, start_entry: int, number_entries: int) -> List[int]:

for entry in range(number_entries):
entry_address = self.address_lookup(entry=start_entry+entry)
# python 3.7 doesn't have the callback defined as protocol so mypy doesn't
# recognise the arguments in the call back functions
data_entry = await read_callback(addr=entry_address, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width) # type: ignore[call-arg]

data_entry = await read_callback(addr=entry_address,
width=self.width,
accesswidth=self.width)

data_read[entry] = data_entry

Expand Down Expand Up @@ -248,14 +245,12 @@ async def _read_legacy(self, start_entry: int, number_entries: int) -> Array:
read_callback = self._callbacks.read_callback

if read_block_callback is not None:
# python 3.7 doesn't have the callback defined as protocol so mypy doesn't recognise
# the arguments in the call back functions
addr = self.address_lookup(entry=start_entry)
data_read = \
await read_block_callback(addr=addr, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width, # type: ignore[call-arg]
length=number_entries) # type: ignore[call-arg]
await read_block_callback(addr=addr,
width=self.width,
accesswidth=self.width,
length=number_entries)

if isinstance(self._callbacks, AsyncCallbackSet):
if not isinstance(data_read, List):
Expand All @@ -275,11 +270,9 @@ async def _read_legacy(self, start_entry: int, number_entries: int) -> Array:

for entry in range(number_entries):
entry_address = self.address_lookup(entry=start_entry + entry)
# python 3.7 doesn't have the callback defined as protocol so mypy doesn't
# recognise the arguments in the call back functions
data_entry = await read_callback(addr=entry_address, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width) # type: ignore[call-arg]
data_entry = await read_callback(addr=entry_address,
width=self.width,
accesswidth=self.width)

data_read_block[entry] = data_entry

Expand Down Expand Up @@ -428,53 +421,41 @@ async def _write(self, start_entry: int, data: Union[Array, List[int]]) -> None:
f'but got {len(data):d}')

if self._callbacks.write_block_callback is not None:
# python 3.7 doesn't have the callback defined as protocol so mypy doesn't recognise
# the arguments in the call back functions

addr = self.address_lookup(entry=start_entry)
if isinstance(self._callbacks, AsyncCallbackSet):
if isinstance(data, Array):
# pylint: disable=line-too-long
await self._callbacks.write_block_callback(addr=addr, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width, # type: ignore[call-arg]
data=data.tolist()) # type: ignore[call-arg]
# pylint: enable=line-too-long
await self._callbacks.write_block_callback(addr=addr,
width=self.width,
accesswidth=self.width,
data=data.tolist())
else:
# pylint: disable=line-too-long
await self._callbacks.write_block_callback(addr=addr, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width, # type: ignore[call-arg]
data=data) # type: ignore[call-arg]
# pylint: enable=line-too-long
await self._callbacks.write_block_callback(addr=addr,
width=self.width,
accesswidth=self.width,
data=data)
if isinstance(self._callbacks, AsyncCallbackSetLegacy):
if isinstance(data, list):
# need to convert the data to an array before calling
# pylint: disable=line-too-long
await self._callbacks.write_block_callback(addr=addr, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width, # type: ignore[call-arg]
data=Array(self.array_typecode, data)) # type: ignore[call-arg]
# pylint: enable=line-too-long
await self._callbacks.write_block_callback(
addr=addr,
width=self.width,
accesswidth=self.width,
data=Array(self.array_typecode, data))
else:
# pylint: disable=line-too-long
await self._callbacks.write_block_callback(addr=addr, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width, # type: ignore[call-arg]
data=data) # type: ignore[call-arg]
# pylint: enable=line-too-long
await self._callbacks.write_block_callback(addr=addr,
width=self.width,
accesswidth=self.width,
data=data)

elif self._callbacks.write_callback is not None:
# there is not write_block_callback defined so we must used individual write
for entry_index, entry_data in enumerate(data):
entry_address = self.address_lookup(entry=start_entry+entry_index)
# python 3.7 doesn't have the callback defined as protocol so mypy doesn't
# recognise the arguments in the call back functions
# pylint: disable=line-too-long
await self._callbacks.write_callback(addr=entry_address, # type: ignore[call-arg]
width=self.width, # type: ignore[call-arg]
accesswidth=self.width, # type: ignore[call-arg]
data=entry_data) # type: ignore[call-arg]
# pylint: enable=line-too-long
await self._callbacks.write_callback(addr=entry_address,
width=self.width,
accesswidth=self.width,
data=entry_data)

else:
raise RuntimeError('No suitable callback')
Expand Down
Loading
Loading