Skip to content

Commit 53d7f1c

Browse files
committed
lint cleanup
1 parent 62b0fac commit 53d7f1c

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

src/peakrdl_systemrdl/exporter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
from systemrdl.messages import MessageHandler
99

1010
class SystemRDLExporter:
11-
def __init__(self) -> None:
12-
self.msg = None # type: MessageHandler
11+
msg: "MessageHandler"
1312

1413
def export(self, node: Union[AddrmapNode, RootNode], path: str) -> None:
1514
self.msg = node.env.msg

src/peakrdl_systemrdl/stringify.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ def stringify_rdl_value(value: Any) -> str:
77
Convert value into its RDL string.
88
"""
99

10-
if type(value) == int:
11-
return stringify_int(value)
12-
elif type(value) == bool:
10+
if isinstance(value, bool):
1311
return stringify_boolean(value)
14-
elif type(value) == str:
12+
elif isinstance(value, int):
13+
return stringify_int(value)
14+
elif isinstance(value, str):
1515
return stringify_string(value)
16-
elif type(value) == list:
16+
elif isinstance(value, list):
1717
return stringify_array(value)
1818
elif isinstance(value, rdltypes.BuiltinEnum):
1919
return stringify_builtin_enum(value)
@@ -57,7 +57,7 @@ def stringify_builtin_enum(value: rdltypes.BuiltinEnum) -> str:
5757

5858

5959
def stringify_user_enum_member(value: rdltypes.UserEnum) -> str:
60-
return "%s::%s" % (type(value).type_name, value.name)
60+
return "%s::%s" % (type(value).type_name, value.name) # type: ignore
6161

6262

6363
def stringify_struct(value: rdltypes.UserStruct) -> str:
@@ -66,4 +66,4 @@ def stringify_struct(value: rdltypes.UserStruct) -> str:
6666

6767

6868
def stringify_user_enum_type(value: rdltypes.UserEnum) -> str:
69-
return value.type_name
69+
return value.type_name # type: ignore

test/pylint.rc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ disable=
8888
too-many-statements,
8989
too-many-instance-attributes,
9090
too-many-function-args,
91+
too-many-positional-arguments,
9192
line-too-long,
9293

9394
# Noise / Don't care
@@ -98,10 +99,7 @@ disable=
9899
abstract-method,
99100
protected-access,
100101
duplicate-code,
101-
cyclic-import,
102-
unidiomatic-typecheck,
103-
104-
# Can't do until py35 support is dropped
102+
unused-argument,
105103
consider-using-f-string
106104

107105
# Enable the message, report, category or checker with the given id(s). You can
@@ -145,7 +143,7 @@ max-nested-blocks=5
145143
# inconsistent-return-statements if a never returning function is called then
146144
# it will be considered as an explicit return statement and no message will be
147145
# printed.
148-
never-returning-functions=sys.exit
146+
never-returning-functions=sys.exit,argparse.parse_error
149147

150148

151149
[STRING]
@@ -495,7 +493,7 @@ valid-metaclass-classmethod-first-arg=cls
495493
ignored-parents=
496494

497495
# Maximum number of arguments for function / method.
498-
max-args=8
496+
max-args=16
499497

500498
# Maximum number of attributes for a class (see R0902).
501499
max-attributes=7
@@ -570,5 +568,5 @@ preferred-modules=
570568

571569
# Exceptions that will emit a warning when being caught. Defaults to
572570
# "BaseException, Exception".
573-
overgeneral-exceptions=BaseException,
574-
Exception
571+
overgeneral-exceptions=builtin.BaseException,
572+
builtin.Exception

0 commit comments

Comments
 (0)