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

Move server implementation to server.py #866

Merged
merged 2 commits into from
Nov 25, 2020
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
Empty file removed uvicorn/_impl/__init__.py
Empty file.
6 changes: 1 addition & 5 deletions uvicorn/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import click

import uvicorn
from uvicorn._impl.asyncio import AsyncioServer, AsyncioServerState
from uvicorn.config import (
HTTP_PROTOCOLS,
INTERFACES,
Expand All @@ -19,6 +18,7 @@
WS_PROTOCOLS,
Config,
)
from uvicorn.server import Server, ServerState # noqa: F401 # Used to be defined here.
from uvicorn.supervisors import ChangeReload, Multiprocess

LEVEL_CHOICES = click.Choice(LOG_LEVELS.keys())
Expand All @@ -30,10 +30,6 @@

logger = logging.getLogger("uvicorn.error")

# Aliases for backwards compatibility. These used to be defined here.
Server = AsyncioServer
ServerState = AsyncioServerState


def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
Expand Down
6 changes: 3 additions & 3 deletions uvicorn/_impl/asyncio.py → uvicorn/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
logger = logging.getLogger("uvicorn.error")


class AsyncioServerState:
class ServerState:
"""
Shared servers state that is available between all protocol instances.
"""
Expand All @@ -31,10 +31,10 @@ def __init__(self):
self.default_headers = []


class AsyncioServer:
class Server:
def __init__(self, config):
self.config = config
self.server_state = AsyncioServerState()
self.server_state = ServerState()

self.started = False
self.should_exit = False
Expand Down