diff --git a/bugme.py b/bugme.py index 901f2bc..6229bf9 100755 --- a/bugme.py +++ b/bugme.py @@ -284,7 +284,7 @@ def print_issues( # pylint: disable=too-many-arguments print("") -def main(): +def main() -> None: """ Main function """ diff --git a/services/__init__.py b/services/__init__.py index 3d550f7..3815c16 100644 --- a/services/__init__.py +++ b/services/__init__.py @@ -164,13 +164,13 @@ class Service(ABC): Service class to abstract methods """ - def __init__(self, url: str): + def __init__(self, url: str) -> None: url = url.rstrip("/") self.url = url if url.startswith("https://") else f"https://{url}" self.tag = "".join([s[0] for s in str(urlparse(self.url).hostname).split(".")]) @abstractmethod - def close(self): + def close(self) -> None: """ Close session """ @@ -234,7 +234,7 @@ class Generic(Service): Generic class for services using python requests """ - def __init__(self, url: str, token: str | None): + def __init__(self, url: str, token: str | None) -> None: super().__init__(url) self.issue_api_url = self.pr_api_url = "OVERRIDE" self.issue_web_url = self.pr_web_url = "OVERRIDE" @@ -323,7 +323,7 @@ def get_page(page: int) -> list[dict[str, Any]]: ) return entries - def close(self): + def close(self) -> None: self.session.close() def get_issue(self, issue_id: str = "", **kwargs) -> Issue | None: diff --git a/services/bugzilla.py b/services/bugzilla.py index 3746a73..9b9a5c8 100644 --- a/services/bugzilla.py +++ b/services/bugzilla.py @@ -20,7 +20,7 @@ class MyBugzilla(Service): Bugzilla """ - def __init__(self, url: str, creds: dict): + def __init__(self, url: str, creds: dict) -> None: super().__init__(url) options = { # "force_rest": True, @@ -41,7 +41,7 @@ def __init__(self, url: str, creds: dict): if path: self.url = f"{self.url}/bugzilla" - def close(self): + def close(self) -> None: try: self.client.disconnect() except (AttributeError, BugzillaError): diff --git a/services/gitea.py b/services/gitea.py index a4f9586..bc82570 100644 --- a/services/gitea.py +++ b/services/gitea.py @@ -17,7 +17,7 @@ class MyGitea(Generic): Gitea """ - def __init__(self, url: str, creds: dict): + def __init__(self, url: str, creds: dict) -> None: super().__init__(url, token=creds.get("token")) self.issue_api_url = f"{self.url}/api/v1/repos/{{repo}}/issues/{{issue}}" self.issue_web_url = f"{self.url}/{{repo}}/issues/{{issue}}" diff --git a/services/github.py b/services/github.py index 6db160a..ac82a7c 100644 --- a/services/github.py +++ b/services/github.py @@ -20,7 +20,7 @@ class MyGithub(Service): Github """ - def __init__(self, url: str, creds: dict): + def __init__(self, url: str, creds: dict) -> None: super().__init__(url) options: dict[str, Any] = { # NOTE: Uncomment when latest PyGithub is published on Tumbleweed @@ -34,7 +34,7 @@ def __init__(self, url: str, creds: dict): if os.getenv("DEBUG"): logging.getLogger("github").setLevel(logging.DEBUG) - def close(self): + def close(self) -> None: try: self.client.close() except (AttributeError, GithubException): diff --git a/services/gitlab.py b/services/gitlab.py index 542b9ff..08dedb3 100644 --- a/services/gitlab.py +++ b/services/gitlab.py @@ -23,7 +23,7 @@ class MyGitlab(Service): Gitlab """ - def __init__(self, url: str, creds: dict): + def __init__(self, url: str, creds: dict) -> None: super().__init__(url) options: dict[str, Any] = { "ssl_verify": os.environ.get("REQUESTS_CA_BUNDLE", True), @@ -40,7 +40,7 @@ def __init__(self, url: str, creds: dict): except (GitlabError, RequestException): pass - def close(self): + def close(self) -> None: try: self.client.session.close() except (AttributeError, GitlabError): diff --git a/services/jira.py b/services/jira.py index 8038cf9..103a530 100644 --- a/services/jira.py +++ b/services/jira.py @@ -21,14 +21,14 @@ class MyJira(Service): Jira """ - def __init__(self, url: str, creds: dict): + def __init__(self, url: str, creds: dict) -> None: super().__init__(url) self.client = Jira(url=self.url, **creds) self.client._session.headers["User-Agent"] = f"bugme/{VERSION}" if os.getenv("DEBUG"): self.client._session.hooks["response"].append(debugme) - def close(self): + def close(self) -> None: try: self.client.session.close() except AttributeError: diff --git a/services/pagure.py b/services/pagure.py index d6c1d28..ce64d09 100644 --- a/services/pagure.py +++ b/services/pagure.py @@ -17,7 +17,7 @@ class MyPagure(Generic): Pagure """ - def __init__(self, url: str, creds: dict): + def __init__(self, url: str, creds: dict) -> None: super().__init__(url, token=creds.get("token")) self.issue_api_url = f"{self.url}/api/0/{{repo}}/issue/{{issue}}" self.issue_web_url = f"{self.url}/{{repo}}/issue/{{issue}}" diff --git a/services/redmine.py b/services/redmine.py index 3b847a0..88c4dd5 100644 --- a/services/redmine.py +++ b/services/redmine.py @@ -20,7 +20,7 @@ class MyRedmine(Service): Redmine """ - def __init__(self, url: str, creds: dict): + def __init__(self, url: str, creds: dict) -> None: super().__init__(url) options = { "raise_attr_exception": False, @@ -31,7 +31,7 @@ def __init__(self, url: str, creds: dict): if os.getenv("DEBUG"): self.client.engine.session.hooks["response"].append(debugme) - def close(self): + def close(self) -> None: try: self.client.engine.session.close() except AttributeError: