diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index d8796ad5..00000000 --- a/mypy.ini +++ /dev/null @@ -1,17 +0,0 @@ -[mypy] -files=tools,src,tests -show_error_codes = True -warn_unused_ignores = True - -;disallow_any_generics = True -disallow_subclassing_any = True -;disallow_untyped_calls = True -;disallow_untyped_defs = True -disallow_incomplete_defs = True -check_untyped_defs = True -disallow_untyped_decorators = True -no_implicit_optional = True -warn_return_any = True -no_implicit_reexport = True -strict_equality = True -warn_redundant_casts = True diff --git a/pyproject.toml b/pyproject.toml index 9fdacdf5..901eb8d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,3 +5,33 @@ safe = true [tool.isort] profile = "black" + +[tool.mypy] +# Ensure we know what we do +warn_redundant_casts = true +warn_unused_ignores = true +warn_unused_configs = true + +# Imports management +ignore_missing_imports = true +follow_imports = "skip" + +# Ensure full coverage +#disallow_untyped_defs = true [TODO] +disallow_incomplete_defs = true +#disallow_untyped_calls = true [TODO] + +# Restrict dynamic typing (a little) +# e.g. `x: List[Any]` or x: List` +# disallow_any_generics = true + +strict_equality = true + +[tool.pytest.ini_options] +pythonpath = "src" +addopts = """ + --showlocals + -vvv + --cov=watchdog + --cov-report=term-missing:skip-covered +""" diff --git a/setup.cfg b/setup.cfg index 8c5532bd..1b252f95 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,10 +21,3 @@ max-line-length = 120 [upload_sphinx] # Requires sphinx-pypi-upload to work. upload-dir = docs/build/html - -[tool:pytest] -addopts = - --showlocals - -v - --cov=watchdog - --cov-report=term-missing diff --git a/src/watchdog/events.py b/src/watchdog/events.py old mode 100755 new mode 100644 diff --git a/src/watchdog/observers/fsevents.py b/src/watchdog/observers/fsevents.py index 5e9c78ec..a46c0edb 100644 --- a/src/watchdog/observers/fsevents.py +++ b/src/watchdog/observers/fsevents.py @@ -29,7 +29,7 @@ import time import unicodedata -import _watchdog_fsevents as _fsevents # type: ignore[import-not-found] +import _watchdog_fsevents as _fsevents from watchdog.events import ( DirCreatedEvent, @@ -164,7 +164,7 @@ def _is_meta_mod(event): """Returns True if the event indicates a change in metadata.""" return event.is_inode_meta_mod or event.is_xattr_mod or event.is_owner_change - def queue_events(self, timeout, events): # type: ignore[override] + def queue_events(self, timeout, events): if logger.getEffectiveLevel() <= logging.DEBUG: for event in events: flags = ", ".join(attr for attr in dir(event) if getattr(event, attr) is True) diff --git a/src/watchdog/observers/fsevents2.py b/src/watchdog/observers/fsevents2.py index 8a26eb41..0973f980 100644 --- a/src/watchdog/observers/fsevents2.py +++ b/src/watchdog/observers/fsevents2.py @@ -29,8 +29,8 @@ from typing import List, Optional, Type # pyobjc -import AppKit # type: ignore[import-not-found] -from FSEvents import ( # type: ignore[import-not-found] +import AppKit +from FSEvents import ( CFRunLoopGetCurrent, CFRunLoopRun, CFRunLoopStop, diff --git a/src/watchdog/tricks/__init__.py b/src/watchdog/tricks/__init__.py index 60748945..e6cd7d40 100644 --- a/src/watchdog/tricks/__init__.py +++ b/src/watchdog/tricks/__init__.py @@ -298,7 +298,7 @@ def _restart_process(self): if not platform.is_windows(): def kill_process(pid, stop_signal): - os.killpg(os.getpgid(pid), stop_signal) # type: ignore[attr-defined] + os.killpg(os.getpgid(pid), stop_signal) else: diff --git a/src/watchdog/watchmedo.py b/src/watchdog/watchmedo.py old mode 100755 new mode 100644 diff --git a/tox.ini b/tox.ini index 66e52af7..f6ad4528 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ deps = -r requirements-tests.txt commands = # "--platform win32" to not fail on ctypes.windll (it does not affect the overall check on other OSes) - mypy --platform win32 + mypy --platform win32 src [testenv:isort] usedevelop = true