Skip to content

Commit 4d46948

Browse files
a-detisteandrewleech
authored andcommitted
remove Python2 crumbs
1 parent 1fcfd7a commit 4d46948

19 files changed

+10
-45
lines changed

pywebdav/lib/AuthServer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
55
"""
66

7-
from __future__ import absolute_import
87
import base64
98
import binascii
109
import six.moves.BaseHTTPServer

pywebdav/lib/INI_Parse.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
from __future__ import absolute_import
2-
from __future__ import print_function
3-
try:
4-
from configparser import ConfigParser
5-
except ImportError:
6-
from six.moves.configparser import SafeConfigParser as ConfigParser
1+
from configparser import ConfigParser
72

83
class Configuration:
94
def __init__(self, fileName):

pywebdav/lib/WebDAVServer.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This module builds on BaseHTTPServer and implements DAV commands
44
55
"""
6-
from __future__ import absolute_import
76
from . import AuthServer
87
from six.moves import urllib
98
import logging
@@ -25,7 +24,6 @@
2524
from pywebdav import __version__
2625

2726
from xml.parsers.expat import ExpatError
28-
import six
2927

3028
log = logging.getLogger(__name__)
3129

@@ -77,7 +75,7 @@ def send_body(self, DATA, code=None, msg=None, desc=None,
7775
and len(DATA) > self.encode_threshold:
7876
buffer = io.BytesIO()
7977
output = gzip.GzipFile(mode='wb', fileobj=buffer)
80-
if isinstance(DATA, str) or isinstance(DATA, six.text_type):
78+
if isinstance(DATA, str):
8179
output.write(DATA)
8280
else:
8381
for buf in DATA:
@@ -98,7 +96,7 @@ def send_body(self, DATA, code=None, msg=None, desc=None,
9896
if DATA:
9997
if isinstance(DATA, str):
10098
DATA = DATA.encode('utf-8')
101-
if isinstance(DATA, six.text_type) or isinstance(DATA, bytes):
99+
if isinstance(DATA, str) or isinstance(DATA, bytes):
102100
log.debug("Don't use iterator")
103101
self.wfile.write(DATA)
104102
else:
@@ -152,7 +150,7 @@ def send_body_chunks(self, DATA, code, msg=None, desc=None,
152150
output.write(DATA)
153151
else:
154152
for buf in DATA:
155-
buf = buf.encode() if isinstance(buf, six.text_type) else buf
153+
buf = buf.encode() if isinstance(buf, str) else buf
156154
output.write(buf)
157155
output.close()
158156
buffer.seek(0)
@@ -171,8 +169,8 @@ def send_body_chunks(self, DATA, code, msg=None, desc=None,
171169
self.wfile.write(GZDATA)
172170

173171
elif DATA:
174-
DATA = DATA.encode() if isinstance(DATA, six.text_type) else DATA
175-
if isinstance(DATA, six.binary_type):
172+
DATA = DATA.encode() if isinstance(DATA, str) else DATA
173+
if isinstance(DATA, bytes):
176174
self.wfile.write(b"%s\r\n" % hex(len(DATA))[2:].encode())
177175
self.wfile.write(DATA)
178176
self.wfile.write(b"\r\n")
@@ -182,7 +180,7 @@ def send_body_chunks(self, DATA, code, msg=None, desc=None,
182180
if self._config.DAV.getboolean('http_response_use_iterator'):
183181
# Use iterator to reduce using memory
184182
for buf in DATA:
185-
buf = buf.encode() if isinstance(buf, six.text_type) else buf
183+
buf = buf.encode() if isinstance(buf, str) else buf
186184
self.wfile.write((hex(len(buf))[2:] + "\r\n").encode())
187185
self.wfile.write(buf)
188186
self.wfile.write(b"\r\n")
@@ -273,7 +271,7 @@ def _HEAD_GET(self, with_body=False):
273271
if with_body is False:
274272
data = None
275273

276-
if isinstance(data, str) or isinstance(data, six.text_type):
274+
if isinstance(data, str):
277275
self.send_body(data, status_code, None, None, content_type,
278276
headers)
279277
else:

pywebdav/lib/davcmd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
99
"""
1010

11-
from __future__ import absolute_import
1211
from six.moves import urllib
1312

1413
from .utils import create_treelist, is_prefix

pywebdav/lib/davcopy.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from __future__ import absolute_import
21
import xml.dom.minidom
32
domimpl = xml.dom.minidom.getDOMImplementation()
43

5-
import sys
64
import string
75
from six.moves import urllib
86
from io import StringIO

pywebdav/lib/davmove.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
from six.moves import urllib
32

43
from . import utils

pywebdav/lib/dbconn.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
import logging
32

43
log = logging.getLogger(__name__)
@@ -9,7 +8,6 @@
98
log.info('No SQL support - MySQLdb missing...')
109
pass
1110

12-
import sys
1311

1412
class Mconn:
1513
def connect(self,username,userpasswd,host,port,db):

pywebdav/lib/delete.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31
from .utils import gen_estring, quote_uri, make_xmlresponse
42
from .davcmd import deltree
53

pywebdav/lib/iface.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
88
"""
99

10-
from __future__ import absolute_import
1110
from xml.dom import minidom
1211
from .locks import LockManager
1312
from .errors import *

pywebdav/lib/locks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
import time
32
from six.moves import urllib
43
import uuid

pywebdav/lib/propfind.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
import xml.dom.minidom
32
domimpl = xml.dom.minidom.getDOMImplementation()
43

pywebdav/lib/report.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
from .propfind import PROPFIND
32
from xml.dom import minidom
43
domimpl = minidom.getDOMImplementation()

pywebdav/lib/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
import time
32
import re
43
import os

pywebdav/server/daemonize.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
4242
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012
4343
'''
44-
from __future__ import absolute_import
45-
from __future__ import print_function
4644
import sys, os, time
4745
from signal import SIGTERM
4846

pywebdav/server/fileauth.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
2323
"""
2424

25-
from __future__ import absolute_import
26-
import sys
2725
import logging
2826

2927
from pywebdav.lib.WebDAVServer import DAVRequestHandler

pywebdav/server/fshandler.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
from __future__ import absolute_import
21
import os
32
import textwrap
4-
import six
53
import logging
64
import types
75
import shutil
@@ -11,10 +9,7 @@
119
from pywebdav.lib.errors import *
1210
from pywebdav.lib.iface import *
1311
from pywebdav.lib.davcmd import copyone, copytree, moveone, movetree, delone, deltree
14-
if six.PY2:
15-
from cgi import escape
16-
else:
17-
from html import escape
12+
from html import escape
1813

1914
log = logging.getLogger(__name__)
2015

@@ -29,7 +24,7 @@
2924
log.info('Mimetype support DISABLED')
3025
pass
3126

32-
class Resource(object):
27+
class Resource:
3328
# XXX this class is ugly
3429
def __init__(self, fp, file_size):
3530
self.__fp = fp

pywebdav/server/mysqlauth.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
1616
#MA 02111-1307, USA
1717

18-
from __future__ import absolute_import
19-
from __future__ import print_function
2018
from .fileauth import DAVAuthHandler
2119
import sys
2220

pywebdav/server/server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
88
"""
99

10-
from __future__ import absolute_import
11-
from __future__ import print_function
1210
import getopt, sys, os
1311
import logging
1412

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22

3-
from __future__ import absolute_import
43
from setuptools import setup, find_packages
54
from io import open
65
import os

0 commit comments

Comments
 (0)