Skip to content

Commit

Permalink
Remove six package
Browse files Browse the repository at this point in the history
  • Loading branch information
mvantellingen committed May 3, 2020
1 parent 3930abd commit 1ce4e7f
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 89 deletions.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"lxml>=3.1.0",
"requests>=2.7.0",
"requests-toolbelt>=0.7.1",
"six>=1.9.0",
"pytz",
]

Expand Down
2 changes: 1 addition & 1 deletion src/zeep/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import logging
import logging.config
import time
from urllib.parse import urlparse

import requests
from six.moves.urllib.parse import urlparse

from zeep.cache import SqliteCache
from zeep.client import Client
Expand Down
5 changes: 0 additions & 5 deletions src/zeep/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import appdirs
import pytz
import six

# The sqlite3 is not available on Google App Engine so we handle the
# ImportError here and set the sqlite3 var to None.
Expand Down Expand Up @@ -127,13 +126,9 @@ def get(self, url):

def _encode_data(self, data):
data = base64.b64encode(data)
if six.PY2:
return buffer(self._version_string + data) # noqa
return self._version_string + data

def _decode_data(self, data):
if six.PY2:
data = str(data)
if data.startswith(self._version_string):
return base64.b64decode(data[len(self._version_string) :])

Expand Down
2 changes: 1 addition & 1 deletion src/zeep/loader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os.path
from urllib.parse import urljoin, urlparse, urlunparse

from defusedxml.lxml import fromstring
from lxml import etree
from six.moves.urllib.parse import urljoin, urlparse, urlunparse

from zeep.exceptions import XMLSyntaxError
from zeep.settings import Settings
Expand Down
2 changes: 1 addition & 1 deletion src/zeep/transports.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import logging
import os
from contextlib import contextmanager
from urllib.parse import urlparse

import requests
from six.moves.urllib.parse import urlparse

from zeep.utils import get_media_type, get_version
from zeep.wsdl.utils import etree_to_string
Expand Down
3 changes: 1 addition & 2 deletions src/zeep/wsdl/bindings/http.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging

import six
from lxml import etree

from zeep import ns
Expand All @@ -16,7 +15,7 @@

class HttpBinding(Binding):
def create_message(self, operation, *args, **kwargs):
if isinstance(operation, six.string_types):
if isinstance(operation, str):
operation = self.get(operation)
if not operation:
raise ValueError("Operation not found")
Expand Down
6 changes: 0 additions & 6 deletions src/zeep/wsdl/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import warnings
from collections import OrderedDict, namedtuple

from six import python_2_unicode_compatible

from zeep.exceptions import IncompleteOperation

MessagePart = namedtuple("MessagePart", ["element", "type"])
Expand Down Expand Up @@ -96,7 +94,6 @@ def resolve(self, definitions):
pass


@python_2_unicode_compatible
class Binding(object):
"""Base class for the various bindings (SoapBinding / HttpBinding)
Expand Down Expand Up @@ -171,7 +168,6 @@ def parse(cls, definitions, xmlelement):
raise NotImplementedError()


@python_2_unicode_compatible
class Operation(object):
"""Concrete operation
Expand Down Expand Up @@ -242,7 +238,6 @@ def parse(cls, wsdl, xmlelement, binding):
raise NotImplementedError()


@python_2_unicode_compatible
class Port(object):
"""Specifies an address for a binding, thus defining a single communication
endpoint.
Expand Down Expand Up @@ -291,7 +286,6 @@ def resolve(self, definitions):
return True


@python_2_unicode_compatible
class Service(object):
"""Used to aggregate a set of related ports.
Expand Down
5 changes: 3 additions & 2 deletions src/zeep/wsdl/messages/mime.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
~~~~~~~~~~~~~~~~~~~~~~~
"""
import six
from urllib.parse import urlencode

from defusedxml.lxml import fromstring
from lxml import etree

Expand Down Expand Up @@ -103,7 +104,7 @@ def serialize(self, *args, **kwargs):
data = ""
if self.content_type == "application/x-www-form-urlencoded":
items = serialize_object(value)
data = six.moves.urllib.parse.urlencode(items)
data = urlencode(items)
elif self.content_type == "text/xml":
document = etree.Element("root")
self.body.render(document, value)
Expand Down
3 changes: 1 addition & 2 deletions src/zeep/wsdl/messages/xop.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import base64

from six.moves.urllib.parse import unquote
from urllib.parse import unquote


def process_xop(document, message_pack):
Expand Down
3 changes: 2 additions & 1 deletion src/zeep/wsdl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
~~~~~~~~~~~~~~~
"""
from urllib.parse import urlparse, urlunparse

from lxml import etree
from six.moves.urllib.parse import urlparse, urlunparse

from zeep.utils import detect_soap_env

Expand Down
15 changes: 6 additions & 9 deletions src/zeep/wsdl/wsdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import warnings
from collections import OrderedDict

import six
from lxml import etree

from zeep.exceptions import IncompleteMessage
Expand Down Expand Up @@ -59,7 +58,7 @@ def __init__(self, location, transport, base=None, settings=None):
"""
self.settings = settings or Settings()

if isinstance(location, six.string_types):
if isinstance(location, str):
if is_relative_path(location):
location = os.path.abspath(location)
self.location = location
Expand Down Expand Up @@ -111,24 +110,22 @@ def dump(self):

print("")
print("Bindings:")
for binding_obj in sorted(
self.bindings.values(), key=lambda k: six.text_type(k)
):
print(" " * 4, six.text_type(binding_obj))
for binding_obj in sorted(self.bindings.values(), key=lambda k: str(k)):
print(" " * 4, str(binding_obj))

print("")
for service in self.services.values():
print(six.text_type(service))
print(str(service))
for port in service.ports.values():
print(" " * 4, six.text_type(port))
print(" " * 4, str(port))
print(" " * 8, "Operations:")

operations = sorted(
port.binding._operations.values(), key=operator.attrgetter("name")
)

for operation in operations:
print("%s%s" % (" " * 12, six.text_type(operation)))
print("%s%s" % (" " * 12, str(operation)))
print("")

def _get_xml_document(self, location):
Expand Down
3 changes: 1 addition & 2 deletions src/zeep/xsd/printer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from collections import OrderedDict

from six import StringIO
from io import StringIO


class PrettyPrinter(object):
Expand Down
Loading

0 comments on commit 1ce4e7f

Please sign in to comment.