+\hdZddlmZddlmZmZddlmZddlm Z ddl m Z m Z ddl mZmZddlmZmZmZmZmZmZmZmZmZmZd Zed d d d d d f dd Zed d d d d d f dd Zy )z*Tools to parse and validate a MongoDB URI.) annotations)AnyOptional) unquote_plus) _SrvResolver)SRV_SERVICE_NAME_CaseInsensitiveDictionary)ConfigurationError InvalidURI) _ALLOWED_TXT_OPTS DEFAULT_PORTSCHEME SCHEME_LENSRV_SCHEME_LEN_check_options_make_options_case_sensitive _validate_uri split_hosts split_optionsFTNc Kt||||||}|jt||||||||d{t|d|d<|S7w)aParse and validate a MongoDB URI. Returns a dict of the form:: { 'nodelist': , 'username': or None, 'password': or None, 'database': or None, 'collection': or None, 'options': , 'fqdn': or None } If the URI scheme is "mongodb+srv://" DNS SRV and TXT lookups will be done to build nodelist and options. :param uri: The MongoDB URI to parse. :param default_port: The port number to use when one wasn't specified for a host in the URI. :param validate: If ``True`` (the default), validate and normalize all options. Default: ``True``. :param warn: When validating, if ``True`` then will warn the user then ignore any invalid options or values. If ``False``, validation will error when options are unsupported or values are invalid. Default: ``False``. :param normalize: If ``True``, convert names of URI options to their internally-used names. Default: ``True``. :param connect_timeout: The maximum time in milliseconds to wait for a response from the DNS server. :param srv_service_name: A custom SRV service name .. versionchanged:: 4.14 ``options`` is now type ``dict`` as opposed to a ``_CaseInsensitiveDictionary``. .. versionchanged:: 4.6 The delimiting slash (``/``) between hosts and connection options is now optional. For example, "mongodb://example.com?tls=true" is now a valid URI. .. versionchanged:: 4.0 To better follow RFC 3986, unquoted percent signs ("%") are no longer supported. .. versionchanged:: 3.9 Added the ``normalize`` parameter. .. versionchanged:: 3.6 Added support for mongodb+srv:// URIs. .. versionchanged:: 3.5 Return the original value of the ``readPreference`` MongoDB URI option instead of the validated read preference mode. .. versionchanged:: 3.1 ``warn`` added so invalid options can be ignored. Noptions)rupdate _parse_srvr) uri default_portvalidatewarn normalizeconnect_timeoutsrv_service_name srv_max_hostsresults b/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/asynchronous/uri_parser.py parse_urir$)snD3 hi WF MM           5VI5FGF9 M s1AAAcK|jtr d}|td} n d}|td} t } | j d\} } } d| vr| j d\}} } n| }| r| j t| ||||| jdt}d|vr|jd\} } }n|}t|}|xs| jd}|rt|d}|d \}}|xs| jd }t||||}|jd{}|jd{}|rMt||||}t!|t"z r t%d |j'D]\}}|| vs || |<| jd r |r t)d | jdr |r t)dd| vrd| vr|rdnd| d<n t||}t+|| || dS77w)NFT?/srvServiceName@ srvMaxHosts)rrconnectTimeoutMSzDOnly authSource, replicaSet, and loadBalanced are supported from DNS loadBalancedz0You cannot specify loadBalanced with srvMaxHosts replicaSetz.You cannot specify replicaSet with srvMaxHoststlsssltrue)nodelistr) startswithrrrr partitionrrgetr rpartitionrrr get_hosts get_optionssetr r itemsr r)rrrrrrr r!is_srv scheme_freerhost_plus_db_part_opts host_parthostsnodesfqdnport dns_resolver dns_optionsparsed_dns_optionsoptvals r#rr|s7 ~~f*+& ./* (*G!,!6!6s!;q$ +55c: 1a%  }T8T9EF";;'79IJ i**3/ 1e  E!?W[[%?M E51X d*LW[[9K-L#D/;K][ ",,..(4466 !.{HdI!V %&)::(Z/446 'Sg%#&GCL ' ;;~ &=OP P ;;| $MN N  E$8%-T6GENE =5'" -/6s,D)H+H,HHA HA4HH)rstrr Optional[int]rboolrrKrrKrzOptional[float]r z Optional[str]r!rJreturnzdict[str, Any])__doc__ __future__rtypingrr urllib.parser!pymongo.asynchronous.srv_resolverrpymongo.commonrr pymongo.errorsr r pymongo.uri_parser_sharedr r rrrrrrrr_IS_SYNCr$rr#rXs+ 1" %:G9     #/'+&*#'P PPP  P  P % P$P!PPj#/'+&*#'E EEE  E  E % E$E!EErW