Jelmer Vernooij 5 месяцев назад
Родитель
Сommit
e898e245f5
4 измененных файлов с 12 добавлено и 8 удалено
  1. 6 2
      dulwich/file.py
  2. 4 4
      dulwich/porcelain.py
  3. 1 1
      dulwich/stash.py
  4. 1 1
      dulwich/worktree.py

+ 6 - 2
dulwich/file.py

@@ -287,7 +287,9 @@ class _GitFile(IO[bytes]):
     def read(self, size: int = -1) -> bytes:
         return self._file.read(size)
 
-    def write(self, data: Buffer, /) -> int:
+    # TODO: Remove type: ignore when Python 3.10 support is dropped (Oct 2026)
+    # Python 3.9/3.10 have issues with IO[bytes] overload signatures
+    def write(self, data: Buffer, /) -> int:  # type: ignore[override]
         return self._file.write(data)
 
     def readline(self, size: int = -1) -> bytes:
@@ -296,7 +298,9 @@ class _GitFile(IO[bytes]):
     def readlines(self, hint: int = -1) -> list[bytes]:
         return self._file.readlines(hint)
 
-    def writelines(self, lines: Iterable[Buffer], /) -> None:
+    # TODO: Remove type: ignore when Python 3.10 support is dropped (Oct 2026)
+    # Python 3.9/3.10 have issues with IO[bytes] overload signatures
+    def writelines(self, lines: Iterable[Buffer], /) -> None:  # type: ignore[override]
         return self._file.writelines(lines)
 
     def seek(self, offset: int, whence: int = 0) -> int:

+ 4 - 4
dulwich/porcelain.py

@@ -103,13 +103,13 @@ from typing import (
     Union,
     cast,
     overload,
-    override,
 )
 
 if sys.version_info >= (3, 12):
     from collections.abc import Buffer
+    from typing import override
 else:
-    from typing_extensions import Buffer
+    from typing_extensions import Buffer, override
 
 if TYPE_CHECKING:
     from .gc import GCStats
@@ -2222,7 +2222,7 @@ def reset(
                     source: Union[str, bytes, os.PathLike],
                     target: Union[str, bytes, os.PathLike],
                 ) -> None:
-                    symlink(source, target)
+                    symlink(source, target)  # type: ignore[arg-type]  # type: ignore[arg-type]
 
                 symlink_fn = symlink_wrapper
             else:
@@ -3830,7 +3830,7 @@ def checkout(
                 source: Union[str, bytes, os.PathLike],
                 target: Union[str, bytes, os.PathLike],
             ) -> None:
-                symlink(source, target)
+                symlink(source, target)  # type: ignore[arg-type]
 
             symlink_fn = symlink_wrapper
         else:

+ 1 - 1
dulwich/stash.py

@@ -234,7 +234,7 @@ class Stash:
                     entry.mode,
                     full_path,
                     honor_filemode=honor_filemode,
-                    symlink_fn=symlink_fn,
+                    symlink_fn=symlink_fn,  # type: ignore[arg-type]
                 )
 
             # Update index if the file wasn't already staged

+ 1 - 1
dulwich/worktree.py

@@ -655,7 +655,7 @@ class WorkTree:
             tree,
             honor_filemode=honor_filemode,
             validate_path_element=validate_path_element,
-            symlink_fn=symlink_fn,
+            symlink_fn=symlink_fn,  # type: ignore[arg-type]
             blob_normalizer=blob_normalizer,
         )