summaryrefslogtreecommitdiff
path: root/openid
diff options
context:
space:
mode:
authorVlastimil Zíma <vlastimil.zima@nic.cz>2018-05-02 15:39:27 +0200
committerVlastimil Zíma <vlastimil.zima@nic.cz>2018-05-11 10:05:43 +0200
commiteaeadc59c2be733322d97e048e02a79686a6af55 (patch)
tree478b72b20533833fb85894758becfae6eaed9c5f /openid
parent2a28ff0db2ee6b2842bf09afeb037026ab9c9a9f (diff)
downloadopenid-eaeadc59c2be733322d97e048e02a79686a6af55.tar.gz
Replace unicode with six.text_type
Diffstat (limited to 'openid')
-rw-r--r--openid/consumer/consumer.py4
-rw-r--r--openid/consumer/discover.py2
-rw-r--r--openid/extensions/ax.py14
-rw-r--r--openid/oidutil.py2
-rw-r--r--openid/server/server.py4
-rw-r--r--openid/yadis/etxrd.py4
-rw-r--r--openid/yadis/xri.py6
-rw-r--r--openid/yadis/xrires.py6
8 files changed, 22 insertions, 20 deletions
diff --git a/openid/consumer/consumer.py b/openid/consumer/consumer.py
index a836c90..96c6ef7 100644
--- a/openid/consumer/consumer.py
+++ b/openid/consumer/consumer.py
@@ -308,7 +308,7 @@ class Consumer(object):
normalizing and resolving any redirects the server might
issue.
- @type user_url: unicode
+ @type user_url: six.text_type
@param anonymous: Whether to make an anonymous request of the OpenID
provider. Such a request does not ask for an authorization
@@ -1616,7 +1616,7 @@ class AuthRequest(object):
the form tag. 'accept-charset' and 'enctype' have defaults
that can be overridden. If a value is supplied for
'action' or 'method', it will be replaced.
- @type form_tag_attrs: {unicode: unicode}
+ @type form_tag_attrs: Dict[six.text_type, six.text_type]
"""
message = self.getMessage(realm, return_to, immediate)
return message.toFormMarkup(self.endpoint.server_url, form_tag_attrs)
diff --git a/openid/consumer/discover.py b/openid/consumer/discover.py
index 0824af4..08af0a6 100644
--- a/openid/consumer/discover.py
+++ b/openid/consumer/discover.py
@@ -269,7 +269,7 @@ def findOPLocalIdentifier(service_element, type_uris):
@returns: The OP-Local Identifier for this service element, if one
is present, or None otherwise.
- @rtype: str or unicode or NoneType
+ @rtype: six.text_type or NoneType
"""
# XXX: Test this function on its own!
diff --git a/openid/extensions/ax.py b/openid/extensions/ax.py
index b48d19c..39b85cd 100644
--- a/openid/extensions/ax.py
+++ b/openid/extensions/ax.py
@@ -212,7 +212,7 @@ class FetchRequest(AXMessage):
"""Get the serialized form of this attribute fetch request.
@returns: The fetch request message parameters
- @rtype: {unicode:unicode}
+ @rtype: Dict[six.text_type, six.text_type]
"""
aliases = NamespaceMap()
@@ -418,7 +418,7 @@ class AXKeyValueMessage(AXMessage):
@param value: The value to add to the response to the relying
party for this attribute
- @type value: unicode
+ @type value: six.text_type
@returns: None
"""
@@ -436,7 +436,7 @@ class AXKeyValueMessage(AXMessage):
@param type_uri: The URI for the attribute
@param values: A list of values to send for this attribute.
- @type values: [unicode]
+ @type values: List[six.text_type]
"""
self.data[type_uri] = values
@@ -471,7 +471,7 @@ class AXKeyValueMessage(AXMessage):
@param ax_args: The attribute exchange fetch_response
arguments, with namespacing removed.
- @type ax_args: {unicode:unicode}
+ @type ax_args: Dict[six.text_type, six.text_type]
@returns: None
@@ -525,7 +525,7 @@ class AXKeyValueMessage(AXMessage):
@returns: The value of the attribute in the fetch_response
message, or the default supplied
- @rtype: unicode or NoneType
+ @rtype: six.text_type or NoneType
@raises ValueError: If there is more than one value for this
parameter in the fetch_response message.
@@ -554,7 +554,7 @@ class AXKeyValueMessage(AXMessage):
@returns: The list of values for this attribute in the
response. May be an empty list.
- @rtype: [unicode]
+ @rtype: List[six.text_type]
@raises KeyError: If the attribute was not sent in the response
"""
@@ -605,7 +605,7 @@ class FetchResponse(AXKeyValueMessage):
@returns: The dictionary of unqualified attribute exchange
arguments that represent this fetch_response.
- @rtype: {unicode;unicode}
+ @rtype: Dict[six.text_type, six.text_type]
"""
aliases = NamespaceMap()
diff --git a/openid/oidutil.py b/openid/oidutil.py
index 6e688fb..3d3f03c 100644
--- a/openid/oidutil.py
+++ b/openid/oidutil.py
@@ -121,7 +121,7 @@ def fromBase64(s):
class Symbol(object):
"""This class implements an object that compares equal to others
of the same type that have the same name. These are distict from
- str or unicode objects.
+ string objects.
"""
def __init__(self, name):
diff --git a/openid/server/server.py b/openid/server/server.py
index 4576c82..6afe826 100644
--- a/openid/server/server.py
+++ b/openid/server/server.py
@@ -121,6 +121,8 @@ import time
import warnings
from copy import deepcopy
+import six
+
from openid import cryptutil, kvform, oidutil
from openid.association import Association, default_negotiator, getSecretSize
from openid.dh import DiffieHellman
@@ -1624,7 +1626,7 @@ class ProtocolError(Exception):
self.openid_message = message
self.reference = reference
self.contact = contact
- assert type(message) not in [str, unicode]
+ assert not isinstance(message, six.string_types)
Exception.__init__(self, text)
def getReturnTo(self):
diff --git a/openid/yadis/etxrd.py b/openid/yadis/etxrd.py
index a96a107..4039c9e 100644
--- a/openid/yadis/etxrd.py
+++ b/openid/yadis/etxrd.py
@@ -153,13 +153,13 @@ def getCanonicalID(iname, xrd_tree):
"""Return the CanonicalID from this XRDS document.
@param iname: the XRI being resolved.
- @type iname: unicode
+ @type iname: six.text_type
@param xrd_tree: The XRDS output from the resolver.
@type xrd_tree: ElementTree
@returns: The XRI CanonicalID or None.
- @returntype: unicode or None
+ @returntype: six.text_type or None
"""
xrd_list = xrd_tree.findall(xrd_tag)
xrd_list.reverse()
diff --git a/openid/yadis/xri.py b/openid/yadis/xri.py
index 73ad798..7728c60 100644
--- a/openid/yadis/xri.py
+++ b/openid/yadis/xri.py
@@ -94,8 +94,8 @@ def rootAuthority(xri):
rootAuthority("xri://@example") == "xri://@"
- @type xri: unicode
- @returntype: unicode
+ @type xri: six.text_type
+ @returntype: six.text_type
"""
if xri.startswith('xri://'):
xri = xri[6:]
@@ -127,7 +127,7 @@ def XRI(xri):
canonicalization by ensuring the xri scheme is present.
@param xri: an xri string
- @type xri: unicode
+ @type xri: six.text_type
"""
if not xri.startswith('xri://'):
xri = 'xri://' + xri
diff --git a/openid/yadis/xrires.py b/openid/yadis/xrires.py
index 4a36595..fe54c48 100644
--- a/openid/yadis/xrires.py
+++ b/openid/yadis/xrires.py
@@ -23,7 +23,7 @@ class ProxyResolver(object):
"""Build a URL to query the proxy resolver.
@param xri: An XRI to resolve.
- @type xri: unicode
+ @type xri: six.text_type
@param service_type: The service type to resolve, if you desire
service endpoint selection. A service type is a URI.
@@ -63,14 +63,14 @@ class ProxyResolver(object):
the fetching or parsing don't go so well.
@param xri: An XRI to resolve.
- @type xri: unicode
+ @type xri: six.text_type
@param service_types: A list of services types to query for. Service
types are URIs.
@type service_types: list of str
@returns: tuple of (CanonicalID, Service elements)
- @returntype: (unicode, list of C{ElementTree.Element}s)
+ @returntype: (six.text_type, list of C{ElementTree.Element}s)
"""
# FIXME: No test coverage!
services = []