Skip to content

Commit

Permalink
Review feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
cibinmathew committed Aug 22, 2023
1 parent ab536c5 commit 8b59ac2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,6 @@ def parse_inline_configuration(self, source: str) -> None:
"""Check for inline mypy: options directive and parse them."""
flags = get_mypy_comments(source)
if flags:
# TODO: should this be captured as well for parser errors?
changes, config_errors = parse_mypy_comments(flags, self.options)
self.options = self.options.apply_changes(changes)
self.manager.errors.set_file(self.xpath, self.id, self.options)
Expand Down
4 changes: 1 addition & 3 deletions mypy/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def parse_section(
else:
msg = f"{prefix}Unrecognized report type: {key}"
raise argparse.ArgumentTypeError(msg)
if key.startswith("x_"):
elif key.startswith("x_"):
pass # Don't complain about `x_blah` flags
elif key.startswith("no_") and hasattr(template, key[3:]):
options_key = key[3:]
Expand Down Expand Up @@ -489,7 +489,6 @@ def parse_section(
v = not v
elif callable(ct):
if invert:
# TODO: should this be captured or it is okay to ignore
print(f"{prefix}Can not invert non-boolean key {options_key}", file=stderr)
continue
try:
Expand All @@ -499,7 +498,6 @@ def parse_section(
raise argparse.ArgumentTypeError(msg) from err
else:
print(f"{prefix}Don't know what type {key} should have", file=stderr)
# TODO: should this be captured or it is okay to ignore as type is not known
continue
except ValueError as err:
msg = f"{prefix}{key}: {err}"
Expand Down
3 changes: 1 addition & 2 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,8 +1252,7 @@ def set_strict_flags() -> None:
try:
parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
except (argparse.ArgumentTypeError, ValueError) as err:
stderr.write(f"{err}")
sys.exit(1)
raise SystemExit(str(err)) from err

# Set strict flags before parsing (if strict mode enabled), so other command
# line options can override.
Expand Down

0 comments on commit 8b59ac2

Please sign in to comment.