Skip to content

Commit

Permalink
Upgrade MyPy to 1.8.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Vasilyev <[email protected]>
  • Loading branch information
nolar committed Jan 19, 2024
1 parent e68ef3b commit b75f561
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
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

0 comments on commit b75f561

Please sign in to comment.