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

Commit0c98b2d

Browse files
nejchJohnVillalovos
authored andcommitted
refactor: explicitly use ProjectSecureFile
1 parentad7c8fa commit0c98b2d

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

‎docs/gl_objects/secure_files.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ References
1010

1111
* v4 API:
1212

13-
+:class:`gitlab.v4.objects.SecureFile`
14-
+:class:`gitlab.v4.objects.SecureFileManager`
13+
+:class:`gitlab.v4.objects.ProjectSecureFile`
14+
+:class:`gitlab.v4.objects.ProjectSecureFileManager`
1515
+:attr:`gitlab.v4.objects.Project.secure_files`
1616

1717
* GitLab API: https://docs.gitlab.com/ee/api/secure_files.html

‎gitlab/v4/objects/projects.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
from .releasesimportProjectReleaseManager# noqa: F401
8383
from .repositoriesimportRepositoryMixin
8484
from .runnersimportProjectRunnerManager# noqa: F401
85-
from .secure_filesimportSecureFileManager# noqa: F401
85+
from .secure_filesimportProjectSecureFileManager# noqa: F401
8686
from .snippetsimportProjectSnippetManager# noqa: F401
8787
from .statisticsimport (# noqa: F401
8888
ProjectAdditionalStatisticsManager,
@@ -210,7 +210,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
210210
remote_mirrors:"ProjectRemoteMirrorManager"
211211
repositories:ProjectRegistryRepositoryManager
212212
runners:ProjectRunnerManager
213-
secure_files:SecureFileManager
213+
secure_files:ProjectSecureFileManager
214214
services:ProjectServiceManager
215215
snippets:ProjectSnippetManager
216216
storage:"ProjectStorageManager"

‎gitlab/v4/objects/secure_files.py‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
fromgitlab.mixinsimportNoUpdateMixin,ObjectDeleteMixin
1414
fromgitlab.typesimportFileAttribute,RequiredOptional
1515

16-
__all__= ["SecureFile","SecureFileManager"]
16+
__all__= ["ProjectSecureFile","ProjectSecureFileManager"]
1717

1818

19-
classSecureFile(ObjectDeleteMixin,RESTObject):
20-
@cli.register_custom_action("SecureFile")
19+
classProjectSecureFile(ObjectDeleteMixin,RESTObject):
20+
@cli.register_custom_action("ProjectSecureFile")
2121
@exc.on_http_error(exc.GitlabGetError)
2222
defdownload(
2323
self,
@@ -58,12 +58,14 @@ def download(
5858
)
5959

6060

61-
classSecureFileManager(NoUpdateMixin,RESTManager):
61+
classProjectSecureFileManager(NoUpdateMixin,RESTManager):
6262
_path="/projects/{project_id}/secure_files"
63-
_obj_cls=SecureFile
63+
_obj_cls=ProjectSecureFile
6464
_from_parent_attrs= {"project_id":"id"}
6565
_create_attrs=RequiredOptional(required=("name","file"))
6666
_types= {"file":FileAttribute}
6767

68-
defget(self,id:Union[str,int],lazy:bool=False,**kwargs:Any)->SecureFile:
69-
returncast(SecureFile,super().get(id=id,lazy=lazy,**kwargs))
68+
defget(
69+
self,id:Union[str,int],lazy:bool=False,**kwargs:Any
70+
)->ProjectSecureFile:
71+
returncast(ProjectSecureFile,super().get(id=id,lazy=lazy,**kwargs))

‎tests/unit/objects/test_secure_files.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importpytest
66
importresponses
77

8-
fromgitlab.v4.objectsimportSecureFile
8+
fromgitlab.v4.objectsimportProjectSecureFile
99

1010
secure_file_content= {
1111
"id":1,
@@ -93,7 +93,7 @@ def test_create_secure_file(project, resp_create_secure_file):
9393
deftest_download_secure_file(project,binary_content,resp_download_secure_file):
9494
secure_file=project.secure_files.get(1)
9595
secure_content=secure_file.download()
96-
assertisinstance(secure_file,SecureFile)
96+
assertisinstance(secure_file,ProjectSecureFile)
9797
assertsecure_content==binary_content
9898

9999

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp