Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix container.partial for async methods (Sourcery refactored) #163

Merged
merged 1 commit into from
Aug 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions lagom/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,12 @@ def _infer_dependencies(
return {key: dep for (key, dep) in sub_deps.items() if dep is not None}

def _get_spec_without_self(self, func: Callable[..., X]) -> FunctionSpec:
if isinstance(func, FunctionType) or isinstance(func, MethodType):
spec = self._reflector.get_function_spec(func)
else:
t = cast(Type[X], func)
spec = self._reflector.get_function_spec(t.__init__).without_argument(
if isinstance(func, (FunctionType, MethodType)):
return self._reflector.get_function_spec(func)
t = cast(Type[X], func)
return self._reflector.get_function_spec(t.__init__).without_argument(
"self"
)
return spec
Comment on lines -413 to -420
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _get_spec_without_self refactored with the following changes:



class ExplicitContainer(Container):
Expand Down