Use pylint for zendesk_admin.py

This commit is contained in:
Степаненко Ольга 2021-04-28 16:42:19 +03:00
parent e5460d90fc
commit 4666570177
2 changed files with 11 additions and 5 deletions

View File

@ -145,7 +145,7 @@ disable=print-statement,
exception-escape, exception-escape,
comprehension-escape, comprehension-escape,
E5110, E5110,
C045, C0415,
# Enable the message, report, category or checker with the given id(s). You can # Enable the message, report, category or checker with the given id(s). You can
@ -261,6 +261,9 @@ function-naming-style=snake_case
# Good variable names which should always be accepted, separated by a comma. # Good variable names which should always be accepted, separated by a comma.
good-names=i, good-names=i,
id,
e,
n,
j, j,
k, k,
ex, ex,

View File

@ -1,3 +1,7 @@
"""
Функционал работы администратора Zendesk.
"""
from typing import Optional, Dict from typing import Optional, Dict
from zenpy import Zenpy from zenpy import Zenpy
@ -35,7 +39,7 @@ class ZendeskAdmin:
:param email: Email пользователя :param email: Email пользователя
:return: Является ли зарегистрированным :return: Является ли зарегистрированным
""" """
return True if self.admin.search(email, type='user') else False return bool(self.admin.search(email, type='user'))
def get_user(self, email: str) -> ZenpyUser: def get_user(self, email: str) -> ZenpyUser:
""" """
@ -85,9 +89,8 @@ class ZendeskAdmin:
admin = Zenpy(**self.credentials) admin = Zenpy(**self.credentials)
try: try:
admin.search(self.credentials['email'], type='user') admin.search(self.credentials['email'], type='user')
except APIException: except APIException as invalid_data:
raise ValueError('invalid access_controller`s login data') raise ValueError('invalid access_controller`s login data') from invalid_data
return admin return admin