@@ -101,7 +101,7 @@ def get(
101
101
"""
102
102
if not isinstance (id , int ):
103
103
id = utils .clean_str_id (id )
104
- path = "%s/%s" % ( self .path , id )
104
+ path = f" { self .path } / { id } "
105
105
if TYPE_CHECKING :
106
106
assert self ._obj_cls is not None
107
107
if lazy is True :
@@ -173,7 +173,7 @@ def refresh(self, **kwargs: Any) -> None:
173
173
GitlabGetError: If the server cannot perform the request
174
174
"""
175
175
if self ._id_attr :
176
- path = "%s/%s" % ( self .manager .path , self .id )
176
+ path = f" { self .manager .path } / { self .id } "
177
177
else :
178
178
if TYPE_CHECKING :
179
179
assert self .manager .path is not None
@@ -273,7 +273,7 @@ def _check_missing_create_attrs(self, data: Dict[str, Any]) -> None:
273
273
missing .append (attr )
274
274
continue
275
275
if missing :
276
- raise AttributeError ("Missing attributes: %s" % ", " .join (missing ))
276
+ raise AttributeError (f "Missing attributes: { ', ' .join (missing )} " )
277
277
278
278
@exc .on_http_error (exc .GitlabCreateError )
279
279
def create (
@@ -349,7 +349,7 @@ def _check_missing_update_attrs(self, data: Dict[str, Any]) -> None:
349
349
missing .append (attr )
350
350
continue
351
351
if missing :
352
- raise AttributeError ("Missing attributes: %s" % ", " .join (missing ))
352
+ raise AttributeError (f "Missing attributes: { ', ' .join (missing )} " )
353
353
354
354
def _get_update_method (
355
355
self ,
@@ -370,7 +370,7 @@ def update(
370
370
self ,
371
371
id : Optional [Union [str , int ]] = None ,
372
372
new_data : Optional [Dict [str , Any ]] = None ,
373
- ** kwargs : Any
373
+ ** kwargs : Any ,
374
374
) -> Dict [str , Any ]:
375
375
"""Update an object on the server.
376
376
@@ -391,7 +391,7 @@ def update(
391
391
if id is None :
392
392
path = self .path
393
393
else :
394
- path = "%s/%s" % ( self .path , id )
394
+ path = f" { self .path } / { id } "
395
395
396
396
self ._check_missing_update_attrs (new_data )
397
397
files = {}
@@ -444,7 +444,7 @@ def set(self, key: str, value: str, **kwargs: Any) -> base.RESTObject:
444
444
Returns:
445
445
obj: The created/updated attribute
446
446
"""
447
- path = "%s/%s" % ( self .path , utils .clean_str_id (key ))
447
+ path = f" { self .path } / { utils .clean_str_id (key )} "
448
448
data = {"value" : value }
449
449
server_data = self .gitlab .http_put (path , post_data = data , ** kwargs )
450
450
if TYPE_CHECKING :
@@ -479,7 +479,7 @@ def delete(self, id: Union[str, int], **kwargs: Any) -> None:
479
479
else :
480
480
if not isinstance (id , int ):
481
481
id = utils .clean_str_id (id )
482
- path = "%s/%s" % ( self .path , id )
482
+ path = f" { self .path } / { id } "
483
483
self .gitlab .http_delete (path , ** kwargs )
484
484
485
485
@@ -598,7 +598,7 @@ def user_agent_detail(self, **kwargs: Any) -> Dict[str, Any]:
598
598
GitlabAuthenticationError: If authentication is not correct
599
599
GitlabGetError: If the server cannot perform the request
600
600
"""
601
- path = "%s/%s/user_agent_detail" % ( self .manager .path , self .get_id ())
601
+ path = f" { self .manager .path } / { self .get_id ()} /user_agent_detail"
602
602
result = self .manager .gitlab .http_get (path , ** kwargs )
603
603
if TYPE_CHECKING :
604
604
assert not isinstance (result , requests .Response )
@@ -631,7 +631,7 @@ def approve(
631
631
GitlabUpdateError: If the server fails to perform the request
632
632
"""
633
633
634
- path = "%s/%s/approve" % ( self .manager .path , self .id )
634
+ path = f" { self .manager .path } / { self .id } /approve"
635
635
data = {"access_level" : access_level }
636
636
server_data = self .manager .gitlab .http_put (path , post_data = data , ** kwargs )
637
637
if TYPE_CHECKING :
@@ -654,7 +654,7 @@ def download(
654
654
streamed : bool = False ,
655
655
action : Optional [Callable ] = None ,
656
656
chunk_size : int = 1024 ,
657
- ** kwargs : Any
657
+ ** kwargs : Any ,
658
658
) -> Optional [bytes ]:
659
659
"""Download the archive of a resource export.
660
660
@@ -674,7 +674,7 @@ def download(
674
674
Returns:
675
675
str: The blob content if streamed is False, None otherwise
676
676
"""
677
- path = "%s/download" % ( self .manager .path )
677
+ path = f" { self .manager .path } /download"
678
678
result = self .manager .gitlab .http_get (
679
679
path , streamed = streamed , raw = True , ** kwargs
680
680
)
@@ -705,7 +705,7 @@ def subscribe(self, **kwargs: Any) -> None:
705
705
GitlabAuthenticationError: If authentication is not correct
706
706
GitlabSubscribeError: If the subscription cannot be done
707
707
"""
708
- path = "%s/%s/subscribe" % ( self .manager .path , self .get_id ())
708
+ path = f" { self .manager .path } / { self .get_id ()} /subscribe"
709
709
server_data = self .manager .gitlab .http_post (path , ** kwargs )
710
710
if TYPE_CHECKING :
711
711
assert not isinstance (server_data , requests .Response )
@@ -725,7 +725,7 @@ def unsubscribe(self, **kwargs: Any) -> None:
725
725
GitlabAuthenticationError: If authentication is not correct
726
726
GitlabUnsubscribeError: If the unsubscription cannot be done
727
727
"""
728
- path = "%s/%s/unsubscribe" % ( self .manager .path , self .get_id ())
728
+ path = f" { self .manager .path } / { self .get_id ()} /unsubscribe"
729
729
server_data = self .manager .gitlab .http_post (path , ** kwargs )
730
730
if TYPE_CHECKING :
731
731
assert not isinstance (server_data , requests .Response )
@@ -752,7 +752,7 @@ def todo(self, **kwargs: Any) -> None:
752
752
GitlabAuthenticationError: If authentication is not correct
753
753
GitlabTodoError: If the todo cannot be set
754
754
"""
755
- path = "%s/%s/todo" % ( self .manager .path , self .get_id ())
755
+ path = f" { self .manager .path } / { self .get_id ()} /todo"
756
756
self .manager .gitlab .http_post (path , ** kwargs )
757
757
758
758
@@ -781,7 +781,7 @@ def time_stats(self, **kwargs: Any) -> Dict[str, Any]:
781
781
if "time_stats" in self .attributes :
782
782
return self .attributes ["time_stats" ]
783
783
784
- path = "%s/%s/time_stats" % ( self .manager .path , self .get_id ())
784
+ path = f" { self .manager .path } / { self .get_id ()} /time_stats"
785
785
result = self .manager .gitlab .http_get (path , ** kwargs )
786
786
if TYPE_CHECKING :
787
787
assert not isinstance (result , requests .Response )
@@ -800,7 +800,7 @@ def time_estimate(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
800
800
GitlabAuthenticationError: If authentication is not correct
801
801
GitlabTimeTrackingError: If the time tracking update cannot be done
802
802
"""
803
- path = "%s/%s/time_estimate" % ( self .manager .path , self .get_id ())
803
+ path = f" { self .manager .path } / { self .get_id ()} /time_estimate"
804
804
data = {"duration" : duration }
805
805
result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
806
806
if TYPE_CHECKING :
@@ -819,7 +819,7 @@ def reset_time_estimate(self, **kwargs: Any) -> Dict[str, Any]:
819
819
GitlabAuthenticationError: If authentication is not correct
820
820
GitlabTimeTrackingError: If the time tracking update cannot be done
821
821
"""
822
- path = "%s/%s/reset_time_estimate" % ( self .manager .path , self .get_id ())
822
+ path = f" { self .manager .path } / { self .get_id ()} /reset_time_estimate"
823
823
result = self .manager .gitlab .http_post (path , ** kwargs )
824
824
if TYPE_CHECKING :
825
825
assert not isinstance (result , requests .Response )
@@ -838,7 +838,7 @@ def add_spent_time(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
838
838
GitlabAuthenticationError: If authentication is not correct
839
839
GitlabTimeTrackingError: If the time tracking update cannot be done
840
840
"""
841
- path = "%s/%s/add_spent_time" % ( self .manager .path , self .get_id ())
841
+ path = f" { self .manager .path } / { self .get_id ()} /add_spent_time"
842
842
data = {"duration" : duration }
843
843
result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
844
844
if TYPE_CHECKING :
@@ -857,7 +857,7 @@ def reset_spent_time(self, **kwargs: Any) -> Dict[str, Any]:
857
857
GitlabAuthenticationError: If authentication is not correct
858
858
GitlabTimeTrackingError: If the time tracking update cannot be done
859
859
"""
860
- path = "%s/%s/reset_spent_time" % ( self .manager .path , self .get_id ())
860
+ path = f" { self .manager .path } / { self .get_id ()} /reset_spent_time"
861
861
result = self .manager .gitlab .http_post (path , ** kwargs )
862
862
if TYPE_CHECKING :
863
863
assert not isinstance (result , requests .Response )
@@ -893,7 +893,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
893
893
RESTObjectList: The list of participants
894
894
"""
895
895
896
- path = "%s/%s/participants" % ( self .manager .path , self .get_id ())
896
+ path = f" { self .manager .path } / { self .get_id ()} /participants"
897
897
result = self .manager .gitlab .http_get (path , ** kwargs )
898
898
if TYPE_CHECKING :
899
899
assert not isinstance (result , requests .Response )
@@ -920,7 +920,7 @@ def render(self, link_url: str, image_url: str, **kwargs: Any) -> Dict[str, Any]
920
920
Returns:
921
921
dict: The rendering properties
922
922
"""
923
- path = "%s/render" % self .path
923
+ path = f" { self .path } /render"
924
924
data = {"link_url" : link_url , "image_url" : image_url }
925
925
result = self .gitlab .http_get (path , data , ** kwargs )
926
926
if TYPE_CHECKING :
@@ -967,7 +967,7 @@ def promote(self, **kwargs: Any) -> Dict[str, Any]:
967
967
dict: The updated object data (*not* a RESTObject)
968
968
"""
969
969
970
- path = "%s/%s/promote" % ( self .manager .path , self .id )
970
+ path = f" { self .manager .path } / { self .id } /promote"
971
971
http_method = self ._get_update_method ()
972
972
result = http_method (path , ** kwargs )
973
973
if TYPE_CHECKING :
0 commit comments