Skip to content

Commit 73692c8

Browse files
committed
utils-logger implimented, black
1 parent aba07f0 commit 73692c8

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

commits_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'branch',
1818
)
1919

20+
2021
def log_repository_commits(repository: Repository, csv_name, start, finish, branch):
2122
branches = []
2223
match branch:

contributors_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'site_admin',
2222
)
2323

24+
2425
def log_repository_contributors(repository: Repository, csv_name: str):
2526
contributors_stats = get_contributors_stats(repository)
2627

invites_parser.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
)
1111
TIMEDELTA = 0.05
1212

13+
1314
def log_inviter(repo, invite, writer):
1415
invite_info = [
1516
repo.full_name,
@@ -20,14 +21,15 @@ def log_inviter(repo, invite, writer):
2021
writer.writerow(invite_info)
2122
print(invite_info)
2223

24+
2325
def log_repository_invitations(repository: Repository, csv_name):
2426
invitations = repository.get_pending_invitations()
2527
for invite in invitations:
2628
invite_info = {
27-
'repository name': repository.full_name,
28-
'invited login': invite.invitee.login,
29-
'invite creation date': invite.created_at.strftime("%d/%m/%Y, %H:%M:%S"),
30-
'invitation url': invite.html_url,
29+
'repository name': repository.full_name,
30+
'invited login': invite.invitee.login,
31+
'invite creation date': invite.created_at.strftime("%d/%m/%Y, %H:%M:%S"),
32+
'invitation url': invite.html_url,
3133
}
3234
logger.log_to_csv(csv_name, FIELDNAMES, invite_info)
3335
logger.log_to_stdout(invite_info)

issues_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def log_repository_issues(repository: Repository, csv_name, token, start, finish
168168
else:
169169
logger.log_to_csv(csv_name, FIELDNAMES, info_tmp)
170170
logger.log_to_stdout(info_tmp)
171-
171+
172172
sleep(TIMEDELTA)
173173

174174

utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
MIN_SIDE_PADDING = 4
55
SIDE_WHITE_SPACES = 1
66

7+
78
class logger:
89
@staticmethod
910
def log_title(title: str, title_len: int = TITLE_LEN):
@@ -15,9 +16,11 @@ def log_title(title: str, title_len: int = TITLE_LEN):
1516
padding = title_len - (len(title) + SIDE_WHITE_SPACES * 2)
1617

1718
right_padding = (padding + 1) // 2
18-
left_padding = padding // 2
19+
left_padding = padding // 2
1920

20-
print(f"{left_padding * '='}{SIDE_WHITE_SPACES * ' '}{title}{SIDE_WHITE_SPACES * ' '}{right_padding * '='}")
21+
print(
22+
f"{left_padding * '='}{SIDE_WHITE_SPACES * ' '}{title}{SIDE_WHITE_SPACES * ' '}{right_padding * '='}"
23+
)
2124

2225
@staticmethod
2326
def log_to_csv(csv_name: str, field_names: tuple[str], row: dict | None = None):
@@ -30,7 +33,7 @@ def log_to_csv(csv_name: str, field_names: tuple[str], row: dict | None = None):
3033
row = field_names
3134
else:
3235
raise TypeError(f"row has type {type(row)} but must be [ dict | None ]")
33-
36+
3437
writer.writerow(row)
3538

3639
file.close()
@@ -43,7 +46,7 @@ def log_to_stdout(info: dict):
4346
def log_error(error: str):
4447
# или использовать logging, как в interface_wrapper
4548
pass
46-
49+
4750
@staticmethod
4851
def log_warning(warning: str):
49-
pass
52+
pass

0 commit comments

Comments
 (0)