lib/util/fs.py
def load_json_file(path, encoding='utf-8'):
    '''
    Returns a `dict` generated by reading the file at `path`, and then parsing
    it as JSON. This will throw if the file does not exist, cannot be read, or
    cannot be parsed as JSON.
    The `encoding` parameter is used when initially reading the file.
    '''
    if not isinstance(path, str):
        raise TypeError('path must be a str: %r' % (path))
    if not isinstance(encoding, str):
        raise TypeError('encoding must be a str: %r' % (encoding))

    path = resolve_env(path)
    if not is_file(path):
        logger.warning('path does not seem to refer to a valid file: %s', path)
        # but fall through and try anyway

    logger.debug(
        'attempting to parse file with path, encoding: %s, %s', path, encoding,
    )
    with open(path, encoding=encoding) as file_handle:
        file_data = json.load(file_handle)

    logger.debug('successfully parsed json file')
    return file_data

    Returns a `dict` generated by reading the file at `path`, and then parsing
    it as JSON. This will throw if the file does not exist, cannot be read, or
    cannot be parsed as JSON.
    The `encoding` parameter is used when initially reading the file.
    
Returns a `dict` generated by reading the file at `path`, and then parsing
it as JSON. This will throw if the file does not exist, cannot be read, or
cannot be parsed as JSON.
The `encoding` parameter is used when initially reading the file.
Returns a ` dict ` generated by reading the file at ` path ` and then parsing it as JSON . This will throw if the file does not exist cannot be read or cannot be parsed as JSON . The ` encoding ` parameter is used when initially reading the file .
def load_json_file(path, encoding='utf-8'):
    if not isinstance(path, str):
        raise TypeError('path must be a str: %r' % (path))
    if not isinstance(encoding, str):
        raise TypeError('encoding must be a str: %r' % (encoding))
    path = resolve_env(path)
    if not is_file(path):
        logger.warning('path does not seem to refer to a valid file: %s', path)
    logger.debug(
        'attempting to parse file with path, encoding: %s, %s', path, encoding,
    )
    with open(path, encoding=encoding) as file_handle:
        file_data = json.load(file_handle)
    logger.debug('successfully parsed json file')
    return file_data
def load_json_file ( path , encoding = 'utf-8' ) : if not isinstance ( path , str ) : raise TypeError ( 'path must be a str: %r' % ( path ) ) if not isinstance ( encoding , str ) : raise TypeError ( 'encoding must be a str: %r' % ( encoding ) ) path = resolve_env ( path ) if not is_file ( path ) : logger . warning ( 'path does not seem to refer to a valid file: %s' , path ) logger . debug ( 'attempting to parse file with path, encoding: %s, %s' , path , encoding , ) with open ( path , encoding = encoding ) as file_handle : file_data = json . load ( file_handle ) logger . debug ( 'successfully parsed json file' ) return file_data
Returns a `dict` generated by reading the file at `path`, and then parsing
it as JSON.
Returns a ` dict ` generated by reading the file at ` path ` and then parsing it as JSON .
'''
    Returns a `dict` generated by reading the file at `path`, and then parsing
    it as JSON. This will throw if the file does not exist, cannot be read, or
    cannot be parsed as JSON.
    The `encoding` parameter is used when initially reading the file.
    ''' # but fall through and try anyway
path
encoding