Skip to content

Commit f4008a4

Browse files
[mypy] nncf/*py (#3176)
### Changes Enable mypy check for `nncf/*py`
1 parent fec8c6e commit f4008a4

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

Diff for: nncf/errors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class StatisticsCacheError(Exception):
136136
Raised when any error occurs during statistics caching.
137137
"""
138138

139-
def __str__(self):
139+
def __str__(self) -> str:
140140
return (
141141
"The error occurred during statistics caching:\n"
142142
f"{super().__str__()}\n"

Diff for: nncf/parameters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class StrEnum(str, Enum):
1818
def __str__(self) -> str:
19-
return self.value
19+
return str(self.value)
2020

2121

2222
@api(canonical_alias="nncf.TargetDevice")

Diff for: nncf/scopes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def convert_ignored_scope_to_list(ignored_scope: Optional[IgnoredScope]) -> List
141141
:param ignored_scope: The ignored scope.
142142
:return: An ignored scope in the legacy format as list.
143143
"""
144-
results = []
144+
results: List[str] = []
145145
if ignored_scope is None:
146146
return results
147147
results.extend(ignored_scope.names)
@@ -164,7 +164,7 @@ def get_matched_ignored_scope_info(
164164
:param nncf_graphs: Graphs.
165165
:returns: Matched ignored scope along with all matches.
166166
"""
167-
names, patterns, types, subgraphs_numbers = set(), set(), set(), set()
167+
names, patterns, types, subgraphs_numbers = set(), set(), set(), set() # type: ignore
168168
matches = {"names": names, "patterns": set(), "types": set(), "subgraphs": set()}
169169

170170
for graph in nncf_graphs:

Diff for: pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ files = [
105105
"nncf/quantization/range_estimator.py",
106106
"nncf/quantization/telemetry_extractors.py",
107107
"nncf/telemetry/",
108+
"nncf/*py",
108109
]
109110

110111
[tool.ruff]

0 commit comments

Comments
 (0)