Skip to content

Commit cc986db

Browse files
Dreamsorcerermvantellingen
authored andcommitted
Fix type errors.
1 parent 2f5c126 commit cc986db

17 files changed

Lines changed: 59 additions & 43 deletions

examples/trafficvance_apikey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
API_KEY_TEST = 'YOUR_OWN_API_KEY'
44
WSDL_TEST = 'https://apitest.trafficvance.com/?v3=system.wsdl'
55

6-
client = Client(WSDL)
6+
client = Client(WSDL_TEST)
77
header = xsd.Element(
88
'{WSDL_TEST}AuthenticateRequest',
99
xsd.ComplexType([

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[mypy]
2+
files = src/, benchmark/, examples/, tests/
23
ignore_missing_imports = True
34
implicit_reexport = False
45
python_version = 3.6
56
warn_unused_configs = True
67
mypy_path = src
78
warn_unreachable = True
8-
follow_imports = True
99
follow_imports_for_stubs = True

src/zeep/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from zeep.client import AsyncClient, CachingClient, Client # noqa
2-
from zeep.plugins import Plugin # noqa
3-
from zeep.settings import Settings # noqa
4-
from zeep.transports import Transport # noqa
5-
from zeep.xsd.valueobjects import AnyObject # noqa
1+
from zeep.client import AsyncClient as AsyncClient, CachingClient as CachingClient, Client as Client # noqa
2+
from zeep.plugins import Plugin as Plugin # noqa
3+
from zeep.settings import Settings as Settings # noqa
4+
from zeep.transports import Transport as Transport # noqa
5+
from zeep.xsd.valueobjects import AnyObject as AnyObject # noqa
66

77
__version__ = "4.1.0"

src/zeep/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Client:
5151
5252
"""
5353

54-
_default_transport = Transport
54+
_default_transport = typing.Union[Transport, AsyncTransport]
5555

5656
def __init__(
5757
self,

src/zeep/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def parse_xml(content: str, transport, base_url=None, settings=None):
6868
)
6969

7070

71-
def load_external(url: typing.IO, transport, base_url=None, settings=None):
71+
def load_external(url: typing.Union[typing.IO, str], transport, base_url=None, settings=None):
7272
"""Load an external XML document.
7373
7474
:param url:

src/zeep/wsdl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
1414
1515
"""
16-
from zeep.wsdl.wsdl import Document # noqa
16+
from zeep.wsdl.wsdl import Document as Document # noqa

src/zeep/wsdl/attachments.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"""
66

77
import base64
8+
import sys
89

9-
try:
10+
if sys.version_info >= (3, 8):
1011
from functools import cached_property
11-
except ImportError:
12+
else:
1213
from cached_property import cached_property
1314

1415
from requests.structures import CaseInsensitiveDict

src/zeep/wsdl/bindings/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
from .http import HttpGetBinding, HttpPostBinding # noqa
2-
from .soap import Soap11Binding, Soap12Binding # noqa
1+
from .http import HttpGetBinding as HttpGetBinding, HttpPostBinding as HttpPostBinding # noqa
2+
from .soap import Soap11Binding as Soap11Binding, Soap12Binding as Soap12Binding # noqa

src/zeep/wsdl/definitions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
if typing.TYPE_CHECKING:
2727
from zeep.wsdl.wsdl import Definition
28+
else:
29+
Definition = None
2830

2931
MessagePart = namedtuple("MessagePart", ["element", "type"])
3032

@@ -134,7 +136,7 @@ def __init__(self, wsdl, name, port_name):
134136
self.wsdl = wsdl
135137
self._operations = {}
136138

137-
def resolve(self, definitions: "Definition") -> None:
139+
def resolve(self, definitions: Definition) -> None:
138140
self.port_type = definitions.get("port_types", self.port_name.text)
139141

140142
for name, operation in list(self._operations.items()):

src/zeep/wsdl/wsdl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ def __init__(self, wsdl, doc, location):
181181
self.types = wsdl.types
182182
self.port_types = {}
183183
self.messages = {}
184-
self.bindings = {} # type: typing.Dict[str, typing.Type[Binding]]
185-
self.services = OrderedDict() # type: typing.Dict[str, Service]
184+
self.bindings: typing.Dict[str, Binding] = {}
185+
self.services: typing.Dict[str, Service] = OrderedDict()
186186

187187
self.imports = {}
188188
self._resolved_imports = False

0 commit comments

Comments
 (0)