Skip to content

Fix some more mypy disallow_untyped_calls #1408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pygit2/_libgit2/ffi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ def new(a: Literal['git_buf *'], b: tuple[NULL_TYPE, Literal[0]]) -> GitBufC: ..
@overload
def new(a: Literal['char **']) -> _Pointer[char_pointer]: ...
@overload
def new(a: Literal['void **'], b: bytes) -> _Pointer[bytes]: ...
@overload
def new(a: Literal['char[]', 'char []'], b: bytes | NULL_TYPE) -> ArrayC[char]: ...
def addressof(a: object, attribute: str) -> _Pointer[object]: ...

Expand Down
2 changes: 1 addition & 1 deletion pygit2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __del__(self) -> None:
except AttributeError:
pass

def _get(self, key: str | bytes) -> tuple[object, 'ConfigEntry']:
def _get(self, key: str | bytes) -> tuple[int, 'ConfigEntry']:
key = str_to_bytes(key, 'key')

entry = ffi.new('git_config_entry **')
Expand Down
2 changes: 1 addition & 1 deletion pygit2/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
value_errors = set([C.GIT_EEXISTS, C.GIT_EINVALIDSPEC, C.GIT_EAMBIGUOUS])


def check_error(err, io=False):
def check_error(err: int, io=False) -> None:
if err >= 0:
return

Expand Down
2 changes: 1 addition & 1 deletion pygit2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def to_str(s):
raise TypeError(f'unexpected type "{repr(s)}"')


def ptr_to_bytes(ptr_cdata):
def ptr_to_bytes(ptr_cdata) -> bytes:
"""
Convert a pointer coming from C code (<cdata 'some_type *'>)
to a byte buffer containing the address that the pointer refers to.
Expand Down
Loading