Repository URL to install this package:
|
Version:
3.3.30 ▾
|
ó
ȍEYc @ s 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 d d l m Z d e d e j
f d
YZ d S( s? Module containing the implementation of the URIReference class.iÿÿÿÿ( t
namedtuplei ( t compat( t
exceptions( t misc( t normalizers( t
validatorst URIReferencec B s
e Z d Z d Z d d Z d Z e d d Z d Z e d Z
e d Z e d Z d Z
d
Z e d Z e d Z e d
Z e d Z e d Z d Z d Z e d Z d Z e j e j e j e j e j d Z RS( sÝ 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 adddres parsed from the authority.
.. attribute:: port
The port parsed from the authority.
s utf-8c
C sF t t | j | | p d | p$ d | p- d | | } | | _ | S( s Create a new URIReference.N( t superR t __new__t Nonet encoding( t clst schemet authorityt patht queryt fragmentR
t ref( ( s@ /home/tvault/.virtenv/lib/python2.7/site-packages/rfc3986/uri.pyR V s c C s¦ | } t | t r$ t | } nW t | t s{ y t j | } Wq{ t k
rw t d j t | j q{ Xn t | t | k } | p¥ | j | S( s" Compare this reference to another.s) Unable to compare URIReference() to {0}()( t
isinstancet tupleR t from_stringt TypeErrort formatt typet __name__t normalized_equality( t selft othert other_reft naive_equality( ( s@ /home/tvault/.virtenv/lib/python2.7/site-packages/rfc3986/uri.pyt __eq__c s
c C s{ t j | | } t j j | j } | | d | d t j | d | t j | d | t j | d | | S( s 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 t to_strR t URI_MATCHERt matcht groupdictR t encode_component( R t
uri_stringR
t split_uri( ( s@ /home/tvault/.virtenv/lib/python2.7/site-packages/rfc3986/uri.pyR t s c C sÌ | j s" i d d 6d d 6d d 6St j j | j } | d k rd t j | j j | j n | j } | j
d } | rÈ t j j | rÈ t j
| rÈ t j | j j | j n | S( sÌ Return a dictionary with the ``userinfo``, ``host``, and ``port``.
If the authority is not valid, it will raise a
:class:`~rfc3986.exceptions.InvalidAuthority` Exception.
:returns:
``{'userinfo': 'username:password', 'host': 'www.example.com',
'port': '80'}``
:rtype: dict
:raises rfc3986.exceptions.InvalidAuthority:
If the authority is not ``None`` and can not be parsed.
t userinfot hostt portN( R
R R t SUBAUTHORITY_MATCHERR! t exct InvalidAuthorityt encodeR
R" t gett IPv4_MATCHERR t valid_ipv4_host_address( R R! t matchesR' ( ( s@ /home/tvault/.virtenv/lib/python2.7/site-packages/rfc3986/uri.pyt authority_info s
!!c C s0 y | j } Wn t j k
r' d SX| d S( s+ If present, a string representing the host.R' N( R1 R* R+ R ( R R
( ( s@ /home/tvault/.virtenv/lib/python2.7/site-packages/rfc3986/uri.pyR' s
c C s0 y | j } Wn t j k
r' d SX| d S( s2 If present, the port extracted from the authority.R( N( R1 R* R+ R ( R R
( ( s@ /home/tvault/.virtenv/lib/python2.7/site-packages/rfc3986/uri.pyR( ¶ s
c C s0 y | j } Wn t j k
r' d SX| d S( s6 If present, the userinfo extracted from the authority.R&