Skip to content

Commit 1e52631

Browse files
committed
Fix Pattern annotation
1 parent 5046a51 commit 1e52631

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

httpx/_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
TimeoutTypes,
4747
)
4848
from ._urls import URL, QueryParams
49-
from ._utils import URLPattern, build_url_pattern, get_environment_proxies
49+
from ._utils import Pattern, build_url_pattern, get_environment_proxies
5050

5151
if typing.TYPE_CHECKING:
5252
import ssl # pragma: no cover
@@ -694,7 +694,7 @@ def __init__(
694694
limits=limits,
695695
transport=transport,
696696
)
697-
self._mounts: dict[URLPattern, BaseTransport | None] = {
697+
self._mounts: dict[Pattern, BaseTransport | None] = {
698698
build_url_pattern(key): None
699699
if proxy is None
700700
else self._init_proxy_transport(
@@ -1409,7 +1409,7 @@ def __init__(
14091409
transport=transport,
14101410
)
14111411

1412-
self._mounts: dict[URLPattern, AsyncBaseTransport | None] = {
1412+
self._mounts: dict[Pattern, AsyncBaseTransport | None] = {
14131413
build_url_pattern(key): None
14141414
if proxy is None
14151415
else self._init_proxy_transport(

httpx/_utils.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def priority(self) -> tuple[int, int, int]:
237237
def __hash__(self) -> int:
238238
return hash(self.pattern)
239239

240-
def __lt__(self, other: URLPattern) -> bool:
240+
def __lt__(self, other: Pattern) -> bool:
241241
return self.priority < other.priority
242242

243243
def __eq__(self, other: typing.Any) -> bool:
@@ -268,17 +268,14 @@ def priority(self) -> tuple[int, int, int]:
268268
def __hash__(self) -> int:
269269
return hash(self.net)
270270

271-
def __lt__(self, other: URLPattern) -> bool:
271+
def __lt__(self, other: Pattern) -> bool:
272272
return self.priority < other.priority
273273

274274
def __eq__(self, other: typing.Any) -> bool:
275275
return isinstance(other, IPNetPattern) and self.net == other.net
276276

277277

278-
URLPattern = IPNetPattern | WildcardURLPattern
279-
280-
281-
def build_url_pattern(pattern: str) -> URLPattern:
278+
def build_url_pattern(pattern: str) -> Pattern:
282279
try:
283280
proto, rest = pattern.split("://", 1)
284281
if proto == "all" and "/" in rest:

0 commit comments

Comments
 (0)