Skip to content

Commit bb9ff37

Browse files
committed
allow periods in type hint
1 parent 840ac5b commit bb9ff37

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

parsers/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,10 @@ def parse_arguments(self, line):
563563
arguments = re.search(r'^\s*def\s+\w+\((.*)\)', line)
564564

565565
# Parse type hints
566-
hints = dict(re.findall(r'(\w+)\s*:\s*(\w+\[[^:]*\]|\w+)\s*', arguments.group(1)))
566+
hints = dict(re.findall(r'(\w+)\s*:\s*([\w\.]+\[[^:]*\]|[\w\.]+)\s*', arguments.group(1)))
567567

568568
# Remove type hints
569-
arguments = re.sub(r':\s*(\w+\[[^:]*\]|\w+)\s*', "", arguments.group(1))
569+
arguments = re.sub(r':\s*([\w\.]+\[[^:]*\]|[\w\.]+)\s*', "", arguments.group(1))
570570

571571
if not arguments:
572572
return None
@@ -602,7 +602,7 @@ def parse_returns(self, contents):
602602
if len(match) == 0:
603603
return None
604604

605-
hint = re.search(r'^\s*def\s+\w+\(.*\)\s*->\s*(\w+\[[^:]*\]|\w+)\s*:', contents)
605+
hint = re.search(r'^\s*def\s+\w+\(.*\)\s*->\s*([\w\.]+\[[^:]*\]|[\w\.]+)\s*:', contents)
606606
if hint:
607607
hint = hint.group(1)
608608

0 commit comments

Comments
 (0)