Skip to content

Commit

Permalink
Fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
khud committed Dec 31, 2020
1 parent c5ed07c commit cb0efc1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions typedparse/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ def create(obj: ty.Any) -> ParserSpec:

def _is_optional(tpe: str) -> (bool, ty.Optional[str]):
result = re.search(r"typing.Union\[(.+), NoneType]", tpe)

if not result:
result = re.search(r"typing.Optional\[(.+)]", tpe)

return (True, result.group(1)) if result else (False, None)


Expand Down

0 comments on commit cb0efc1

Please sign in to comment.