Skip to content

Commit

Permalink
Tmp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinugu committed Apr 4, 2023
1 parent 69f7603 commit bf7fdbe
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/omnipy/compute/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,38 @@ def a(a: int) -> int:
#
# TaskTemplate = get_task_template()


class ListDoubler(Generic[C]):
def __init__(self, l: list[C]) -> None:
self._l = list

def get_double_l(self) -> list[C]:
return self._l + self._l


reveal_type(ListDoubler)
reveal_type(TaskTemplateInner)


class IsPrintingListDoubler(Protocol[C]):
def get_double_l(self):
...

def print(self):
...


def add_print(cls: Type[ListDoubler[C]]) -> IsPrintingListDoubler[C]:
def _inner():
print(cls.get_double_l())

cls.print = _inner
return cast(IsPrintingListDoubler[C], cls)


P = add_print(ListDoubler)
reveal_type(P)

TaskTemplate = task_template_callable_decorator_cls(TaskTemplateInner)
reveal_type(TaskTemplate)

Expand Down
10 changes: 10 additions & 0 deletions src/omnipy/modules/fairtracks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ def import_dataset_from_encode(endpoints: Iterable[constr(min_length=1)],
format='json',
)
return dataset


def a(a: int) -> int:
return a + 2


tttts = TaskTemplate()(a)
reveal_type(tttts)
b = tttts.run(a=2)
reveal_type(b)

0 comments on commit bf7fdbe

Please sign in to comment.