mirror of
https://github.com/arsenetar/send2trash.git
synced 2025-08-29 20:29:40 +00:00
This removes support for Python 2, and drops most of the compatibility code that was used to support both Python 2 and Python 3.
19 lines
662 B
Python
19 lines
662 B
Python
# encoding: utf-8
|
|
# Copyright 2017 Virgil Dupras
|
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
|
# which should be included with this package. The terms are also available at
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
|
|
|
import collections.abc
|
|
|
|
|
|
def preprocess_paths(paths):
|
|
if isinstance(paths, collections.abc.Iterable) and not isinstance(paths, (str, bytes)):
|
|
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]
|
|
return paths
|