Skip to content

Commit

Permalink
Pass mypy and link issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 26, 2024
1 parent fa0fec1 commit 43fdc58
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 17 deletions.
4 changes: 2 additions & 2 deletions jaraco/mongodb/check-gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion jaraco/mongodb/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
4 changes: 2 additions & 2 deletions jaraco/mongodb/insert-doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
2 changes: 1 addition & 1 deletion jaraco/mongodb/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions jaraco/mongodb/monitor-index-creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 4 additions & 2 deletions jaraco/mongodb/move-gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
['test.txt']
"""

from __future__ import annotations

import itertools
import logging
import signal
Expand Down Expand Up @@ -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)
Expand All @@ -131,4 +133,4 @@ def run(


if __name__ == '__main__':
run()
run() # type: ignore[call-arg]
2 changes: 1 addition & 1 deletion jaraco/mongodb/repair-gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
53 changes: 51 additions & 2 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.*]
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
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,3 @@ pytest11 = {MongoDB = "jaraco.mongodb.fixtures"}


[tool.setuptools_scm]


[tool.pytest-enabler.mypy]
# Disabled due to jaraco/skeleton#143

0 comments on commit 43fdc58

Please sign in to comment.