Skip to content

Commit ee928ec

Browse files
committed
ruff: use TYPE_CHECKING for ssl and werkzeug
1 parent f959d06 commit ee928ec

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

pytest_httpserver/blocking_httpserver.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
from queue import Empty
44
from queue import Queue
5-
from ssl import SSLContext
5+
from typing import TYPE_CHECKING
66
from typing import Any
77
from typing import Dict
88
from typing import Mapping
99
from typing import Optional
1010
from typing import Pattern
1111
from typing import Union
1212

13-
from werkzeug.wrappers import Request
14-
from werkzeug.wrappers import Response
15-
1613
from pytest_httpserver.httpserver import METHOD_ALL
1714
from pytest_httpserver.httpserver import UNDEFINED
1815
from pytest_httpserver.httpserver import HeaderValueMatcher
@@ -21,6 +18,12 @@
2118
from pytest_httpserver.httpserver import RequestHandlerBase
2219
from pytest_httpserver.httpserver import URIPattern
2320

21+
if TYPE_CHECKING:
22+
from ssl import SSLContext
23+
24+
from werkzeug.wrappers import Request
25+
from werkzeug.wrappers import Response
26+
2427

2528
class BlockingRequestHandler(RequestHandlerBase):
2629
"""

pytest_httpserver/httpserver.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from contextlib import suppress
1414
from copy import copy
1515
from enum import Enum
16-
from ssl import SSLContext
16+
from typing import TYPE_CHECKING
1717
from typing import Any
1818
from typing import Callable
1919
from typing import Iterable
@@ -32,6 +32,9 @@
3232
from werkzeug.wrappers import Request
3333
from werkzeug.wrappers import Response
3434

35+
if TYPE_CHECKING:
36+
from ssl import SSLContext
37+
3538
URI_DEFAULT = ""
3639
METHOD_ALL = "__ALL"
3740

0 commit comments

Comments
 (0)