Use pylint for extra_func.py
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Вспомогательные функции со списками пользователей, статистикой и т.д.
|
||||
"""
|
||||
import logging
|
||||
from datetime import timedelta, datetime, date
|
||||
from typing import Optional, Union
|
||||
@@ -44,7 +47,7 @@ def make_engineer(user_profile: UserProfile, who_changes: User) -> None:
|
||||
update_role(user_profile, ROLES['engineer'])
|
||||
|
||||
|
||||
def make_light_agent(user_profile: UserProfile) -> None:
|
||||
def make_light_agent(user_profile: UserProfile, who_changes: User) -> None:
|
||||
"""
|
||||
Функция устанавливает пользователю роль легкого агента.
|
||||
|
||||
@@ -66,7 +69,6 @@ def make_light_agent(user_profile: UserProfile) -> None:
|
||||
else:
|
||||
ticket.assignee = None
|
||||
ticket.group_id = zenpy.buffer_group_id
|
||||
|
||||
zenpy.admin.tickets.update(tickets.values)
|
||||
|
||||
attempts, success = 5, False
|
||||
@@ -405,8 +407,7 @@ class StatisticData:
|
||||
|
||||
def _init_data(self) -> None:
|
||||
"""
|
||||
Функция возвращает логи в диапазоне дат
|
||||
start_date - end_date для пользователя с указанным email.
|
||||
Функция возвращает логи в диапазоне дат start_date - end_date для пользователя с указанным email.
|
||||
|
||||
:return: Данные о смене статусов пользователя.
|
||||
Если пользователь не найден или интервал времени некорректен - ошибку.
|
||||
@@ -434,7 +435,7 @@ class StatisticData:
|
||||
self.clear_statistic()
|
||||
if not self.get_data():
|
||||
self.warnings += ['Не обнаружены изменения роли в данном промежутке']
|
||||
return None
|
||||
return
|
||||
first_log, last_log = self.data[0], self.data[len(self.data) - 1]
|
||||
|
||||
if first_log.old_role == ROLES['engineer']:
|
||||
@@ -518,6 +519,9 @@ class StatisticData:
|
||||
|
||||
|
||||
class DatabaseHandler(logging.Handler):
|
||||
"""
|
||||
Класс записи изменений ролей в базу данных.
|
||||
"""
|
||||
def __init__(self):
|
||||
logging.Handler.__init__(self)
|
||||
|
||||
@@ -547,6 +551,9 @@ class DatabaseHandler(logging.Handler):
|
||||
|
||||
|
||||
class CsvFormatter(logging.Formatter):
|
||||
"""
|
||||
Класс преобразования смены ролей пользователей в строковый формат.
|
||||
"""
|
||||
def __init__(self):
|
||||
logging.Formatter.__init__(self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user