Skip to content

Commit

Permalink
Fixes resolve decorator docs (#1270)
Browse files Browse the repository at this point in the history
* fixed ordered list in markdown and fixed error in `__init__` argument description
  • Loading branch information
MG-MW authored Jan 13, 2025
1 parent dc2ffce commit 7f4bc66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hamilton/function_modifiers/delayed.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ def summation(s1: pd.Series, s2: pd.Series) -> pd.Series:
return s1 + s2
Note how this works:
1. The `decorate_with` argument is a function that gives you the decorator you want to apply.
Currently its "hamilton-esque" -- while we do not require it to be typed, you can use a separate
configuration-reoslver function (and include type information). This lambda function must return
a decorator.
2. The `when` argument is the point at which you want to resolve the decorator. Currently, we
only support `ResolveAt.CONFIG_AVAILABLE`, which means that the decorator will be resolved at compile
time, E.G. when the driver is instantiated.
3. This is then run and dynamically resolved.
This is powerful, but the code is uglier. It's meant to be used in some very specific cases,
Expand All @@ -112,7 +115,7 @@ def __init__(self, *, when: ResolveAt, decorate_with: Callable[..., NodeTransfor
"""Initializes a delayed decorator that gets called at some specific resolution time.
:param decorate_with: Function that takes required and optional parameters/returns a decorator.
:param until: When to resolve the decorator. Currently only supports `ResolveAt.CONFIG_AVAILABLE`.
:param when: When to resolve the decorator. Currently only supports `ResolveAt.CONFIG_AVAILABLE`.
"""
if when != ResolveAt.CONFIG_AVAILABLE:
raise ValueError("Dynamic functions must be configured at config time!")
Expand Down

0 comments on commit 7f4bc66

Please sign in to comment.