From 5ec9926bd4a5af71a50fb833db3386b26cc5dc25 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Fri, 7 Jun 2024 16:56:21 +0100 Subject: [PATCH] =?UTF-8?q?Update=20Send2Trash=201.5.0=20(66afce7)=20?= =?UTF-8?q?=E2=86=92=201.8.3=20(91d0698).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 1 + lib/send2trash/compat.py | 5 +++++ lib/send2trash/plat_other.py | 2 +- lib/send2trash/util.py | 6 +++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ae36ee8d..bbbdc9c9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ * Update pytz 2023.3/2023c (488d3eb) to 2024.1/2024a (3680953) * Update Rarfile 4.1a1 (8a72967) to 4.2 (db1df33) * 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 urllib3 2.0.7 (56f01e0) to 2.2.1 (54d6edf) diff --git a/lib/send2trash/compat.py b/lib/send2trash/compat.py index 9e9b5fb2..a3043a4e 100644 --- a/lib/send2trash/compat.py +++ b/lib/send2trash/compat.py @@ -18,3 +18,8 @@ else: text_type = unicode # noqa: F821 binary_type = str environb = os.environ + +try: + from collections.abc import Iterable as iterable_type +except ImportError: + from collections import Iterable as iterable_type # noqa: F401 diff --git a/lib/send2trash/plat_other.py b/lib/send2trash/plat_other.py index 517e2a05..ace7b130 100644 --- a/lib/send2trash/plat_other.py +++ b/lib/send2trash/plat_other.py @@ -115,7 +115,7 @@ def trash_move(src, dst, topdir=None, cross_dev=False): f.write(info_for(src, topdir)) destpath = op.join(filespath, destname) if cross_dev: - shutil.move(src, destpath) + shutil.move(fsdecode(src), fsdecode(destpath)) else: os.rename(src, destpath) diff --git a/lib/send2trash/util.py b/lib/send2trash/util.py index 2c73d443..108537e1 100644 --- a/lib/send2trash/util.py +++ b/lib/send2trash/util.py @@ -5,9 +5,13 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_license +from send2trash.compat import text_type, binary_type, iterable_type + 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] # Convert items such as pathlib paths to strings paths = [path.__fspath__() if hasattr(path, "__fspath__") else path for path in paths]