Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb0dbd02

Browse files
chore: moveRequiredOptional to thegitlab.types module
By having `RequiredOptional` in the `gitlab.base` module it makes itdifficult with circular imports. Move it to the `gitlab.types`module which has no dependencies on any other gitlab module.
1 parent1f17349 commitb0dbd02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+107
-64
lines changed

‎gitlab/base.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
importimportlib
1919
importpprint
2020
importtextwrap
21-
fromdataclassesimportdataclass
2221
fromtypesimportModuleType
2322
fromtypingimportAny,Dict,Iterable,Optional,Tuple,Type,Union
2423

@@ -29,7 +28,6 @@
2928
from .clientimportGitlab,GitlabList
3029

3130
__all__= [
32-
"RequiredOptional",
3331
"RESTObject",
3432
"RESTObjectList",
3533
"RESTManager",
@@ -330,12 +328,6 @@ def total(self) -> Optional[int]:
330328
returnself._list.total
331329

332330

333-
@dataclass(frozen=True)
334-
classRequiredOptional:
335-
required:Tuple[str, ...]= ()
336-
optional:Tuple[str, ...]= ()
337-
338-
339331
classRESTManager:
340332
"""Base class for CRUD operations on objects.
341333
@@ -345,8 +337,8 @@ class RESTManager:
345337
``_obj_cls``: The class of objects that will be created
346338
"""
347339

348-
_create_attrs:RequiredOptional=RequiredOptional()
349-
_update_attrs:RequiredOptional=RequiredOptional()
340+
_create_attrs:g_types.RequiredOptional=g_types.RequiredOptional()
341+
_update_attrs:g_types.RequiredOptional=g_types.RequiredOptional()
350342
_path:Optional[str]=None
351343
_obj_cls:Optional[Type[RESTObject]]=None
352344
_from_parent_attrs:Dict[str,Any]= {}

‎gitlab/types.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18-
fromtypingimportAny,Optional,TYPE_CHECKING
18+
importdataclasses
19+
fromtypingimportAny,Optional,Tuple,TYPE_CHECKING
20+
21+
22+
@dataclasses.dataclass(frozen=True)
23+
classRequiredOptional:
24+
required:Tuple[str, ...]= ()
25+
optional:Tuple[str, ...]= ()
1926

2027

2128
classGitlabAttribute:

‎gitlab/v4/objects/appearance.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
fromtypingimportAny,cast,Dict,Optional,Union
22

33
fromgitlabimportexceptionsasexc
4-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
4+
fromgitlab.baseimportRESTManager,RESTObject
55
fromgitlab.mixinsimportGetWithoutIdMixin,SaveMixin,UpdateMixin
6+
fromgitlab.typesimportRequiredOptional
67

78
__all__= [
89
"ApplicationAppearance",

‎gitlab/v4/objects/applications.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
1+
fromgitlab.baseimportRESTManager,RESTObject
22
fromgitlab.mixinsimportCreateMixin,DeleteMixin,ListMixin,ObjectDeleteMixin
3+
fromgitlab.typesimportRequiredOptional
34

45
__all__= [
56
"Application",

‎gitlab/v4/objects/award_emojis.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
fromtypingimportAny,cast,Union
22

3-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
3+
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportNoUpdateMixin,ObjectDeleteMixin
5+
fromgitlab.typesimportRequiredOptional
56

67
__all__= [
78
"GroupEpicAwardEmoji",

‎gitlab/v4/objects/badges.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
fromtypingimportAny,cast,Union
22

3-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
3+
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportBadgeRenderMixin,CRUDMixin,ObjectDeleteMixin,SaveMixin
5+
fromgitlab.typesimportRequiredOptional
56

67
__all__= [
78
"GroupBadge",

‎gitlab/v4/objects/boards.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
fromtypingimportAny,cast,Union
22

3-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
3+
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportCRUDMixin,ObjectDeleteMixin,SaveMixin
5+
fromgitlab.typesimportRequiredOptional
56

67
__all__= [
78
"GroupBoardList",

‎gitlab/v4/objects/branches.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
fromtypingimportAny,cast,Union
22

3-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
3+
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportNoUpdateMixin,ObjectDeleteMixin
5+
fromgitlab.typesimportRequiredOptional
56

67
__all__= [
78
"ProjectBranch",

‎gitlab/v4/objects/broadcast_messages.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
fromtypingimportAny,cast,Union
22

3-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
3+
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportCRUDMixin,ObjectDeleteMixin,SaveMixin
5+
fromgitlab.typesimportRequiredOptional
56

67
__all__= [
78
"BroadcastMessage",

‎gitlab/v4/objects/clusters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
fromtypingimportAny,cast,Dict,Optional,Union
22

33
fromgitlabimportexceptionsasexc
4-
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
4+
fromgitlab.baseimportRESTManager,RESTObject
55
fromgitlab.mixinsimportCreateMixin,CRUDMixin,ObjectDeleteMixin,SaveMixin
6+
fromgitlab.typesimportRequiredOptional
67

78
__all__= [
89
"GroupCluster",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp