1
1
from typing import Iterable , List , Union , cast
2
2
3
3
from lxml .builder import E
4
- from lxml .etree import _Element , XMLParser , fromstring , tostring
4
+ from lxml .etree import XMLParser , _Element , fromstring , tostring
5
5
6
- from .common import (
7
- XmlRpcTypes ,
8
- XmlRpcStructType ,
9
- py2xml ,
10
- validate_schema ,
11
- xml2py ,
12
- )
13
- from .exceptions import (
14
- ParseError ,
15
- ServerError ,
16
- XMLRPCSystemError ,
17
- xml2py_exception ,
18
- )
6
+ from .common import XmlRpcStructType , XmlRpcTypes , py2xml , validate_schema , xml2py
7
+ from .exceptions import ParseError , ServerError , XMLRPCSystemError , xml2py_exception
19
8
20
9
21
- def build_xml (
22
- method_name : str , * args : Iterable [XmlRpcTypes ]
23
- ) -> Union [str , bytes ]:
10
+ def build_xml (method_name : str , * args : Iterable [XmlRpcTypes ]) -> Union [str , bytes ]:
24
11
return b'<?xml version="1.0"?>\n ' + tostring (
25
12
E (
26
13
"methodCall" ,
@@ -34,9 +21,7 @@ def build_xml(
34
21
)
35
22
36
23
37
- def parse_xml (
38
- body : bytes , method_name : str , * , huge_tree = False
39
- ) -> XmlRpcTypes :
24
+ def parse_xml (body : bytes , method_name : str , * , huge_tree = False ) -> XmlRpcTypes :
40
25
parser = XMLParser (huge_tree = huge_tree )
41
26
response = fromstring (body , parser )
42
27
if not validate_schema (response ):
@@ -60,6 +45,5 @@ def parse_xml(
60
45
)
61
46
62
47
raise ParseError (
63
- f'Respond body for method "{ method_name } " '
64
- "not contains any response."
48
+ f'Respond body for method "{ method_name } " ' "not contains any response."
65
49
)
0 commit comments