Skip to content

Commit

Permalink
Add @my_context.consumer decorator.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelme committed Aug 18, 2024
1 parent 54d64bb commit a54c3d5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions htpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def provide(self, value: T, children_func: Callable[[], Node]) -> ContextProvide
def use(self, children_func: Callable[[T], Node]) -> ContextUse[T]:
return ContextUse(self, children_func)

def consumer(self, func: Callable[[T], Node]) -> Callable[[], Node]:
return lambda: ContextUse(self, func)


ContextDict: t.TypeAlias = dict[t.Any, t.Any]

Expand Down

0 comments on commit a54c3d5

Please sign in to comment.