Skip to content

Commit bc42a5a

Browse files
committed
Fix part of mypy disallow_any_generics
Not all fixes done yet.
1 parent ff66108 commit bc42a5a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pygit2/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@
364364

365365

366366
def init_repository(
367-
path: str | bytes | os.PathLike | None,
367+
path: str | bytes | os.PathLike[str] | os.PathLike[bytes] | None,
368368
bare: bool = False,
369369
flags: enums.RepositoryInitFlag = enums.RepositoryInitFlag.MKPATH,
370370
mode: int | enums.RepositoryInitMode = enums.RepositoryInitMode.SHARED_UMASK,
@@ -444,8 +444,8 @@ def init_repository(
444444

445445

446446
def clone_repository(
447-
url: str | bytes | os.PathLike,
448-
path: str | bytes | os.PathLike,
447+
url: str | bytes | os.PathLike[str] | os.PathLike[bytes],
448+
path: str | bytes | os.PathLike[str] | os.PathLike[bytes],
449449
bare: bool = False,
450450
repository: typing.Callable | None = None,
451451
remote: typing.Callable | None = None,

pygit2/_pygit2.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ class Repository:
763763
def references_iterator_init(self) -> Iterator[Reference]: ...
764764
def references_iterator_next(
765765
self,
766-
iter: Iterator,
766+
iter: Iterator[T],
767767
references_return_type: ReferenceFilter = ReferenceFilter.ALL,
768768
) -> Reference: ...
769769
def reset(self, oid: _OidArg, reset_type: ResetMode) -> None: ...

pygit2/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def maybe_string(ptr: 'char_pointer | None') -> str | None:
5353

5454
@overload
5555
def to_bytes(
56-
s: str | bytes | os.PathLike[str],
56+
s: str | bytes | os.PathLike[str] | os.PathLike[bytes],
5757
encoding: str = 'utf-8',
5858
errors: str = 'strict',
5959
) -> bytes: ...
@@ -64,7 +64,7 @@ def to_bytes(
6464
errors: str = 'strict',
6565
) -> Union['ffi.NULL_TYPE']: ...
6666
def to_bytes(
67-
s: Union[str, bytes, 'ffi.NULL_TYPE', os.PathLike[str], None],
67+
s: Union[str, bytes, 'ffi.NULL_TYPE', os.PathLike[str], os.PathLike[bytes], None],
6868
encoding: str = 'utf-8',
6969
errors: str = 'strict',
7070
) -> Union[bytes, 'ffi.NULL_TYPE']:

0 commit comments

Comments
 (0)