Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias alias alias Assign NameStore Str Assign NameStore Call NameLoad NameLoad Assign NameStore Num FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num If CompareEq Call NameLoad NameLoad Num body Return TupleLoad SubscriptLoad NameLoad Index Num NameLoad SubscriptLoad NameLoad Index Num orelse Return TupleLoad NameLoad Str Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq NameLoad Num body Return TupleLoad Str Str NameLoad Return TupleLoad SubscriptLoad NameLoad Slice NameLoad NameLoad SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str If BoolOpOr CompareIn Str NameLoad CompareGt Call AttributeLoad NameLoad attr Str Num body Raise Call NameLoad Str Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad Str If UnaryOpNot NameLoad body Raise Call NameLoad Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareEq Call AttributeLoad NameLoad attr Str Num body Raise Call NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str If CompareEq NameLoad Num body Return TupleLoad SubscriptLoad NameLoad Slice Num Num NameLoad Return TupleLoad SubscriptLoad NameLoad Slice Num NameLoad SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore NameLoad Assign NameStore NameLoad If CompareEq SubscriptLoad NameLoad Index Num Str body Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad orelse If CompareNotEq Call AttributeLoad NameLoad attr Str Num body If CompareGt Call AttributeLoad NameLoad attr Str Num body Raise Call NameLoad Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Num If Call NameLoad NameLoad NameLoad body If UnaryOpNot Call AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign NameStore Call NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Dict For NameStore Call AttributeLoad NameLoad attr NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str If CompareEq Call AttributeLoad NameLoad attr Str body Expr Call AttributeLoad Call AttributeLoad NameLoad attr Str ListLoad attr NameLoad orelse Assign SubscriptStore NameLoad Index NameLoad NameLoad If CompareIn Str NameLoad body Assign NameStore ListLoad For NameStore SubscriptLoad NameLoad Index Str body Assign NameStore Dict TryExcept body For NameStore Call AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr Str Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Dict Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str TryExcept body If BoolOpAnd CompareGtE NameLoad Num CompareGtE NameLoad Num body Raise Call NameLoad Str orelse If CompareGtE NameLoad Num body Assign NameStore Call NameLoad NameLoad Str orelse If CompareGtE NameLoad Num body Assign NameStore Call NameLoad NameLoad Str orelse If CompareNotEq Call AttributeLoad NameLoad attr Str Num body Assign NameStore Call NameLoad NameLoad NameLoad orelse Raise NameLoad handlers ExceptHandler type NameLoad body Raise Call NameLoad Str Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr Str body If UnaryOpNot NameLoad body Raise Call NameLoad Str Assign NameStore NameLoad If Call AttributeLoad NameLoad attr Str body Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad Assign NameStore SubscriptLoad NameLoad Slice NameLoad If UnaryOpNot NameLoad body Raise Call NameLoad Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Dict If CompareIn Str NameLoad body Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad Str TryExcept body Expr Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign NameStore NameLoad Assign NameStore Str orelse Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad Str If BoolOpAnd UnaryOpNot NameLoad CompareIn Str NameLoad body Raise Call NameLoad Str If CompareIn Str NameLoad body Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad Str Assign TupleStore NameStore NameStore Call NameLoad NameLoad orelse Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad If NameLoad body If CompareEq SubscriptLoad NameLoad Index Num Str body Assign NameStore SubscriptLoad NameLoad Slice Num orelse Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad Str If CompareIn Str NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Num If NameLoad body Assign NameStore Call NameLoad NameLoad Return Dict Str Str Str Str Str Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list If CompareEq NameLoad Str body Import alias Import alias TryExcept body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num handlers ExceptHandler type TupleLoad NameLoad NameLoad name NameStore body Print NameLoad Expr Call AttributeLoad NameLoad attr Num
N/A N/A Tools to parse and validate a MongoDB URI. urllib unquote_plus pymongo.common validate pymongo.errors ConfigurationError InvalidURI UnsupportedOption N/A SCHEME mongodb:// N/A SCHEME_LEN N/A len SCHEME N/A DEFAULT_PORT 27017 _partition N/A N/A entity sep N/A N/A N/A Python2.4 doesn't have a partition method so we provide
    our own that mimics str.partition from later releases.

    Split the string at the first occurrence of sep, and return a
    3-tuple containing the part before the separator, the separator
    itself, and the part after the separator. If the separator is not
    found, return a 3-tuple containing the string itself, followed
    by two empty strings.
     N/A parts N/A N/A entity split sep 1 N/A N/A N/A len parts 2 N/A N/A N/A N/A parts N/A 0 sep N/A parts N/A 1 N/A N/A N/A entity N/A _rpartition N/A N/A entity sep N/A N/A N/A Python2.4 doesn't have an rpartition method so we provide
    our own that mimics str.rpartition from later releases.

    Split the string at the last occurrence of sep, and return a
    3-tuple containing the part before the separator, the separator
    itself, and the part after the separator. If the separator is not
    found, return a 3-tuple containing two empty strings, followed
    by the string itself.
     N/A idx N/A N/A entity rfind sep N/A N/A idx -1 N/A N/A N/A entity N/A N/A N/A entity N/A idx sep N/A entity N/A N/A idx 1 N/A parse_userinfo N/A N/A userinfo N/A N/A N/A Validates the format of user information in a MongoDB URI.
    Reserved characters like ':', '/', '+' and '@' must be escaped
    following RFC 2396.

    Returns a 2-tuple containing the unescaped username followed
    by the unescaped password.

    :Paramaters:
        - `userinfo`: A string of the form <username>:<password>

    .. versionchanged:: 2.2
       Now uses `urllib.unquote_plus` so `+` characters must be escaped.
     N/A N/A N/A @ userinfo N/A N/A N/A userinfo count : 1 N/A N/A N/A InvalidURI ':' or '@' characters in a username or password must be escaped according to RFC 2396. N/A N/A user _ passwd N/A _partition userinfo : N/A N/A user N/A N/A N/A InvalidURI The empty string is not valid username. N/A user N/A unquote_plus user N/A passwd N/A unquote_plus passwd N/A N/A user passwd N/A parse_ipv6_literal_host N/A N/A entity default_port N/A N/A N/A Validates an IPv6 literal host:port string.

    Returns a 2-tuple of IPv6 literal followed by port where
    port is default_port if it wasn't specified in entity.

    :Parameters:
        - `entity`: A string that represents an IPv6 literal enclosed
                    in braces (e.g. '[::1]' or '[::1]:27017').
        - `default_port`: The port number to use when one wasn't
                          specified in entity.
     N/A N/A N/A N/A entity find ] -1 N/A N/A N/A ConfigurationError an IPv6 address literal must be enclosed in '[' and ']' according to RFC 2732. N/A i N/A N/A entity find ]: N/A N/A i -1 N/A N/A N/A N/A entity N/A 1 -1 default_port N/A N/A N/A entity N/A 1 i N/A entity N/A N/A i 2 N/A parse_host N/A N/A entity default_port N/A DEFAULT_PORT N/A N/A Validates a host string

    Returns a 2-tuple of host followed by port where port is default_port
    if it wasn't specified in the string.

    :Parameters:
        - `entity`: A host or host:port string where host could be a
                    hostname or IP address.
        - `default_port`: The port number to use when one wasn't
                          specified in entity.
     N/A host entity N/A port default_port N/A N/A N/A entity N/A 0 [ N/A N/A N/A host port N/A parse_ipv6_literal_host entity default_port N/A N/A N/A N/A N/A entity find : -1 N/A N/A N/A N/A N/A entity count : 1 N/A N/A N/A ConfigurationError Reserved characters such as ':' must be escaped according RFC 2396. An IPv6 address literal must be enclosed in '[' and ']' according to RFC 2732. N/A N/A host port N/A N/A host split : 1 N/A N/A isinstance port basestring N/A N/A N/A N/A N/A port isdigit N/A N/A N/A ConfigurationError Port number must be an integer. N/A port N/A int port N/A N/A host port N/A validate_options N/A N/A opts N/A N/A N/A Validates and normalizes options passed in a MongoDB URI.

    Returns a new dictionary of validated and normalized options.

    :Parameters:
        - `opts`: A dict of MongoDB URI options.
     N/A normalized N/A N/A N/A option value N/A N/A opts iteritems N/A N/A N/A option value N/A validate option value N/A N/A normalized N/A N/A str option value N/A normalized N/A _parse_options N/A N/A opts delim N/A N/A N/A Helper method for split_options which creates the options dict.
    Also handles the creation of a list of dicts for the URI tag_sets/
    readpreferencetags portion. N/A options N/A N/A opt N/A N/A opts split delim N/A N/A N/A key val N/A N/A opt split = N/A N/A N/A N/A key lower readpreferencetags N/A N/A N/A N/A N/A N/A options setdefault readpreferencetags N/A append val N/A N/A N/A options N/A key val N/A N/A readpreferencetags options N/A N/A new_tag_sets N/A N/A tag_set N/A options N/A readpreferencetags N/A N/A tag_dict N/A N/A N/A N/A tag N/A N/A tag_set split , N/A N/A tag_parts N/A N/A tag split : N/A N/A tag_dict N/A N/A tag_parts N/A 0 N/A tag_parts N/A 1 N/A N/A N/A new_tag_sets append tag_dict N/A N/A N/A IndexError N/A N/A N/A N/A new_tag_sets append N/A N/A N/A options N/A readpreferencetags new_tag_sets N/A options N/A split_options N/A N/A opts N/A N/A N/A Takes the options portion of a MongoDB URI, validates each option
    and returns the options in a dictionary. The option names will be returned
    lowercase even if camelCase options are used.

    :Parameters:
        - `opt`: A string representing MongoDB URI options.
     N/A and_idx N/A N/A opts find & N/A semi_idx N/A N/A opts find ; N/A N/A N/A N/A N/A and_idx 0 N/A semi_idx 0 N/A N/A N/A InvalidURI Can not mix '&' and ';' for option separators. N/A N/A N/A and_idx 0 N/A N/A options N/A _parse_options opts & N/A N/A N/A semi_idx 0 N/A N/A options N/A _parse_options opts ; N/A N/A N/A N/A N/A opts find = -1 N/A N/A options N/A _parse_options opts None N/A N/A ValueError N/A N/A N/A ValueError N/A N/A N/A InvalidURI MongoDB URI options are key=value pairs. N/A N/A validate_options options N/A split_hosts N/A N/A hosts default_port N/A DEFAULT_PORT N/A N/A Takes a string of the form host1[:port],host2[:port]... and
    splits it into (host, port) tuples. If [:port] isn't present the
    default_port is used.

    Returns a set of 2-tuples containing the host name (or IP) followed by
    port number.

    :Parameters:
        - `hosts`: A string of the form host1[:port],host2[:port],...
        - `default_port`: The port number to use when one wasn't specified
                          for a host.
     N/A nodes N/A N/A entity N/A N/A hosts split , N/A N/A N/A entity N/A N/A N/A ConfigurationError Empty host (or extra comma in host list). N/A port default_port N/A N/A N/A entity endswith .sock N/A N/A port None N/A N/A N/A nodes append N/A parse_host entity port N/A nodes N/A parse_uri N/A N/A uri default_port N/A DEFAULT_PORT N/A N/A Parse and validate a MongoDB URI.

    Returns a dict of the form::

        {
            'nodelist': <list of (host, port) tuples>,
            'username': <username> or None,
            'password': <password> or None,
            'database': <database name> or None,
            'collection': <collection name> or None,
            'options': <dict of MongoDB URI options>
        }

    :Parameters:
        - `uri`: The MongoDB URI to parse.
        - `default_port`: The port number to use when one wasn't specified
                          for a host in the URI.
     N/A N/A N/A N/A uri startswith SCHEME N/A N/A N/A InvalidURI N/A Invalid URI scheme: URI must begin with '%s' N/A SCHEME N/A scheme_free N/A uri N/A SCHEME_LEN N/A N/A scheme_free N/A N/A N/A InvalidURI Must provide at least one hostname or IP. N/A nodes None N/A user None N/A passwd None N/A dbase None N/A collection None N/A options N/A N/A N/A .sock scheme_free N/A N/A N/A host_part _ path_part N/A _rpartition scheme_free / N/A N/A N/A N/A parse_uri N/A %s%s N/A SCHEME host_part N/A N/A N/A N/A ConfigurationError InvalidURI N/A N/A host_part scheme_free N/A path_part N/A N/A N/A host_part _ path_part N/A _partition scheme_free / N/A N/A N/A path_part N/A ? host_part N/A N/A N/A InvalidURI A '/' is required between the host list and any options. N/A N/A @ host_part N/A N/A N/A userinfo _ hosts N/A _rpartition host_part @ N/A N/A user passwd N/A parse_userinfo userinfo N/A N/A hosts host_part N/A nodes N/A split_hosts hosts default_port default_port N/A path_part N/A N/A N/A N/A path_part N/A 0 ? N/A N/A opts N/A path_part N/A 1 N/A N/A N/A dbase _ opts N/A _partition path_part ? N/A N/A . dbase N/A N/A N/A dbase collection N/A N/A dbase split . 1 N/A opts N/A N/A options N/A split_options opts N/A N/A nodelist username password database collection options nodes user passwd dbase collection options N/A N/A N/A __name__ __main__ N/A N/A pprint N/A sys N/A N/A N/A N/A N/A pprint pprint N/A parse_uri N/A N/A sys argv N/A 1 N/A N/A N/A N/A InvalidURI UnsupportedOption N/A e N/A N/A e N/A N/A N/A sys exit 0