Skip to content

Commit 6bf134b

Browse files
committed
Remove redundant and unused functions
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 9e64ad5 commit 6bf134b

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

src/saml2/saml.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -91,43 +91,6 @@
9191
_b64_encode_fn = getattr(base64, 'encodebytes', base64.encodestring)
9292

9393

94-
def _decode_attribute_value(typ, text):
95-
if typ == XSD + "string":
96-
return text or ""
97-
if typ == XSD + "integer" or typ == XSD + "int":
98-
return str(int(text))
99-
if typ == XSD + "float" or typ == XSD + "double":
100-
return str(float(text))
101-
if typ == XSD + "boolean":
102-
return str(text.lower() == "true")
103-
if typ == XSD + "base64Binary":
104-
return _b64_decode_fn(text)
105-
raise ValueError("type %s not supported" % type)
106-
107-
108-
def _verify_value_type(typ, val):
109-
# print("verify value type: %s, %s" % (typ, val))
110-
if typ == XSD + "string":
111-
try:
112-
return str(val)
113-
except UnicodeEncodeError:
114-
if six.PY2:
115-
return unicode(val)
116-
else:
117-
return val.decode('utf8')
118-
if typ == XSD + "integer" or typ == XSD + "int":
119-
return int(val)
120-
if typ == XSD + "float" or typ == XSD + "double":
121-
return float(val)
122-
if typ == XSD + "boolean":
123-
if val.lower() == "true" or val.lower() == "false":
124-
pass
125-
else:
126-
raise ValueError("Faulty boolean value")
127-
if typ == XSD + "base64Binary":
128-
return _b64_decode_fn(val.encode())
129-
130-
13194
class AttributeValueBase(SamlBase):
13295
def __init__(self,
13396
text=None,
@@ -325,11 +288,6 @@ def harvest_element_tree(self, tree):
325288
self.set_text(tree.text)
326289
if XSI_NIL in self.extension_attributes:
327290
del self.extension_attributes[XSI_NIL]
328-
try:
329-
typ = self.extension_attributes[XSI_TYPE]
330-
_verify_value_type(typ, getattr(self, "text"))
331-
except KeyError:
332-
pass
333291

334292

335293
class BaseIDAbstractType_(SamlBase):

0 commit comments

Comments
 (0)