From 8e82dc8639e5833f8a4187981b6d09cb46398f2d Mon Sep 17 00:00:00 2001 From: Sadra Yahyapour Date: Tue, 19 Nov 2024 14:02:08 +0330 Subject: [PATCH] refactored --- pyaction/issues/connector.py | 12 ++++++------ pyaction/issues/rendering.py | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pyaction/issues/connector.py b/pyaction/issues/connector.py index 12cf9f7..d4b74fe 100644 --- a/pyaction/issues/connector.py +++ b/pyaction/issues/connector.py @@ -8,23 +8,23 @@ class IssueForm: def __init__(self, repository: str, number: int, token: str | None = None) -> None: """ - initializer + Initializer. Args: - repository (str): repository name in the form of username/repository - number (int): issue number/ID + repository (str): Repository name in the form of username/repository. + number (int): Issue number/ID. token (str, optional): GITHUB_TOKEN token. Defaults to None. """ - self._token = token self.repository = repository self.number = number + self._token = token def render(self) -> dict[str, str]: """ - renders the issue body + Renders the issue body. Returns: - OrderedDict: the issue body in form of dictionary + dict[str, str]: The issue body in form of dictionary. """ headers = {"Accept": "application/vnd.github+json"} diff --git a/pyaction/issues/rendering.py b/pyaction/issues/rendering.py index 1a8b5cb..fa058dd 100644 --- a/pyaction/issues/rendering.py +++ b/pyaction/issues/rendering.py @@ -1,24 +1,24 @@ -from __future__ import annotations - import re +from typing import Dict class IssueTemplate: def __init__(self, context: str) -> None: - """initializer + """ + Initializer. Args: - context (str): issue body + context (str): The issue body. """ self.context = context - def to_dict(self) -> dict[str, str]: - """converting the issue body to dictionary + def to_dict(self) -> Dict[str, str]: + """ + Converting the issue body to dictionary. Returns: - Dict[str, str]: issue body in form of dictionary + Dict[str, str]: Issue body in form of dictionary. """ - pattern = re.compile("### ([^\n]+)\n\n([^#]+)") matches = pattern.findall(self.context)