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

Commitc970a22

Browse files
author
Gauvain Pocentek
committed
Remove deprecated methods
Also deprecate {un,}archive_() in favor of {un,}archive().Fix#115
1 parent258aab4 commitc970a22

File tree

1 file changed

+13
-66
lines changed

1 file changed

+13
-66
lines changed

‎gitlab/objects.py

Lines changed: 13 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,11 +1852,6 @@ class ProjectSnippet(GitlabObject):
18521852
[('project_id','project_id'), ('snippet_id','id')]),
18531853
)
18541854

1855-
defContent(self,**kwargs):
1856-
warnings.warn("`Content` is deprecated, use `content` instead",
1857-
DeprecationWarning)
1858-
returnself.content()
1859-
18601855
defcontent(self,streamed=False,action=None,chunk_size=1024,**kwargs):
18611856
"""Return the raw content of a snippet.
18621857
@@ -2082,11 +2077,6 @@ class Project(GitlabObject):
20822077
VISIBILITY_INTERNAL=gitlab.VISIBILITY_INTERNAL
20832078
VISIBILITY_PUBLIC=gitlab.VISIBILITY_PUBLIC
20842079

2085-
deftree(self,path='',ref_name='',**kwargs):
2086-
warnings.warn("`tree` is deprecated, use `repository_tree` instead",
2087-
DeprecationWarning)
2088-
returnself.repository_tree(path,ref_name,**kwargs)
2089-
20902080
defrepository_tree(self,path='',ref_name='',**kwargs):
20912081
"""Return a list of files in the repository.
20922082
@@ -2113,11 +2103,6 @@ def repository_tree(self, path='', ref_name='', **kwargs):
21132103
raise_error_from_response(r,GitlabGetError)
21142104
returnr.json()
21152105

2116-
defblob(self,sha,filepath,**kwargs):
2117-
warnings.warn("`blob` is deprecated, use `repository_blob` instead",
2118-
DeprecationWarning)
2119-
returnself.repository_blob(sha,filepath,**kwargs)
2120-
21212106
defrepository_blob(self,sha,filepath,streamed=False,action=None,
21222107
chunk_size=1024,**kwargs):
21232108
"""Return the content of a file for a commit.
@@ -2205,12 +2190,6 @@ def repository_contributors(self):
22052190
raise_error_from_response(r,GitlabListError)
22062191
returnr.json()
22072192

2208-
defarchive(self,sha=None,**kwargs):
2209-
warnings.warn("`archive` is deprecated, "
2210-
"use `repository_archive` instead",
2211-
DeprecationWarning)
2212-
returnself.repository_archive(sha,**kwargs)
2213-
22142193
defrepository_archive(self,sha=None,streamed=False,action=None,
22152194
chunk_size=1024,**kwargs):
22162195
"""Return a tarball of the repository.
@@ -2238,49 +2217,6 @@ def repository_archive(self, sha=None, streamed=False, action=None,
22382217
raise_error_from_response(r,GitlabGetError)
22392218
returnutils.response_content(r,streamed,action,chunk_size)
22402219

2241-
defcreate_file(self,path,branch,content,message,**kwargs):
2242-
"""Creates file in project repository
2243-
2244-
Args:
2245-
path (str): Full path to new file.
2246-
branch (str): The name of branch.
2247-
content (str): Content of the file.
2248-
message (str): Commit message.
2249-
**kwargs: Arbitrary keyword arguments.
2250-
2251-
Raises:
2252-
GitlabConnectionError: If the server cannot be reached.
2253-
GitlabCreateError: If the server fails to perform the request.
2254-
"""
2255-
warnings.warn("`create_file` is deprecated, "
2256-
"use `files.create()` instead",
2257-
DeprecationWarning)
2258-
url="/projects/%s/repository/files"%self.id
2259-
url+= ("?file_path=%s&branch_name=%s&content=%s&commit_message=%s"%
2260-
(path,branch,content,message))
2261-
r=self.gitlab._raw_post(url,data=None,content_type=None,**kwargs)
2262-
raise_error_from_response(r,GitlabCreateError,201)
2263-
2264-
defupdate_file(self,path,branch,content,message,**kwargs):
2265-
warnings.warn("`update_file` is deprecated, "
2266-
"use `files.update()` instead",
2267-
DeprecationWarning)
2268-
url="/projects/%s/repository/files"%self.id
2269-
url+= ("?file_path=%s&branch_name=%s&content=%s&commit_message=%s"%
2270-
(path,branch,content,message))
2271-
r=self.gitlab._raw_put(url,data=None,content_type=None,**kwargs)
2272-
raise_error_from_response(r,GitlabUpdateError)
2273-
2274-
defdelete_file(self,path,branch,message,**kwargs):
2275-
warnings.warn("`delete_file` is deprecated, "
2276-
"use `files.delete()` instead",
2277-
DeprecationWarning)
2278-
url="/projects/%s/repository/files"%self.id
2279-
url+= ("?file_path=%s&branch_name=%s&commit_message=%s"%
2280-
(path,branch,message))
2281-
r=self.gitlab._raw_delete(url,**kwargs)
2282-
raise_error_from_response(r,GitlabDeleteError)
2283-
22842220
defcreate_fork_relation(self,forked_from_id):
22852221
"""Create a forked from/to relation between existing projects.
22862222
@@ -2336,7 +2272,7 @@ def unstar(self, **kwargs):
23362272
raise_error_from_response(r,GitlabDeleteError, [200,304])
23372273
returnProject(self.gitlab,r.json())ifr.status_code==200elseself
23382274

2339-
defarchive_(self,**kwargs):
2275+
defarchive(self,**kwargs):
23402276
"""Archive a project.
23412277
23422278
Returns:
@@ -2351,7 +2287,12 @@ def archive_(self, **kwargs):
23512287
raise_error_from_response(r,GitlabCreateError,201)
23522288
returnProject(self.gitlab,r.json())ifr.status_code==201elseself
23532289

2354-
defunarchive_(self,**kwargs):
2290+
defarchive_(self,**kwargs):
2291+
warnings.warn("`archive_()` is deprecated, use `archive()` instead",
2292+
DeprecationWarning)
2293+
returnself.archive(**kwargs)
2294+
2295+
defunarchive(self,**kwargs):
23552296
"""Unarchive a project.
23562297
23572298
Returns:
@@ -2366,6 +2307,12 @@ def unarchive_(self, **kwargs):
23662307
raise_error_from_response(r,GitlabCreateError,201)
23672308
returnProject(self.gitlab,r.json())ifr.status_code==201elseself
23682309

2310+
defunarchive_(self,**kwargs):
2311+
warnings.warn("`unarchive_()` is deprecated, "
2312+
"use `unarchive()` instead",
2313+
DeprecationWarning)
2314+
returnself.unarchive(**kwargs)
2315+
23692316
defshare(self,group_id,group_access,**kwargs):
23702317
"""Share the project with a group.
23712318

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp