def __get(name, stype, **kwargs):
    """

    Parameters
    ----------
    name: str

    stype: str

    kwargs:
    - style_url: str

    - stylelib_url: str

    - stylelib_format: str

    - ignore_cache: bool

    Raises
    ------
    IOError:
    HTTPError:
    URLError:
    JSONDecodeError:
    """
    folder    = kwargs.get('stylelib_url', CONFIG['stylelib_url'])
    file_path = kwargs.get('stylelib_format', CONFIG['stylelib_format'])
    style_url = kwargs.get('style_url', folder+file_path).format(stype=stype, name=name)

    if not kwargs.get('ignore_cache', False) and CACHE.is_cached(stype, name):
        logger.debug('loading {} file from cache'.format(stype))
        with open(CACHE.file_path(stype=stype, name=name), 'r') as f:
            content = remove_comments(f.read())
    else:
        try:
            logger.debug('trying to urlopen file: {}'.format(style_url))
            with urlopen(style_url) as f:
                # get file content from specified url
                content = remove_comments(f.read().decode())
            logger.debug('loaded raw {} file from URL'.format(stype))
            CACHE.add(stype, name, content)
        except ValueError as e:  # style_url is not a valid url
            logger.debug('urlopen failed: {}'.format(str(e)))
            logger.debug('trying to (regular) open file')
            try:
                with open(style_url) as f:
                    # get file content from file path instead
                    content = remove_comments(f.read())
                logger.debug('loaded file from local disk'.format(stype))
            except IOError:
                raise
        except HTTPError as e:
            raise
        except URLError as e:
            logger.debug('urlopen failed: {}'.format(str(e)))
            raise

    try:
        logger.debug('converting file content to Python dict')
        # convert file content to python dict
        return json.loads(content)
    except json.JSONDecodeError as e:
        logger.debug('json.loads failed: {}'.format(str(e)))
        raise
def __get ( name , stype , ** kwargs ) : folder = kwargs . get ( 'stylelib_url' , CONFIG [ 'stylelib_url' ] ) file_path = kwargs . get ( 'stylelib_format' , CONFIG [ 'stylelib_format' ] ) style_url = kwargs . get ( 'style_url' , folder + file_path ) . format ( stype = stype , name = name ) if not kwargs . get ( 'ignore_cache' , False ) and CACHE . is_cached ( stype , name ) : logger . debug ( 'loading {} file from cache' . format ( stype ) ) with open ( CACHE . file_path ( stype = stype , name = name ) , 'r' ) as f : content = remove_comments ( f . read ( ) ) else : try : logger . debug ( 'trying to urlopen file: {}' . format ( style_url ) ) with urlopen ( style_url ) as f : content = remove_comments ( f . read ( ) . decode ( ) ) logger . debug ( 'loaded raw {} file from URL' . format ( stype ) ) CACHE . add ( stype , name , content ) except ValueError as e : logger . debug ( 'urlopen failed: {}' . format ( str ( e ) ) ) logger . debug ( 'trying to (regular) open file' ) try : with open ( style_url ) as f : content = remove_comments ( f . read ( ) ) logger . debug ( 'loaded file from local disk' . format ( stype ) ) except IOError : raise except HTTPError as e : raise except URLError as e : logger . debug ( 'urlopen failed: {}' . format ( str ( e ) ) ) raise try : logger . debug ( 'converting file content to Python dict' ) return json . loads ( content ) except json . JSONDecodeError as e : logger . debug ( 'json.loads failed: {}' . format ( str ( e ) ) ) raise
Parameters
    ----------
    name: str

    stype: str

    kwargs:
    - style_url: str

    - stylelib_url: str

    - stylelib_format: str

    - ignore_cache: bool

    Raises
    ------
    IOError:
    HTTPError:
    URLError:
    JSONDecodeError: