Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass mypy and link issues #42

Merged
merged 3 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
3 changes: 1 addition & 2 deletions jaraco/mongodb/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ def _extract_application_zip(resp, target):
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
5 changes: 3 additions & 2 deletions jaraco/mongodb/move-gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
['test.txt']
"""

from __future__ import annotations

import itertools
import logging
import signal
import sys

import autocommand
import bson
import dateutil.parser
from more_itertools.recipes import consume
Expand Down Expand Up @@ -121,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, # type: ignore[assignment] jaraco/jaraco.mongodb#42#discussion_r1739885173
limit_date: (dateutil.parser.parse, 'only move files older than this date') = None, # noqa: F722
):
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
Expand Down
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
49 changes: 49 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,52 @@ explicit_package_bases = True
disable_error_code =
# Disable due to many false positives
overload-overlap,

# autocommand fights mypy; consider jaraco/jaraco.mongodb#43
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
Loading