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

Upgrade MyPy to 1.8.0 #1089

Merged
merged 1 commit into from
Jan 19, 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
9 changes: 7 additions & 2 deletions kopf/_cogs/aiokits/aioadapters.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import asyncio
import concurrent.futures
import threading
from typing import Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional, Union

from kopf._cogs.aiokits import aiotasks

Flag = Union[aiotasks.Future, asyncio.Event, concurrent.futures.Future, threading.Event]
if TYPE_CHECKING:
concurrent_Future = concurrent.futures.Future[Any]

Check warning on line 9 in kopf/_cogs/aiokits/aioadapters.py

View check run for this annotation

Codecov / codecov/patch

kopf/_cogs/aiokits/aioadapters.py#L9

Added line #L9 was not covered by tests
else:
concurrent_Future = concurrent.futures.Future # Python<=3.8

Flag = Union[aiotasks.Future, asyncio.Event, concurrent_Future, threading.Event]


async def wait_flag(
Expand Down
2 changes: 1 addition & 1 deletion kopf/_cogs/structs/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# A namespace specification with globs, negations, and some minimal syntax; see `match_namespace()`.
# Regexps are also supported if pre-compiled from the code, not from the CLI options as raw strings.
NamespacePattern = Union[str, Pattern]
NamespacePattern = Union[str, Pattern[str]]

# A specific really existing addressable namespace (at least, the one assumed to be so).
# Made as a NewType for stricter type-checking to avoid collisions with patterns and other strings.
Expand Down
4 changes: 2 additions & 2 deletions kopf/_core/engines/peering.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ async def touch_command(
) -> None:

await asyncio.wait({
insights.ready_namespaces.wait(),
insights.ready_resources.wait(),
asyncio.create_task(insights.ready_namespaces.wait()),
asyncio.create_task(insights.ready_resources.wait()),
})

selectors = guess_selectors(settings=settings)
Expand Down
4 changes: 2 additions & 2 deletions kopf/_core/intents/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
ActivityFn = Callable[
[
NamedArg(configuration.OperatorSettings, "settings"),
NamedArg(ephemera.Index, "*"),
NamedArg(ephemera.Index[Any, Any], "*"),
NamedArg(int, "retry"),
NamedArg(datetime.datetime, "started"),
NamedArg(datetime.timedelta, "runtime"),
Expand Down Expand Up @@ -175,7 +175,7 @@

TimerFn = Callable[
[
NamedArg(ephemera.Index, "*"),
NamedArg(ephemera.Index[Any, Any], "*"),
NamedArg(bodies.Annotations, "annotations"),
NamedArg(bodies.Labels, "labels"),
NamedArg(bodies.Body, "body"),
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ freezegun
import-linter
isort
lxml
mypy==1.5.1
mypy==1.8.0
pre-commit
pyngrok
pytest>=6.0.0
Expand Down
Loading