Skip to content

Commit

Permalink
apply ruff lint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism committed Nov 18, 2024
1 parent 95a9ac3 commit 506e402
Show file tree
Hide file tree
Showing 61 changed files with 1,219 additions and 665 deletions.
9 changes: 7 additions & 2 deletions examples/api/src/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
from __future__ import annotations

from dataclasses import dataclass
from datetime import datetime

from quart_schema import QuartSchema, validate_request, validate_response
from quart_schema import QuartSchema
from quart_schema import validate_request
from quart_schema import validate_response

from quart import Quart, request
from quart import Quart
from quart import request

app = Quart(__name__)
QuartSchema(app)
Expand Down
3 changes: 2 additions & 1 deletion examples/api/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from api import app, TodoIn
from api import app
from api import TodoIn


async def test_echo() -> None:
Expand Down
7 changes: 6 additions & 1 deletion examples/blog/src/blog/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from sqlite3 import dbapi2 as sqlite3

from quart import g, Quart, redirect, render_template, request, url_for
from quart import g
from quart import Quart
from quart import redirect
from quart import render_template
from quart import request
from quart import url_for

app = Quart(__name__)

Expand Down
3 changes: 2 additions & 1 deletion examples/blog/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from blog import app, init_db
from blog import app
from blog import init_db


@pytest.fixture(autouse=True)
Expand Down
4 changes: 3 additions & 1 deletion examples/blog/tests/test_blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

async def test_create_post():
test_client = app.test_client()
response = await test_client.post("/create/", form={"title": "Post", "text": "Text"})
response = await test_client.post(
"/create/", form={"title": "Post", "text": "Text"}
)
assert response.status_code == 302
response = await test_client.get("/")
text = await response.get_data()
Expand Down
5 changes: 3 additions & 2 deletions examples/chat/src/chat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import asyncio

from chat.broker import Broker

from quart import Quart, render_template, websocket
from quart import Quart
from quart import render_template
from quart import websocket

app = Quart(__name__)
broker = Broker()
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/src/chat/broker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from typing import AsyncGenerator
from collections.abc import AsyncGenerator


class Broker:
Expand Down
4 changes: 3 additions & 1 deletion examples/chat/tests/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from chat import app

from quart.testing.connections import TestWebsocketConnection as _TestWebsocketConnection
from quart.testing.connections import (
TestWebsocketConnection as _TestWebsocketConnection,
)


async def _receive(test_websocket: _TestWebsocketConnection) -> str:
Expand Down
4 changes: 3 additions & 1 deletion examples/video/src/video/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from quart import Quart, render_template, send_file
from quart import Quart
from quart import render_template
from quart import send_file

app = Quart(__name__)

Expand Down
101 changes: 47 additions & 54 deletions src/quart/__init__.py
Original file line number Diff line number Diff line change
@@ -1,62 +1,55 @@
from __future__ import annotations

from markupsafe import escape as escape, Markup as Markup
from markupsafe import escape as escape
from markupsafe import Markup as Markup

from .app import Quart as Quart
from .blueprints import Blueprint as Blueprint
from .config import Config as Config
from .ctx import (
after_this_request as after_this_request,
copy_current_app_context as copy_current_app_context,
copy_current_request_context as copy_current_request_context,
copy_current_websocket_context as copy_current_websocket_context,
has_app_context as has_app_context,
has_request_context as has_request_context,
has_websocket_context as has_websocket_context,
)
from .globals import (
current_app as current_app,
g as g,
request as request,
session as session,
websocket as websocket,
)
from .helpers import (
abort as abort,
flash as flash,
get_flashed_messages as get_flashed_messages,
get_template_attribute as get_template_attribute,
make_push_promise as make_push_promise,
make_response as make_response,
redirect as redirect,
send_file as send_file,
send_from_directory as send_from_directory,
stream_with_context as stream_with_context,
url_for as url_for,
)
from .ctx import after_this_request as after_this_request
from .ctx import copy_current_app_context as copy_current_app_context
from .ctx import copy_current_request_context as copy_current_request_context
from .ctx import copy_current_websocket_context as copy_current_websocket_context
from .ctx import has_app_context as has_app_context
from .ctx import has_request_context as has_request_context
from .ctx import has_websocket_context as has_websocket_context
from .globals import current_app as current_app
from .globals import g as g
from .globals import request as request
from .globals import session as session
from .globals import websocket as websocket
from .helpers import abort as abort
from .helpers import flash as flash
from .helpers import get_flashed_messages as get_flashed_messages
from .helpers import get_template_attribute as get_template_attribute
from .helpers import make_push_promise as make_push_promise
from .helpers import make_response as make_response
from .helpers import redirect as redirect
from .helpers import send_file as send_file
from .helpers import send_from_directory as send_from_directory
from .helpers import stream_with_context as stream_with_context
from .helpers import url_for as url_for
from .json import jsonify as jsonify
from .signals import (
appcontext_popped as appcontext_popped,
appcontext_pushed as appcontext_pushed,
appcontext_tearing_down as appcontext_tearing_down,
before_render_template as before_render_template,
got_request_exception as got_request_exception,
got_websocket_exception as got_websocket_exception,
message_flashed as message_flashed,
request_finished as request_finished,
request_started as request_started,
request_tearing_down as request_tearing_down,
signals_available as signals_available,
template_rendered as template_rendered,
websocket_finished as websocket_finished,
websocket_started as websocket_started,
websocket_tearing_down as websocket_tearing_down,
)
from .templating import (
render_template as render_template,
render_template_string as render_template_string,
stream_template as stream_template,
stream_template_string as stream_template_string,
)
from .signals import appcontext_popped as appcontext_popped
from .signals import appcontext_pushed as appcontext_pushed
from .signals import appcontext_tearing_down as appcontext_tearing_down
from .signals import before_render_template as before_render_template
from .signals import got_request_exception as got_request_exception
from .signals import got_websocket_exception as got_websocket_exception
from .signals import message_flashed as message_flashed
from .signals import request_finished as request_finished
from .signals import request_started as request_started
from .signals import request_tearing_down as request_tearing_down
from .signals import signals_available as signals_available
from .signals import template_rendered as template_rendered
from .signals import websocket_finished as websocket_finished
from .signals import websocket_started as websocket_started
from .signals import websocket_tearing_down as websocket_tearing_down
from .templating import render_template as render_template
from .templating import render_template_string as render_template_string
from .templating import stream_template as stream_template
from .templating import stream_template_string as stream_template_string
from .typing import ResponseReturnValue as ResponseReturnValue
from .wrappers import Request as Request, Response as Response, Websocket as Websocket
from .wrappers import Request as Request
from .wrappers import Response as Response
from .wrappers import Websocket as Websocket
Loading

0 comments on commit 506e402

Please sign in to comment.