Skip to content

Commit a685ea1

Browse files
committed
Remove walrus operator to support Python >= 3.7
Signed-off-by: Jorge Marques <jorge.marques@analog.com>
1 parent 98b64c3 commit a685ea1

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

adi_doctools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .role import setup as role_setup
1010
from .lut import get_lut
1111

12-
__version__ = "0.3.19"
12+
__version__ = "0.3.20"
1313

1414
logger = logging.getLogger(__name__)
1515

adi_doctools/tool/hdl_parser.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
from ..directive.string import string_hdl
99

10+
1011
# From https://github.com/tfcollins/vger/blob/main/vger/hdl_reg_map.py
1112
def parse_hdl_regmap(reg: str, ctime: float, prefix: str) -> Tuple[Dict, List[str]]:
1213
regmap = {
1314
'subregmap': {},
14-
'owners':[],
15+
'owners': [],
1516
'ctime': ctime
1617
}
1718
warning = []
@@ -31,7 +32,7 @@ def parse_hdl_regmap(reg: str, ctime: float, prefix: str) -> Tuple[Dict, List[st
3132

3233
title = str(data[tit + 1].strip())
3334
title_tool = str(data[tit + 2].strip())
34-
data = data[tit + 2 :]
35+
data = data[tit + 2:]
3536

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

6061
with contextlib.suppress(ValueError):
61-
if tet := data.index("TITLE"):
62+
tet = data.index("TITLE") if "TITLE" in data else -1
63+
if tet != -1:
6264
if regi > tet:
6365
# into next regmap
6466
break
65-
data = data[regi + 1 :]
67+
data = data[regi + 1:]
6668

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

7678
with contextlib.suppress(ValueError):
77-
if rege := data.index("REG"):
79+
rege = data.index("REG") if "REG" in data else -1
80+
if rege != -1:
7881
if fi > rege:
7982
# into next register
8083
break

0 commit comments

Comments
 (0)