montreal_forced_aligner/abc.py
def parse_args(cls, args: Optional[Namespace], unknown_args: Optional[List[str]]) -> MetaDict:
        """
        Class method for parsing configuration parameters from command line arguments

        Parameters
        ----------
        args: :class:`~argparse.Namespace`
            Arguments parsed by argparse
        unknown_args: list[str]
            Optional list of arguments that were not parsed by argparse

        Returns
        -------
        dict[str, Any]
            Dictionary of specified configuration parameters
        """
        param_types = cls.get_configuration_parameters()
        params = {}
        unknown_dict = {}
        if unknown_args:
            for i, a in enumerate(unknown_args):
                if not a.startswith("--"):
                    continue
                name = a.replace("--", "")
                if name not in param_types:
                    continue
                if i == len(unknown_args) - 1 or unknown_args[i + 1].startswith("--"):
                    val = True
                else:
                    val = unknown_args[i + 1]
                unknown_dict[name] = val
        for name, param_type in param_types.items():
            if name.endswith("_directory") or name.endswith("_path"):
                continue
            if args is not None and hasattr(args, name):
                params[name] = param_type(getattr(args, name))
            elif name in unknown_dict:
                params[name] = param_type(unknown_dict[name])
                if param_type == bool:
                    if unknown_dict[name].lower() == "false":
                        params[name] = False
        if getattr(args, "disable_mp", False):
            params["use_mp"] = False
        elif getattr(args, "disable_textgrid_cleanup", False):
            params["cleanup_textgrids"] = False
        return params

        Class method for parsing configuration parameters from command line arguments

        Parameters
        ----------
        args: :class:`~argparse.Namespace`
            Arguments parsed by argparse
        unknown_args: list[str]
            Optional list of arguments that were not parsed by argparse

        Returns
        -------
        dict[str, Any]
            Dictionary of specified configuration parameters
        
Class method for parsing configuration parameters from command line arguments
Parameters

:class:`~argparse.Namespace`
Arguments parsed by argparse
unknown_args: list[str]
Optional list of arguments that were not parsed by argparse

Returns

dict[str, Any]
Dictionary of specified configuration parameters
Class method for parsing configuration parameters from command line arguments Parameters : class : ` ~argparse . Namespace ` Arguments parsed by argparse unknown_args : list [ str ] Optional list of arguments that were not parsed by argparse Returns dict [ str Any ] Dictionary of specified configuration parameters
def parse_args(cls, args: Optional[Namespace], unknown_args: Optional[List[str]]) -> MetaDict:
        param_types = cls.get_configuration_parameters()
        params = {}
        unknown_dict = {}
        if unknown_args:
            for i, a in enumerate(unknown_args):
                if not a.startswith("--"):
                    continue
                name = a.replace("--", "")
                if name not in param_types:
                    continue
                if i == len(unknown_args) - 1 or unknown_args[i + 1].startswith("--"):
                    val = True
                else:
                    val = unknown_args[i + 1]
                unknown_dict[name] = val
        for name, param_type in param_types.items():
            if name.endswith("_directory") or name.endswith("_path"):
                continue
            if args is not None and hasattr(args, name):
                params[name] = param_type(getattr(args, name))
            elif name in unknown_dict:
                params[name] = param_type(unknown_dict[name])
                if param_type == bool:
                    if unknown_dict[name].lower() == "false":
                        params[name] = False
        if getattr(args, "disable_mp", False):
            params["use_mp"] = False
        elif getattr(args, "disable_textgrid_cleanup", False):
            params["cleanup_textgrids"] = False
        return params
def parse_args ( cls , args : Optional [ Namespace ] , unknown_args : Optional [ List [ str ] ] ) -> MetaDict : param_types = cls . get_configuration_parameters ( ) params = { } unknown_dict = { } if unknown_args : for i , a in enumerate ( unknown_args ) : if not a . startswith ( "--" ) : continue name = a . replace ( "--" , "" ) if name not in param_types : continue if i == len ( unknown_args ) - 1 or unknown_args [ i + 1 ] . startswith ( "--" ) : val = True else : val = unknown_args [ i + 1 ] unknown_dict [ name ] = val for name , param_type in param_types . items ( ) : if name . endswith ( "_directory" ) or name . endswith ( "_path" ) : continue if args is not None and hasattr ( args , name ) : params [ name ] = param_type ( getattr ( args , name ) ) elif name in unknown_dict : params [ name ] = param_type ( unknown_dict [ name ] ) if param_type == bool : if unknown_dict [ name ] . lower ( ) == "false" : params [ name ] = False if getattr ( args , "disable_mp" , False ) : params [ "use_mp" ] = False elif getattr ( args , "disable_textgrid_cleanup" , False ) : params [ "cleanup_textgrids" ] = False return params
Class method for parsing configuration parameters from command line arguments
Parameters
Class method for parsing configuration parameters from command line arguments Parameters
"""
        Class method for parsing configuration parameters from command line arguments

        Parameters
        ----------
        args: :class:`~argparse.Namespace`
            Arguments parsed by argparse
        unknown_args: list[str]
            Optional list of arguments that were not parsed by argparse

        Returns
        -------
        dict[str, Any]
            Dictionary of specified configuration parameters
        """
cls
args
Optional[Namespace]
unknown_args
Optional[List[str]]