feat(utils.py): add function extract_inner_type to extract the inner type from a type hint that is a list

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-22 16:11:47 -03:00
commit 1dbe776e6a

View file

@ -0,0 +1,10 @@
import re
def extract_inner_type(return_type: str) -> str:
"""
Extracts the inner type from a type hint that is a list.
"""
if match := re.match(r"list\[(.*)\]", return_type, re.IGNORECASE):
return match[1]
return return_type