-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify interface for labels Needed for packit/packit-service#2334 RELEASE NOTES BEGIN Interface for labels was unified and labels property for PullRequest and Issue now return list of PRLabel and IssueLabel respectively. RELEASE NOTES END Reviewed-by: Matej Focko
- Loading branch information
Showing
14 changed files
with
164 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
from typing import Union | ||
|
||
from github.Label import Label as _GithubLabel | ||
|
||
from ogr.abstract import Issue, IssueLabel, Label, PRLabel, PullRequest | ||
|
||
|
||
class GithubLabel(Label): | ||
def __init__( | ||
self, | ||
raw_label: _GithubLabel, | ||
parent: Union[PullRequest, Issue], | ||
) -> None: | ||
super().__init__(parent) | ||
self._raw_label = raw_label | ||
|
||
def __str__(self) -> str: | ||
return f'GithubLabel(name="{self.name}")' | ||
|
||
@property | ||
def name(self): | ||
return self._raw_label.name | ||
|
||
|
||
class GithubPRLabel(GithubLabel, PRLabel): | ||
pass | ||
|
||
|
||
class GithubIssueLabel(GithubLabel, IssueLabel): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
from typing import Union | ||
|
||
from ogr.abstract import Issue, IssueLabel, Label, PRLabel, PullRequest | ||
|
||
|
||
class GitlabLabel(Label): | ||
def __init__(self, name: str, parent: Union[PullRequest, Issue]) -> None: | ||
super().__init__(parent) | ||
self._name = name | ||
|
||
def __str__(self) -> str: | ||
return f'GitlabLabel(name="{self.name}")' | ||
|
||
@property | ||
def name(self): | ||
return self._name | ||
|
||
|
||
class GitlabPRLabel(GitlabLabel, PRLabel): | ||
pass | ||
|
||
|
||
class GitlabIssueLabel(GitlabLabel, IssueLabel): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
from typing import Union | ||
|
||
from ogr.abstract import Issue, IssueLabel, Label, PRLabel, PullRequest | ||
|
||
|
||
class PagureLabel(Label): | ||
def __init__(self, name: str, parent: Union[PullRequest, Issue]) -> None: | ||
super().__init__(parent) | ||
self._name = name | ||
|
||
def __str__(self) -> str: | ||
return f'PagureLabel(name="{self.name}")' | ||
|
||
@property | ||
def name(self): | ||
return self._name | ||
|
||
|
||
class PagurePRLabel(PagureLabel, PRLabel): | ||
pass | ||
|
||
|
||
class PagureIssueLabel(PagureLabel, IssueLabel): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters