Skip to content

Commit

Permalink
Cleanup lgtm errors (aio-libs#3902)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov authored Jul 13, 2019
1 parent 637db70 commit 9957202
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .lgtm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
queries:
- exclude: py/unsafe-cyclic-import
5 changes: 2 additions & 3 deletions aiohttp/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,8 @@ async def _create_direct_connection(
continue

return transp, proto
else:
assert last_exc is not None
raise last_exc
assert last_exc is not None
raise last_exc

async def _create_proxy_connection(
self,
Expand Down
1 change: 0 additions & 1 deletion aiohttp/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ async def _run(self) -> None:

ctx = self._create_ssl_context(self.cfg) if self.cfg.is_ssl else None

runner = runner
assert runner is not None
server = runner.server
assert server is not None
Expand Down
3 changes: 1 addition & 2 deletions examples/fake_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ async def main(loop):
fake_facebook = FakeFacebook()
info = await fake_facebook.start()
resolver = FakeResolver(info)
connector = aiohttp.TCPConnector(resolver=resolver,
verify_ssl=False)
connector = aiohttp.TCPConnector(resolver=resolver, ssl=False)

async with aiohttp.ClientSession(connector=connector) as session:
async with session.get('https://graph.facebook.com/v2.7/me',
Expand Down
4 changes: 2 additions & 2 deletions examples/web_cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ async def logout(request):
return resp


def init(loop):
app = web.Application(loop=loop)
def init():
app = web.Application()
app.router.add_get('/', root)
app.router.add_get('/login', login)
app.router.add_get('/logout', logout)
Expand Down
13 changes: 9 additions & 4 deletions tools/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import aiohttp
import pathlib
from aiohttp import hdrs
import aiohttp.hdrs
import multidict
from collections import defaultdict
import io

headers = [getattr(hdrs, name)
for name in dir(hdrs)
if isinstance(getattr(hdrs, name), hdrs.istr)]
headers = [getattr(aiohttp.hdrs, name)
for name in dir(aiohttp.hdrs)
if isinstance(getattr(aiohttp.hdrs, name), multidict.istr)]


def factory():
return defaultdict(factory)
Expand All @@ -26,6 +28,7 @@ def build(headers):
d[TERMINAL] = hdr
return dct


dct = build(headers)


Expand Down Expand Up @@ -82,6 +85,7 @@ def build(headers):
}}
"""


def gen_prefix(prefix, k):
if k == '-':
return prefix + '_'
Expand Down Expand Up @@ -148,6 +152,7 @@ def gen_headers(headers):
# print(gen(dct).getvalue())
# print(gen_headers(headers).getvalue())


folder = pathlib.Path(aiohttp.__file__).parent

with (folder / '_find_header.c').open('w') as f:
Expand Down

0 comments on commit 9957202

Please sign in to comment.