Skip to content

Commit 27c8517

Browse files
Revert "start making Severity a type instead of str"
This reverts commit 18ca5cf. This will allow the PR that fixes this problem to be more focused.
1 parent c42c817 commit 27c8517

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

mypy/errors.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
T = TypeVar("T")
2323

24-
Severity = Literal["note", "warning", "error"]
25-
2624
# Show error codes for some note-level messages (these usually appear alone
2725
# and not as a comment for a previous error-level message).
2826
SHOW_NOTE_CODES: Final = {codes.ANNOTATION_UNCHECKED, codes.DEPRECATED}
@@ -81,8 +79,8 @@ class ErrorInfo:
8179
# The end column number related to this error with file.
8280
end_column = 0 # -1 if unknown
8381

84-
# A set string indicating the badness of the info
85-
severity: Severity
82+
# Either 'error' or 'note'
83+
severity = ""
8684

8785
# The error message.
8886
message = ""
@@ -123,7 +121,7 @@ def __init__(
123121
column: int,
124122
end_line: int,
125123
end_column: int,
126-
severity: Severity,
124+
severity: str,
127125
message: str,
128126
code: ErrorCode | None,
129127
blocker: bool,
@@ -496,7 +494,7 @@ def report(
496494
code: ErrorCode | None = None,
497495
*,
498496
blocker: bool = False,
499-
severity: Severity = "error",
497+
severity: str = "error",
500498
file: str | None = None,
501499
only_once: bool = False,
502500
origin_span: Iterable[int] | None = None,
@@ -513,7 +511,7 @@ def report(
513511
message: message to report
514512
code: error code (defaults to misc; or None for notes), not shown for notes
515513
blocker: if True, don't continue analysis after this error
516-
severity: a Severity like "note" or "error"
514+
severity: 'error' or 'note'
517515
file: if non-None, override current file as context
518516
only_once: if True, only report this exact message once per build
519517
origin_span: if non-None, override current context as origin

mypy/messages.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
ErrorWatcher,
3030
IterationDependentErrors,
3131
IterationErrorWatcher,
32-
Severity,
3332
)
3433
from mypy.nodes import (
3534
ARG_NAMED,
@@ -234,7 +233,7 @@ def report(
234233
self,
235234
msg: str,
236235
context: Context | None,
237-
severity: Severity,
236+
severity: str,
238237
*,
239238
code: ErrorCode | None = None,
240239
file: str | None = None,

mypy/semanal_classprop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from typing import Final
99

10-
from mypy.errors import Errors, Severity
10+
from mypy.errors import Errors
1111
from mypy.nodes import (
1212
IMPLICITLY_ABSTRACT,
1313
IS_ABSTRACT,
@@ -102,7 +102,7 @@ def calculate_class_abstract_status(typ: TypeInfo, is_stub_file: bool, errors: E
102102
return
103103
if abstract and not abstract_in_this_class:
104104

105-
def report(message: str, severity: Severity) -> None:
105+
def report(message: str, severity: str) -> None:
106106
errors.report(typ.line, typ.column, message, severity=severity)
107107

108108
attrs = ", ".join(f'"{attr}"' for attr, _ in sorted(abstract))

0 commit comments

Comments
 (0)