INNER CODE UNIT · Python

load_transforms

ALW1EZ/PANO · transforms/__init__.py:10

def load_transforms() -> None:
    """Dynamically load all transform classes from the transforms directory"""
    current_dir = os.path.dirname(__file__)
    
    # Clear existing transforms
    TRANSFORMS.clear()
    ENTITY_TRANSFORMS.clear()
    
    # Exclude these files from loading
    exclude_files = {'__init__.py', 'base.py'}
    
    # Keep track of loaded transform classes to prevent duplicates
    loaded_transform_classes = set()
    
    for filename in os.listdir(current_dir):
        if filename.endswith('.py') and filename not in exclude_files:
            module_name = filename[:-3]  # Remove .py extension
            module = importlib.import_module(f'.{module_name}', package='transforms')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…