1+ from collections .abc import Iterator , Sequence
12from io import DEFAULT_BUFFER_SIZE , IOBase
23from pathlib import Path
34from queue import Queue
45from threading import Event
56from typing import (
67 Generic ,
7- Iterator ,
88 Literal ,
9- Optional ,
10- Sequence ,
11- Type ,
129 TypedDict ,
1310 TypeVar ,
1411 overload ,
@@ -303,29 +300,29 @@ class _ObjectBase(Generic[T]):
303300 name : str | None
304301 raw_name : bytes | None
305302 short_id : str
306- type : ' Literal[GIT_OBJ_COMMIT] | Literal[GIT_OBJ_TREE] | Literal[GIT_OBJ_TAG] | Literal[GIT_OBJ_BLOB]'
307- type_str : " Literal['commit'] | Literal['tree'] | Literal['tag'] | Literal['blob']"
303+ type : Literal [GIT_OBJ_COMMIT ] | Literal [GIT_OBJ_TREE ] | Literal [GIT_OBJ_TAG ] | Literal [GIT_OBJ_BLOB ]
304+ type_str : Literal ['commit' ] | Literal ['tree' ] | Literal ['tag' ] | Literal ['blob' ]
308305 author : Signature
309306 committer : Signature
310307 tree : Tree
311308 @overload
312309 def peel (
313- self , target_type : ' Literal[GIT_OBJ_COMMIT, ObjectType.COMMIT] | Type [Commit]'
314- ) -> ' Commit' : ...
310+ self , target_type : Literal [GIT_OBJ_COMMIT , ObjectType .COMMIT ] | type [Commit ]
311+ ) -> Commit : ...
315312 @overload
316313 def peel (
317- self , target_type : ' Literal[GIT_OBJ_TREE, ObjectType.TREE] | Type [Tree]'
318- ) -> ' Tree' : ...
314+ self , target_type : Literal [GIT_OBJ_TREE , ObjectType .TREE ] | type [Tree ]
315+ ) -> Tree : ...
319316 @overload
320317 def peel (
321- self , target_type : ' Literal[GIT_OBJ_TAG, ObjectType.TAG] | Type [Tag]'
322- ) -> ' Tag' : ...
318+ self , target_type : Literal [GIT_OBJ_TAG , ObjectType .TAG ] | type [Tag ]
319+ ) -> Tag : ...
323320 @overload
324321 def peel (
325- self , target_type : ' Literal[GIT_OBJ_BLOB, ObjectType.BLOB] | Type [Blob]'
326- ) -> ' Blob' : ...
322+ self , target_type : Literal [GIT_OBJ_BLOB , ObjectType .BLOB ] | type [Blob ]
323+ ) -> Blob : ...
327324 @overload
328- def peel (self , target_type : ' None' ) -> ' Commit|Tree|Tag|Blob' : ...
325+ def peel (self , target_type : None ) -> Commit | Tree | Tag | Blob : ...
329326 def read_raw (self ) -> bytes : ...
330327 def __eq__ (self , other ) -> bool : ...
331328 def __ge__ (self , other ) -> bool : ...
@@ -350,15 +347,15 @@ class Reference:
350347 def delete (self ) -> None : ...
351348 def log (self ) -> Iterator [RefLogEntry ]: ...
352349 @overload
353- def peel (self , type : ' Literal[GIT_OBJ_COMMIT] | Type [Commit]' ) -> ' Commit' : ...
350+ def peel (self , type : Literal [GIT_OBJ_COMMIT ] | type [Commit ]) -> Commit : ...
354351 @overload
355- def peel (self , type : ' Literal[GIT_OBJ_TREE] | Type [Tree]' ) -> ' Tree' : ...
352+ def peel (self , type : Literal [GIT_OBJ_TREE ] | type [Tree ]) -> Tree : ...
356353 @overload
357- def peel (self , type : ' Literal[GIT_OBJ_TAG] | Type [Tag]' ) -> ' Tag' : ...
354+ def peel (self , type : Literal [GIT_OBJ_TAG ] | type [Tag ]) -> Tag : ...
358355 @overload
359- def peel (self , type : ' Literal[GIT_OBJ_BLOB] | Type [Blob]' ) -> ' Blob' : ...
356+ def peel (self , type : Literal [GIT_OBJ_BLOB ] | type [Blob ]) -> Blob : ...
360357 @overload
361- def peel (self , type : ' None' = None ) -> ' Commit|Tree|Tag|Blob' : ...
358+ def peel (self , type : None = None ) -> Commit | Tree | Tag | Blob : ...
362359 def rename (self , new_name : str ) -> None : ...
363360 def resolve (self ) -> Reference : ...
364361 def set_target (self , target : _OidArg , message : str = ...) -> None : ...
@@ -384,7 +381,7 @@ class Blob(Object):
384381 ) -> Patch : ...
385382 def diff_to_buffer (
386383 self ,
387- buffer : Optional [ bytes | str ] = None ,
384+ buffer : bytes | str | None = None ,
388385 flag : DiffOption = DiffOption .NORMAL ,
389386 old_as_path : str = ...,
390387 buffer_as_path : str = ...,
@@ -395,9 +392,9 @@ class Blob(Object):
395392 ready : Event ,
396393 done : Event ,
397394 chunk_size : int = DEFAULT_BUFFER_SIZE ,
398- as_path : Optional [ str ] = None ,
395+ as_path : str | None = None ,
399396 flags : BlobFilter = BlobFilter .CHECK_FOR_BINARY ,
400- commit_id : Optional [ Oid ] = None ,
397+ commit_id : Oid | None = None ,
401398 ) -> None : ...
402399 def __buffer__ (self , flags : int ) -> memoryview : ...
403400 def __release_buffer__ (self , buffer : memoryview ) -> None : ...
@@ -411,7 +408,7 @@ class Branch(Reference):
411408 def delete (self ) -> None : ...
412409 def is_checked_out (self ) -> bool : ...
413410 def is_head (self ) -> bool : ...
414- def rename (self , name : str , force : bool = False ) -> ' Branch' : ... # type: ignore[override]
411+ def rename (self , name : str , force : bool = False ) -> Branch : ... # type: ignore[override]
415412
416413class FetchOptions :
417414 # incomplete
@@ -693,7 +690,7 @@ class Repository:
693690 def create_branch (self , name : str , commit : Commit , force = False ) -> Branch : ...
694691 def create_commit (
695692 self ,
696- reference_name : Optional [ str ] ,
693+ reference_name : str | None ,
697694 author : Signature ,
698695 committer : Signature ,
699696 message : str | bytes ,
@@ -711,7 +708,7 @@ class Repository:
711708 encoding : str = ...,
712709 ) -> Oid : ...
713710 def create_commit_with_signature (
714- self , content : str , signature : str , signature_field : Optional [ str ] = None
711+ self , content : str , signature : str , signature_field : str | None = None
715712 ) -> Oid : ...
716713 def create_note (
717714 self ,
@@ -723,10 +720,10 @@ class Repository:
723720 force : bool = False ,
724721 ) -> Oid : ...
725722 def create_reference_direct (
726- self , name : str , target : _OidArg , force : bool , message : Optional [ str ] = None
723+ self , name : str , target : _OidArg , force : bool , message : str | None = None
727724 ) -> Reference : ...
728725 def create_reference_symbolic (
729- self , name : str , target : str , force : bool , message : Optional [ str ] = None
726+ self , name : str , target : str , force : bool , message : str | None = None
730727 ) -> Reference : ...
731728 def create_tag (
732729 self , name : str , oid : _OidArg , type : ObjectType , tagger : Signature , message : str
@@ -801,7 +798,7 @@ class Signature:
801798 email : str ,
802799 time : int = - 1 ,
803800 offset : int = 0 ,
804- encoding : Optional [ str ] = None ,
801+ encoding : str | None = None ,
805802 ) -> None : ...
806803 def __eq__ (self , other ) -> bool : ...
807804 def __ge__ (self , other ) -> bool : ...
0 commit comments