Changed code style to black

This commit is contained in:
2023-03-09 16:25:06 +01:00
parent 5b8951fe07
commit 3304339244
44 changed files with 3243 additions and 936 deletions

View File

@@ -1,5 +1,8 @@
class PlaceNotFoundError(Exception):
"""Query provided did not lead to any city or populated area"""
"""Query provided did not lead to any city or populated area"""
def __init__(self, query):
self.query = query
super().__init__(f"Could not find any place on geonames.org of feature classes A and P by query '{self.query}'")
super().__init__(
f"Could not find any place on geonames.org of feature classes A and P by query '{self.query}'"
)

View File

@@ -1,24 +1,38 @@
"""Exceptions that are meant to be used by HoloUser class
and other modules that handle those exceptions"""
class UserNotFoundError(Exception):
"""HoloUser could not find user with such an ID in database"""
def __init__(self, user, user_id):
self.user = user
self.user_id = user_id
super().__init__(f"User of type {type(self.user)} with id {self.user_id} was not found")
super().__init__(
f"User of type {type(self.user)} with id {self.user_id} was not found"
)
class UserInvalidError(Exception):
"""Provided to HoloUser object is not supported"""
"""Provided to HoloUser object is not supported"""
def __init__(self, user):
self.user = user
super().__init__(f"Could not find HoloUser by using {type(self.user)} as an input type")
super().__init__(
f"Could not find HoloUser by using {type(self.user)} as an input type"
)
class LabelTooLongError(Exception):
def __init__(self, label: str) -> None:
self.label = label
super().__init__(f"Could not set label to '{label}' because it is {len(label)} characters long (16 is maximum)")
super().__init__(
f"Could not set label to '{label}' because it is {len(label)} characters long (16 is maximum)"
)
class LabelSettingError(Exception):
def __init__(self, exp: Exception, trace: str) -> None:
super().__init__(f"❌ **Could not set label**\n\nException: `{exp}`\n\n**Traceback:**\n```\n{trace}\n```")
super().__init__(
f"❌ **Could not set label**\n\nException: `{exp}`\n\n**Traceback:**\n```\n{trace}\n```"
)