From ec9f23f422c85409a343aa01d095b58d35a22f6f Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Fri, 9 Dec 2022 12:49:51 +1000 Subject: [PATCH] Fix typings of real file manipulations --- beets/util/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index e2de0e4e8..62356be7f 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -449,7 +449,7 @@ def samefile(p1: Bytestring, p2: Bytestring) -> bool: return shutil._samefile(syspath(p1), syspath(p2)) -def remove(path: AnyStr, soft: bool = True): +def remove(path: bytes, soft: bool = True): """Remove the file. If `soft`, then no error will be raised if the file does not exist. """ @@ -462,7 +462,7 @@ def remove(path: AnyStr, soft: bool = True): raise FilesystemError(exc, 'delete', (path,), traceback.format_exc()) -def copy(path: AnyStr, dest: AnyStr, replace: bool = False): +def copy(path: bytes, dest: bytes, replace: bool = False): """Copy a plain file. Permissions are not copied. If `dest` already exists, raises a FilesystemError unless `replace` is True. Has no effect if `path` is the same as `dest`. Paths are translated to @@ -481,7 +481,7 @@ def copy(path: AnyStr, dest: AnyStr, replace: bool = False): traceback.format_exc()) -def move(path: Bytestring, dest: Bytestring, replace: bool = False): +def move(path: bytes, dest: bytes, replace: bool = False): """Rename a file. `dest` may not be a directory. If `dest` already exists, raises an OSError unless `replace` is True. Has no effect if `path` is the same as `dest`. If the paths are on different @@ -531,7 +531,7 @@ def move(path: Bytestring, dest: Bytestring, replace: bool = False): os.remove(tmp) -def link(path: AnyStr, dest: AnyStr, replace: bool = False): +def link(path: bytes, dest: bytes, replace: bool = False): """Create a symbolic link from path to `dest`. Raises an OSError if `dest` already exists, unless `replace` is True. Does nothing if `path` == `dest`. @@ -552,7 +552,7 @@ def link(path: AnyStr, dest: AnyStr, replace: bool = False): traceback.format_exc()) -def hardlink(path: AnyStr, dest: AnyStr, replace: bool = False): +def hardlink(path: bytes, dest: bytes, replace: bool = False): """Create a hard link from path to `dest`. Raises an OSError if `dest` already exists, unless `replace` is True. Does nothing if `path` == `dest`. @@ -577,8 +577,8 @@ def hardlink(path: AnyStr, dest: AnyStr, replace: bool = False): def reflink( - path: AnyStr, - dest: AnyStr, + path: bytes, + dest: bytes, replace: bool = False, fallback: bool = False, ):