Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
Can't have `__wrapped__` be a property, since some tools check for the
presence of `__wrapped__` on all objects, and a property would define
that attribute on the class.
  • Loading branch information
jcrist committed Jun 1, 2020
1 parent 54641d4 commit ffbe022
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/prefect/tasks/core/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def __get__(self, obj, cls):

class FunctionTask(prefect.Task):
__doc__ = _DocProxy(
"""
A convenience Task for functionally creating Task instances with
"""A convenience Task for functionally creating Task instances with
arbitrary callable `run` methods.
Args:
Expand Down Expand Up @@ -63,7 +62,7 @@ def __init__(self, fn: Callable, name: str = None, **kwargs: Any):

super().__init__(name=name, **kwargs)

@property
def __wrapped__(self):
"""Propogates information about the wrapped function"""
return self.run
def __getattr__(self, k):
if k == "__wrapped__":
return self.run
raise AttributeError(f"'FunctionTask' object has no attribute {k}")
1 change: 1 addition & 0 deletions tests/tasks/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def my_fn():

t = FunctionTask(fn=my_fn)
assert t.__wrapped__ == my_fn
assert not hasattr(FunctionTask, "__wrapped__")


class TestCollections:
Expand Down

0 comments on commit ffbe022

Please sign in to comment.