From a1ed54c44db24e9ff797c20eff5a6cb7372a5270 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:57:26 +0200 Subject: [PATCH] added some typehints --- .../tools/publisher/models/publish.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/client/ayon_core/tools/publisher/models/publish.py b/client/ayon_core/tools/publisher/models/publish.py index 020436a466..b01cfb30f9 100644 --- a/client/ayon_core/tools/publisher/models/publish.py +++ b/client/ayon_core/tools/publisher/models/publish.py @@ -27,12 +27,17 @@ PLUGIN_ORDER_OFFSET = 0.5 class PublishErrorInfo: - def __init__(self, description, title, detail): - self.description = description - self.title = title - self.detail = detail + def __init__( + self, + description: str, + title: Optional[str], + detail: Optional[str] + ): + self.description: str = description + self.title: Optional[str] = title + self.detail: Optional[str] = detail - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: if not isinstance(other, PublishErrorInfo): return False return ( @@ -41,11 +46,11 @@ class PublishErrorInfo: and self.detail == other.detail ) - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: return not self.__eq__(other) @classmethod - def from_exception(cls, exc): + def from_exception(cls, exc) -> "PublishErrorInfo": if isinstance(exc, PublishArtistError): return cls( exc.description or exc.message, @@ -60,7 +65,7 @@ class PublishErrorInfo: "Something went wrong. Send report" " to your supervisor or Ynput team." ) - return cls(msg, title) + return cls(msg, title, None) class PublishReportMaker: