Skip to content

Commit 48c4226

Browse files
committed
Fix typing
1 parent 930299d commit 48c4226

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

dulwich/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3065,7 +3065,7 @@ def from_parsedurl(
30653065
path_encoding: str = TraditionalGitClient.DEFAULT_ENCODING,
30663066
vendor: Optional[SSHVendor] = None,
30673067
key_filename: Optional[str] = None,
3068-
ssh_command: str | None = None,
3068+
ssh_command: Optional[str] = None,
30693069
) -> "SSHGitClient":
30703070
"""Create an SSHGitClient from a parsed URL.
30713071

dulwich/worktree.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def list(self) -> list[WorkTreeInfo]:
154154

155155
def add(
156156
self,
157-
path: str | bytes | os.PathLike[str],
158-
branch: str | bytes | None = None,
157+
path: Union[str, bytes, os.PathLike[str]],
158+
branch: Union[str, bytes, None] = None,
159159
commit: ObjectID | None = None,
160160
force: bool = False,
161161
detach: bool = False,
@@ -184,7 +184,7 @@ def add(
184184
exist_ok=exist_ok,
185185
)
186186

187-
def remove(self, path: str | bytes | os.PathLike[str], force: bool = False) -> None:
187+
def remove(self, path: Union[str, bytes, os.PathLike[str]], force: bool = False) -> None:
188188
"""Remove a worktree.
189189
190190
Args:
@@ -209,8 +209,8 @@ def prune(
209209

210210
def move(
211211
self,
212-
old_path: str | bytes | os.PathLike[str],
213-
new_path: str | bytes | os.PathLike[str],
212+
old_path: Union[str, bytes, os.PathLike[str]],
213+
new_path: Union[str, bytes, os.PathLike[str]],
214214
) -> None:
215215
"""Move a worktree to a new location.
216216
@@ -221,7 +221,7 @@ def move(
221221
move_worktree(self._repo, old_path, new_path)
222222

223223
def lock(
224-
self, path: str | bytes | os.PathLike[str], reason: str | None = None
224+
self, path: Union[str, bytes, os.PathLike[str]], reason: str | None = None
225225
) -> None:
226226
"""Lock a worktree to prevent it from being pruned.
227227
@@ -231,7 +231,7 @@ def lock(
231231
"""
232232
lock_worktree(self._repo, path, reason=reason)
233233

234-
def unlock(self, path: str | bytes | os.PathLike[str]) -> None:
234+
def unlock(self, path: Union[str, bytes, os.PathLike[str]]) -> None:
235235
"""Unlock a worktree.
236236
237237
Args:
@@ -240,7 +240,7 @@ def unlock(self, path: str | bytes | os.PathLike[str]) -> None:
240240
unlock_worktree(self._repo, path)
241241

242242
def repair(
243-
self, paths: Sequence[str | bytes | os.PathLike[str]] | None = None
243+
self, paths: Sequence[Union[str, bytes, os.PathLike[str]]] | None = None
244244
) -> builtins.list[str]:
245245
"""Repair worktree administrative files.
246246
@@ -265,7 +265,7 @@ class WorkTree:
265265
such as staging files, committing changes, and resetting the index.
266266
"""
267267

268-
def __init__(self, repo: Repo, path: str | bytes | os.PathLike[str]) -> None:
268+
def __init__(self, repo: Repo, path: Union[str, bytes, os.PathLike[str]]) -> None:
269269
"""Initialize a WorkTree for the given repository.
270270
271271
Args:
@@ -282,10 +282,12 @@ def __init__(self, repo: Repo, path: str | bytes | os.PathLike[str]) -> None:
282282

283283
def stage(
284284
self,
285-
fs_paths: str
286-
| bytes
287-
| os.PathLike[str]
288-
| Iterable[str | bytes | os.PathLike[str]],
285+
fs_paths: Union[
286+
str,
287+
bytes,
288+
os.PathLike[str],
289+
Iterable[Union[str, bytes, os.PathLike[str]]],
290+
],
289291
) -> None:
290292
"""Stage a set of paths.
291293
@@ -920,8 +922,8 @@ def list_worktrees(repo: Repo) -> list[WorkTreeInfo]:
920922

921923
def add_worktree(
922924
repo: Repo,
923-
path: str | bytes | os.PathLike[str],
924-
branch: str | bytes | None = None,
925+
path: Union[str, bytes, os.PathLike[str]],
926+
branch: Union[str, bytes, None] = None,
925927
commit: ObjectID | None = None,
926928
force: bool = False,
927929
detach: bool = False,
@@ -1014,7 +1016,7 @@ def add_worktree(
10141016

10151017

10161018
def remove_worktree(
1017-
repo: Repo, path: str | bytes | os.PathLike[str], force: bool = False
1019+
repo: Repo, path: Union[str, bytes, os.PathLike[str]], force: bool = False
10181020
) -> None:
10191021
"""Remove a worktree.
10201022
@@ -1146,7 +1148,7 @@ def prune_worktrees(
11461148

11471149

11481150
def lock_worktree(
1149-
repo: Repo, path: str | bytes | os.PathLike[str], reason: str | None = None
1151+
repo: Repo, path: Union[str, bytes, os.PathLike[str]], reason: str | None = None
11501152
) -> None:
11511153
"""Lock a worktree to prevent it from being pruned.
11521154
@@ -1164,7 +1166,7 @@ def lock_worktree(
11641166
f.write(reason)
11651167

11661168

1167-
def unlock_worktree(repo: Repo, path: str | bytes | os.PathLike[str]) -> None:
1169+
def unlock_worktree(repo: Repo, path: Union[str, bytes, os.PathLike[str]]) -> None:
11681170
"""Unlock a worktree.
11691171
11701172
Args:
@@ -1179,7 +1181,7 @@ def unlock_worktree(repo: Repo, path: str | bytes | os.PathLike[str]) -> None:
11791181
os.remove(lock_path)
11801182

11811183

1182-
def _find_worktree_id(repo: Repo, path: str | bytes | os.PathLike[str]) -> str:
1184+
def _find_worktree_id(repo: Repo, path: Union[str, bytes, os.PathLike[str]]) -> str:
11831185
"""Find the worktree identifier for the given path.
11841186
11851187
Args:
@@ -1221,8 +1223,8 @@ def _find_worktree_id(repo: Repo, path: str | bytes | os.PathLike[str]) -> str:
12211223

12221224
def move_worktree(
12231225
repo: Repo,
1224-
old_path: str | bytes | os.PathLike[str],
1225-
new_path: str | bytes | os.PathLike[str],
1226+
old_path: Union[str, bytes, os.PathLike[str]],
1227+
new_path: Union[str, bytes, os.PathLike[str]],
12261228
) -> None:
12271229
"""Move a worktree to a new location.
12281230
@@ -1265,7 +1267,7 @@ def move_worktree(
12651267

12661268

12671269
def repair_worktree(
1268-
repo: Repo, paths: Sequence[str | bytes | os.PathLike[str]] | None = None
1270+
repo: Repo, paths: Sequence[Union[str, bytes, os.PathLike[str]]] | None = None
12691271
) -> list[str]:
12701272
"""Repair worktree administrative files.
12711273

0 commit comments

Comments
 (0)