From 23c100b0d308ba0e3efdf2e0e202bfe21bb12ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Mon, 2 Oct 2023 15:26:36 +0200 Subject: [PATCH] Change: Move SortOrder to pontos.github.model.base SortOrder is either desc or asc and can be used at several places in the GitHub API. Therefore it is a base model class. --- pontos/github/models/base.py | 14 ++++++++++++++ pontos/github/models/search.py | 22 ++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/pontos/github/models/base.py b/pontos/github/models/base.py index ad8d65b2..d2541cc0 100644 --- a/pontos/github/models/base.py +++ b/pontos/github/models/base.py @@ -27,6 +27,7 @@ "FileStatus", "GitHubModel", "Permission", + "SortOrder", "Team", "TeamPrivacy", "TeamRole", @@ -306,3 +307,16 @@ class Event(Enum): WORKFLOW_CALL = "workflow_call" WORKFLOW_DISPATCH = "workflow_dispatch" WORKFLOW_RUN = "workflow_run" + + +class SortOrder(Enum): + """ + Sort order: asc or desc + + Attributes: + ASC: Use ascending sort order + DESC: Use descending sort order + """ + + ASC = "asc" + DESC = "desc" diff --git a/pontos/github/models/search.py b/pontos/github/models/search.py index 3edc613f..4abaf1e3 100644 --- a/pontos/github/models/search.py +++ b/pontos/github/models/search.py @@ -15,6 +15,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + +from abc import ABC +from enum import Enum + +from .base import SortOrder + __all__ = ( "InDescriptionQualifier", "InNameQualifier", @@ -31,22 +37,6 @@ "UserQualifier", ) -from abc import ABC -from enum import Enum - - -class SortOrder(Enum): - """ - Sort order: asc or desc - - Attributes: - ASC: Use ascending sort order - DESC: Use descending sort order - """ - - ASC = "asc" - DESC = "desc" - class RepositorySort(Enum): """