Skip to content

Commit

Permalink
Remove walrus operator to support Python >= 3.7
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Marques <[email protected]>
  • Loading branch information
gastmaier committed Mar 11, 2024
1 parent 98b64c3 commit a685ea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion adi_doctools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .role import setup as role_setup
from .lut import get_lut

__version__ = "0.3.19"
__version__ = "0.3.20"

logger = logging.getLogger(__name__)

Expand Down
13 changes: 8 additions & 5 deletions adi_doctools/tool/hdl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

from ..directive.string import string_hdl


# From https://github.com/tfcollins/vger/blob/main/vger/hdl_reg_map.py
def parse_hdl_regmap(reg: str, ctime: float, prefix: str) -> Tuple[Dict, List[str]]:
regmap = {
'subregmap': {},
'owners':[],
'owners': [],
'ctime': ctime
}
warning = []
Expand All @@ -31,7 +32,7 @@ def parse_hdl_regmap(reg: str, ctime: float, prefix: str) -> Tuple[Dict, List[st

title = str(data[tit + 1].strip())
title_tool = str(data[tit + 2].strip())
data = data[tit + 2 :]
data = data[tit + 2:]

if 'ENDTITLE' in [title_tool, title]:
warning.append(f"Malformed title fields at file {prefix}/regmap/adi_regmap_{reg}.txt, skipped!")
Expand All @@ -58,11 +59,12 @@ def parse_hdl_regmap(reg: str, ctime: float, prefix: str) -> Tuple[Dict, List[st
reg_desc = " ".join(reg_desc)

with contextlib.suppress(ValueError):
if tet := data.index("TITLE"):
tet = data.index("TITLE") if "TITLE" in data else -1
if tet != -1:
if regi > tet:
# into next regmap
break
data = data[regi + 1 :]
data = data[regi + 1:]

# Get fields
fields = []
Expand All @@ -74,7 +76,8 @@ def parse_hdl_regmap(reg: str, ctime: float, prefix: str) -> Tuple[Dict, List[st
break

with contextlib.suppress(ValueError):
if rege := data.index("REG"):
rege = data.index("REG") if "REG" in data else -1
if rege != -1:
if fi > rege:
# into next register
break
Expand Down

0 comments on commit a685ea1

Please sign in to comment.