Skip to content

Commit

Permalink
Update wraps
Browse files Browse the repository at this point in the history
  • Loading branch information
kmagusiak committed Dec 19, 2023
1 parent fbeb4e0 commit 417d962
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions alphaconf/inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __call__(self, *a, **kw):
def wrap(func) -> "ParamDefaultsFunction":
if isinstance(func, ParamDefaultsFunction):
return func
return functools.wraps(func)(ParamDefaultsFunction(func))
return ParamDefaultsFunction(func)


def getter(
Expand Down Expand Up @@ -71,7 +71,7 @@ def do_inject(func):
else:
b = factory
f.bind(name, b)
return f
return functools.wraps(func)(f)

return do_inject

Expand All @@ -87,6 +87,6 @@ def do_inject(func):
if name in ignore:
continue
f.bind(name, getter(prefix + name, param=param))
return f
return functools.wraps(func)(f)

return do_inject
2 changes: 1 addition & 1 deletion alphaconf/internal/type_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def convert_to_type(value, type):

def type_from_annotation(annotation) -> typing.Generator[type, None, None]:
"""Given an annotation (optional), figure out the types"""
if isinstance(annotation, type) and annotation is not type(None):
if isinstance(annotation, type) and issubclass(annotation, type(None)):
yield annotation
else:
for t in typing.get_args(annotation):
Expand Down

0 comments on commit 417d962

Please sign in to comment.