second-ed / class_inspector

Code that writes code
https://pypi.org/project/class-inspector/
MIT License
2 stars 0 forks source link

read signatures with aliases #7

Open second-ed opened 3 months ago

second-ed commented 3 months ago

eg:

ValueError: sig not in function str: def read_data(filepath: str) -> pandas.core.frame.DataFrame:
 def read_data(filepath: str) -> pd.DataFrame:

this has interpreted pd.DataFrame as pandas.core.frame.DataFrame, need a way to account for these long names and the aliases the user might've assigned

location:

# function_inspector
     [88] if sig not in func_str:
---> [89]     raise ValueError(f"sig not in function str: {sig} {func_str}")
second-ed commented 2 months ago

there isn't a way to read in the aliases without reading in the whole file that the function is in to get the imports. toying with the idea of splitting type hints and return annots on "." to capture DataFrame in each, it's not as accurate but it would avoid this issue