1
0
spogulis no https://github.com/arsenetar/send2trash.git synced 2025-09-11 18:08:16 +00:00

Properly reuse the "compat" unit

Šī revīzija ir iekļauta:
Virgil Dupras 2017-08-03 20:47:58 -04:00
vecāks f3231ef857
revīzija f324ff491e
3 mainīti faili ar 19 papildinājumiem un 16 dzēšanām

Parādīt failu

@ -5,9 +5,14 @@
# http://www.hardcoded.net/licenses/bsd_license # http://www.hardcoded.net/licenses/bsd_license
import sys import sys
if sys.version < '3': import os
text_type = unicode
binary_type = str PY3 = sys.version_info[0] >= 3
else: if PY3:
text_type = str text_type = str
binary_type = bytes binary_type = bytes
environb = os.environb
else:
text_type = unicode
binary_type = str
environb = os.environ

Parādīt failu

@ -27,9 +27,7 @@ except ImportError:
# Python 2 # Python 2
from urllib import quote from urllib import quote
# PY2-PY3 compatibilty from .compat import text_type, environb
text_type = str if sys.version_info[0] == 3 else unicode
environb = os.environb if sys.version_info[0] >= 3 else os.environ
try: try:
fsencode = os.fsencode # Python 3 fsencode = os.fsencode # Python 3

Parādīt failu

@ -5,6 +5,7 @@ import os
from os import path as op from os import path as op
import send2trash.plat_other import send2trash.plat_other
from send2trash.plat_other import send2trash as s2t from send2trash.plat_other import send2trash as s2t
from send2trash.compat import PY3
from configparser import ConfigParser from configparser import ConfigParser
from tempfile import mkdtemp, NamedTemporaryFile, mktemp from tempfile import mkdtemp, NamedTemporaryFile, mktemp
import shutil import shutil
@ -13,7 +14,6 @@ import sys
# Could still use cleaning up. But no longer relies on ramfs. # Could still use cleaning up. But no longer relies on ramfs.
HOMETRASH = send2trash.plat_other.HOMETRASH HOMETRASH = send2trash.plat_other.HOMETRASH
PY3 = sys.version_info[0] >= 3
def touch(path): def touch(path):
with open(path, 'a'): with open(path, 'a'):