Skip to content

Commit

Permalink
add has_default method
Browse files Browse the repository at this point in the history
  • Loading branch information
zunda-arrow committed Sep 8, 2022
1 parent 655e1cf commit 8fc2dd7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sigparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class Parameter:
default: typing.Any
kind: inspect._ParameterKind

def has_default(self) -> bool:
"""
Return `True` if this argument has a default value.
"""
return not self.default is inspect._empty


def _convert_signiture(
param: inspect.Parameter, type_hints: dict[str, type[typing.Any]]
Expand Down

0 comments on commit 8fc2dd7

Please sign in to comment.