23
23
24
24
import six
25
25
26
- import gitlab
27
26
from gitlab .base import * # noqa
28
27
from gitlab .exceptions import * # noqa
29
28
from gitlab .mixins import * # noqa
@@ -203,6 +202,7 @@ def credentials_auth(self, email, password):
203
202
server_data = self .gitlab .http_post ('/session' , post_data = data )
204
203
return CurrentUser (self , server_data )
205
204
205
+
206
206
class ApplicationSettings (SaveMixin , RESTObject ):
207
207
_id_attr = None
208
208
@@ -300,6 +300,7 @@ class GitlabciymlManager(RetrieveMixin, RESTManager):
300
300
class GroupIssue (RESTObject ):
301
301
pass
302
302
303
+
303
304
class GroupIssueManager (GetFromListMixin , RESTManager ):
304
305
_path = '/groups/%(group_id)s/issues'
305
306
_obj_cls = GroupIssue
@@ -373,7 +374,7 @@ class License(RESTObject):
373
374
class LicenseManager (RetrieveMixin , RESTManager ):
374
375
_path = '/templates/licenses'
375
376
_obj_cls = License
376
- _list_filters = ('popular' )
377
+ _list_filters = ('popular' , )
377
378
_optional_get_attrs = ('project' , 'fullname' )
378
379
379
380
@@ -402,7 +403,7 @@ def content(self, streamed=False, action=None, chunk_size=1024, **kwargs):
402
403
path = '/snippets/%s/raw' % self .get_id ()
403
404
result = self .manager .gitlab .http_get (path , streamed = streamed ,
404
405
** kwargs )
405
- return utils .response_content (r , streamed , action , chunk_size )
406
+ return utils .response_content (result , streamed , action , chunk_size )
406
407
407
408
408
409
class SnippetManager (CRUDMixin , RESTManager ):
@@ -467,7 +468,7 @@ class ProjectBranch(RESTObject):
467
468
def protect (self , developers_can_push = False , developers_can_merge = False ,
468
469
** kwargs ):
469
470
"""Protects the branch.
470
-
471
+
471
472
Args:
472
473
developers_can_push (bool): Set to True if developers are allowed
473
474
to push to the branch
@@ -588,7 +589,8 @@ class ProjectCommitStatus(RESTObject):
588
589
589
590
590
591
class ProjectCommitStatusManager (RetrieveMixin , CreateMixin , RESTManager ):
591
- _path = '/projects/%(project_id)s/repository/commits/%(commit_id)s/statuses'
592
+ _path = ('/projects/%(project_id)s/repository/commits/%(commit_id)s'
593
+ '/statuses' )
592
594
_obj_cls = ProjectCommitStatus
593
595
_from_parent_attrs = {'project_id' : 'project_id' , 'commit_id' : 'id' }
594
596
_create_attrs = (('state' , ),
@@ -696,7 +698,7 @@ class ProjectEvent(RESTObject):
696
698
697
699
698
700
class ProjectEventManager (GetFromListMixin , RESTManager ):
699
- _path = '/projects/%(project_id)s/events'
701
+ _path = '/projects/%(project_id)s/events'
700
702
_obj_cls = ProjectEvent
701
703
_from_parent_attrs = {'project_id' : 'id' }
702
704
@@ -741,7 +743,7 @@ class ProjectHookManager(CRUDMixin, RESTManager):
741
743
742
744
743
745
class ProjectIssueNote (SaveMixin , RESTObject ):
744
- _constructor_types = {'author' : 'User' }
746
+ _constructor_types = {'author' : 'User' }
745
747
746
748
747
749
class ProjectIssueNoteManager (RetrieveMixin , CreateMixin , UpdateMixin ,
@@ -754,7 +756,7 @@ class ProjectIssueNoteManager(RetrieveMixin, CreateMixin, UpdateMixin,
754
756
755
757
756
758
class ProjectIssue (SubscribableMixin , TodoMixin , TimeTrackingMixin , SaveMixin ,
757
- RESTObject ):
759
+ RESTObject ):
758
760
_constructor_types = {'author' : 'User' , 'assignee' : 'User' , 'milestone' :
759
761
'ProjectMilestone' }
760
762
_short_print_attr = 'title'
@@ -769,7 +771,7 @@ def move(self, to_project_id, **kwargs):
769
771
"""
770
772
path = '%s/%s/move' % (self .manager .path , self .get_id ())
771
773
data = {'to_project_id' : to_project_id }
772
- server_data = self .manager .gitlab .http_post (url , post_data = data ,
774
+ server_data = self .manager .gitlab .http_post (path , post_data = data ,
773
775
** kwargs )
774
776
self ._update_attrs (server_data )
775
777
@@ -808,7 +810,7 @@ class ProjectNote(RESTObject):
808
810
809
811
810
812
class ProjectNoteManager (RetrieveMixin , RESTManager ):
811
- _path = '/projects/%(project_id)s/notes'
813
+ _path = '/projects/%(project_id)s/notes'
812
814
_obj_cls = ProjectNote
813
815
_from_parent_attrs = {'project_id' : 'id' }
814
816
_create_attrs = (('body' , ), tuple ())
@@ -844,13 +846,13 @@ def set_release_description(self, description, **kwargs):
844
846
GitlabCreateError: If the server fails to create the release.
845
847
GitlabUpdateError: If the server fails to update the release.
846
848
"""
847
- _path = '%s/%s/release' % (self .manager .path , self .get_id ())
849
+ path = '%s/%s/release' % (self .manager .path , self .get_id ())
848
850
data = {'description' : description }
849
851
if self .release is None :
850
- result = self .manager .gitlab .http_post (url , post_data = data ,
852
+ result = self .manager .gitlab .http_post (path , post_data = data ,
851
853
** kwargs )
852
854
else :
853
- result = self .manager .gitlab .http_put (url , post_data = data ,
855
+ result = self .manager .gitlab .http_put (path , post_data = data ,
854
856
** kwargs )
855
857
self .release = result .json ()
856
858
@@ -1215,7 +1217,7 @@ def content(self, streamed=False, action=None, chunk_size=1024, **kwargs):
1215
1217
path = "%s/%s/raw" % (self .manager .path , self .get_id ())
1216
1218
result = self .manager .gitlab .http_get (path , streamed = streamed ,
1217
1219
** kwargs )
1218
- return utils .response_content (r , streamed , action , chunk_size )
1220
+ return utils .response_content (result , streamed , action , chunk_size )
1219
1221
1220
1222
1221
1223
class ProjectSnippetManager (CRUDMixin , RESTManager ):
@@ -1382,7 +1384,6 @@ class ProjectRunnerManager(NoUpdateMixin, RESTManager):
1382
1384
_create_attrs = (('runner_id' , ), tuple ())
1383
1385
1384
1386
1385
-
1386
1387
class Project (SaveMixin , RESTObject ):
1387
1388
_constructor_types = {'owner' : 'User' , 'namespace' : 'Group' }
1388
1389
_short_print_attr = 'path'
@@ -1459,7 +1460,7 @@ def repository_raw_blob(self, sha, streamed=False, action=None,
1459
1460
GitlabGetError: If the server fails to perform the request.
1460
1461
"""
1461
1462
path = '/projects/%s/repository/raw_blobs/%s' % (self .get_id (), sha )
1462
- result = self .gitlab ._raw_get (url , streamed = streamed , ** kwargs )
1463
+ result = self .gitlab ._raw_get (path , streamed = streamed , ** kwargs )
1463
1464
return utils .response_content (result , streamed , action , chunk_size )
1464
1465
1465
1466
def repository_compare (self , from_ , to , ** kwargs ):
@@ -1598,7 +1599,7 @@ def unarchive(self, **kwargs):
1598
1599
GitlabConnectionError: If the server cannot be reached.
1599
1600
"""
1600
1601
path = '/projects/%s/unarchive' % self .get_id ()
1601
- server_data = self .manager .gitlab .http_post (url , ** kwargs )
1602
+ server_data = self .manager .gitlab .http_post (path , ** kwargs )
1602
1603
self ._update_attrs (server_data )
1603
1604
1604
1605
def share (self , group_id , group_access , expires_at = None , ** kwargs ):
@@ -1649,7 +1650,6 @@ class RunnerManager(RetrieveMixin, UpdateMixin, DeleteMixin, RESTManager):
1649
1650
_update_attrs = (tuple (), ('description' , 'active' , 'tag_list' ))
1650
1651
_list_filters = ('scope' , )
1651
1652
1652
-
1653
1653
def all (self , scope = None , ** kwargs ):
1654
1654
"""List all the runners.
1655
1655
0 commit comments