Skip to content

Commit e2ef9ce

Browse files
committed
Refactoring. Adding the None annotation to the return value
1 parent 7c1945b commit e2ef9ce

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎pyscreeze__examples/win_calc_clicker/main.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
DIR_BUTTONS = DIR / "buttons"
2020

2121

22-
def click(x, y, sleep_secs: float = 0.01):
22+
def click(x, y, sleep_secs: float = 0.01) -> None:
2323
win32api.SetCursorPos((x, y))
2424
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
2525
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
@@ -30,7 +30,7 @@ def click(x, y, sleep_secs: float = 0.01):
3030
BUTTON_BY_POSITION = dict()
3131

3232

33-
def init_button_positions(grayscale: bool = True):
33+
def init_button_positions(grayscale: bool = True) -> None:
3434
BUTTON_BY_POSITION.clear()
3535

3636
for path in DIR_BUTTONS.glob("*.png"):
@@ -44,7 +44,7 @@ def init_button_positions(grayscale: bool = True):
4444
BUTTON_BY_POSITION[button] = position
4545

4646

47-
def go(expression: str):
47+
def go(expression: str) -> None:
4848
init_button_positions()
4949

5050
for button in expression:
@@ -61,7 +61,7 @@ def go(expression: str):
6161
click(x, y)
6262

6363

64-
def show_test_calc():
64+
def show_test_calc() -> None:
6565
os.startfile("calc.exe")
6666
time.sleep(1)
6767

‎pythonnet__examples/OpenHardwareMonitorLib__Sensor_Temperature/main.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def initialize_openhardwaremonitor():
5757
return handle
5858

5959

60-
def fetch_stats(handle):
60+
def fetch_stats(handle) -> None:
6161
for i in handle.Hardware:
6262
i.Update()
6363

@@ -70,7 +70,7 @@ def fetch_stats(handle):
7070
parse_sensor(subsensor)
7171

7272

73-
def parse_sensor(sensor):
73+
def parse_sensor(sensor) -> None:
7474
if sensor.Value is None:
7575
return
7676

‎qbittorrent_examples/check_changes_in_torrent.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_rutor_torrent_download_info(torrent_url):
4545
return torrent_url.replace("/torrent/", "/download/"), magnet_url, info_hash
4646

4747

48-
def remove_previous_torrent_from_qbittorrent(qb, new_info_hash):
48+
def remove_previous_torrent_from_qbittorrent(qb, new_info_hash) -> None:
4949
info_hash_by_name_dict = {
5050
torrent["hash"]: torrent["name"] for torrent in qb.torrents()
5151
}

‎qbittorrent_examples/common.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
from config import IP_HOST, USER, PASSWORD
1717

1818

19-
def print_table(rows: list[list[str]], headers: list[str], show_index=True):
19+
def print_table(rows: list[list[str]], headers: list[str], show_index=True) -> None:
2020
if show_index:
2121
show_index = range(1, len(rows) + 1)
2222

2323
text = tabulate(rows, headers=headers, tablefmt="grid", showindex=show_index)
2424
print(text)
2525

2626

27-
def print_files_table(files: list[dict]):
27+
def print_files_table(files: list[dict]) -> None:
2828
rows = [
2929
(file["name"], sizeof_fmt(file["size"]))
3030
for file in sorted(files, key=lambda x: x["name"])
@@ -33,7 +33,7 @@ def print_files_table(files: list[dict]):
3333
print_table(rows, headers)
3434

3535

36-
def print_torrents(torrents: list[dict]):
36+
def print_torrents(torrents: list[dict]) -> None:
3737
total_size = 0
3838

3939
for i, torrent in enumerate(torrents, 1):

‎qbittorrent_examples/torrent_list__table_gui_pyqt.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class TorrentInfoWidget(QTableWidget):
16-
def __init__(self):
16+
def __init__(self) -> None:
1717
super().__init__()
1818

1919
self.setEditTriggers(QTableWidget.NoEditTriggers)
@@ -27,7 +27,7 @@ def __init__(self):
2727
self.horizontalHeader().setStretchLastSection(True)
2828
self.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
2929

30-
def fill(self, torrent_details: dict):
30+
def fill(self, torrent_details: dict) -> None:
3131
while self.rowCount():
3232
self.removeRow(0)
3333

@@ -40,7 +40,7 @@ def fill(self, torrent_details: dict):
4040

4141

4242
class MainWindow(QMainWindow):
43-
def __init__(self):
43+
def __init__(self) -> None:
4444
super().__init__()
4545

4646
self.table_torrent = QTableWidget()
@@ -57,7 +57,7 @@ def __init__(self):
5757

5858
self.setCentralWidget(splitter)
5959

60-
def fill_table(self):
60+
def fill_table(self) -> None:
6161
qb = get_client()
6262
torrents = qb.torrents()
6363
if not torrents:
@@ -80,7 +80,7 @@ def fill_table(self):
8080

8181
self.table_torrent.setItem(row, column, item)
8282

83-
def fill_torrent_info(self):
83+
def fill_torrent_info(self) -> None:
8484
items = self.table_torrent.selectedItems()
8585
if not items:
8686
return

0 commit comments

Comments
 (0)