Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
joemarshall committed Oct 31, 2024
1 parent 4a36ab5 commit bd5827c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion httpx/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def __init__(
self,
verify: bool = True,
) -> None:

# ssl.SSLContext sets OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION,
# OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE and OP_SINGLE_ECDH_USE
# by default. (from `ssl.create_default_context`)
Expand All @@ -108,6 +107,7 @@ def __init__(
# Default to `certifi` for certificiate verification.
try:
import certifi

self.load_verify_locations(cafile=certifi.where())
except ImportError:
pass
Expand Down
2 changes: 2 additions & 0 deletions httpx/_transports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
if sys.platform == "emscripten": # pragma: nocover
# in emscripten we use javascript fetch
from .jsfetch import *

# override default transport names
HTTPTransport = JavascriptFetchTransport
AsyncHTTPTransport = AsyncJavascriptFetchTransport
else:
# everywhere else we use httpcore
from .httpcore import *

HTTPTransport = HTTPCoreTransport
AsyncHTTPTransport = AsyncHTTPCoreTransport

Expand Down
1 change: 1 addition & 0 deletions httpx/_urlparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ def encode_host(host: str) -> str:
WHATWG_SAFE = '"`{}%|\\'
return quote(host.lower(), safe=SUB_DELIMS + WHATWG_SAFE)
import idna

# IDNA hostnames
try:
return idna.encode(host.lower()).decode("ascii")
Expand Down
1 change: 1 addition & 0 deletions httpx/_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def host(self) -> str:

if host.startswith("xn--"):
import idna

host = idna.decode(host)

return host
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,14 @@ def server() -> typing.Iterator[TestServer]:
server = TestServer(config=config)
yield from serve_in_thread(server)


@pytest.fixture(scope="session")
def https_server() -> typing.Iterator[TestServer]:
config = Config(app=app, lifespan="off", loop="asyncio")
server = TestServer(config=config)
yield from serve_in_thread(server)


@pytest.fixture(scope="session")
def https_server(cert_pem_file, cert_private_key_file):
config = Config(
Expand All @@ -366,4 +368,4 @@ def https_server(cert_pem_file, cert_private_key_file):
loop="asyncio",
)
server = TestServer(config=config)
yield from serve_in_thread(server)
yield from serve_in_thread(server)
2 changes: 1 addition & 1 deletion tests/emscripten/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _get_coverage_filename(prefix: str) -> str:
def selenium_with_jspi_if_possible(
request: pytest.FixtureRequest, runtime: str, has_jspi: bool
) -> Generator[Any, None, None]:
if has_jspi==False: # pragma: no cover
if has_jspi == False: # pragma: no cover
fixture_name = "selenium"
else:
fixture_name = "selenium_jspi"
Expand Down

0 comments on commit bd5827c

Please sign in to comment.