Skip to content

Commit

Permalink
chore: turn on a few more mypy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Mar 29, 2022
1 parent 1f85d04 commit 18c7e5d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
rev: v1.2.5
hooks:
- id: pycln
args: [--config=pyproject.toml]
args: [--all]
stages: [manual]

- repo: https://github.com/pycqa/flake8
Expand All @@ -59,7 +59,7 @@ repos:
hooks:
- id: mypy
files: plumbum
args: [--show-error-codes]
args: []
additional_dependencies: [typed-ast, types-paramiko, types-setuptools]

# This wants the .mo files removed
Expand Down
4 changes: 2 additions & 2 deletions plumbum/colorlib/factories.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
Color-related factories. They produce Styles.
"""


import sys
from functools import reduce
from typing import Any

from .names import color_names, default_styles
from .styles import ColorNotFound
Expand Down Expand Up @@ -108,7 +108,7 @@ def __enter__(self):
"""This will reset the color on leaving the with statement."""
return self

def __exit__(self, _type, _value, _traceback) -> None:
def __exit__(self, _type: Any, _value: Any, _traceback: Any) -> None:
"""This resets a FG/BG color or all styles,
due to different definition of RESET for the
factories."""
Expand Down
3 changes: 2 additions & 1 deletion plumbum/commands/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ def _shutdown_bg_threads():
global _shutting_down # pylint: disable=global-statement
_shutting_down = True
# Make sure this still exists (don't throw error in atexit!)
if _timeout_queue:
# TODO: not sure why this would be "falsy", though
if _timeout_queue: # type: ignore[truthy-bool]
_timeout_queue.put((SystemExit, 0))
# grace period
bgthd.join(0.1)
Expand Down
2 changes: 1 addition & 1 deletion plumbum/machines/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from plumbum.lib import ProcInfo
from plumbum.machines.base import BaseMachine
from plumbum.machines.env import BaseEnv
from plumbum.machines.local import LocalPath
from plumbum.path.local import LocalPath
from plumbum.path.remote import RemotePath, RemoteWorkdir, StatRes


Expand Down
3 changes: 2 additions & 1 deletion plumbum/path/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os

from plumbum.machines.local import LocalPath, local
from plumbum.machines.local import local
from plumbum.path.base import Path
from plumbum.path.local import LocalPath


def delete(*paths):
Expand Down
17 changes: 14 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ files = ["plumbum"]
python_version = "3.6"
warn_unused_configs = true
warn_unused_ignores = true
show_error_codes = true
enable_error_code = ["ignore-without-code", "truthy-bool"]
disallow_any_generics = false
disallow_subclassing_any = false
disallow_untyped_calls = false
disallow_untyped_defs = false
disallow_incomplete_defs = true
check_untyped_defs = false
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_return_any = false
no_implicit_reexport = true
strict_equality = true


[[tool.mypy.overrides]]
Expand Down Expand Up @@ -50,9 +64,6 @@ ignore = [
"CONTRIBUTING.rst",
]

[tool.pycln]
all = true


[tool.pylint]
master.py-version = "3.6"
Expand Down

0 comments on commit 18c7e5d

Please sign in to comment.