Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Zeep documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 4 16:51:06 2016.
Expand All @@ -12,9 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import pkg_resources

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -52,9 +48,9 @@
master_doc = 'index'

# General information about the project.
project = u'Zeep'
copyright = u'2016, <a href="https://www.mvantellingen.nl/">Michael van Tellingen</a>'
author = u'Michael van Tellingen'
project = 'Zeep'
copyright = '2016, <a href="https://www.mvantellingen.nl/">Michael van Tellingen</a>'
author = 'Michael van Tellingen'


# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -249,8 +245,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Zeep.tex', u'Zeep Documentation',
u'Michael van Tellingen', 'manual'),
(master_doc, 'Zeep.tex', 'Zeep Documentation',
'Michael van Tellingen', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -293,7 +289,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Zeep', u'Zeep Documentation',
(master_doc, 'Zeep', 'Zeep Documentation',
author, 'Zeep', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
2 changes: 0 additions & 2 deletions examples/async_client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import asyncio
import httpx
import time

import zeep

from zeep.transports import AsyncTransport


def run_async():
Expand Down
1 change: 0 additions & 1 deletion examples/code39.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import zeep

client = zeep.Client(
Expand Down
1 change: 0 additions & 1 deletion examples/eu_vat_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import zeep


Expand Down
2 changes: 0 additions & 2 deletions examples/http_basic_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

from requests import Session
from requests.auth import HTTPBasicAuth

Expand Down
1 change: 0 additions & 1 deletion examples/km_to_miles.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import zeep


Expand Down
2 changes: 1 addition & 1 deletion examples/soap_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExampleService(ServiceBase):
@rpc(Unicode, _returns=Unicode)
def slow_request(ctx, request_id):
time.sleep(1)
return u'Request: %s' % request_id
return 'Request: %s' % request_id

application = Application(
services=[ExampleService],
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

install_requires = [
"attrs>=17.2.0",
"cached-property>=1.3.0; python_version<'3.8'",
"isodate>=0.5.4",
"lxml>=4.6.0",
"platformdirs>=1.4.0",
Expand Down Expand Up @@ -58,7 +57,7 @@
project_urls={
"Source": "https://github.com/mvantellingen/python-zeep",
},
python_requires=">=3.7",
python_requires=">=3.8",
install_requires=install_requires,
tests_require=tests_require,
extras_require={
Expand All @@ -75,13 +74,11 @@
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
2 changes: 0 additions & 2 deletions src/zeep/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, print_function

import argparse
import logging
import logging.config
Expand Down
3 changes: 1 addition & 2 deletions src/zeep/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
import os
import threading
import typing
from contextlib import contextmanager

import platformdirs
Expand Down Expand Up @@ -79,7 +78,7 @@ def add(self, url, content):
logger.debug("Caching contents of %s", url)
if not isinstance(content, (str, bytes)):
raise TypeError(
"a bytes-like object is required, not {}".format(type(content).__name__)
f"a bytes-like object is required, not {type(content).__name__}"
)
self._cache[url] = (datetime.datetime.utcnow(), content)

Expand Down
2 changes: 1 addition & 1 deletion src/zeep/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __getitem__(self, key):
:rtype: zeep.xsd.ComplexType or zeep.xsd.AnySimpleType

"""
return self._method("{%s}%s" % (self._ns, key))
return self._method("{{{}}}{}".format(self._ns, key))


class Client:
Expand Down
12 changes: 6 additions & 6 deletions src/zeep/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def __init__(self, message=""):
self.message = message

def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.message)
return "{}({!r})".format(self.__class__.__name__, self.message)


class XMLSyntaxError(Error):
Expand All @@ -22,9 +22,9 @@ def __init__(self, *args, **kwargs):
def __str__(self):
location = None
if self.filename and self.sourceline:
location = "%s:%s" % (self.filename, self.sourceline)
location = "{}:{}".format(self.filename, self.sourceline)
if location:
return "%s (%s)" % (self.message, location)
return "{} ({})".format(self.message, location)
return self.message


Expand Down Expand Up @@ -77,7 +77,7 @@ def __init__(self, *args, **kwargs):
def __str__(self):
if self.path:
path = ".".join(str(x) for x in self.path)
return "%s (%s)" % (self.message, path)
return "{} ({})".format(self.message, path)
return self.message


Expand All @@ -95,7 +95,7 @@ class IncompleteOperation(Error):

class DTDForbidden(Error):
def __init__(self, name, sysid, pubid):
super(DTDForbidden, self).__init__()
super().__init__()
self.name = name
self.sysid = sysid
self.pubid = pubid
Expand All @@ -107,7 +107,7 @@ def __str__(self):

class EntitiesForbidden(Error):
def __init__(self, name, content):
super(EntitiesForbidden, self).__init__()
super().__init__()
self.name = name
self.content = content

Expand Down
2 changes: 1 addition & 1 deletion src/zeep/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _load_remote_data(self, url):

try:
response.raise_for_status()
except httpx.HTTPStatusError as exc:
except httpx.HTTPStatusError:
raise TransportError(status_code=response.status_code)
return result

Expand Down
2 changes: 1 addition & 1 deletion src/zeep/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def as_qname(value: str, nsmap, target_namespace=None) -> etree.QName:
namespace = nsmap.get(prefix)

if not namespace:
raise XMLParseError("No namespace defined for %r (%r)" % (prefix, value))
raise XMLParseError("No namespace defined for {!r} ({!r})".format(prefix, value))

# Workaround for https://github.com/mvantellingen/python-zeep/issues/349
if not local:
Expand Down
8 changes: 2 additions & 6 deletions src/zeep/wsdl/attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
"""

import base64
import sys

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property
from functools import cached_property

from requests.structures import CaseInsensitiveDict

Expand Down Expand Up @@ -65,7 +61,7 @@ def __init__(self, part):
self._part = part

def __repr__(self):
return "<Attachment(%r, %r)>" % (self.content_id, self.content_type)
return "<Attachment({!r}, {!r})>".format(self.content_id, self.content_type)

@cached_property
def content(self):
Expand Down
20 changes: 10 additions & 10 deletions src/zeep/wsdl/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, name):
self.parts = OrderedDict()

def __repr__(self):
return "<%s(name=%r)>" % (self.__class__.__name__, self.name.text)
return "<{}(name={!r})>".format(self.__class__.__name__, self.name.text)

def resolve(self, definitions):
pass
Expand Down Expand Up @@ -98,7 +98,7 @@ def __init__(
self.operations = operations

def __repr__(self):
return "<%s(name=%r)>" % (self.__class__.__name__, self.name.text)
return "<{}(name={!r})>".format(self.__class__.__name__, self.name.text)

def resolve(self, definitions):
pass
Expand Down Expand Up @@ -151,10 +151,10 @@ def _operation_add(self, operation):
self._operations[operation.name] = operation

def __str__(self):
return "%s: %s" % (self.__class__.__name__, self.name.text)
return "{}: {}".format(self.__class__.__name__, self.name.text)

def __repr__(self):
return "<%s(name=%r, port_type=%r)>" % (
return "<{}(name={!r}, port_type={!r})>".format(
self.__class__.__name__,
self.name.text,
self.port_type,
Expand All @@ -167,7 +167,7 @@ def get(self, key):
try:
return self._operations[key]
except KeyError:
raise ValueError("No such operation %r on %s" % (key, self.name))
raise ValueError("No such operation {!r} on {}".format(key, self.name))

@classmethod
def match(cls, node):
Expand Down Expand Up @@ -204,7 +204,7 @@ def resolve(self, definitions):
)

def __repr__(self):
return "<%s(name=%r, style=%r)>" % (
return "<{}(name={!r}, style={!r})>".format(
self.__class__.__name__,
self.name,
self.style,
Expand All @@ -214,7 +214,7 @@ def __str__(self):
if not self.input:
return "%s(missing input message)" % (self.name)

retval = "%s(%s)" % (self.name, self.input.signature())
retval = "{}({})".format(self.name, self.input.signature())
if self.output:
retval += " -> %s" % (self.output.signature(as_output=True))
return retval
Expand Down Expand Up @@ -267,15 +267,15 @@ def __init__(self, name, binding_name, xmlelement):
self.binding_options = {}

def __repr__(self):
return "<%s(name=%r, binding=%r, %r)>" % (
return "<{}(name={!r}, binding={!r}, {!r})>".format(
self.__class__.__name__,
self.name,
self.binding,
self.binding_options,
)

def __str__(self):
return "Port: %s (%s)" % (self.name, self.binding)
return "Port: {} ({})".format(self.name, self.binding)

def resolve(self, definitions):
if self._resolve_context is None:
Expand Down Expand Up @@ -312,7 +312,7 @@ def __str__(self):
return "Service: %s" % self.name

def __repr__(self):
return "<%s(name=%r, ports=%r)>" % (
return "<{}(name={!r}, ports={!r})>".format(
self.__class__.__name__,
self.name,
self.ports,
Expand Down
4 changes: 2 additions & 2 deletions src/zeep/wsdl/messages/multiref.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _prefix_node(node):
namespace, localname = match.groups()

if namespace in reverse_nsmap:
value = "%s:%s" % (reverse_nsmap.get(namespace), localname)
value = "{}:{}".format(reverse_nsmap.get(namespace), localname)
node.set(key, value)


Expand Down Expand Up @@ -151,6 +151,6 @@ def _get_attributes(node):

if prefix in nsmap:
namespace = nsmap[prefix]
value = "{%s}%s" % (namespace, localname)
value = "{{{}}}{}".format(namespace, localname)
result[key] = value
return list(result.items())
10 changes: 4 additions & 6 deletions src/zeep/wsdl/wsdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
~~~~~~~~~~~~~~

"""
from __future__ import print_function

import logging
import operator
Expand All @@ -19,7 +18,6 @@
absolute_location,
is_relative_path,
load_external,
load_external_async,
)
from zeep.settings import Settings
from zeep.utils import findall_multiple_ns
Expand Down Expand Up @@ -110,7 +108,7 @@ def dump(self):
print("")
print("Prefixes:")
for prefix, namespace in self.types.prefix_map.items():
print(" " * 4, "%s: %s" % (prefix, namespace))
print(" " * 4, "{}: {}".format(prefix, namespace))

print("")
print("Global elements:")
Expand Down Expand Up @@ -141,7 +139,7 @@ def dump(self):
)

for operation in operations:
print("%s%s" % (" " * 12, str(operation)))
print("{}{}".format(" " * 12, str(operation)))
print("")

def _get_xml_document(self, location: typing.IO) -> etree._Element:
Expand Down Expand Up @@ -202,7 +200,7 @@ def _load(self, doc):
self.services = self.parse_service(doc)

def __repr__(self):
return "<%s(location=%r)>" % (self.__class__.__name__, self.location)
return "<{}(location={!r})>".format(self.__class__.__name__, self.location)

def get(self, name, key, _processed=None):
container = getattr(self, name)
Expand All @@ -229,7 +227,7 @@ def get(self, name, key, _processed=None):
except IndexError:
pass

raise IndexError("No definition %r in %r found" % (key, name))
raise IndexError("No definition {!r} in {!r} found".format(key, name))

def resolve_imports(self) -> None:
"""Resolve all root elements (types, messages, etc)."""
Expand Down
Loading