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

Commit8273450

Browse files
committed
refactor: use super().get_id()
Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>
1 parente7b85e0 commit8273450

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎gitlab/v4/objects/job_token_scope.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ def get_id(self) -> int:
4444
"""Returns the id of the resource. This override deals with
4545
the fact that either an `id` or a `target_project_id` attribute
4646
is returned by the server depending on the endpoint called."""
47-
try:
48-
returncast(int,getattr(self,self._id_attr))
49-
exceptAttributeError:
50-
returncast(int,self.id)
47+
project_id=cast(int,super().get_id())
48+
ifproject_idisnotNone:
49+
returnproject_id
50+
returncast(int,self.id)
5151

5252

5353
classAllowlistProjectManager(ListMixin,CreateMixin,DeleteMixin,RESTManager):
@@ -64,10 +64,10 @@ def get_id(self) -> int:
6464
"""Returns the id of the resource. This override deals with
6565
the fact that either an `id` or a `target_group_id` attribute
6666
is returned by the server depending on the endpoint called."""
67-
try:
68-
returncast(int,getattr(self,self._id_attr))
69-
exceptAttributeError:
70-
returncast(int,self.id)
67+
group_id=cast(int,super().get_id())
68+
ifgroup_idisnotNone:
69+
returngroup_id
70+
returncast(int,self.id)
7171

7272

7373
classAllowlistGroupManager(ListMixin,CreateMixin,DeleteMixin,RESTManager):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp