Skip to content

Commit

Permalink
Callable[[Any] -> Callable[...
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinugu committed Dec 9, 2024
1 parent 73efb7d commit 3a4dfbc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/omnipy/api/protocols/public/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class IsTarFileSerializer(IsSerializer, Protocol):
@classmethod
def create_tarfile_from_dataset(cls,
dataset: IsDataset,
data_encode_func: Callable[[Any], bytes | memoryview]) -> bytes:
data_encode_func: Callable[..., bytes | memoryview]) -> bytes:
""""""
...

Expand Down
2 changes: 1 addition & 1 deletion src/omnipy/data/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TarFileSerializer(Serializer):
@classmethod
def create_tarfile_from_dataset(cls,
dataset: IsDataset,
data_encode_func: Callable[[Any], bytes | memoryview]) -> bytes:
data_encode_func: Callable[..., bytes | memoryview]) -> bytes:
bytes_io = BytesIO()
with tarfile.open(fileobj=bytes_io, mode='w:gz') as tarfile_stream:
for data_file, data in dataset.items(): # type: ignore[attr-defined]
Expand Down
6 changes: 3 additions & 3 deletions src/omnipy/util/publisher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Any, Callable, DefaultDict
from typing import Callable, DefaultDict

from omnipy.api.protocols.public.hub import IsRuntime

Expand All @@ -11,9 +11,9 @@ def _subscribers_factory():

@dataclass
class DataPublisher:
_self_subscriptions: list[Callable[[Any], None]] = field(
_self_subscriptions: list[Callable[..., None]] = field(
default_factory=list, init=False, repr=False)
_attr_subscriptions: DefaultDict[str, list[Callable[[Any], None]]] = \
_attr_subscriptions: DefaultDict[str, list[Callable[..., None]]] = \
field(default_factory=_subscribers_factory, init=False, repr=False)

def subscribe_attr(self, attr_name: str, callback_fun: Callable[..., None]):
Expand Down
4 changes: 2 additions & 2 deletions tests/compute/cases/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class FlowCase(Generic[CallP, RetT]):
flow_template: IsLinearFlowTemplate | IsDagFlowTemplate | IsFuncFlowTemplate
args: tuple[Any, ...]
kwargs: dict[str, Any]
assert_results_func: Callable[[Any], None]
# assert_signature_and_return_type_func: Callable[[Any], None]
assert_results_func: Callable[..., None]
# assert_signature_and_return_type_func: Callable[..., None]


# TODO: Add assert_signature_and_return_type_func
Expand Down
4 changes: 2 additions & 2 deletions tests/compute/cases/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class TaskCase(Generic[CallP, RetT]):
task_func: Callable[CallP, RetT]
args: tuple[Any, ...]
kwargs: dict[str, Any]
assert_results_func: Callable[[Any], None]
assert_signature_and_return_type_func: Callable[[Any], None]
assert_results_func: Callable[..., None]
assert_signature_and_return_type_func: Callable[..., None]


@pc.case(
Expand Down
2 changes: 1 addition & 1 deletion tests/data/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ def test_weakly_referenced_snapshot_deepcopy_memo_entry(
class ModelCase:
new_model_func: Callable[[], Model]
deepcopy_memo_count: int
contents_modify_func: Callable[[Any], None]
contents_modify_func: Callable[..., None]
target_contents: Any


Expand Down
2 changes: 1 addition & 1 deletion tests/engine/helpers/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class JobType(Enum):
class JobCase(Generic[ArgT, ReturnT]):
name: str
job_func: Callable[[ArgT], ReturnT]
run_and_assert_results_func: Callable[[Any], None] | Awaitable[Callable[[Any], None]]
run_and_assert_results_func: Callable[..., None] | Awaitable[Callable[..., None]]
job_type: JobType | None = None
job: IsJob | None = None

Expand Down

0 comments on commit 3a4dfbc

Please sign in to comment.