Skip to content

Commit 5271874

Browse files
author
andrew (from workstation)
committed
apply flake8 suggestions
1 parent 70c090d commit 5271874

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

.flake8

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length=140

.github/workflows/flake8.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "flake8"
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Python 3.8
12+
uses: actions/setup-python@v1
13+
with:
14+
python-version: 3.8
15+
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install flake8
20+
pip install -r requirements.txt
21+
22+
- name: Analysing the code with flake8
23+
run: |
24+
pylint smart_tv_telegram/
25+
shell: bash

smart_tv_telegram/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
]
99

1010

11-
class Config:
11+
class Config:
1212
_api_id: int
1313
_api_hash: str
1414
_token: str

smart_tv_telegram/http.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def _get_stream_transports(self, local_token: int) -> typing.Set[asyncio.Transpo
108108
return self._stream_trasports[local_token] if local_token in self._stream_trasports else set()
109109

110110
async def _timeout_handler(self, message_id: int, chat_id: int, local_token: int, size: int):
111+
_debounce: typing.Optional[AsyncDebounce] = None # avoid garbage collector
112+
111113
if all(t.is_closing() for t in self._get_stream_transports(local_token)):
112114
blocks = (size // self._config.block_size) + 1
113115

@@ -120,10 +122,8 @@ async def _timeout_handler(self, message_id: int, chat_id: int, local_token: int
120122
remain_blocks = blocks - len(self._downloaded_blocks[local_token])
121123
del self._downloaded_blocks[local_token]
122124

123-
_debounce = None
124-
125125
if local_token in self._stream_debounce:
126-
_debounce = self._stream_debounce[local_token] # avoid garbage collector
126+
_debounce = self._stream_debounce[local_token]
127127
del self._stream_debounce[local_token]
128128

129129
if local_token in self._stream_trasports:
@@ -140,6 +140,8 @@ async def _timeout_handler(self, message_id: int, chat_id: int, local_token: int
140140
if local_token in self._stream_debounce:
141141
self._stream_debounce[local_token].reschedule()
142142

143+
del _debounce
144+
143145
async def _stream_handler(self, request: Request) -> typing.Optional[Response]:
144146
_message_id: str = request.match_info["message_id"]
145147

0 commit comments

Comments
 (0)