Your IP : 3.144.108.209


Current Path : /lib64/python3.6/xml/dom/__pycache__/
Upload File :
Current File : //lib64/python3.6/xml/dom/__pycache__/domreg.cpython-36.pyc

3


 \{
�@sDdZddlZddd�ZiZdd�Zdd	�Zdffd
d�Zdd
�ZdS)z�Registration facilities for DOM. This module should not be used
directly. Instead, the functions getDOMImplementation and
registerDOMImplementation should be imported from xml.dom.�Nzxml.dom.minidomzxml.dom.DOMImplementation)ZminidomZ4DOMcCs|t|<dS)aIregisterDOMImplementation(name, factory)

    Register the factory function with the name. The factory function
    should return an object which implements the DOMImplementation
    interface. The factory function can either return the same object,
    or a new one (e.g. if that implementation supports some
    customization).N)�
registered)�name�factory�r�/usr/lib64/python3.6/domreg.py�registerDOMImplementations	rcCs&x |D]\}}|j||�sdSqWdS)zF_good_enough(dom, features) -> Return 1 if the dom offers the featuresr�)Z
hasFeature)�dom�features�f�vrrr�_good_enough sr
cCs�ddl}d}tj|�}|r2t|iidg�}|j�S|r@t|�Stjjrdd|j	krdt|j	dd�St
|t�rvt|�}x$tj
�D]}|�}t||�r�|Sq�WxDtj�D]8}yt|d�}Wntk
r�w�YnXt||�r�|Sq�Wtd��dS)aSgetDOMImplementation(name = None, features = ()) -> DOM implementation.

    Return a suitable DOM implementation. The name is either
    well-known, the module name of a DOM implementation, or None. If
    it is not None, imports the corresponding module and returns
    DOMImplementation object if the import succeeds.

    If name is not given, consider the available implementations to
    find one with the required feature set. If no implementation can
    be found, raise an ImportError. The features list must be a sequence
    of (feature, version) pairs which are passed to hasFeature.rN�getDOMImplementationZ
PYTHON_DOM)rz$no suitable DOM implementation found)�os�well_known_implementations�get�
__import__rr�sys�flags�ignore_environment�environ�
isinstance�str�_parse_feature_string�valuesr
�keys�	Exception�ImportError)rr
rZcreator�modr	rrrr's0





rcCs�g}|j�}d}t|�}xp||kr�||}|ddkrDtd|f��|d}d}||krx||}|ddkrx|d}|}|j||f�qWt|�S)Nr�
0123456789zbad feature name: %rr)�split�len�
ValueError�append�tuple)�sr
�parts�iZlengthZfeature�versionrrrrrRs"
r)�__doc__rrrrr
rrrrrr�<module>s+