xp1632 / VPE_IP

0 stars 0 forks source link

Pipeline Feasibility for Python Library: Kornia #83

Open xp1632 opened 1 month ago

xp1632 commented 1 month ago
xp1632 commented 1 month ago

Where to get parameter information for a python method:



when checking the source code for kornia method: morphology.dilation: https://github.com/kornia/kornia/blob/main/kornia/morphology/morphology.py

image

xp1632 commented 1 month ago

Then we just iterate over the Kornia Library via inspect

import kornia
import inspect

# Iterate over the attributes of the kornia module
for name, obj in inspect.getmembers(kornia):
    # Check if the attribute is a function
    if inspect.isfunction(obj):
        print(f"Function name: {name}")

        # Get the function's signature
        sig = inspect.signature(obj)

        # Iterate over the parameters of the function
        for param_name, param in sig.parameters.items():
            print(f"  Parameter: {param_name}")

            # Check if the parameter has a type annotation
            if param.annotation is not param.empty:
                print(f"    Type: {param.annotation}")
            else:
                print(f"    Type: Unknown")