Skip to content

Commit 6dd252b

Browse files
Remove six references.
1 parent 3663f80 commit 6dd252b

File tree

7 files changed

+4
-17
lines changed

7 files changed

+4
-17
lines changed

src/pyff/api.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from pyramid.events import NewRequest
1616
from pyramid.request import Request
1717
from pyramid.response import Response
18-
from six import b
1918
from urllib.parse import quote_plus
2019

2120
from pyff.constants import config
@@ -464,7 +463,7 @@ def _response() -> Generator[bytes, bytes, None]:
464463
for e in entities:
465464
if in_loop:
466465
yield b','
467-
yield b(dumps(e))
466+
yield dumps(e)
468467
in_loop = True
469468
yield b']'
470469

src/pyff/builtins.py

-2
Original file line numberDiff line numberDiff line change
@@ -1630,8 +1630,6 @@ def emit(req: Plumbing.Request, ctype="application/xml", *opts):
16301630
raise PipeException("Empty")
16311631

16321632
req.state['headers']['Content-Type'] = ctype
1633-
if six.PY2:
1634-
d = d
16351633
return d
16361634

16371635

src/pyff/constants.py

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from str2bool import str2bool
1212

1313
import pyconfig
14-
import six
1514

1615
from pyff import __version__ as pyff_version
1716

src/pyff/exceptions.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
__author__ = 'leifj'
2-
import six
32

43

54
class PyffException(BaseException):

src/pyff/mdq.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import os
88

99
import gunicorn.app.base
10-
from six import iteritems
1110

1211
from pyff.api import mkapp
1312
from pyff.constants import config, parse_options

src/pyff/store.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from threading import ThreadError
1010

1111
import ipaddress
12-
import six
1312
from cachetools.func import ttl_cache
1413
from redis_collections import Dict, Set
1514
from whoosh.fields import ID, KEYWORD, NGRAMWORDS, Schema
@@ -756,7 +755,7 @@ def lookup(self, key):
756755
if key == 'entities' or key is None:
757756
return self._entities()
758757

759-
bkey = six.b(key)
758+
bkey = key.encode('latin-1')
760759
if bkey in self.objects:
761760
return [self.objects.get(bkey)]
762761

src/pyff/utils.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,6 @@ def safe_write(fn, data, mkdirs=False):
313313
data = data.decode('utf-8')
314314

315315
with tempfile.NamedTemporaryFile(mode, **kwargs) as tmp:
316-
if six.PY2:
317-
data = data.encode('utf-8')
318-
319316
log.debug(f"safe writing {len(data)} chrs into {fn}")
320317
tmp.write(data)
321318
tmpn = tmp.name
@@ -679,7 +676,7 @@ def send(self, request, **kwargs):
679676
(_, _, _dir) = request.url.partition('://')
680677
if _dir is None or len(_dir) == 0:
681678
raise ValueError(f"not a directory url: {request.url}")
682-
resp.raw = six.BytesIO(six.b(_dir))
679+
resp.raw = io.BytesIO(_dir.encode("latin-1"))
683680
resp.status_code = 200
684681
resp.reason = "OK"
685682
resp.headers = {}
@@ -727,9 +724,6 @@ def url_get(url: str, verify_tls: Optional[bool] = False) -> Response:
727724
s = requests.Session()
728725
r = s.get(url, headers=headers, verify=verify_tls, timeout=config.request_timeout)
729726

730-
if six.PY2:
731-
r.encoding = "utf-8"
732-
733727
log.debug(f"url_get({url}) returns {len(r.content)} chrs encoded as {r.encoding}")
734728

735729
if config.request_override_encoding is not None:
@@ -788,7 +782,7 @@ def short_id(data):
788782

789783

790784
def unicode_stream(data: str) -> io.BytesIO:
791-
return six.BytesIO(data.encode('UTF-8'))
785+
return io.BytesIO(data.encode('UTF-8'))
792786

793787

794788
def b2u(data: Union[str, bytes, tuple, list, set]) -> Union[str, bytes, tuple, list, set]:

0 commit comments

Comments
 (0)