Module Expr Str Import alias alias alias ImportFrom alias FunctionDef arguments args NameParam defaults body Expr Str If CompareIsNot Call NameLoad NameLoad NameLoad body If Call AttributeLoad NameLoad attr NameLoad body Assign NameStore NameLoad orelse Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad If CompareEq NameLoad Str body Assign NameStore ListLoad Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Num Call AttributeLoad NameLoad attr For NameStore NameLoad body If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore NameLoad Break orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Expr Str Assign NameStore Num Assign NameStore NameLoad While CompareIn NameLoad NameLoad body Assign NameStore BinOpAdd BinOpAdd NameLoad NameLoad Call NameLoad NameLoad AugAssignAdd NameStore Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str TryExcept body ImportFrom alias alias alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return NameLoad orelse Raise orelse Return Call NameLoad NameLoad NameLoad handlers ExceptHandler body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body If NameLoad body Return NameLoad orelse Return Call NameLoad NameLoad Str If CompareIs NameLoad NameLoad body Return If NameLoad body Return Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad TryExcept body Return Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Str handlers ExceptHandler body Return decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad If CompareIs NameLoad NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list
N/A N/A  Utility functions for managing and finding resources (ie. images/files etc).

    get_path :           Returns the absolute path of a class or instance

    create_unique_name : Creates a name with a given prefix that is not in a
                         given list of existing names. The separator between the
                         prefix and the rest of the name can also be specified
                         (default is a '_')

    find_resource:       Given a setuptools project specification string
                         ('MyProject>=2.1') and a partial path leading from the
                         projects base directory to the desired resource, will
                         return either an opened file object or, if specified, a
                         full path to the resource.
 N/A inspect os sys distutils.sysconfig get_python_lib get_path N/A N/A path N/A N/A N/A  Returns an absolute path for the specified path.

    'path' can be a string, class or instance.

     N/A N/A N/A type path str N/A N/A N/A N/A inspect isclass path N/A N/A klass path N/A N/A klass N/A path __class__ N/A module_name N/A klass __module__ N/A module N/A N/A sys modules N/A module_name N/A N/A module_name __main__ N/A N/A dirs N/A N/A N/A N/A os path dirname N/A N/A sys argv N/A 0 N/A N/A os getcwd N/A d dirs N/A N/A N/A N/A N/A os path exists d N/A N/A path d N/A N/A N/A path N/A N/A N/A os path dirname N/A module __file__ N/A path N/A create_unique_name N/A N/A prefix names separator N/A _ N/A N/A  Creates a name starting with 'prefix' that is not in 'names'.  N/A i 1 N/A name prefix N/A N/A name names N/A N/A name N/A N/A prefix separator N/A str i N/A i 1 N/A name N/A find_resource N/A N/A project resource_path alt_path return_path N/A None False N/A N/A  Returns a file object or file path pointing to the desired resource.

    Parameters
    ----------
    project : str
        The name of the project to look for the resource in. Can be the name or
        a requirement string. Ex: 'MyProject', 'MyProject>1.0', 'MyProject==1.1'
    resource_path : str
        The path to the file from inside the package. If the file desired is
        MyProject/data/image.jpg, resource_path would be 'data/image.jpg'.
    alt_path : str
        The path to the resource relative to the location of the application's
        top-level script (the one with __main__). If this function is called in
        code/scripts/myscript.py and the resource is code/data/image.jpg, the
        alt_path would be '../data/image.jpg'. This path is only used if the
        resource cannot be found using setuptools.
    return_path : bool
        Determines whether the function should return a file object or a full
        path to the resource.

    Returns
    -------
    file : file object or file path
        A file object containing the resource. If return_path is True, 'file'
        will be the full path to the resource. If the file is not found or
        cannot be opened, None is returned.

    Description
    -----------
    This function will find a desired resource file and return an opened file
    object. The main method of finding the resource uses the pkg_resources
    resource_stream method, which searches your working set for the installed
    project specified and appends the resource_path given to the project
    path, leading it to the file. If setuptools is not installed or it cannot
    find/open the resource, find_resource will use the sys.path[0] to find the
    resource if alt_path is defined.
     N/A N/A pkg_resources resource_stream working_set Requirement N/A requirement N/A N/A Requirement parse project N/A return_path N/A N/A dist N/A N/A working_set find requirement N/A full_path N/A N/A N/A os path join N/A dist location resource_path N/A N/A N/A N/A os path exists full_path N/A N/A full_path N/A N/A N/A N/A N/A resource_stream requirement resource_path N/A N/A N/A N/A full_path N/A N/A N/A os path join N/A get_python_lib resource_path N/A N/A N/A N/A os path exists full_path N/A N/A return_path N/A N/A full_path N/A N/A N/A open full_path rb N/A N/A alt_path None N/A N/A N/A return_path N/A N/A N/A N/A N/A os path join N/A N/A sys path N/A 0 alt_path N/A N/A N/A N/A open N/A N/A N/A os path join N/A N/A sys path N/A 0 alt_path rb N/A N/A N/A N/A N/A store_resource N/A N/A project resource_path filename N/A N/A N/A  Store the content of a resource, given by the name of the project
        and the path (relative to the root of the project), into a newly
        created file.

        The first two arguments (project and resource_path) are the same
        as for the function find_resource in this module.  The third
        argument (filename) is the name of the file which will be created,
        or overwritten if it already exists.
        The return value in always None.
     N/A fi N/A find_resource project resource_path N/A N/A fi None N/A N/A N/A RuntimeError N/A Resource not found for project "%s": %s N/A project resource_path N/A fo N/A open filename wb N/A N/A N/A fo write N/A N/A fi read N/A N/A N/A fo close N/A N/A N/A fi close N/A