Pārlūkot izejas kodu

allow passing bytes and os.PathLike as fs_path in repo.stage

Jan Wiśniewski 3 gadi atpakaļ
vecāks
revīzija
39fd508b5c
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      dulwich/repo.py

+ 2 - 2
dulwich/repo.py

@@ -1253,7 +1253,7 @@ class Repo(BaseRepo):
         # missing index file, which is treated as empty.
         return not self.bare
 
-    def stage(self, fs_paths):
+    def stage(self, fs_paths: Union[str, bytes, os.PathLike, Iterable[Union[str, bytes, os.PathLike]]]) -> None:
         """Stage a set of paths.
 
         Args:
@@ -1262,7 +1262,7 @@ class Repo(BaseRepo):
 
         root_path_bytes = os.fsencode(self.path)
 
-        if isinstance(fs_paths, str):
+        if isinstance(fs_paths, (str, bytes, os.PathLike)):
             fs_paths = [fs_paths]
         fs_paths = list(fs_paths)