Skip to content

Commit 43fdc58

Browse files
committed
Pass mypy and link issues
1 parent fa0fec1 commit 43fdc58

9 files changed

+64
-17
lines changed

jaraco/mongodb/check-gridfs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def handle_trap(self, trap):
4545

4646
@autocommand.autocommand(__name__)
4747
def run(
48-
db: helper.connect_gridfs, # type: ignore
49-
depth: (int, 'Bytes to read into each file during check') = 1024, # type: ignore # noqa: F722
48+
db: helper.connect_gridfs,
49+
depth: (int, 'Bytes to read into each file during check') = 1024, # noqa: F722
5050
):
5151
logging.basicConfig(stream=sys.stderr)
5252

jaraco/mongodb/codec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def maybe_date(obj):
4242
smart_hook = compose(maybe_date, collections.OrderedDict)
4343

4444

45-
decode = functools.partial(json.loads, object_pairs_hook=smart_hook) # type: ignore
45+
decode = functools.partial(json.loads, object_pairs_hook=smart_hook) # type: ignore[arg-type]

jaraco/mongodb/insert-doc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def get_collection(uri: str) -> pymongo.collection.Collection:
1212

1313

1414
@autocommand.autocommand(__name__)
15-
def main(collection: get_collection): # type: ignore
15+
def main(collection: get_collection):
1616
"""
1717
Insert a document from stdin into the specified collection.
1818
"""
19-
collection.insert_one(json.load(sys.stdin)) # type: ignore
19+
collection.insert_one(json.load(sys.stdin)) # type: ignore[attr-defined]

jaraco/mongodb/install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _extract_application_gzip(resp, target):
7878
with tarfile.open(fileobj=resp, mode='r|*') as obj:
7979
roots = RootFinder()
8080
# python/typeshed#10514
81-
obj.extractall(target, filter=roots) # type: ignore
81+
obj.extractall(target, filter=roots)
8282
return roots
8383

8484

jaraco/mongodb/monitor-index-creation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ def is_index_op(op):
1414

1515

1616
@autocommand.autocommand(__name__)
17-
def run(db: helper.connect_db): # type: ignore
17+
def run(db: helper.connect_db):
1818
while True:
19-
ops = db.current_op()['inprog'] # type: ignore
19+
ops = db.current_op()['inprog'] # type: ignore[attr-defined]
2020
index_op = next(filter(is_index_op, ops), None)
2121
if not index_op:
2222
print("No index operations in progress")

jaraco/mongodb/move-gridfs.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
['test.txt']
1919
"""
2020

21+
from __future__ import annotations
22+
2123
import itertools
2224
import logging
2325
import signal
@@ -120,7 +122,7 @@ def run(
120122
dest_gfs: helper.connect_gridfs,
121123
include: (str, "a filter of files (regex) to include") = None, # noqa: F722
122124
delete: (bool, "delete files after moving") = False, # noqa: F722
123-
limit: int = None,
125+
limit: int | None = None,
124126
limit_date: (dateutil.parser.parse, 'only move files older than this date') = None, # noqa: F722
125127
):
126128
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
@@ -131,4 +133,4 @@ def run(
131133

132134

133135
if __name__ == '__main__':
134-
run()
136+
run() # type: ignore[call-arg]

jaraco/mongodb/repair-gridfs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def handle_trap(self, trap):
5656

5757

5858
@autocommand.autocommand(__name__)
59-
def run(db: helper.connect_gridfs): # type: ignore
59+
def run(db: helper.connect_gridfs):
6060
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
6161

6262
repair = FileRepair(db)

mypy.ini

+51-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,54 @@ enable_error_code = ignore-without-code
1010
# Support namespace packages per https://github.com/python/mypy/issues/14057
1111
explicit_package_bases = True
1212

13-
# Disable overload-overlap due to many false-positives
14-
disable_error_code = overload-overlap
13+
disable_error_code =
14+
# Disable overload-overlap due to many false-positives
15+
overload-overlap,
16+
# TODO: Consider Annotated and/or replacing autocommand jaraco/jaraco.develop#20
17+
valid-type,
18+
syntax,
19+
20+
# jaraco/backports.tarfile#1
21+
[mypy-backports.*]
22+
ignore_missing_imports = True
23+
24+
# jaraco/jaraco.itertools#20
25+
[mypy-jaraco.itertools.*]
26+
ignore_missing_imports = True
27+
28+
# jaraco/jaraco.ui#4
29+
[mypy-jaraco.ui.*]
30+
ignore_missing_imports = True
31+
32+
# jaraco/jaraco.logging#6
33+
[mypy-jaraco.logging.*]
34+
ignore_missing_imports = True
35+
36+
# jaraco/jaraco.services#5
37+
[mypy-jaraco.services.*]
38+
ignore_missing_imports = True
39+
40+
# jaraco/tempora#35
41+
[mypy-tempora.*]
42+
ignore_missing_imports = True
43+
44+
# jaraco/portend#17
45+
[mypy-portend.*]
46+
ignore_missing_imports = True
47+
48+
# pmxbot/pmxbot#113
49+
[mypy-pmxbot.*]
50+
ignore_missing_imports = True
51+
52+
# cherrypy/cherrypy#1510
53+
[mypy-cherrypy.*]
54+
ignore_missing_imports = True
55+
56+
# jaraco/jaraco.develop#20
57+
# Lucretiel/autocommand#38
58+
[mypy-autocommand.*]
59+
ignore_missing_imports = True
60+
61+
# TODO: Raise issue upstream
62+
[mypy-pytimeparse.*]
63+
ignore_missing_imports = True

pyproject.toml

-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,3 @@ pytest11 = {MongoDB = "jaraco.mongodb.fixtures"}
9393

9494

9595
[tool.setuptools_scm]
96-
97-
98-
[tool.pytest-enabler.mypy]
99-
# Disabled due to jaraco/skeleton#143

0 commit comments

Comments
 (0)