Skip to content

Commit 379b4d8

Browse files
committed
fix(repository): amend annotations on reflog identity
Since set_ident() already has type annotations, it seems fitting that we adorn ident() with those too. :) Also, to_bytes() is perfectly capable of mapping None to ffi.NULL, so the parameters on set_ident() should be `str | None` (aka Optional[str]). Signed-off-by: Ethan Meng <ethan@rapidcow.org>
1 parent d32573e commit 379b4d8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pygit2/repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ def get_attr(
15781578
# Identity for reference operations
15791579
#
15801580
@property
1581-
def ident(self):
1581+
def ident(self) -> tuple[Optional[str], Optional[str]]:
15821582
cname = ffi.new('char **')
15831583
cemail = ffi.new('char **')
15841584

@@ -1587,7 +1587,7 @@ def ident(self):
15871587

15881588
return (maybe_string(cname[0]), maybe_string(cemail[0]))
15891589

1590-
def set_ident(self, name: str, email: str) -> None:
1590+
def set_ident(self, name: Optional[str], email: Optional[str]) -> None:
15911591
"""Set the identity to be used for reference operations.
15921592
15931593
Updates to some references also append data to their

0 commit comments

Comments
 (0)