
    }Whi                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ  G d d	 ed	ej	                  e          Z
d
S )z?Module containing the implementation of the URIReference class.    )
namedtuple   )compat)misc)normalizers)URIMixinc                   \     e Zd ZdZdZ	 d fd	Zej        Zd Zd Z	e
dd            Z xZS )	URIReferencea  Immutable object representing a parsed URI Reference.

    .. note::

        This class is not intended to be directly instantiated by the user.

    This object exposes attributes for the following components of a
    URI:

    - scheme
    - authority
    - path
    - query
    - fragment

    .. attribute:: scheme

        The scheme that was parsed for the URI Reference. For example,
        ``http``, ``https``, ``smtp``, ``imap``, etc.

    .. attribute:: authority

        Component of the URI that contains the user information, host,
        and port sub-components. For example,
        ``google.com``, ``127.0.0.1:5000``, ``username@[::1]``,
        ``username:password@example.com:443``, etc.

    .. attribute:: path

        The path that was parsed for the given URI Reference. For example,
        ``/``, ``/index.php``, etc.

    .. attribute:: query

        The query component for a given URI Reference. For example, ``a=b``,
        ``a=b%20c``, ``a=b+c``, ``a=b,c=d,e=%20f``, etc.

    .. attribute:: fragment

        The fragment component of a URI. For example, ``section-3.1``.

    This class also provides extra attributes for easier access to information
    like the subcomponents of the authority component.

    .. attribute:: userinfo

        The user information parsed from the authority.

    .. attribute:: host

        The hostname, IPv4, or IPv6 address parsed from the authority.

    .. attribute:: port

        The port parsed from the authority.
     utf-8c                 |    t          t          |                               | |pd|pd|pd||          }||_        |S )zCreate a new URIReference.N)superr
   __new__encoding)	clsscheme	authoritypathqueryfragmentr   ref	__class__s	           Q/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/rfc3986/uri.pyr   zURIReference.__new__U   sQ     L#&&..NdLD
 
  
    c                    |}t          |t                    r
t          | }nst          |t                    s^	 t                              |          }nB# t          $ r5 t	          d                    t          |          j                            w xY wt          |           t          |          k    }|p|                     |          S )z"Compare this reference to another.z)Unable to compare URIReference() to {0}())	
isinstancetupler
   from_string	TypeErrorformattype__name__normalized_equality)selfother	other_refnaive_equalitys       r   __eq__zURIReference.__eq__f   s    	eU## 
	$e,IIE<00 	(44U;;		   ?FFU,    ti(8(88D!9!9)!D!DDs   A ?Bc           	      <   t          t          j        | j        pd          t          j        | j        | j        | j        f          t          j        | j	        pd          t          j
        | j                  t          j        | j                  | j                  S )a  Normalize this reference as described in Section 6.2.2.

        This is not an in-place normalization. Instead this creates a new
        URIReference.

        :returns: A new reference object with normalized components.
        :rtype: URIReference
         )r
   r   normalize_schemer   normalize_authorityuserinfohostportnormalize_pathr   normalize_queryr   normalize_fragmentr   r   )r$   s    r   	normalizezURIReference.normalizey   s     ():;;+	495  &tyB77'
33*4=99M	
 	
 		
r   c           
      \   t          j        ||          }t          j                            |                                          } | |d         |d         t          j        |d         |          t          j        |d         |          t          j        |d         |          |          S )a	  Parse a URI reference from the given unicode URI string.

        :param str uri_string: Unicode URI to be parsed into a reference.
        :param str encoding: The encoding of the string provided
        :returns: :class:`URIReference` or subclass thereof
        r   r   r   r   r   )r   to_strr   URI_MATCHERmatch	groupdictr   encode_component)r   
uri_stringr   	split_uris       r   r   zURIReference.from_string   s     ]:x88
$**:66@@BB	shk"(6):HEE(7);XFF(:)>II
 
 	
r   )r   )r"   
__module____qualname____doc__slotsr   r   __hash__r(   r3   classmethodr   __classcell__)r   s   @r   r
   r
      s        7 7r E AH      ~HE E E&
 
 
, 
 
 
 [
 
 
 
 
r   r
   N)r>   collectionsr   r*   r   r   r   _mixinr   URI_COMPONENTSr
   r   r   r   <module>rF      s    E E  # " " " " "                        H
 H
 H
 H
 H
::nd.ABBH H
 H
 H
 H
 H
r   