o
    OZhu	                     @   sb   d Z dgZddlZddlZz
ddlmZmZ W n ey(   dd Zdd ZY nw efd	dZ	dS )
ab  
pkgdata is a simple, extensible way for a package to acquire data file
resources.

The getResource function is equivalent to the standard idioms, such as
the following minimal implementation:

    import sys, os

    def getResource(identifier, pkgname=__name__):
        pkgpath = os.path.dirname(sys.modules[pkgname].__file__)
        path = os.path.join(pkgpath, identifier)
        return file(os.path.normpath(path), mode='rb')

When a __loader__ is present on the module given by __name__, it will defer
getResource to its get_data implementation and return it as a file-like
object (such as StringIO).
getResource    N)resource_streamresource_existsc                 C   s   dS )zi
        A stub for when we fail to import this function.

        :return: Always returns False
        F )Z_package_or_requirement_resource_namer   r   =/var/www/auris/lib/python3.10/site-packages/pygame/pkgdata.pyr         r   c                 C   s   t )z|
        A stub for when we fail to import this function.

        Always raises a NotImplementedError when called.
        )NotImplementedError)Z_package_of_requirementr   r   r   r   r   $   r   r   c                 C   s   zt || rt|| W S W n	 ty   Y nw tj| }t|dd}|du r/tt| dtj	
tj	|| }ttj	|dS )a<  
    Acquire a readable object for a given package name and identifier.
    An IOError will be raised if the resource can not be found.

    For example:
        mydata = getResource('mypkgdata.jpg').read()

    Note that the package name must be fully qualified, if given, such
    that it would be found in sys.modules.

    In some cases, getResource will return a real file object.  In that
    case, it may be useful to use its name attribute to get the path
    rather than use it as a file-like object.  For example, you may
    be handing data off to a C API.
    __file__Nz has no __file__!rb)r   r   r	   sysmodulesgetattrOSErrorreprospathjoindirnameopennormpath)
identifierZpkgnamemodZpath_to_filer   r   r   r   r   -   s   

)
__doc____all__r   r   pkg_resourcesr   r   ImportError__name__r   r   r   r   r   <module>   s    