Skip to content

Commit e9be020

Browse files
Adjust typing
1 parent c8b3af9 commit e9be020

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pylint/lint/report_functions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
import collections
88
from collections import defaultdict
9+
from typing import cast
910

1011
from pylint import checkers, exceptions
1112
from pylint.reporters.ureports.nodes import Section, Table
13+
from pylint.typing import MessageTypesFullName
1214
from pylint.utils import LinterStats
1315

1416

@@ -54,6 +56,7 @@ def report_messages_by_module_stats(
5456
raise exceptions.EmptyReportError()
5557
by_mod: defaultdict[str, dict[str, int | float]] = collections.defaultdict(dict)
5658
for m_type in ("fatal", "error", "warning", "refactor", "convention"):
59+
m_type = cast(MessageTypesFullName, m_type)
5760
total = stats.get_global_message_count(m_type)
5861
for module in module_stats.keys():
5962
mod_total = stats.get_module_message_count(module, m_type)

pylint/utils/linterstats.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ def get_global_message_count(self, type_name: str) -> int:
292292
"""Get a global message count."""
293293
return getattr(self, type_name, 0)
294294

295-
def get_module_message_count(self, modname: str, type_name: str) -> int:
295+
def get_module_message_count(
296+
self, modname: str, type_name: MessageTypesFullName
297+
) -> int:
296298
"""Get a module message count."""
297299
return self.by_module[modname].get(type_name, 0)
298300

0 commit comments

Comments
 (0)