Skip to content

Commit

Permalink
removed unused arguments and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Apr 28, 2019
1 parent 5a7f9e7 commit 951b4c3
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions engineio/async_drivers/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,18 @@ def __init__(self, engineio_server, other_asgi_app=None,
async def __call__(self, scope, receive, send):
if scope['type'] in ['http', 'websocket'] and \
scope['path'].startswith('/{0}/'.format(self.engineio_path)):
await self.engineio_asgi_app(scope, receive, send)
await self.engineio_server.handle_request(scope, receive, send)
elif scope['type'] == 'http' and scope['path'] in self.static_files:
await self.serve_static_file(scope, receive, send)
elif self.other_asgi_app is not None:
await self.other_asgi_app(scope, receive, send)
elif scope['type'] == 'lifespan':
await self.lifespan(scope, receive, send)
await self.lifespan(receive, send)
else:
await self.not_found(scope, receive, send)
await self.not_found(receive, send)

async def engineio_asgi_app(self, scope, receive, send):
await self.engineio_server.handle_request(scope, receive, send)

async def serve_static_file(self, scope, receive, send):
async def serve_static_file(self, scope, receive,
send): # pragma: no cover
event = await receive()
if event['type'] == 'http.request':
if scope['path'] in self.static_files:
Expand All @@ -76,14 +74,14 @@ async def serve_static_file(self, scope, receive, send):
await send({'type': 'http.response.body',
'body': payload})

async def lifespan(self, scope, receive, send):
async def lifespan(self, receive, send):
event = await receive()
if event['type'] == 'lifespan.startup':
await send({'type': 'lifespan.startup.complete'})
elif event['type'] == 'lifespan.shutdown':
await send({'type': 'lifespan.shutdown.complete'})

async def not_found(self, scope, receive, send):
async def not_found(self, receive, send):
"""Return a 404 Not Found error to the client."""
await send({'type': 'http.response.start',
'status': 404,
Expand Down

0 comments on commit 951b4c3

Please sign in to comment.