Skip to content

Commit

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

Fix & bump

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

__version__ = '5.0.0'
__version__ = '5.0.1'
__author__ = "Alexey Stepanov"
__author_email__ = 'penguinolog@gmail.com'
__maintainers__ = {
Expand Down
6 changes: 3 additions & 3 deletions logwrap/_log_wrap.py
Expand Up @@ -133,7 +133,7 @@ def __str__(self) -> str:
as_str += ': {annotation!s}'.format(annotation=inspect.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 @@ -549,7 +549,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 @@ -568,7 +568,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
12 changes: 6 additions & 6 deletions logwrap/_repr_utils.py
Expand Up @@ -493,9 +493,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 @@ -509,7 +509,7 @@ def _repr_callable(
param_str += "\n" + " " * indent

sig = inspect.signature(src)
if sig.return_annotation == inspect.Parameter.empty:
if sig.return_annotation is inspect.Parameter.empty:
annotation = ''
else:
annotation = ' -> {sig.return_annotation!r}'.format(sig=sig)
Expand Down Expand Up @@ -666,9 +666,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 @@ -682,7 +682,7 @@ def _repr_callable(
param_str += "\n" + " " * indent

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

0 comments on commit 47fd1aa

Please sign in to comment.