summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/snippets.py
diff options
context:
space:
mode:
authorJohn Villalovos <john@sodarock.com>2022-06-27 12:53:49 -0700
committerGitHub <noreply@github.com>2022-06-27 21:53:49 +0200
commit212ddfc9e9c5de50d2507cc637c01ceb31aaba41 (patch)
treec5a0a92cb72b1886567330381e8ba5a277efb45d /gitlab/v4/objects/snippets.py
parentebd579588d05966ee66cce014b141e6ab39435cc (diff)
downloadgitlab-212ddfc9e9c5de50d2507cc637c01ceb31aaba41.tar.gz
refactor: avoid possible breaking change in iterator (#2107)
Commit b6447211754e126f64e12fc735ad74fe557b7fb4 inadvertently introduced a possible breaking change as it added a new argument `iterator` and added it in between existing (potentially positional) arguments. This moves the `iterator` argument to the end of the argument list and requires it to be a keyword-only argument.
Diffstat (limited to 'gitlab/v4/objects/snippets.py')
-rw-r--r--gitlab/v4/objects/snippets.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/gitlab/v4/objects/snippets.py b/gitlab/v4/objects/snippets.py
index aa46c77..648def2 100644
--- a/gitlab/v4/objects/snippets.py
+++ b/gitlab/v4/objects/snippets.py
@@ -29,9 +29,10 @@ class Snippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
def content(
self,
streamed: bool = False,
- iterator: bool = False,
action: Optional[Callable[..., Any]] = None,
chunk_size: int = 1024,
+ *,
+ iterator: bool = False,
**kwargs: Any,
) -> Optional[Union[bytes, Iterator[Any]]]:
"""Return the content of a snippet.
@@ -60,7 +61,9 @@ class Snippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
)
if TYPE_CHECKING:
assert isinstance(result, requests.Response)
- return utils.response_content(result, streamed, iterator, action, chunk_size)
+ return utils.response_content(
+ result, streamed, action, chunk_size, iterator=iterator
+ )
class SnippetManager(CRUDMixin, RESTManager):
@@ -106,9 +109,10 @@ class ProjectSnippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObj
def content(
self,
streamed: bool = False,
- iterator: bool = False,
action: Optional[Callable[..., Any]] = None,
chunk_size: int = 1024,
+ *,
+ iterator: bool = False,
**kwargs: Any,
) -> Optional[Union[bytes, Iterator[Any]]]:
"""Return the content of a snippet.
@@ -137,7 +141,9 @@ class ProjectSnippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObj
)
if TYPE_CHECKING:
assert isinstance(result, requests.Response)
- return utils.response_content(result, streamed, iterator, action, chunk_size)
+ return utils.response_content(
+ result, streamed, action, chunk_size, iterator=iterator
+ )
class ProjectSnippetManager(CRUDMixin, RESTManager):