Skip to content

Commit

Permalink
Move server implementation to server.py (#866)
Browse files Browse the repository at this point in the history
* Move server implementation to server.py

* Lint
  • Loading branch information
florimondmanca authored Nov 25, 2020
1 parent 16d12f3 commit f1bcade
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
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

0 comments on commit f1bcade

Please sign in to comment.