✨ 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:
parent
39ae660e45
commit
1dbe776e6a
1 changed files with 10 additions and 0 deletions
10
src/backend/langflow/interface/custom/utils.py
Normal file
10
src/backend/langflow/interface/custom/utils.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue