diff --git a/jaraco/mongodb/check-gridfs.py b/jaraco/mongodb/check-gridfs.py index 301b82d..89f8106 100644 --- a/jaraco/mongodb/check-gridfs.py +++ b/jaraco/mongodb/check-gridfs.py @@ -45,8 +45,8 @@ def handle_trap(self, trap): @autocommand.autocommand(__name__) def run( - db: helper.connect_gridfs, # type: ignore - depth: (int, 'Bytes to read into each file during check') = 1024, # type: ignore # noqa: F722 + db: helper.connect_gridfs, + depth: (int, 'Bytes to read into each file during check') = 1024, # noqa: F722 ): logging.basicConfig(stream=sys.stderr) diff --git a/jaraco/mongodb/codec.py b/jaraco/mongodb/codec.py index 9398a3a..7bed275 100644 --- a/jaraco/mongodb/codec.py +++ b/jaraco/mongodb/codec.py @@ -42,4 +42,4 @@ def maybe_date(obj): smart_hook = compose(maybe_date, collections.OrderedDict) -decode = functools.partial(json.loads, object_pairs_hook=smart_hook) # type: ignore +decode = functools.partial(json.loads, object_pairs_hook=smart_hook) # type: ignore[arg-type] diff --git a/jaraco/mongodb/insert-doc.py b/jaraco/mongodb/insert-doc.py index e63c762..5ed510f 100644 --- a/jaraco/mongodb/insert-doc.py +++ b/jaraco/mongodb/insert-doc.py @@ -12,8 +12,8 @@ def get_collection(uri: str) -> pymongo.collection.Collection: @autocommand.autocommand(__name__) -def main(collection: get_collection): # type: ignore +def main(collection: get_collection): """ Insert a document from stdin into the specified collection. """ - collection.insert_one(json.load(sys.stdin)) # type: ignore + collection.insert_one(json.load(sys.stdin)) # type: ignore[attr-defined] diff --git a/jaraco/mongodb/install.py b/jaraco/mongodb/install.py index 503b857..8b873ce 100644 --- a/jaraco/mongodb/install.py +++ b/jaraco/mongodb/install.py @@ -78,7 +78,7 @@ def _extract_application_gzip(resp, target): with tarfile.open(fileobj=resp, mode='r|*') as obj: roots = RootFinder() # python/typeshed#10514 - obj.extractall(target, filter=roots) # type: ignore + obj.extractall(target, filter=roots) return roots diff --git a/jaraco/mongodb/monitor-index-creation.py b/jaraco/mongodb/monitor-index-creation.py index 3c3923c..47a476e 100644 --- a/jaraco/mongodb/monitor-index-creation.py +++ b/jaraco/mongodb/monitor-index-creation.py @@ -14,9 +14,9 @@ def is_index_op(op): @autocommand.autocommand(__name__) -def run(db: helper.connect_db): # type: ignore +def run(db: helper.connect_db): while True: - ops = db.current_op()['inprog'] # type: ignore + ops = db.current_op()['inprog'] # type: ignore[attr-defined] index_op = next(filter(is_index_op, ops), None) if not index_op: print("No index operations in progress") diff --git a/jaraco/mongodb/move-gridfs.py b/jaraco/mongodb/move-gridfs.py index 1ff287b..e976ce6 100644 --- a/jaraco/mongodb/move-gridfs.py +++ b/jaraco/mongodb/move-gridfs.py @@ -18,6 +18,8 @@ ['test.txt'] """ +from __future__ import annotations + import itertools import logging import signal @@ -120,7 +122,7 @@ def run( dest_gfs: helper.connect_gridfs, include: (str, "a filter of files (regex) to include") = None, # noqa: F722 delete: (bool, "delete files after moving") = False, # noqa: F722 - limit: int = None, + limit: int | None = None, limit_date: (dateutil.parser.parse, 'only move files older than this date') = None, # noqa: F722 ): logging.basicConfig(stream=sys.stderr, level=logging.INFO) @@ -131,4 +133,4 @@ def run( if __name__ == '__main__': - run() + run() # type: ignore[call-arg] diff --git a/jaraco/mongodb/repair-gridfs.py b/jaraco/mongodb/repair-gridfs.py index 402ebe4..c19db96 100644 --- a/jaraco/mongodb/repair-gridfs.py +++ b/jaraco/mongodb/repair-gridfs.py @@ -56,7 +56,7 @@ def handle_trap(self, trap): @autocommand.autocommand(__name__) -def run(db: helper.connect_gridfs): # type: ignore +def run(db: helper.connect_gridfs): logging.basicConfig(stream=sys.stderr, level=logging.INFO) repair = FileRepair(db) diff --git a/mypy.ini b/mypy.ini index 83b0d15..4bf45c8 100644 --- a/mypy.ini +++ b/mypy.ini @@ -10,5 +10,54 @@ enable_error_code = ignore-without-code # Support namespace packages per https://github.com/python/mypy/issues/14057 explicit_package_bases = True -# Disable overload-overlap due to many false-positives -disable_error_code = overload-overlap +disable_error_code = + # Disable overload-overlap due to many false-positives + overload-overlap, + # TODO: Consider Annotated and/or replacing autocommand jaraco/jaraco.develop#20 + valid-type, + syntax, + +# jaraco/backports.tarfile#1 +[mypy-backports.tarfile.*] +ignore_missing_imports = True + +# jaraco/jaraco.itertools#20 +[mypy-jaraco.itertools.*] +ignore_missing_imports = True + +# jaraco/jaraco.ui#4 +[mypy-jaraco.ui.*] +ignore_missing_imports = True + +# jaraco/jaraco.logging#6 +[mypy-jaraco.logging.*] +ignore_missing_imports = True + +# jaraco/jaraco.services#5 +[mypy-jaraco.services.*] +ignore_missing_imports = True + +# jaraco/tempora#35 +[mypy-tempora.*] +ignore_missing_imports = True + +# jaraco/portend#17 +[mypy-portend.*] +ignore_missing_imports = True + +# pmxbot/pmxbot#113 +[mypy-pmxbot.*] +ignore_missing_imports = True + +# cherrypy/cherrypy#1510 +[mypy-cherrypy.*] +ignore_missing_imports = True + +# jaraco/jaraco.develop#20 +# Lucretiel/autocommand#38 +[mypy-autocommand.*] +ignore_missing_imports = True + +# TODO: Raise issue upstream +[mypy-pytimeparse.*] +ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index 002dd6d..44ca5f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,3 @@ pytest11 = {MongoDB = "jaraco.mongodb.fixtures"} [tool.setuptools_scm] - - -[tool.pytest-enabler.mypy] -# Disabled due to jaraco/skeleton#143