(filepath: str)
return match.groups()[0]
valid migrations:
        0001_initial.py
        0014_auto_20200323_0159.py
        0023_account_limit_billing_access_to_owners.py
    invalid migrations:
        __init__.py

    For a valid migration 0001_initial.py, return 0001_initial.
valid migrations:
        0001_initial.py
        0014_auto_20200323_0159.py
        0023_account_limit_billing_access_to_owners.py
    invalid migrations:
        __init__.py
valid migrations : 0001_initial . py 0014_auto_20200323_0159 . py 0023_account_limit_billing_access_to_owners . py invalid migrations : __init__ . py
def get_migration_id(filepath: str) -> Optional[str]:
    """
    valid migrations:
        0001_initial.py
        0014_auto_20200323_0159.py
        0023_account_limit_billing_access_to_owners.py
    invalid migrations:
        __init__.py

    For a valid migration 0001_initial.py, return 0001_initial.
    """
    filename = Path(filepath).name
    match = MIGRATION_REGEX.match(filename)
    if match is None:
        return None
    return match.groups()[0]
def get_migration_id ( filepath : str ) -> Optional [ str ] : filename = Path ( filepath ) . name match = MIGRATION_REGEX . match ( filename ) if match is None : return None return match . groups ( ) [ 0 ]