L i.LdZddlmZddlZddlmZddlmZd dZd dZ d dZ y) ay This file includes code adapted from HTTPX's utility module (https://github.com/encode/httpx/blob/336204f0121a9aefdebac5cacd81f912bafe8057/httpx/_utils.py). We implement custom proxy handling to support configurations like `socket_options`, which are not currently configurable through the HTTPX client. For more context, see: https://github.com/encode/httpx/discussions/3514 ) annotationsN)Mapping) getproxiescr tj|jddy#t$rYywxYwN/rFT) ipaddress IPv4Addresssplit Exceptionhostnames ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/anthropic/_utils/_httpx.pyis_ipv4_hostnamer<hnnS1!45   '* 66cr tj|jddy#t$rYywxYwr)r IPv6Addressr r r s ris_ipv6_hostnamerrrct}i}dD]*}|j|s||}d|vr|nd|||d<,|jddjdDcgc]}|j}}|D]e}|dk(ricS|sd|vrd||<t |r d|d |<-t |r d|d |d <B|j d k(r d|d |<^d|d |<g|Scc}w)u Gets the proxy mappings based on environment variables. We use our own logic to parse these variables, as HTTPX doesn’t allow full configuration of the underlying transport when proxies are set via environment variables. )httphttpsallz://zhttp://no,*Nzall://zall://[] localhostzall://*)rgetr striprrlower) proxy_infomountsschemerhostno_proxy_hostss rget_environment_proxiesr( s,J$&F*] >>& !!&)H16(1BX'RZQ[H\FfXS> "] 0:~~dB/G/M/Mc/RStdjjlSNS" 4 s?I  #'x !(+.2z*+!(+04 !,-![0.2z*+/3 +, 4 M!TsC$)rstrreturnbool)r*zMapping[str, str | None]) __doc__ __future__rr typingrurllib.requestrrrr(rr2s'#% r1