Skip to content

Commit 2432466

Browse files
committed
CR fixes
1 parent c5e41c8 commit 2432466

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

llsd/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def _array_to_python(node, depth=0):
317317
def _to_python(node, depth=0):
318318
"Convert node to a python object."
319319
if depth > MAX_PARSE_DEPTH:
320-
raise LLSDParseError("Cannot parse depth of more than %d" % MAX_FORMAT_DEPTH)
320+
raise LLSDParseError("Cannot parse depth of more than %d" % MAX_PARSE_DEPTH)
321321

322322
return NODE_HANDLERS[node.tag](node, depth)
323323

llsd/serde_xml.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,18 @@ def _UUID(self, v):
9898
self.stream.writelines([b'<uuid>', str(v).encode('utf-8'), b'</uuid>', self._eol])
9999
def _BINARY(self, v):
100100
self.stream.writelines([b'<binary>', base64.b64encode(v).strip(), b'</binary>', self._eol])
101-
def _STRING(self, v):
102-
# We don't simply have a function that encapsulates the PY2 vs PY3 calls,
103-
# as that results in another function call and is slightly less performant
104-
if PY2: # pragma: no cover
101+
102+
if PY2:
103+
def _STRING(self, v):
105104
return self.stream.writelines([b'<string>', _str_to_bytes(xml_esc(v)), b'</string>', self._eol])
106-
self.stream.writelines([b'<string>', v.translate(XML_ESC_TRANS).encode('utf-8'), b'</string>', self._eol])
107-
def _URI(self, v):
108-
# We don't simply have a function that encapsulates the PY2 vs PY3 calls,
109-
# as that results in another function call and is slightly less performant
110-
if PY2: # pragma: no cover
105+
def _URI(self, v):
111106
return self.stream.writelines([b'<uri>', _str_to_bytes(xml_esc(v)), b'</uri>', self._eol])
112-
self.stream.writelines([b'<uri>', str(v).translate(XML_ESC_TRANS).encode('utf-8'), b'</uri>', self._eol])
107+
else:
108+
def _STRING(self, v):
109+
self.stream.writelines([b'<string>', v.translate(XML_ESC_TRANS).encode('utf-8'), b'</string>', self._eol])
110+
def _URI(self, v):
111+
self.stream.writelines([b'<uri>', str(v).translate(XML_ESC_TRANS).encode('utf-8'), b'</uri>', self._eol])
112+
113113
def _DATE(self, v):
114114
self.stream.writelines([b'<date>', _format_datestr(v), b'</date>', self._eol])
115115
def _ARRAY(self, v):

0 commit comments

Comments
 (0)