Skip to content

Commit

Permalink
MyPy: enable ignore-without-code
Browse files Browse the repository at this point in the history
This will force all skips to include the error code, which makes
them more readable, and avoids skipping something unintended.
  • Loading branch information
DimitriPapadopoulos committed Aug 4, 2024
1 parent dee7e20 commit 2ced351
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ exclude = [
[tool.mypy]
disallow_untyped_defs = false
disallow_incomplete_defs = false
enable_error_code = ["ignore-without-code"]
follow_imports = "normal"
ignore_missing_imports = true
pretty = true
Expand Down
2 changes: 1 addition & 1 deletion src/hatch/env/collectors/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class CustomEnvironmentCollector:
PLUGIN_NAME = 'custom'

def __new__( # type: ignore
def __new__( # type: ignore[misc]
cls,
root: str,
config: dict[str, Any],
Expand Down
2 changes: 1 addition & 1 deletion src/hatch/env/collectors/plugin/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

@hookimpl
def hatch_register_environment_collector() -> list[type[EnvironmentCollectorInterface]]:
return [CustomEnvironmentCollector, DefaultEnvironmentCollector] # type: ignore
return [CustomEnvironmentCollector, DefaultEnvironmentCollector] # type: ignore[list-item]
4 changes: 2 additions & 2 deletions src/hatch/plugin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def load_plugin_from_script(
from importlib.util import module_from_spec, spec_from_file_location

spec = spec_from_file_location(script_name, path)
module = module_from_spec(spec) # type: ignore
spec.loader.exec_module(module) # type: ignore
module = module_from_spec(spec) # type: ignore[arg-type]
spec.loader.exec_module(module) # type: ignore[union-attr]

plugin_finder = f'get_{plugin_id}'
names = dir(module)
Expand Down
2 changes: 1 addition & 1 deletion src/hatch/utils/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def populate_default_popen_kwargs(self, kwargs: dict[str, Any], *, shell: bool)
@staticmethod
def stream_process_output(process: Popen) -> Iterable[str]:
# To avoid blocking never use a pipe's file descriptor iterator. See https://bugs.python.org/issue3907
for line in iter(process.stdout.readline, b''): # type: ignore
for line in iter(process.stdout.readline, b''): # type: ignore[union-attr]
yield line.decode('utf-8')

@property
Expand Down

0 comments on commit 2ced351

Please sign in to comment.