Skip to content

Commit

Permalink
Use keyword-only args for ErrorInfo
Browse files Browse the repository at this point in the history
I checked, I don't think any plugins are using this
  • Loading branch information
hauntsaninja committed Jun 19, 2023
1 parent 719e7e7 commit 1f15134
Showing 1 changed file with 57 additions and 56 deletions.
113 changes: 57 additions & 56 deletions mypy/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class ErrorInfo:
def __init__(
self,
import_ctx: list[tuple[str, int]],
*,
file: str,
module: str | None,
typ: str | None,
Expand Down Expand Up @@ -415,21 +416,21 @@ def report(
code = code or (codes.MISC if not blocker else None)

info = ErrorInfo(
self.import_context(),
file,
self.current_module(),
type,
function,
line,
column,
end_line,
end_column,
severity,
message,
code,
blocker,
only_once,
allow_dups,
import_ctx=self.import_context(),
file=file,
module=self.current_module(),
typ=type,
function_or_member=function,
line=line,
column=column,
end_line=end_line,
end_column=end_column,
severity=severity,
message=message,
code=code,
blocker=blocker,
only_once=only_once,
allow_dups=allow_dups,
origin=(self.file, origin_span),
target=self.current_target(),
)
Expand Down Expand Up @@ -511,17 +512,17 @@ def add_error_info(self, info: ErrorInfo) -> None:
+ "may be out of date"
)
note = ErrorInfo(
info.import_ctx,
info.file,
info.module,
info.type,
info.function_or_member,
info.line,
info.column,
info.end_line,
info.end_column,
"note",
msg,
import_ctx=info.import_ctx,
file=info.file,
module=info.module,
typ=info.type,
function_or_member=info.function_or_member,
line=info.line,
column=info.column,
end_line=info.end_line,
end_column=info.end_column,
severity="note",
message=msg,
code=None,
blocker=False,
only_once=False,
Expand Down Expand Up @@ -653,21 +654,21 @@ def generate_unused_ignore_errors(self, file: str) -> None:
message += f", use narrower [{', '.join(narrower)}] instead of [{unused}] code"
# Don't use report since add_error_info will ignore the error!
info = ErrorInfo(
self.import_context(),
file,
self.current_module(),
None,
None,
line,
-1,
line,
-1,
"error",
message,
codes.UNUSED_IGNORE,
False,
False,
False,
import_ctx=self.import_context(),
file=file,
module=self.current_module(),
typ=None,
function_or_member=None,
line=line,
column=-1,
end_line=line,
end_column=-1,
severity="error",
message=message,
code=codes.UNUSED_IGNORE,
blocker=False,
only_once=False,
allow_dups=False,
)
self._add_error_info(file, info)

Expand Down Expand Up @@ -705,21 +706,21 @@ def generate_ignore_without_code_errors(
message = f'"type: ignore" comment without error code{codes_hint}'
# Don't use report since add_error_info will ignore the error!
info = ErrorInfo(
self.import_context(),
file,
self.current_module(),
None,
None,
line,
-1,
line,
-1,
"error",
message,
codes.IGNORE_WITHOUT_CODE,
False,
False,
False,
import_ctx=self.import_context(),
file=file,
module=self.current_module(),
typ=None,
function_or_member=None,
line=line,
column=-1,
end_line=line,
end_column=-1,
severity="error",
message=message,
code=codes.IGNORE_WITHOUT_CODE,
blocker=False,
only_once=False,
allow_dups=False,
)
self._add_error_info(file, info)

Expand Down

0 comments on commit 1f15134

Please sign in to comment.