Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin format requirements for the project #163

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/trio-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def format_date_time(dt=None):
# I/O adapter: h11 <-> trio
################################################################


# The core of this could be factored out to be usable for trio-based clients
# too, as well as servers. But as a simplified pedagogical example we don't
# attempt this here.
Expand Down Expand Up @@ -212,6 +213,7 @@ def info(self, *args):
# Server main loop
################################################################


# General theory:
#
# If everything goes well:
Expand Down Expand Up @@ -276,6 +278,7 @@ async def http_serve(stream):
# Actual response handlers
################################################################


# Helper function
async def send_simple_response(wrapper, status_code, content_type, body):
wrapper.info("Sending", status_code, "response with", len(body), "bytes")
Expand Down
2 changes: 2 additions & 0 deletions format-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
black==23.3.0
isort==5.12.0
1 change: 1 addition & 0 deletions h11/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class PAUSED(Sentinel, metaclass=Sentinel):
# - Apache: <8 KiB per line>
DEFAULT_MAX_INCOMPLETE_EVENT_SIZE = 16 * 1024


# RFC 7230's rules for connection lifecycles:
# - If either side says they want to close the connection, then the connection
# must close.
Expand Down
4 changes: 2 additions & 2 deletions h11/tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def test_pipelining() -> None:


def test_protocol_switch() -> None:
for (req, deny, accept) in [
for req, deny, accept in [
(
Request(
method="CONNECT",
Expand Down Expand Up @@ -721,7 +721,7 @@ def setup() -> ConnectionPair:
def test_close_simple() -> None:
# Just immediately closing a new connection without anything having
# happened yet.
for (who_shot_first, who_shot_second) in [(CLIENT, SERVER), (SERVER, CLIENT)]:
for who_shot_first, who_shot_second in [(CLIENT, SERVER), (SERVER, CLIENT)]:

def setup() -> ConnectionPair:
p = ConnectionPair()
Expand Down
4 changes: 2 additions & 2 deletions h11/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def check(got: Any) -> None:


def test_writers_simple() -> None:
for ((role, state), event, binary) in SIMPLE_CASES:
for (role, state), event, binary in SIMPLE_CASES:
tw(WRITERS[role, state], event, binary)


def test_readers_simple() -> None:
for ((role, state), event, binary) in SIMPLE_CASES:
for (role, state), event, binary in SIMPLE_CASES:
tr(READERS[role, state], binary, event)


Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ commands = pytest --cov=h11 --cov-config=.coveragerc h11

[testenv:format]
basepython = python3.10
deps =
black
isort
deps = -r{toxinidir}/format-requirements.txt
commands =
black --check --diff h11/ bench/ examples/ fuzz/
isort --check --diff --profile black --dt h11 bench examples fuzz
Expand Down
Loading