Skip to content

Commit 36d9b24

Browse files
igorp-collaboranejch
authored andcommitted
feat(api): Narrow down return type of ProjectFileManager.raw using typing.overload
This is equivalent to the changes in 44fd9dc but for `ProjectFileManager.raw` method that I must have missed in the original commit. Signed-off-by: Igor Ponomarev <igor.ponomarev@collabora.com>
1 parent 175b355 commit 36d9b24

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

gitlab/v4/objects/files.py

+41
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
Dict,
66
Iterator,
77
List,
8+
Literal,
89
Optional,
10+
overload,
911
Tuple,
1012
TYPE_CHECKING,
1113
Union,
@@ -274,6 +276,45 @@ def delete( # type: ignore[override]
274276
data = {"branch": branch, "commit_message": commit_message}
275277
self.gitlab.http_delete(path, query_data=data, **kwargs)
276278

279+
@overload
280+
def raw(
281+
self,
282+
file_path: str,
283+
ref: Optional[str] = None,
284+
streamed: Literal[False] = False,
285+
action: None = None,
286+
chunk_size: int = 1024,
287+
*,
288+
iterator: Literal[False] = False,
289+
**kwargs: Any,
290+
) -> bytes: ...
291+
292+
@overload
293+
def raw(
294+
self,
295+
file_path: str,
296+
ref: Optional[str] = None,
297+
streamed: bool = False,
298+
action: None = None,
299+
chunk_size: int = 1024,
300+
*,
301+
iterator: Literal[True] = True,
302+
**kwargs: Any,
303+
) -> Iterator[Any]: ...
304+
305+
@overload
306+
def raw(
307+
self,
308+
file_path: str,
309+
ref: Optional[str] = None,
310+
streamed: Literal[True] = True,
311+
action: Optional[Callable[[bytes], None]] = None,
312+
chunk_size: int = 1024,
313+
*,
314+
iterator: Literal[False] = False,
315+
**kwargs: Any,
316+
) -> None: ...
317+
277318
@cli.register_custom_action(
278319
cls_names="ProjectFileManager",
279320
required=("file_path",),

0 commit comments

Comments
 (0)