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

Commitd9fdf1d

Browse files
authored
Merge pull request#1318 from JohnVillalovos/jlvillal/testing
chore: remove usage of 'from ... import *' in client.py
2 parents8c58b07 +bf0c8c5 commitd9fdf1d

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

‎gitlab/client.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
importrequests.utils
2323

2424
importgitlab.config
25-
fromgitlab.constimport*# noqa
26-
fromgitlab.exceptionsimport*# noqa
27-
fromgitlabimportutils# noqa
25+
importgitlab.const
26+
importgitlab.exceptions
27+
fromgitlabimportutils
2828
fromrequests_toolbelt.multipart.encoderimportMultipartEncoder
2929

3030

@@ -69,7 +69,7 @@ def __init__(
6969
per_page=None,
7070
pagination=None,
7171
order_by=None,
72-
user_agent=USER_AGENT,
72+
user_agent=gitlab.const.USER_AGENT,
7373
):
7474

7575
self._api_version=str(api_version)
@@ -239,7 +239,7 @@ def version(self):
239239

240240
returnself._server_version,self._server_revision
241241

242-
@on_http_error(GitlabVerifyError)
242+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabVerifyError)
243243
deflint(self,content,**kwargs):
244244
"""Validate a gitlab CI configuration.
245245
@@ -259,7 +259,7 @@ def lint(self, content, **kwargs):
259259
data=self.http_post("/ci/lint",post_data=post_data,**kwargs)
260260
return (data["status"]=="valid",data["errors"])
261261

262-
@on_http_error(GitlabMarkdownError)
262+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabMarkdownError)
263263
defmarkdown(self,text,gfm=False,project=None,**kwargs):
264264
"""Render an arbitrary Markdown document.
265265
@@ -284,7 +284,7 @@ def markdown(self, text, gfm=False, project=None, **kwargs):
284284
data=self.http_post("/markdown",post_data=post_data,**kwargs)
285285
returndata["html"]
286286

287-
@on_http_error(GitlabLicenseError)
287+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
288288
defget_license(self,**kwargs):
289289
"""Retrieve information about the current license.
290290
@@ -300,7 +300,7 @@ def get_license(self, **kwargs):
300300
"""
301301
returnself.http_get("/license",**kwargs)
302302

303-
@on_http_error(GitlabLicenseError)
303+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
304304
defset_license(self,license,**kwargs):
305305
"""Add a new license.
306306
@@ -438,7 +438,7 @@ def _check_redirects(self, result):
438438
# Did we end-up with an https:// URL?
439439
location=item.headers.get("Location",None)
440440
iflocationandlocation.startswith("https://"):
441-
raiseRedirectError(REDIRECT_MSG)
441+
raisegitlab.exceptions.RedirectError(REDIRECT_MSG)
442442

443443
defhttp_request(
444444
self,
@@ -559,13 +559,13 @@ def http_request(
559559
pass
560560

561561
ifresult.status_code==401:
562-
raiseGitlabAuthenticationError(
562+
raisegitlab.exceptions.GitlabAuthenticationError(
563563
response_code=result.status_code,
564564
error_message=error_message,
565565
response_body=result.content,
566566
)
567567

568-
raiseGitlabHttpError(
568+
raisegitlab.exceptions.GitlabHttpError(
569569
response_code=result.status_code,
570570
error_message=error_message,
571571
response_body=result.content,
@@ -604,7 +604,7 @@ def http_get(self, path, query_data=None, streamed=False, raw=False, **kwargs):
604604
try:
605605
returnresult.json()
606606
exceptExceptionase:
607-
raiseGitlabParsingError(
607+
raisegitlab.exceptions.GitlabParsingError(
608608
error_message="Failed to parse the server message"
609609
)frome
610610
else:
@@ -686,7 +686,7 @@ def http_post(self, path, query_data=None, post_data=None, files=None, **kwargs)
686686
ifresult.headers.get("Content-Type",None)=="application/json":
687687
returnresult.json()
688688
exceptExceptionase:
689-
raiseGitlabParsingError(
689+
raisegitlab.exceptions.GitlabParsingError(
690690
error_message="Failed to parse the server message"
691691
)frome
692692
returnresult
@@ -724,7 +724,7 @@ def http_put(self, path, query_data=None, post_data=None, files=None, **kwargs):
724724
try:
725725
returnresult.json()
726726
exceptExceptionase:
727-
raiseGitlabParsingError(
727+
raisegitlab.exceptions.GitlabParsingError(
728728
error_message="Failed to parse the server message"
729729
)frome
730730

@@ -744,7 +744,7 @@ def http_delete(self, path, **kwargs):
744744
"""
745745
returnself.http_request("delete",path,**kwargs)
746746

747-
@on_http_error(GitlabSearchError)
747+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabSearchError)
748748
defsearch(self,scope,search,**kwargs):
749749
"""Search GitLab resources matching the provided string.'
750750
@@ -804,7 +804,7 @@ def _query(self, url, query_data=None, **kwargs):
804804
try:
805805
self._data=result.json()
806806
exceptExceptionase:
807-
raiseGitlabParsingError(
807+
raisegitlab.exceptions.GitlabParsingError(
808808
error_message="Failed to parse the server message"
809809
)frome
810810

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp