Skip to content

Commit

Permalink
Made lgtm happy
Browse files Browse the repository at this point in the history
  • Loading branch information
WisdomPill committed Nov 18, 2020
1 parent 9f08ad1 commit c3dc373
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
1 change: 0 additions & 1 deletion examples/background_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async def listen_to_redis(app: web.Application) -> None:


async def start_background_tasks(app: web.Application) -> None:
loop = asyncio.get_event_loop()
app["redis_listener"] = app.loop.create_task(listen_to_redis(app))


Expand Down
3 changes: 1 addition & 2 deletions examples/client_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import asyncio
import signal
import sys
from asyncio import AbstractEventLoop

import aiohttp


async def start_client(loop: AbstractEventLoop, url: str) -> None:
async def start_client(loop: asyncio.AbstractEventLoop, url: str) -> None:
name = input("Please enter your name: ")

# input reader
Expand Down
14 changes: 5 additions & 9 deletions examples/fake_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
import ssl
from typing import Any, Dict, List, Union

import aiohttp
from aiohttp import web
from aiohttp.abc import AbstractResolver
from aiohttp.resolver import DefaultResolver
from aiohttp.test_utils import unused_port
from aiohttp import ClientSession, TCPConnector, web, resolver, test_utils


class FakeResolver:
Expand All @@ -18,7 +14,7 @@ class FakeResolver:
def __init__(self, fakes: Dict[str, int]) -> None:
"""fakes -- dns -> port dict"""
self._fakes = fakes
self._resolver = DefaultResolver()
self._resolver = resolver.DefaultResolver()

async def resolve(
self,
Expand Down Expand Up @@ -63,7 +59,7 @@ def __init__(self) -> None:
self.ssl_context.load_cert_chain(str(ssl_cert), str(ssl_key))

async def start(self) -> Dict[str, int]:
port = unused_port()
port = test_utils.unused_port()
await self.runner.setup()
site = web.TCPSite(self.runner, "127.0.0.1", port, ssl_context=self.ssl_context)
await site.start()
Expand Down Expand Up @@ -104,9 +100,9 @@ async def main() -> None:
fake_facebook = FakeFacebook()
info = await fake_facebook.start()
resolver = FakeResolver(info)
connector = aiohttp.TCPConnector(resolver=resolver, ssl=False)
connector = TCPConnector(resolver=resolver, ssl=False)

async with aiohttp.ClientSession(connector=connector) as session:
async with ClientSession(connector=connector) as session:
async with session.get(
"https://graph.facebook.com/v2.7/me", params={"access_token": token}
) as resp:
Expand Down
5 changes: 2 additions & 3 deletions examples/lowlevel_srv.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import asyncio
from asyncio import AbstractEventLoop

from aiohttp import web
from aiohttp.web_request import BaseRequest
from aiohttp import web, web_request


async def handler(request: BaseRequest) -> web.StreamResponse:
async def handler(request: web_request.BaseRequest) -> web.StreamResponse:
return web.Response(text="OK")


Expand Down

0 comments on commit c3dc373

Please sign in to comment.