pyaltt2/config.py
def choose_file(fname=None, env=None, choices=[]):
    """
    Chooise existing file

    Returned file path is user-expanded

    Args:
        fname: if specified, has top priority and others are not chechked
        env: if specified and set, has second-top priority and choices are not
            inspected
        choices: if env is not set or not specified, choose existing file from
            the list
    Raises:
        LookupError: if file doesn't exists
    """
    if fname:
        fname = os.path.expanduser(fname)
        if os.path.exists(fname):
            return fname
        else:
            raise LookupError(f'No such file {fname}')
    elif env and env in os.environ:
        fname = os.path.expanduser(os.environ[env])
        if os.path.exists(fname):
            return fname
        else:
            raise LookupError(f'No such file {env} = {fname}')
    else:
        ch = []
        for c in choices:
            fname = os.path.expanduser(str(c))
            if os.path.exists(fname):
                return fname
            else:
                ch.append(fname)
        raise LookupError('File not found (tried {}{})'.format(
            env + (', ' if choices else '') if env else '', ', '.join(ch)))

    Chooise existing file

    Returned file path is user-expanded

    Args:
        fname: if specified, has top priority and others are not chechked
        env: if specified and set, has second-top priority and choices are not
            inspected
        choices: if env is not set or not specified, choose existing file from
            the list
    Raises:
        LookupError: if file doesn't exists
    
Chooise existing file
Returned file path is user-expanded
Chooise existing file Returned file path is user - expanded
def choose_file(fname=None, env=None, choices=[]):
    if fname:
        fname = os.path.expanduser(fname)
        if os.path.exists(fname):
            return fname
        else:
            raise LookupError(f'No such file {fname}')
    elif env and env in os.environ:
        fname = os.path.expanduser(os.environ[env])
        if os.path.exists(fname):
            return fname
        else:
            raise LookupError(f'No such file {env} = {fname}')
    else:
        ch = []
        for c in choices:
            fname = os.path.expanduser(str(c))
            if os.path.exists(fname):
                return fname
            else:
                ch.append(fname)
        raise LookupError('File not found (tried {}{})'.format(
            env + (', ' if choices else '') if env else '', ', '.join(ch)))
def choose_file ( fname = None , env = None , choices = [ ] ) : if fname : fname = os . path . expanduser ( fname ) if os . path . exists ( fname ) : return fname else : raise LookupError ( f'No such file {fname}' ) elif env and env in os . environ : fname = os . path . expanduser ( os . environ [ env ] ) if os . path . exists ( fname ) : return fname else : raise LookupError ( f'No such file {env} = {fname}' ) else : ch = [ ] for c in choices : fname = os . path . expanduser ( str ( c ) ) if os . path . exists ( fname ) : return fname else : ch . append ( fname ) raise LookupError ( 'File not found (tried {}{})' . format ( env + ( ', ' if choices else '' ) if env else '' , ', ' . join ( ch ) ) )
Chooise existing file
Returned file path is user-expanded
Chooise existing file Returned file path is user - expanded
"""
    Chooise existing file

    Returned file path is user-expanded

    Args:
        fname: if specified, has top priority and others are not chechked
        env: if specified and set, has second-top priority and choices are not
            inspected
        choices: if env is not set or not specified, choose existing file from
            the list
    Raises:
        LookupError: if file doesn't exists
    """
if file doesn't exists
if file doesn ' t exists
LookupError
fname
if specified, has top priority and others are not chechked
if specified has top priority and others are not chechked
env
if specified and set, has second-top priority and choices are not
inspected
if specified and set has second - top priority and choices are not inspected
choices
if env is not set or not specified, choose existing file from
the list
if env is not set or not specified choose existing file from the list