Skip to content

Commit

Permalink
Enable stricter global mypy defaults (#2817)
Browse files Browse the repository at this point in the history
Some checks only need to be disabled for the lib/ directory now.
  • Loading branch information
correctmost authored Nov 16, 2024
1 parent a4935bd commit e23e5e7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions archinstall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def define_arguments() -> None:
exit(1)


def parse_unspecified_argument_list(unknowns: list, multiple: bool = False, err: bool = False) -> dict:
def parse_unspecified_argument_list(unknowns: list, multiple: bool = False, err: bool = False) -> dict: # type: ignore[type-arg]
"""We accept arguments not defined to the parser. (arguments "ad hoc").
Internally argparse return to us a list of words so we have to parse its contents, manually.
We accept following individual syntax for each argument
Expand Down Expand Up @@ -150,7 +150,7 @@ def parse_unspecified_argument_list(unknowns: list, multiple: bool = False, err:
return config


def cleanup_empty_args(args: Union[Namespace, dict]) -> dict:
def cleanup_empty_args(args: Union[Namespace, dict]) -> dict: # type: ignore[type-arg]
"""
Takes arguments (dictionary or argparse Namespace) and removes any
None values. This ensures clean mergers during dict.update(args)
Expand Down Expand Up @@ -284,7 +284,7 @@ def post_process_arguments(arguments: dict[str, Any]) -> None:

# @archinstall.plugin decorator hook to programmatically add
# plugins in runtime. Useful in profiles_bck and other things.
def plugin(f, *args, **kwargs) -> None:
def plugin(f, *args, **kwargs) -> None: # type: ignore[no-untyped-def]
plugins[f.__name__] = f


Expand Down
2 changes: 1 addition & 1 deletion archinstall/default_profiles/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def post_install(self, install_session: 'Installer') -> None:
are needed
"""

def json(self) -> dict:
def json(self) -> dict[str, Any]:
"""
Returns a json representation of the profile
"""
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
sys.path.insert(0, os.path.abspath('..'))


def process_docstring(app, what, name, obj, options, lines) -> None:
def process_docstring(app, what, name, obj, options, lines) -> None: # type: ignore[no-untyped-def]
spaces_pat = re.compile(r"( {8})")
ll = [spaces_pat.sub(" ", line) for line in lines]
lines[:] = ll


def setup(app) -> None:
def setup(app) -> None: # type: ignore[no-untyped-def]
app.connect('autodoc-process-docstring', process_docstring)


Expand Down
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ exclude = "^build/"
check_untyped_defs = true
disallow_any_explicit = false
disallow_any_expr = false
disallow_any_generics = false
disallow_any_unimported = false
disallow_incomplete_defs = false
disallow_any_generics = true
disallow_any_unimported = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = false
disallow_untyped_defs = true
extra_checks = true
strict = false
strict_equality = true
Expand All @@ -89,14 +89,14 @@ warn_unused_ignores = true
[[tool.mypy.overrides]]
module = "archinstall.examples.*"
disallow_any_explicit = true
disallow_any_generics = true
disallow_any_unimported = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
follow_imports = "silent"

[[tool.mypy.overrides]]
module = "archinstall.lib.*"
disallow_any_generics = false
disallow_any_unimported = false
disallow_incomplete_defs = false
disallow_untyped_defs = false
warn_return_any = false
warn_unreachable = false

Expand Down

0 comments on commit e23e5e7

Please sign in to comment.