Skip to content

Commit

Permalink
inspect.param.empty is a class and can be used as singleton. Related #35
Browse files Browse the repository at this point in the history
 (#36)

Fix legacy

Signed-off-by: Alexey Stepanov <penguinolog@gmail.com>
  • Loading branch information
penguinolog committed Aug 14, 2018
1 parent 9830f3e commit 73815bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion logwrap/__init__.py
Expand Up @@ -56,7 +56,7 @@
'bind_args_kwargs'
)

__version__ = '4.0.1'
__version__ = '4.0.2'
__author__ = "Alexey Stepanov"
__author_email__ = 'penguinolog@gmail.com'
__maintainers__ = {
Expand Down
6 changes: 3 additions & 3 deletions logwrap/_log_wrap_shared.py
Expand Up @@ -170,7 +170,7 @@ def __str__(self):
as_str += ': {annotation!s}'.format(annotation=formatannotation(self.annotation))

value = self.value
if self.empty == value:
if self.empty is value:
if self.VAR_POSITIONAL == self.kind:
value = ()
elif self.VAR_KEYWORD == self.kind:
Expand Down Expand Up @@ -551,7 +551,7 @@ def _get_func_args_repr(
else:
value = param.value

if param.empty == value:
if param.empty is value:
if param.VAR_POSITIONAL == param.kind:
value = ()
elif param.VAR_KEYWORD == param.kind:
Expand All @@ -570,7 +570,7 @@ def _get_func_args_repr(
param_str += comment(kind=param.kind)
last_kind = param.kind

if param.empty == param.annotation:
if param.empty is param.annotation:
annotation = ""
else:
annotation = " # type: {param.annotation!s}".format(param=param)
Expand Down
8 changes: 4 additions & 4 deletions logwrap/_repr_utils.py
Expand Up @@ -532,9 +532,9 @@ def _repr_callable(
indent=self.next_indent(indent),
param=param
)
if param.annotation != param.empty:
if param.annotation is not param.empty:
param_str += ': {param.annotation}'.format(param=param)
if param.value != param.empty:
if param.value is not param.empty:
param_str += '={val}'.format(
val=self.process_element(
src=param.value,
Expand All @@ -548,7 +548,7 @@ def _repr_callable(
param_str += "\n" + " " * indent

sig = signature(src)
annotation = '' if sig.return_annotation == Parameter.empty else ' -> {sig.return_annotation!r}'.format(sig=sig)
annotation = '' if sig.return_annotation is Parameter.empty else ' -> {sig.return_annotation!r}'.format(sig=sig)

return "\n{spc:<{indent}}<{obj!r} with interface ({args}){annotation}>".format(
spc="",
Expand Down Expand Up @@ -724,7 +724,7 @@ def _repr_callable(
param_str += "\n" + " " * indent

sig = signature(src)
annotation = '' if sig.return_annotation == Parameter.empty else ' -> {sig.return_annotation!r}'.format(sig=sig)
annotation = '' if sig.return_annotation is Parameter.empty else ' -> {sig.return_annotation!r}'.format(sig=sig)

return "\n{spc:<{indent}}<{obj!s} with interface ({args}){annotation}>".format(
spc="",
Expand Down

0 comments on commit 73815bd

Please sign in to comment.