1 | import aiohttp |
||
0 ignored issues
–
show
|
|||
2 | import asyncio |
||
3 | |||
4 | |||
5 | @asyncio.coroutine |
||
6 | def get_markup(url): |
||
7 | response = yield from aiohttp.get(url) |
||
8 | markup = yield from response.text() |
||
9 | return markup |
||
10 | |||
11 | |||
12 | class Buffer: |
||
13 | def __init__(self, get_item_class, queue_size=20): |
||
14 | self.queue_size = queue_size |
||
15 | self.queue = asyncio.Queue(maxsize=self.queue_size) |
||
16 | self.get_item_class = get_item_class |
||
17 | |||
18 | @asyncio.coroutine |
||
19 | def populate(self): |
||
20 | for _ in range(self.queue_size): |
||
21 | yield from asyncio.async(self._put_new_entry()) |
||
22 | |||
23 | @asyncio.coroutine |
||
24 | def get(self): |
||
25 | item = yield from self.queue.get() |
||
26 | yield from asyncio.async(self._put_new_entry()) |
||
27 | return item |
||
28 | |||
29 | @asyncio.coroutine |
||
30 | def _put_new_entry(self): |
||
31 | item = yield from self.get_item_class.get() |
||
32 | self.queue.put_nowait(item) |
||
33 |
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.