Merge branch 'feature/UpdateSend2Trash' into dev

This commit is contained in:
JackDandy 2024-06-07 16:59:37 +01:00
commit 354e8d640a
4 changed files with 12 additions and 2 deletions

View file

@ -14,6 +14,7 @@
* Update pytz 2023.3/2023c (488d3eb) to 2024.1/2024a (3680953) * Update pytz 2023.3/2023c (488d3eb) to 2024.1/2024a (3680953)
* Update Rarfile 4.1a1 (8a72967) to 4.2 (db1df33) * Update Rarfile 4.1a1 (8a72967) to 4.2 (db1df33)
* Update Requests library 2.31.0 (8812812) to 2.32.3 (0e322af) * Update Requests library 2.31.0 (8812812) to 2.32.3 (0e322af)
* Update Send2Trash 1.5.0 (66afce7) to 1.8.3 (91d0698)
* Update Tornado Web Server 6.4 (b3f2a4b) to 6.4.1 (2a0e1d1) * Update Tornado Web Server 6.4 (b3f2a4b) to 6.4.1 (2a0e1d1)
* Update urllib3 2.0.7 (56f01e0) to 2.2.1 (54d6edf) * Update urllib3 2.0.7 (56f01e0) to 2.2.1 (54d6edf)

View file

@ -18,3 +18,8 @@ else:
text_type = unicode # noqa: F821 text_type = unicode # noqa: F821
binary_type = str binary_type = str
environb = os.environ environb = os.environ
try:
from collections.abc import Iterable as iterable_type
except ImportError:
from collections import Iterable as iterable_type # noqa: F401

View file

@ -115,7 +115,7 @@ def trash_move(src, dst, topdir=None, cross_dev=False):
f.write(info_for(src, topdir)) f.write(info_for(src, topdir))
destpath = op.join(filespath, destname) destpath = op.join(filespath, destname)
if cross_dev: if cross_dev:
shutil.move(src, destpath) shutil.move(fsdecode(src), fsdecode(destpath))
else: else:
os.rename(src, destpath) os.rename(src, destpath)

View file

@ -5,9 +5,13 @@
# which should be included with this package. The terms are also available at # which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license # http://www.hardcoded.net/licenses/bsd_license
from send2trash.compat import text_type, binary_type, iterable_type
def preprocess_paths(paths): def preprocess_paths(paths):
if not isinstance(paths, list): if isinstance(paths, iterable_type) and not isinstance(paths, (text_type, binary_type)):
paths = list(paths)
elif not isinstance(paths, list):
paths = [paths] paths = [paths]
# Convert items such as pathlib paths to strings # Convert items such as pathlib paths to strings
paths = [path.__fspath__() if hasattr(path, "__fspath__") else path for path in paths] paths = [path.__fspath__() if hasattr(path, "__fspath__") else path for path in paths]