Skip to content

Commit

Permalink
Adds load_from decorator to docs/improves docuemntation
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahbenizzy committed Apr 3, 2023
1 parent d911f88 commit aa8ba68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/reference/api-reference/decorators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ Actual decorators:
------------------------
.. autoclass:: hamilton.function_modifiers.resolve
:special-members: __init__

@load_from
------------------------
.. autoclass:: hamilton.function_modifiers.load_from
:special-members: __init__
6 changes: 3 additions & 3 deletions hamilton/function_modifiers/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ def raw_data(data: dict, valid_keys: List[str]) -> dict:
default_data_loaders. They implement the classmethod `name`. Once they are registered with the
central registry they pick
2. Every data loader class (which are all dataclasses) implements the `applies_to` method,
which takes a type and returns True if it can load data of that type. For example,
the JSONLoader class can load data of type `dict`. Note that the applies_to is read in
2. Every data loader class (which are all dataclasses) implements the `load_targets` method,
which returns a list of types it can load to. For example, the JSONLoader class can load data
of type `dict`. Note that the set of potential loading candidate classes are evaluated in
reverse order, so the most recently registered loader class is the one that is used. That
way, you can register custom ones.
Expand Down

0 comments on commit aa8ba68

Please sign in to comment.