id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16,500 | janpipek/physt | physt/special.py | _prepare_data | def _prepare_data(data, transformed, klass, *args, **kwargs):
"""Transform data for binning.
Returns
-------
np.ndarray
"""
# TODO: Maybe include in the class itself?
data = np.asarray(data)
if not transformed:
data = klass.transform(data)
dropna = kwargs.get("dropna", Fals... | python | def _prepare_data(data, transformed, klass, *args, **kwargs):
"""Transform data for binning.
Returns
-------
np.ndarray
"""
# TODO: Maybe include in the class itself?
data = np.asarray(data)
if not transformed:
data = klass.transform(data)
dropna = kwargs.get("dropna", Fals... | [
"def",
"_prepare_data",
"(",
"data",
",",
"transformed",
",",
"klass",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: Maybe include in the class itself?",
"data",
"=",
"np",
".",
"asarray",
"(",
"data",
")",
"if",
"not",
"transformed",
":",
... | Transform data for binning.
Returns
-------
np.ndarray | [
"Transform",
"data",
"for",
"binning",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/special.py#L331-L345 |
16,501 | janpipek/physt | physt/special.py | polar_histogram | def polar_histogram(xdata, ydata, radial_bins="numpy", phi_bins=16,
transformed=False, *args, **kwargs):
"""Facade construction function for the PolarHistogram.
Parameters
----------
transformed : bool
phi_range : Optional[tuple]
range
"""
dropna = kwargs.pop("dropna... | python | def polar_histogram(xdata, ydata, radial_bins="numpy", phi_bins=16,
transformed=False, *args, **kwargs):
"""Facade construction function for the PolarHistogram.
Parameters
----------
transformed : bool
phi_range : Optional[tuple]
range
"""
dropna = kwargs.pop("dropna... | [
"def",
"polar_histogram",
"(",
"xdata",
",",
"ydata",
",",
"radial_bins",
"=",
"\"numpy\"",
",",
"phi_bins",
"=",
"16",
",",
"transformed",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dropna",
"=",
"kwargs",
".",
"pop",
"(",
"... | Facade construction function for the PolarHistogram.
Parameters
----------
transformed : bool
phi_range : Optional[tuple]
range | [
"Facade",
"construction",
"function",
"for",
"the",
"PolarHistogram",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/special.py#L348-L377 |
16,502 | janpipek/physt | physt/special.py | spherical_histogram | def spherical_histogram(data=None, radial_bins="numpy", theta_bins=16, phi_bins=16, transformed=False, *args, **kwargs):
"""Facade construction function for the SphericalHistogram.
"""
dropna = kwargs.pop("dropna", True)
data = _prepare_data(data, transformed=transformed, klass=SphericalHistogram, dro... | python | def spherical_histogram(data=None, radial_bins="numpy", theta_bins=16, phi_bins=16, transformed=False, *args, **kwargs):
"""Facade construction function for the SphericalHistogram.
"""
dropna = kwargs.pop("dropna", True)
data = _prepare_data(data, transformed=transformed, klass=SphericalHistogram, dro... | [
"def",
"spherical_histogram",
"(",
"data",
"=",
"None",
",",
"radial_bins",
"=",
"\"numpy\"",
",",
"theta_bins",
"=",
"16",
",",
"phi_bins",
"=",
"16",
",",
"transformed",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dropna",
"="... | Facade construction function for the SphericalHistogram. | [
"Facade",
"construction",
"function",
"for",
"the",
"SphericalHistogram",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/special.py#L380-L412 |
16,503 | janpipek/physt | physt/special.py | cylindrical_histogram | def cylindrical_histogram(data=None, rho_bins="numpy", phi_bins=16, z_bins="numpy", transformed=False, *args, **kwargs):
"""Facade construction function for the CylindricalHistogram.
"""
dropna = kwargs.pop("dropna", True)
data = _prepare_data(data, transformed=transformed, klass=CylindricalHistogram,... | python | def cylindrical_histogram(data=None, rho_bins="numpy", phi_bins=16, z_bins="numpy", transformed=False, *args, **kwargs):
"""Facade construction function for the CylindricalHistogram.
"""
dropna = kwargs.pop("dropna", True)
data = _prepare_data(data, transformed=transformed, klass=CylindricalHistogram,... | [
"def",
"cylindrical_histogram",
"(",
"data",
"=",
"None",
",",
"rho_bins",
"=",
"\"numpy\"",
",",
"phi_bins",
"=",
"16",
",",
"z_bins",
"=",
"\"numpy\"",
",",
"transformed",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dropna",
"... | Facade construction function for the CylindricalHistogram. | [
"Facade",
"construction",
"function",
"for",
"the",
"CylindricalHistogram",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/special.py#L415-L439 |
16,504 | janpipek/physt | physt/special.py | TransformedHistogramMixin.projection | def projection(self, *axes, **kwargs):
"""Projection to lower-dimensional histogram.
The inheriting class should implement the _projection_class_map
class attribute to suggest class for the projection. If the
arguments don't match any of the map keys, HistogramND is used. ... | python | def projection(self, *axes, **kwargs):
"""Projection to lower-dimensional histogram.
The inheriting class should implement the _projection_class_map
class attribute to suggest class for the projection. If the
arguments don't match any of the map keys, HistogramND is used. ... | [
"def",
"projection",
"(",
"self",
",",
"*",
"axes",
",",
"*",
"*",
"kwargs",
")",
":",
"axes",
",",
"_",
"=",
"self",
".",
"_get_projection_axes",
"(",
"*",
"axes",
")",
"axes",
"=",
"tuple",
"(",
"sorted",
"(",
"axes",
")",
")",
"if",
"axes",
"i... | Projection to lower-dimensional histogram.
The inheriting class should implement the _projection_class_map
class attribute to suggest class for the projection. If the
arguments don't match any of the map keys, HistogramND is used. | [
"Projection",
"to",
"lower",
"-",
"dimensional",
"histogram",
".",
"The",
"inheriting",
"class",
"should",
"implement",
"the",
"_projection_class_map",
"class",
"attribute",
"to",
"suggest",
"class",
"for",
"the",
"projection",
".",
"If",
"the",
"arguments",
"don"... | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/special.py#L86-L99 |
16,505 | janpipek/physt | physt/plotting/plotly.py | enable_collection | def enable_collection(f):
"""Call the wrapped function with a HistogramCollection as argument."""
@wraps(f)
def new_f(h: AbstractHistogram1D, **kwargs):
from physt.histogram_collection import HistogramCollection
if isinstance(h, HistogramCollection):
return f(h, **kwargs)
... | python | def enable_collection(f):
"""Call the wrapped function with a HistogramCollection as argument."""
@wraps(f)
def new_f(h: AbstractHistogram1D, **kwargs):
from physt.histogram_collection import HistogramCollection
if isinstance(h, HistogramCollection):
return f(h, **kwargs)
... | [
"def",
"enable_collection",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"new_f",
"(",
"h",
":",
"AbstractHistogram1D",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"physt",
".",
"histogram_collection",
"import",
"HistogramCollection",
"if",
"isin... | Call the wrapped function with a HistogramCollection as argument. | [
"Call",
"the",
"wrapped",
"function",
"with",
"a",
"HistogramCollection",
"as",
"argument",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/plotting/plotly.py#L80-L89 |
16,506 | janpipek/physt | physt/plotting/plotly.py | bar | def bar(h: Histogram2D, *,
barmode: str = DEFAULT_BARMODE,
alpha: float = DEFAULT_ALPHA,
**kwargs):
"""Bar plot.
Parameters
----------
alpha: Opacity (0.0 - 1.0)
barmode : "overlay" | "group" | "stack"
"""
get_data_kwargs = pop_many(kwargs, "density", "cumulative", "... | python | def bar(h: Histogram2D, *,
barmode: str = DEFAULT_BARMODE,
alpha: float = DEFAULT_ALPHA,
**kwargs):
"""Bar plot.
Parameters
----------
alpha: Opacity (0.0 - 1.0)
barmode : "overlay" | "group" | "stack"
"""
get_data_kwargs = pop_many(kwargs, "density", "cumulative", "... | [
"def",
"bar",
"(",
"h",
":",
"Histogram2D",
",",
"*",
",",
"barmode",
":",
"str",
"=",
"DEFAULT_BARMODE",
",",
"alpha",
":",
"float",
"=",
"DEFAULT_ALPHA",
",",
"*",
"*",
"kwargs",
")",
":",
"get_data_kwargs",
"=",
"pop_many",
"(",
"kwargs",
",",
"\"de... | Bar plot.
Parameters
----------
alpha: Opacity (0.0 - 1.0)
barmode : "overlay" | "group" | "stack" | [
"Bar",
"plot",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/plotting/plotly.py#L143-L169 |
16,507 | janpipek/physt | physt/plotting/folium.py | _bins_to_json | def _bins_to_json(h2):
"""Create GeoJSON representation of histogram bins
Parameters
----------
h2: physt.histogram_nd.Histogram2D
A histogram of coordinates (in degrees)
Returns
-------
geo_json : dict
"""
south = h2.get_bin_left_edges(0)
north = h2.get_bin_right_edges... | python | def _bins_to_json(h2):
"""Create GeoJSON representation of histogram bins
Parameters
----------
h2: physt.histogram_nd.Histogram2D
A histogram of coordinates (in degrees)
Returns
-------
geo_json : dict
"""
south = h2.get_bin_left_edges(0)
north = h2.get_bin_right_edges... | [
"def",
"_bins_to_json",
"(",
"h2",
")",
":",
"south",
"=",
"h2",
".",
"get_bin_left_edges",
"(",
"0",
")",
"north",
"=",
"h2",
".",
"get_bin_right_edges",
"(",
"0",
")",
"west",
"=",
"h2",
".",
"get_bin_left_edges",
"(",
"1",
")",
"east",
"=",
"h2",
... | Create GeoJSON representation of histogram bins
Parameters
----------
h2: physt.histogram_nd.Histogram2D
A histogram of coordinates (in degrees)
Returns
-------
geo_json : dict | [
"Create",
"GeoJSON",
"representation",
"of",
"histogram",
"bins"
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/plotting/folium.py#L16-L54 |
16,508 | janpipek/physt | physt/plotting/folium.py | geo_map | def geo_map(h2, map=None, tiles='stamenterrain', cmap="wk", alpha=0.5, lw=1, fit_bounds=None, layer_name=None):
"""Show rectangular grid over a map.
Parameters
----------
h2: physt.histogram_nd.Histogram2D
A histogram of coordinates (in degrees: latitude, longitude)
map : folium.folium.Map
... | python | def geo_map(h2, map=None, tiles='stamenterrain', cmap="wk", alpha=0.5, lw=1, fit_bounds=None, layer_name=None):
"""Show rectangular grid over a map.
Parameters
----------
h2: physt.histogram_nd.Histogram2D
A histogram of coordinates (in degrees: latitude, longitude)
map : folium.folium.Map
... | [
"def",
"geo_map",
"(",
"h2",
",",
"map",
"=",
"None",
",",
"tiles",
"=",
"'stamenterrain'",
",",
"cmap",
"=",
"\"wk\"",
",",
"alpha",
"=",
"0.5",
",",
"lw",
"=",
"1",
",",
"fit_bounds",
"=",
"None",
",",
"layer_name",
"=",
"None",
")",
":",
"if",
... | Show rectangular grid over a map.
Parameters
----------
h2: physt.histogram_nd.Histogram2D
A histogram of coordinates (in degrees: latitude, longitude)
map : folium.folium.Map
Returns
-------
map : folium.folium.Map | [
"Show",
"rectangular",
"grid",
"over",
"a",
"map",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/plotting/folium.py#L57-L110 |
16,509 | janpipek/physt | physt/compat/geant4.py | load_csv | def load_csv(path):
"""Loads a histogram as output from Geant4 analysis tools in CSV format.
Parameters
----------
path: str
Path to the CSV file
Returns
-------
physt.histogram1d.Histogram1D or physt.histogram_nd.Histogram2D
"""
meta = []
data = []
with codecs.open... | python | def load_csv(path):
"""Loads a histogram as output from Geant4 analysis tools in CSV format.
Parameters
----------
path: str
Path to the CSV file
Returns
-------
physt.histogram1d.Histogram1D or physt.histogram_nd.Histogram2D
"""
meta = []
data = []
with codecs.open... | [
"def",
"load_csv",
"(",
"path",
")",
":",
"meta",
"=",
"[",
"]",
"data",
"=",
"[",
"]",
"with",
"codecs",
".",
"open",
"(",
"path",
",",
"encoding",
"=",
"\"ASCII\"",
")",
"as",
"in_file",
":",
"for",
"line",
"in",
"in_file",
":",
"if",
"line",
"... | Loads a histogram as output from Geant4 analysis tools in CSV format.
Parameters
----------
path: str
Path to the CSV file
Returns
-------
physt.histogram1d.Histogram1D or physt.histogram_nd.Histogram2D | [
"Loads",
"a",
"histogram",
"as",
"output",
"from",
"Geant4",
"analysis",
"tools",
"in",
"CSV",
"format",
"."
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/compat/geant4.py#L11-L40 |
16,510 | janpipek/physt | physt/compat/geant4.py | _get | def _get(pseudodict, key, single=True):
"""Helper method for getting values from "multi-dict"s"""
matches = [item[1] for item in pseudodict if item[0] == key]
if single:
return matches[0]
else:
return matches | python | def _get(pseudodict, key, single=True):
"""Helper method for getting values from "multi-dict"s"""
matches = [item[1] for item in pseudodict if item[0] == key]
if single:
return matches[0]
else:
return matches | [
"def",
"_get",
"(",
"pseudodict",
",",
"key",
",",
"single",
"=",
"True",
")",
":",
"matches",
"=",
"[",
"item",
"[",
"1",
"]",
"for",
"item",
"in",
"pseudodict",
"if",
"item",
"[",
"0",
"]",
"==",
"key",
"]",
"if",
"single",
":",
"return",
"matc... | Helper method for getting values from "multi-dict"s | [
"Helper",
"method",
"for",
"getting",
"values",
"from",
"multi",
"-",
"dict",
"s"
] | 6dd441b073514e7728235f50b2352d56aacf38d4 | https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/compat/geant4.py#L43-L49 |
16,511 | openid/python-openid | openid/yadis/xrires.py | ProxyResolver.queryURL | def queryURL(self, xri, service_type=None):
"""Build a URL to query the proxy resolver.
@param xri: An XRI to resolve.
@type xri: unicode
@param service_type: The service type to resolve, if you desire
service endpoint selection. A service type is a URI.
@type serv... | python | def queryURL(self, xri, service_type=None):
"""Build a URL to query the proxy resolver.
@param xri: An XRI to resolve.
@type xri: unicode
@param service_type: The service type to resolve, if you desire
service endpoint selection. A service type is a URI.
@type serv... | [
"def",
"queryURL",
"(",
"self",
",",
"xri",
",",
"service_type",
"=",
"None",
")",
":",
"# Trim off the xri:// prefix. The proxy resolver didn't accept it",
"# when this code was written, but that may (or may not) change for",
"# XRI Resolution 2.0 Working Draft 11.",
"qxri",
"=",
... | Build a URL to query the proxy resolver.
@param xri: An XRI to resolve.
@type xri: unicode
@param service_type: The service type to resolve, if you desire
service endpoint selection. A service type is a URI.
@type service_type: str
@returns: a URL
@returnt... | [
"Build",
"a",
"URL",
"to",
"query",
"the",
"proxy",
"resolver",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xrires.py#L20-L51 |
16,512 | openid/python-openid | openid/yadis/xrires.py | ProxyResolver.query | def query(self, xri, service_types):
"""Resolve some services for an XRI.
Note: I don't implement any service endpoint selection beyond what
the resolver I'm querying does, so the Services I return may well
include Services that were not of the types you asked for.
May raise fe... | python | def query(self, xri, service_types):
"""Resolve some services for an XRI.
Note: I don't implement any service endpoint selection beyond what
the resolver I'm querying does, so the Services I return may well
include Services that were not of the types you asked for.
May raise fe... | [
"def",
"query",
"(",
"self",
",",
"xri",
",",
"service_types",
")",
":",
"# FIXME: No test coverage!",
"services",
"=",
"[",
"]",
"# Make a seperate request to the proxy resolver for each service",
"# type, as, if it is following Refs, it could return a different",
"# XRDS for each... | Resolve some services for an XRI.
Note: I don't implement any service endpoint selection beyond what
the resolver I'm querying does, so the Services I return may well
include Services that were not of the types you asked for.
May raise fetchers.HTTPFetchingError or L{etxrd.XRDSError} i... | [
"Resolve",
"some",
"services",
"for",
"an",
"XRI",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xrires.py#L54-L97 |
16,513 | openid/python-openid | openid/yadis/accept.py | generateAcceptHeader | def generateAcceptHeader(*elements):
"""Generate an accept header value
[str or (str, float)] -> str
"""
parts = []
for element in elements:
if type(element) is str:
qs = "1.0"
mtype = element
else:
mtype, q = element
q = float(q)
... | python | def generateAcceptHeader(*elements):
"""Generate an accept header value
[str or (str, float)] -> str
"""
parts = []
for element in elements:
if type(element) is str:
qs = "1.0"
mtype = element
else:
mtype, q = element
q = float(q)
... | [
"def",
"generateAcceptHeader",
"(",
"*",
"elements",
")",
":",
"parts",
"=",
"[",
"]",
"for",
"element",
"in",
"elements",
":",
"if",
"type",
"(",
"element",
")",
"is",
"str",
":",
"qs",
"=",
"\"1.0\"",
"mtype",
"=",
"element",
"else",
":",
"mtype",
... | Generate an accept header value
[str or (str, float)] -> str | [
"Generate",
"an",
"accept",
"header",
"value"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/accept.py#L5-L33 |
16,514 | openid/python-openid | openid/yadis/accept.py | parseAcceptHeader | def parseAcceptHeader(value):
"""Parse an accept header, ignoring any accept-extensions
returns a list of tuples containing main MIME type, MIME subtype,
and quality markdown.
str -> [(str, str, float)]
"""
chunks = [chunk.strip() for chunk in value.split(',')]
accept = []
for chunk in... | python | def parseAcceptHeader(value):
"""Parse an accept header, ignoring any accept-extensions
returns a list of tuples containing main MIME type, MIME subtype,
and quality markdown.
str -> [(str, str, float)]
"""
chunks = [chunk.strip() for chunk in value.split(',')]
accept = []
for chunk in... | [
"def",
"parseAcceptHeader",
"(",
"value",
")",
":",
"chunks",
"=",
"[",
"chunk",
".",
"strip",
"(",
")",
"for",
"chunk",
"in",
"value",
".",
"split",
"(",
"','",
")",
"]",
"accept",
"=",
"[",
"]",
"for",
"chunk",
"in",
"chunks",
":",
"parts",
"=",
... | Parse an accept header, ignoring any accept-extensions
returns a list of tuples containing main MIME type, MIME subtype,
and quality markdown.
str -> [(str, str, float)] | [
"Parse",
"an",
"accept",
"header",
"ignoring",
"any",
"accept",
"-",
"extensions"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/accept.py#L35-L72 |
16,515 | openid/python-openid | openid/yadis/accept.py | getAcceptable | def getAcceptable(accept_header, have_types):
"""Parse the accept header and return a list of available types in
preferred order. If a type is unacceptable, it will not be in the
resulting list.
This is a convenience wrapper around matchTypes and
parseAcceptHeader.
(str, [str]) -> [str]
""... | python | def getAcceptable(accept_header, have_types):
"""Parse the accept header and return a list of available types in
preferred order. If a type is unacceptable, it will not be in the
resulting list.
This is a convenience wrapper around matchTypes and
parseAcceptHeader.
(str, [str]) -> [str]
""... | [
"def",
"getAcceptable",
"(",
"accept_header",
",",
"have_types",
")",
":",
"accepted",
"=",
"parseAcceptHeader",
"(",
"accept_header",
")",
"preferred",
"=",
"matchTypes",
"(",
"accepted",
",",
"have_types",
")",
"return",
"[",
"mtype",
"for",
"(",
"mtype",
",... | Parse the accept header and return a list of available types in
preferred order. If a type is unacceptable, it will not be in the
resulting list.
This is a convenience wrapper around matchTypes and
parseAcceptHeader.
(str, [str]) -> [str] | [
"Parse",
"the",
"accept",
"header",
"and",
"return",
"a",
"list",
"of",
"available",
"types",
"in",
"preferred",
"order",
".",
"If",
"a",
"type",
"is",
"unacceptable",
"it",
"will",
"not",
"be",
"in",
"the",
"resulting",
"list",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/accept.py#L121-L133 |
16,516 | openid/python-openid | openid/message.py | Message.fromPostArgs | def fromPostArgs(cls, args):
"""Construct a Message containing a set of POST arguments.
"""
self = cls()
# Partition into "openid." args and bare args
openid_args = {}
for key, value in args.items():
if isinstance(value, list):
raise TypeErro... | python | def fromPostArgs(cls, args):
"""Construct a Message containing a set of POST arguments.
"""
self = cls()
# Partition into "openid." args and bare args
openid_args = {}
for key, value in args.items():
if isinstance(value, list):
raise TypeErro... | [
"def",
"fromPostArgs",
"(",
"cls",
",",
"args",
")",
":",
"self",
"=",
"cls",
"(",
")",
"# Partition into \"openid.\" args and bare args",
"openid_args",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"args",
".",
"items",
"(",
")",
":",
"if",
"isinstanc... | Construct a Message containing a set of POST arguments. | [
"Construct",
"a",
"Message",
"containing",
"a",
"set",
"of",
"POST",
"arguments",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/message.py#L143-L169 |
16,517 | openid/python-openid | openid/message.py | Message.getKey | def getKey(self, namespace, ns_key):
"""Get the key for a particular namespaced argument"""
namespace = self._fixNS(namespace)
if namespace == BARE_NS:
return ns_key
ns_alias = self.namespaces.getAlias(namespace)
# No alias is defined, so no key can exist
if... | python | def getKey(self, namespace, ns_key):
"""Get the key for a particular namespaced argument"""
namespace = self._fixNS(namespace)
if namespace == BARE_NS:
return ns_key
ns_alias = self.namespaces.getAlias(namespace)
# No alias is defined, so no key can exist
if... | [
"def",
"getKey",
"(",
"self",
",",
"namespace",
",",
"ns_key",
")",
":",
"namespace",
"=",
"self",
".",
"_fixNS",
"(",
"namespace",
")",
"if",
"namespace",
"==",
"BARE_NS",
":",
"return",
"ns_key",
"ns_alias",
"=",
"self",
".",
"namespaces",
".",
"getAli... | Get the key for a particular namespaced argument | [
"Get",
"the",
"key",
"for",
"a",
"particular",
"namespaced",
"argument"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/message.py#L402-L419 |
16,518 | openid/python-openid | openid/message.py | Message.getArg | def getArg(self, namespace, key, default=None):
"""Get a value for a namespaced key.
@param namespace: The namespace in the message for this key
@type namespace: str
@param key: The key to get within this namespace
@type key: str
@param default: The value to use if thi... | python | def getArg(self, namespace, key, default=None):
"""Get a value for a namespaced key.
@param namespace: The namespace in the message for this key
@type namespace: str
@param key: The key to get within this namespace
@type key: str
@param default: The value to use if thi... | [
"def",
"getArg",
"(",
"self",
",",
"namespace",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"namespace",
"=",
"self",
".",
"_fixNS",
"(",
"namespace",
")",
"args_key",
"=",
"(",
"namespace",
",",
"key",
")",
"try",
":",
"return",
"self",
".",
... | Get a value for a namespaced key.
@param namespace: The namespace in the message for this key
@type namespace: str
@param key: The key to get within this namespace
@type key: str
@param default: The value to use if this key is absent from
this message. Using the sp... | [
"Get",
"a",
"value",
"for",
"a",
"namespaced",
"key",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/message.py#L421-L448 |
16,519 | openid/python-openid | openid/message.py | NamespaceMap.add | def add(self, namespace_uri):
"""Add this namespace URI to the mapping, without caring what
alias it ends up with"""
# See if this namespace is already mapped to an alias
alias = self.namespace_to_alias.get(namespace_uri)
if alias is not None:
return alias
# ... | python | def add(self, namespace_uri):
"""Add this namespace URI to the mapping, without caring what
alias it ends up with"""
# See if this namespace is already mapped to an alias
alias = self.namespace_to_alias.get(namespace_uri)
if alias is not None:
return alias
# ... | [
"def",
"add",
"(",
"self",
",",
"namespace_uri",
")",
":",
"# See if this namespace is already mapped to an alias",
"alias",
"=",
"self",
".",
"namespace_to_alias",
".",
"get",
"(",
"namespace_uri",
")",
"if",
"alias",
"is",
"not",
"None",
":",
"return",
"alias",
... | Add this namespace URI to the mapping, without caring what
alias it ends up with | [
"Add",
"this",
"namespace",
"URI",
"to",
"the",
"mapping",
"without",
"caring",
"what",
"alias",
"it",
"ends",
"up",
"with"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/message.py#L604-L623 |
16,520 | openid/python-openid | openid/yadis/parsehtml.py | findHTMLMeta | def findHTMLMeta(stream):
"""Look for a meta http-equiv tag with the YADIS header name.
@param stream: Source of the html text
@type stream: Object that implements a read() method that works
like file.read
@return: The URI from which to fetch the XRDS document
@rtype: str
@raises Meta... | python | def findHTMLMeta(stream):
"""Look for a meta http-equiv tag with the YADIS header name.
@param stream: Source of the html text
@type stream: Object that implements a read() method that works
like file.read
@return: The URI from which to fetch the XRDS document
@rtype: str
@raises Meta... | [
"def",
"findHTMLMeta",
"(",
"stream",
")",
":",
"parser",
"=",
"YadisHTMLParser",
"(",
")",
"chunks",
"=",
"[",
"]",
"while",
"1",
":",
"chunk",
"=",
"stream",
".",
"read",
"(",
"CHUNK_SIZE",
")",
"if",
"not",
"chunk",
":",
"# End of file",
"break",
"c... | Look for a meta http-equiv tag with the YADIS header name.
@param stream: Source of the html text
@type stream: Object that implements a read() method that works
like file.read
@return: The URI from which to fetch the XRDS document
@rtype: str
@raises MetaNotFound: raised with the content... | [
"Look",
"for",
"a",
"meta",
"http",
"-",
"equiv",
"tag",
"with",
"the",
"YADIS",
"header",
"name",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/parsehtml.py#L158-L197 |
16,521 | openid/python-openid | openid/extensions/ax.py | toTypeURIs | def toTypeURIs(namespace_map, alias_list_s):
"""Given a namespace mapping and a string containing a
comma-separated list of namespace aliases, return a list of type
URIs that correspond to those aliases.
@param namespace_map: The mapping from namespace URI to alias
@type namespace_map: openid.messa... | python | def toTypeURIs(namespace_map, alias_list_s):
"""Given a namespace mapping and a string containing a
comma-separated list of namespace aliases, return a list of type
URIs that correspond to those aliases.
@param namespace_map: The mapping from namespace URI to alias
@type namespace_map: openid.messa... | [
"def",
"toTypeURIs",
"(",
"namespace_map",
",",
"alias_list_s",
")",
":",
"uris",
"=",
"[",
"]",
"if",
"alias_list_s",
":",
"for",
"alias",
"in",
"alias_list_s",
".",
"split",
"(",
"','",
")",
":",
"type_uri",
"=",
"namespace_map",
".",
"getNamespaceURI",
... | Given a namespace mapping and a string containing a
comma-separated list of namespace aliases, return a list of type
URIs that correspond to those aliases.
@param namespace_map: The mapping from namespace URI to alias
@type namespace_map: openid.message.NamespaceMap
@param alias_list_s: The string... | [
"Given",
"a",
"namespace",
"mapping",
"and",
"a",
"string",
"containing",
"a",
"comma",
"-",
"separated",
"list",
"of",
"namespace",
"aliases",
"return",
"a",
"list",
"of",
"type",
"URIs",
"that",
"correspond",
"to",
"those",
"aliases",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/ax.py#L149-L179 |
16,522 | openid/python-openid | openid/extensions/ax.py | FetchRequest.add | def add(self, attribute):
"""Add an attribute to this attribute exchange request.
@param attribute: The attribute that is being requested
@type attribute: C{L{AttrInfo}}
@returns: None
@raise KeyError: when the requested attribute is already
present in this fetch r... | python | def add(self, attribute):
"""Add an attribute to this attribute exchange request.
@param attribute: The attribute that is being requested
@type attribute: C{L{AttrInfo}}
@returns: None
@raise KeyError: when the requested attribute is already
present in this fetch r... | [
"def",
"add",
"(",
"self",
",",
"attribute",
")",
":",
"if",
"attribute",
".",
"type_uri",
"in",
"self",
".",
"requested_attributes",
":",
"raise",
"KeyError",
"(",
"'The attribute %r has already been requested'",
"%",
"(",
"attribute",
".",
"type_uri",
",",
")"... | Add an attribute to this attribute exchange request.
@param attribute: The attribute that is being requested
@type attribute: C{L{AttrInfo}}
@returns: None
@raise KeyError: when the requested attribute is already
present in this fetch request. | [
"Add",
"an",
"attribute",
"to",
"this",
"attribute",
"exchange",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/ax.py#L202-L217 |
16,523 | openid/python-openid | openid/extensions/ax.py | AXKeyValueMessage.addValue | def addValue(self, type_uri, value):
"""Add a single value for the given attribute type to the
message. If there are already values specified for this type,
this value will be sent in addition to the values already
specified.
@param type_uri: The URI for the attribute
@... | python | def addValue(self, type_uri, value):
"""Add a single value for the given attribute type to the
message. If there are already values specified for this type,
this value will be sent in addition to the values already
specified.
@param type_uri: The URI for the attribute
@... | [
"def",
"addValue",
"(",
"self",
",",
"type_uri",
",",
"value",
")",
":",
"try",
":",
"values",
"=",
"self",
".",
"data",
"[",
"type_uri",
"]",
"except",
"KeyError",
":",
"values",
"=",
"self",
".",
"data",
"[",
"type_uri",
"]",
"=",
"[",
"]",
"valu... | Add a single value for the given attribute type to the
message. If there are already values specified for this type,
this value will be sent in addition to the values already
specified.
@param type_uri: The URI for the attribute
@param value: The value to add to the response to... | [
"Add",
"a",
"single",
"value",
"for",
"the",
"given",
"attribute",
"type",
"to",
"the",
"message",
".",
"If",
"there",
"are",
"already",
"values",
"specified",
"for",
"this",
"type",
"this",
"value",
"will",
"be",
"sent",
"in",
"addition",
"to",
"the",
"... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/ax.py#L425-L444 |
16,524 | openid/python-openid | openid/extensions/ax.py | AXKeyValueMessage.getSingle | def getSingle(self, type_uri, default=None):
"""Get a single value for an attribute. If no value was sent
for this attribute, use the supplied default. If there is more
than one value for this attribute, this method will fail.
@type type_uri: str
@param type_uri: The URI for the... | python | def getSingle(self, type_uri, default=None):
"""Get a single value for an attribute. If no value was sent
for this attribute, use the supplied default. If there is more
than one value for this attribute, this method will fail.
@type type_uri: str
@param type_uri: The URI for the... | [
"def",
"getSingle",
"(",
"self",
",",
"type_uri",
",",
"default",
"=",
"None",
")",
":",
"values",
"=",
"self",
".",
"data",
".",
"get",
"(",
"type_uri",
")",
"if",
"not",
"values",
":",
"return",
"default",
"elif",
"len",
"(",
"values",
")",
"==",
... | Get a single value for an attribute. If no value was sent
for this attribute, use the supplied default. If there is more
than one value for this attribute, this method will fail.
@type type_uri: str
@param type_uri: The URI for the attribute
@param default: The value to return ... | [
"Get",
"a",
"single",
"value",
"for",
"an",
"attribute",
".",
"If",
"no",
"value",
"was",
"sent",
"for",
"this",
"attribute",
"use",
"the",
"supplied",
"default",
".",
"If",
"there",
"is",
"more",
"than",
"one",
"value",
"for",
"this",
"attribute",
"this... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/ax.py#L529-L555 |
16,525 | openid/python-openid | openid/extensions/ax.py | FetchResponse.getExtensionArgs | def getExtensionArgs(self):
"""Serialize this object into arguments in the attribute
exchange namespace
@returns: The dictionary of unqualified attribute exchange
arguments that represent this fetch_response.
@rtype: {unicode;unicode}
"""
aliases = Namespace... | python | def getExtensionArgs(self):
"""Serialize this object into arguments in the attribute
exchange namespace
@returns: The dictionary of unqualified attribute exchange
arguments that represent this fetch_response.
@rtype: {unicode;unicode}
"""
aliases = Namespace... | [
"def",
"getExtensionArgs",
"(",
"self",
")",
":",
"aliases",
"=",
"NamespaceMap",
"(",
")",
"zero_value_types",
"=",
"[",
"]",
"if",
"self",
".",
"request",
"is",
"not",
"None",
":",
"# Validate the data in the context of the request (the",
"# same attributes should b... | Serialize this object into arguments in the attribute
exchange namespace
@returns: The dictionary of unqualified attribute exchange
arguments that represent this fetch_response.
@rtype: {unicode;unicode} | [
"Serialize",
"this",
"object",
"into",
"arguments",
"in",
"the",
"attribute",
"exchange",
"namespace"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/ax.py#L616-L682 |
16,526 | openid/python-openid | openid/extensions/ax.py | FetchResponse.fromSuccessResponse | def fromSuccessResponse(cls, success_response, signed=True):
"""Construct a FetchResponse object from an OpenID library
SuccessResponse object.
@param success_response: A successful id_res response object
@type success_response: openid.consumer.consumer.SuccessResponse
@param s... | python | def fromSuccessResponse(cls, success_response, signed=True):
"""Construct a FetchResponse object from an OpenID library
SuccessResponse object.
@param success_response: A successful id_res response object
@type success_response: openid.consumer.consumer.SuccessResponse
@param s... | [
"def",
"fromSuccessResponse",
"(",
"cls",
",",
"success_response",
",",
"signed",
"=",
"True",
")",
":",
"self",
"=",
"cls",
"(",
")",
"ax_args",
"=",
"success_response",
".",
"extensionResponse",
"(",
"self",
".",
"ns_uri",
",",
"signed",
")",
"try",
":",... | Construct a FetchResponse object from an OpenID library
SuccessResponse object.
@param success_response: A successful id_res response object
@type success_response: openid.consumer.consumer.SuccessResponse
@param signed: Whether non-signed args should be
processsed. If True... | [
"Construct",
"a",
"FetchResponse",
"object",
"from",
"an",
"OpenID",
"library",
"SuccessResponse",
"object",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/ax.py#L689-L715 |
16,527 | openid/python-openid | openid/extensions/sreg.py | SRegRequest.parseExtensionArgs | def parseExtensionArgs(self, args, strict=False):
"""Parse the unqualified simple registration request
parameters and add them to this object.
This method is essentially the inverse of
C{L{getExtensionArgs}}. This method restores the serialized simple
registration request fields... | python | def parseExtensionArgs(self, args, strict=False):
"""Parse the unqualified simple registration request
parameters and add them to this object.
This method is essentially the inverse of
C{L{getExtensionArgs}}. This method restores the serialized simple
registration request fields... | [
"def",
"parseExtensionArgs",
"(",
"self",
",",
"args",
",",
"strict",
"=",
"False",
")",
":",
"for",
"list_name",
"in",
"[",
"'required'",
",",
"'optional'",
"]",
":",
"required",
"=",
"(",
"list_name",
"==",
"'required'",
")",
"items",
"=",
"args",
".",... | Parse the unqualified simple registration request
parameters and add them to this object.
This method is essentially the inverse of
C{L{getExtensionArgs}}. This method restores the serialized simple
registration request fields.
If you are extracting arguments from a standard Op... | [
"Parse",
"the",
"unqualified",
"simple",
"registration",
"request",
"parameters",
"and",
"add",
"them",
"to",
"this",
"object",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/sreg.py#L232-L271 |
16,528 | openid/python-openid | openid/extensions/sreg.py | SRegRequest.requestField | def requestField(self, field_name, required=False, strict=False):
"""Request the specified field from the OpenID user
@param field_name: the unqualified simple registration field name
@type field_name: str
@param required: whether the given field should be presented
to the ... | python | def requestField(self, field_name, required=False, strict=False):
"""Request the specified field from the OpenID user
@param field_name: the unqualified simple registration field name
@type field_name: str
@param required: whether the given field should be presented
to the ... | [
"def",
"requestField",
"(",
"self",
",",
"field_name",
",",
"required",
"=",
"False",
",",
"strict",
"=",
"False",
")",
":",
"checkFieldName",
"(",
"field_name",
")",
"if",
"strict",
":",
"if",
"field_name",
"in",
"self",
".",
"required",
"or",
"field_name... | Request the specified field from the OpenID user
@param field_name: the unqualified simple registration field name
@type field_name: str
@param required: whether the given field should be presented
to the user as being a required to successfully complete
the request
... | [
"Request",
"the",
"specified",
"field",
"from",
"the",
"OpenID",
"user"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/sreg.py#L293-L328 |
16,529 | openid/python-openid | openid/extensions/sreg.py | SRegRequest.requestFields | def requestFields(self, field_names, required=False, strict=False):
"""Add the given list of fields to the request
@param field_names: The simple registration data fields to request
@type field_names: [str]
@param required: Whether these values should be presented to
the us... | python | def requestFields(self, field_names, required=False, strict=False):
"""Add the given list of fields to the request
@param field_names: The simple registration data fields to request
@type field_names: [str]
@param required: Whether these values should be presented to
the us... | [
"def",
"requestFields",
"(",
"self",
",",
"field_names",
",",
"required",
"=",
"False",
",",
"strict",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"field_names",
",",
"basestring",
")",
":",
"raise",
"TypeError",
"(",
"'Fields should be passed as a list of ... | Add the given list of fields to the request
@param field_names: The simple registration data fields to request
@type field_names: [str]
@param required: Whether these values should be presented to
the user as required
@param strict: whether to raise an exception when a fie... | [
"Add",
"the",
"given",
"list",
"of",
"fields",
"to",
"the",
"request"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/sreg.py#L330-L351 |
16,530 | openid/python-openid | openid/extensions/sreg.py | SRegRequest.getExtensionArgs | def getExtensionArgs(self):
"""Get a dictionary of unqualified simple registration
arguments representing this request.
This method is essentially the inverse of
C{L{parseExtensionArgs}}. This method serializes the simple
registration request fields.
@rtype: {str:str}
... | python | def getExtensionArgs(self):
"""Get a dictionary of unqualified simple registration
arguments representing this request.
This method is essentially the inverse of
C{L{parseExtensionArgs}}. This method serializes the simple
registration request fields.
@rtype: {str:str}
... | [
"def",
"getExtensionArgs",
"(",
"self",
")",
":",
"args",
"=",
"{",
"}",
"if",
"self",
".",
"required",
":",
"args",
"[",
"'required'",
"]",
"=",
"','",
".",
"join",
"(",
"self",
".",
"required",
")",
"if",
"self",
".",
"optional",
":",
"args",
"["... | Get a dictionary of unqualified simple registration
arguments representing this request.
This method is essentially the inverse of
C{L{parseExtensionArgs}}. This method serializes the simple
registration request fields.
@rtype: {str:str} | [
"Get",
"a",
"dictionary",
"of",
"unqualified",
"simple",
"registration",
"arguments",
"representing",
"this",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/sreg.py#L353-L374 |
16,531 | openid/python-openid | openid/extensions/sreg.py | SRegResponse.get | def get(self, field_name, default=None):
"""Like dict.get, except that it checks that the field name is
defined by the simple registration specification"""
checkFieldName(field_name)
return self.data.get(field_name, default) | python | def get(self, field_name, default=None):
"""Like dict.get, except that it checks that the field name is
defined by the simple registration specification"""
checkFieldName(field_name)
return self.data.get(field_name, default) | [
"def",
"get",
"(",
"self",
",",
"field_name",
",",
"default",
"=",
"None",
")",
":",
"checkFieldName",
"(",
"field_name",
")",
"return",
"self",
".",
"data",
".",
"get",
"(",
"field_name",
",",
"default",
")"
] | Like dict.get, except that it checks that the field name is
defined by the simple registration specification | [
"Like",
"dict",
".",
"get",
"except",
"that",
"it",
"checks",
"that",
"the",
"field",
"name",
"is",
"defined",
"by",
"the",
"simple",
"registration",
"specification"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/sreg.py#L483-L487 |
16,532 | openid/python-openid | openid/server/trustroot.py | returnToMatches | def returnToMatches(allowed_return_to_urls, return_to):
"""Is the return_to URL under one of the supplied allowed
return_to URLs?
@since: 2.1.0
"""
for allowed_return_to in allowed_return_to_urls:
# A return_to pattern works the same as a realm, except that
# it's not allowed to us... | python | def returnToMatches(allowed_return_to_urls, return_to):
"""Is the return_to URL under one of the supplied allowed
return_to URLs?
@since: 2.1.0
"""
for allowed_return_to in allowed_return_to_urls:
# A return_to pattern works the same as a realm, except that
# it's not allowed to us... | [
"def",
"returnToMatches",
"(",
"allowed_return_to_urls",
",",
"return_to",
")",
":",
"for",
"allowed_return_to",
"in",
"allowed_return_to_urls",
":",
"# A return_to pattern works the same as a realm, except that",
"# it's not allowed to use a wildcard. We'll model this by",
"# parsing ... | Is the return_to URL under one of the supplied allowed
return_to URLs?
@since: 2.1.0 | [
"Is",
"the",
"return_to",
"URL",
"under",
"one",
"of",
"the",
"supplied",
"allowed",
"return_to",
"URLs?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/trustroot.py#L381-L407 |
16,533 | openid/python-openid | openid/server/trustroot.py | getAllowedReturnURLs | def getAllowedReturnURLs(relying_party_url):
"""Given a relying party discovery URL return a list of return_to URLs.
@since: 2.1.0
"""
(rp_url_after_redirects, return_to_urls) = services.getServiceEndpoints(
relying_party_url, _extractReturnURL)
if rp_url_after_redirects != relying_party_u... | python | def getAllowedReturnURLs(relying_party_url):
"""Given a relying party discovery URL return a list of return_to URLs.
@since: 2.1.0
"""
(rp_url_after_redirects, return_to_urls) = services.getServiceEndpoints(
relying_party_url, _extractReturnURL)
if rp_url_after_redirects != relying_party_u... | [
"def",
"getAllowedReturnURLs",
"(",
"relying_party_url",
")",
":",
"(",
"rp_url_after_redirects",
",",
"return_to_urls",
")",
"=",
"services",
".",
"getServiceEndpoints",
"(",
"relying_party_url",
",",
"_extractReturnURL",
")",
"if",
"rp_url_after_redirects",
"!=",
"rel... | Given a relying party discovery URL return a list of return_to URLs.
@since: 2.1.0 | [
"Given",
"a",
"relying",
"party",
"discovery",
"URL",
"return",
"a",
"list",
"of",
"return_to",
"URLs",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/trustroot.py#L409-L422 |
16,534 | openid/python-openid | openid/server/trustroot.py | verifyReturnTo | def verifyReturnTo(realm_str, return_to, _vrfy=getAllowedReturnURLs):
"""Verify that a return_to URL is valid for the given realm.
This function builds a discovery URL, performs Yadis discovery on
it, makes sure that the URL does not redirect, parses out the
return_to URLs, and finally checks to see if... | python | def verifyReturnTo(realm_str, return_to, _vrfy=getAllowedReturnURLs):
"""Verify that a return_to URL is valid for the given realm.
This function builds a discovery URL, performs Yadis discovery on
it, makes sure that the URL does not redirect, parses out the
return_to URLs, and finally checks to see if... | [
"def",
"verifyReturnTo",
"(",
"realm_str",
",",
"return_to",
",",
"_vrfy",
"=",
"getAllowedReturnURLs",
")",
":",
"realm",
"=",
"TrustRoot",
".",
"parse",
"(",
"realm_str",
")",
"if",
"realm",
"is",
"None",
":",
"# The realm does not parse as a URL pattern",
"retu... | Verify that a return_to URL is valid for the given realm.
This function builds a discovery URL, performs Yadis discovery on
it, makes sure that the URL does not redirect, parses out the
return_to URLs, and finally checks to see if the current return_to
URL matches the return_to.
@raises DiscoveryF... | [
"Verify",
"that",
"a",
"return_to",
"URL",
"is",
"valid",
"for",
"the",
"given",
"realm",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/trustroot.py#L425-L454 |
16,535 | openid/python-openid | openid/server/trustroot.py | TrustRoot.validateURL | def validateURL(self, url):
"""
Validates a URL against this trust root.
@param url: The URL to check
@type url: C{str}
@return: Whether the given URL is within this trust root.
@rtype: C{bool}
"""
url_parts = _parseURL(url)
if url_parts is ... | python | def validateURL(self, url):
"""
Validates a URL against this trust root.
@param url: The URL to check
@type url: C{str}
@return: Whether the given URL is within this trust root.
@rtype: C{bool}
"""
url_parts = _parseURL(url)
if url_parts is ... | [
"def",
"validateURL",
"(",
"self",
",",
"url",
")",
":",
"url_parts",
"=",
"_parseURL",
"(",
"url",
")",
"if",
"url_parts",
"is",
"None",
":",
"return",
"False",
"proto",
",",
"host",
",",
"port",
",",
"path",
"=",
"url_parts",
"if",
"proto",
"!=",
"... | Validates a URL against this trust root.
@param url: The URL to check
@type url: C{str}
@return: Whether the given URL is within this trust root.
@rtype: C{bool} | [
"Validates",
"a",
"URL",
"against",
"this",
"trust",
"root",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/trustroot.py#L190-L247 |
16,536 | openid/python-openid | openid/server/trustroot.py | TrustRoot.checkSanity | def checkSanity(cls, trust_root_string):
"""str -> bool
is this a sane trust root?
"""
trust_root = cls.parse(trust_root_string)
if trust_root is None:
return False
else:
return trust_root.isSane() | python | def checkSanity(cls, trust_root_string):
"""str -> bool
is this a sane trust root?
"""
trust_root = cls.parse(trust_root_string)
if trust_root is None:
return False
else:
return trust_root.isSane() | [
"def",
"checkSanity",
"(",
"cls",
",",
"trust_root_string",
")",
":",
"trust_root",
"=",
"cls",
".",
"parse",
"(",
"trust_root_string",
")",
"if",
"trust_root",
"is",
"None",
":",
"return",
"False",
"else",
":",
"return",
"trust_root",
".",
"isSane",
"(",
... | str -> bool
is this a sane trust root? | [
"str",
"-",
">",
"bool"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/trustroot.py#L303-L312 |
16,537 | openid/python-openid | openid/server/trustroot.py | TrustRoot.checkURL | def checkURL(cls, trust_root, url):
"""quick func for validating a url against a trust root. See the
TrustRoot class if you need more control."""
tr = cls.parse(trust_root)
return tr is not None and tr.validateURL(url) | python | def checkURL(cls, trust_root, url):
"""quick func for validating a url against a trust root. See the
TrustRoot class if you need more control."""
tr = cls.parse(trust_root)
return tr is not None and tr.validateURL(url) | [
"def",
"checkURL",
"(",
"cls",
",",
"trust_root",
",",
"url",
")",
":",
"tr",
"=",
"cls",
".",
"parse",
"(",
"trust_root",
")",
"return",
"tr",
"is",
"not",
"None",
"and",
"tr",
".",
"validateURL",
"(",
"url",
")"
] | quick func for validating a url against a trust root. See the
TrustRoot class if you need more control. | [
"quick",
"func",
"for",
"validating",
"a",
"url",
"against",
"a",
"trust",
"root",
".",
"See",
"the",
"TrustRoot",
"class",
"if",
"you",
"need",
"more",
"control",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/trustroot.py#L316-L320 |
16,538 | openid/python-openid | openid/server/trustroot.py | TrustRoot.buildDiscoveryURL | def buildDiscoveryURL(self):
"""Return a discovery URL for this realm.
This function does not check to make sure that the realm is
valid. Its behaviour on invalid inputs is undefined.
@rtype: str
@returns: The URL upon which relying party discovery should be run
in... | python | def buildDiscoveryURL(self):
"""Return a discovery URL for this realm.
This function does not check to make sure that the realm is
valid. Its behaviour on invalid inputs is undefined.
@rtype: str
@returns: The URL upon which relying party discovery should be run
in... | [
"def",
"buildDiscoveryURL",
"(",
"self",
")",
":",
"if",
"self",
".",
"wildcard",
":",
"# Use \"www.\" in place of the star",
"assert",
"self",
".",
"host",
".",
"startswith",
"(",
"'.'",
")",
",",
"self",
".",
"host",
"www_domain",
"=",
"'www'",
"+",
"self"... | Return a discovery URL for this realm.
This function does not check to make sure that the realm is
valid. Its behaviour on invalid inputs is undefined.
@rtype: str
@returns: The URL upon which relying party discovery should be run
in order to verify the return_to URL
... | [
"Return",
"a",
"discovery",
"URL",
"for",
"this",
"realm",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/trustroot.py#L324-L343 |
16,539 | openid/python-openid | openid/yadis/manager.py | YadisServiceManager.next | def next(self):
"""Return the next service
self.current() will continue to return that service until the
next call to this method."""
try:
self._current = self.services.pop(0)
except IndexError:
raise StopIteration
else:
return self._c... | python | def next(self):
"""Return the next service
self.current() will continue to return that service until the
next call to this method."""
try:
self._current = self.services.pop(0)
except IndexError:
raise StopIteration
else:
return self._c... | [
"def",
"next",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_current",
"=",
"self",
".",
"services",
".",
"pop",
"(",
"0",
")",
"except",
"IndexError",
":",
"raise",
"StopIteration",
"else",
":",
"return",
"self",
".",
"_current"
] | Return the next service
self.current() will continue to return that service until the
next call to this method. | [
"Return",
"the",
"next",
"service"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L27-L37 |
16,540 | openid/python-openid | openid/yadis/manager.py | Discovery.getNextService | def getNextService(self, discover):
"""Return the next authentication service for the pair of
user_input and session. This function handles fallback.
@param discover: a callable that takes a URL and returns a
list of services
@type discover: str -> [service]
@re... | python | def getNextService(self, discover):
"""Return the next authentication service for the pair of
user_input and session. This function handles fallback.
@param discover: a callable that takes a URL and returns a
list of services
@type discover: str -> [service]
@re... | [
"def",
"getNextService",
"(",
"self",
",",
"discover",
")",
":",
"manager",
"=",
"self",
".",
"getManager",
"(",
")",
"if",
"manager",
"is",
"not",
"None",
"and",
"not",
"manager",
":",
"self",
".",
"destroyManager",
"(",
")",
"if",
"not",
"manager",
"... | Return the next authentication service for the pair of
user_input and session. This function handles fallback.
@param discover: a callable that takes a URL and returns a
list of services
@type discover: str -> [service]
@return: the next available service | [
"Return",
"the",
"next",
"authentication",
"service",
"for",
"the",
"pair",
"of",
"user_input",
"and",
"session",
".",
"This",
"function",
"handles",
"fallback",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L87-L114 |
16,541 | openid/python-openid | openid/yadis/manager.py | Discovery.cleanup | def cleanup(self, force=False):
"""Clean up Yadis-related services in the session and return
the most-recently-attempted service from the manager, if one
exists.
@param force: True if the manager should be deleted regardless
of whether it's a manager for self.url.
@retu... | python | def cleanup(self, force=False):
"""Clean up Yadis-related services in the session and return
the most-recently-attempted service from the manager, if one
exists.
@param force: True if the manager should be deleted regardless
of whether it's a manager for self.url.
@retu... | [
"def",
"cleanup",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"manager",
"=",
"self",
".",
"getManager",
"(",
"force",
"=",
"force",
")",
"if",
"manager",
"is",
"not",
"None",
":",
"service",
"=",
"manager",
".",
"current",
"(",
")",
"self",
... | Clean up Yadis-related services in the session and return
the most-recently-attempted service from the manager, if one
exists.
@param force: True if the manager should be deleted regardless
of whether it's a manager for self.url.
@return: current service endpoint object or None... | [
"Clean",
"up",
"Yadis",
"-",
"related",
"services",
"in",
"the",
"session",
"and",
"return",
"the",
"most",
"-",
"recently",
"-",
"attempted",
"service",
"from",
"the",
"manager",
"if",
"one",
"exists",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L116-L134 |
16,542 | openid/python-openid | openid/yadis/manager.py | Discovery.getManager | def getManager(self, force=False):
"""Extract the YadisServiceManager for this object's URL and
suffix from the session.
@param force: True if the manager should be returned
regardless of whether it's a manager for self.url.
@return: The current YadisServiceManager, if it's for... | python | def getManager(self, force=False):
"""Extract the YadisServiceManager for this object's URL and
suffix from the session.
@param force: True if the manager should be returned
regardless of whether it's a manager for self.url.
@return: The current YadisServiceManager, if it's for... | [
"def",
"getManager",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"manager",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"getSessionKey",
"(",
")",
")",
"if",
"(",
"manager",
"is",
"not",
"None",
"and",
"(",
"manager",
".",
"fo... | Extract the YadisServiceManager for this object's URL and
suffix from the session.
@param force: True if the manager should be returned
regardless of whether it's a manager for self.url.
@return: The current YadisServiceManager, if it's for this
URL, or else None | [
"Extract",
"the",
"YadisServiceManager",
"for",
"this",
"object",
"s",
"URL",
"and",
"suffix",
"from",
"the",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L146-L160 |
16,543 | openid/python-openid | openid/yadis/manager.py | Discovery.createManager | def createManager(self, services, yadis_url=None):
"""Create a new YadisService Manager for this starting URL and
suffix, and store it in the session.
@raises KeyError: When I already have a manager.
@return: A new YadisServiceManager or None
"""
key = self.getSessionKe... | python | def createManager(self, services, yadis_url=None):
"""Create a new YadisService Manager for this starting URL and
suffix, and store it in the session.
@raises KeyError: When I already have a manager.
@return: A new YadisServiceManager or None
"""
key = self.getSessionKe... | [
"def",
"createManager",
"(",
"self",
",",
"services",
",",
"yadis_url",
"=",
"None",
")",
":",
"key",
"=",
"self",
".",
"getSessionKey",
"(",
")",
"if",
"self",
".",
"getManager",
"(",
")",
":",
"raise",
"KeyError",
"(",
"'There is already a %r manager for %... | Create a new YadisService Manager for this starting URL and
suffix, and store it in the session.
@raises KeyError: When I already have a manager.
@return: A new YadisServiceManager or None | [
"Create",
"a",
"new",
"YadisService",
"Manager",
"for",
"this",
"starting",
"URL",
"and",
"suffix",
"and",
"store",
"it",
"in",
"the",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L162-L180 |
16,544 | openid/python-openid | openid/yadis/manager.py | Discovery.destroyManager | def destroyManager(self, force=False):
"""Delete any YadisServiceManager with this starting URL and
suffix from the session.
If there is no service manager or the service manager is for a
different URL, it silently does nothing.
@param force: True if the manager should be delet... | python | def destroyManager(self, force=False):
"""Delete any YadisServiceManager with this starting URL and
suffix from the session.
If there is no service manager or the service manager is for a
different URL, it silently does nothing.
@param force: True if the manager should be delet... | [
"def",
"destroyManager",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"self",
".",
"getManager",
"(",
"force",
"=",
"force",
")",
"is",
"not",
"None",
":",
"key",
"=",
"self",
".",
"getSessionKey",
"(",
")",
"del",
"self",
".",
"session",... | Delete any YadisServiceManager with this starting URL and
suffix from the session.
If there is no service manager or the service manager is for a
different URL, it silently does nothing.
@param force: True if the manager should be deleted regardless
of whether it's a manager fo... | [
"Delete",
"any",
"YadisServiceManager",
"with",
"this",
"starting",
"URL",
"and",
"suffix",
"from",
"the",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L182-L194 |
16,545 | openid/python-openid | openid/dh.py | DiffieHellman._setPrivate | def _setPrivate(self, private):
"""This is here to make testing easier"""
self.private = private
self.public = pow(self.generator, self.private, self.modulus) | python | def _setPrivate(self, private):
"""This is here to make testing easier"""
self.private = private
self.public = pow(self.generator, self.private, self.modulus) | [
"def",
"_setPrivate",
"(",
"self",
",",
"private",
")",
":",
"self",
".",
"private",
"=",
"private",
"self",
".",
"public",
"=",
"pow",
"(",
"self",
".",
"generator",
",",
"self",
".",
"private",
",",
"self",
".",
"modulus",
")"
] | This is here to make testing easier | [
"This",
"is",
"here",
"to",
"make",
"testing",
"easier"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/dh.py#L27-L30 |
16,546 | openid/python-openid | openid/server/server.py | AssociateRequest.answerUnsupported | def answerUnsupported(self, message, preferred_association_type=None,
preferred_session_type=None):
"""Respond to this request indicating that the association
type or association session type is not supported."""
if self.message.isOpenID1():
raise ProtocolEr... | python | def answerUnsupported(self, message, preferred_association_type=None,
preferred_session_type=None):
"""Respond to this request indicating that the association
type or association session type is not supported."""
if self.message.isOpenID1():
raise ProtocolEr... | [
"def",
"answerUnsupported",
"(",
"self",
",",
"message",
",",
"preferred_association_type",
"=",
"None",
",",
"preferred_session_type",
"=",
"None",
")",
":",
"if",
"self",
".",
"message",
".",
"isOpenID1",
"(",
")",
":",
"raise",
"ProtocolError",
"(",
"self",... | Respond to this request indicating that the association
type or association session type is not supported. | [
"Respond",
"to",
"this",
"request",
"indicating",
"that",
"the",
"association",
"type",
"or",
"association",
"session",
"type",
"is",
"not",
"supported",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L486-L505 |
16,547 | openid/python-openid | openid/server/server.py | CheckIDRequest.fromMessage | def fromMessage(klass, message, op_endpoint):
"""Construct me from an OpenID message.
@raises ProtocolError: When not all required parameters are present
in the message.
@raises MalformedReturnURL: When the C{return_to} URL is not a URL.
@raises UntrustedReturnURL: When th... | python | def fromMessage(klass, message, op_endpoint):
"""Construct me from an OpenID message.
@raises ProtocolError: When not all required parameters are present
in the message.
@raises MalformedReturnURL: When the C{return_to} URL is not a URL.
@raises UntrustedReturnURL: When th... | [
"def",
"fromMessage",
"(",
"klass",
",",
"message",
",",
"op_endpoint",
")",
":",
"self",
"=",
"klass",
".",
"__new__",
"(",
"klass",
")",
"self",
".",
"message",
"=",
"message",
"self",
".",
"op_endpoint",
"=",
"op_endpoint",
"mode",
"=",
"message",
"."... | Construct me from an OpenID message.
@raises ProtocolError: When not all required parameters are present
in the message.
@raises MalformedReturnURL: When the C{return_to} URL is not a URL.
@raises UntrustedReturnURL: When the C{return_to} URL is outside
the C{trust_roo... | [
"Construct",
"me",
"from",
"an",
"OpenID",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L580-L672 |
16,548 | openid/python-openid | openid/server/server.py | CheckIDRequest.trustRootValid | def trustRootValid(self):
"""Is my return_to under my trust_root?
@returntype: bool
"""
if not self.trust_root:
return True
tr = TrustRoot.parse(self.trust_root)
if tr is None:
raise MalformedTrustRoot(self.message, self.trust_root)
if se... | python | def trustRootValid(self):
"""Is my return_to under my trust_root?
@returntype: bool
"""
if not self.trust_root:
return True
tr = TrustRoot.parse(self.trust_root)
if tr is None:
raise MalformedTrustRoot(self.message, self.trust_root)
if se... | [
"def",
"trustRootValid",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"trust_root",
":",
"return",
"True",
"tr",
"=",
"TrustRoot",
".",
"parse",
"(",
"self",
".",
"trust_root",
")",
"if",
"tr",
"is",
"None",
":",
"raise",
"MalformedTrustRoot",
"(",
... | Is my return_to under my trust_root?
@returntype: bool | [
"Is",
"my",
"return_to",
"under",
"my",
"trust_root?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L684-L698 |
16,549 | openid/python-openid | openid/server/server.py | CheckIDRequest.encodeToURL | def encodeToURL(self, server_url):
"""Encode this request as a URL to GET.
@param server_url: The URL of the OpenID server to make this request of.
@type server_url: str
@returntype: str
@raises NoReturnError: when I do not have a return_to.
"""
if not self.ret... | python | def encodeToURL(self, server_url):
"""Encode this request as a URL to GET.
@param server_url: The URL of the OpenID server to make this request of.
@type server_url: str
@returntype: str
@raises NoReturnError: when I do not have a return_to.
"""
if not self.ret... | [
"def",
"encodeToURL",
"(",
"self",
",",
"server_url",
")",
":",
"if",
"not",
"self",
".",
"return_to",
":",
"raise",
"NoReturnToError",
"# Imported from the alternate reality where these classes are used",
"# in both the client and server code, so Requests are Encodable too.",
"#... | Encode this request as a URL to GET.
@param server_url: The URL of the OpenID server to make this request of.
@type server_url: str
@returntype: str
@raises NoReturnError: when I do not have a return_to. | [
"Encode",
"this",
"request",
"as",
"a",
"URL",
"to",
"GET",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L883-L914 |
16,550 | openid/python-openid | openid/server/server.py | CheckIDRequest.getCancelURL | def getCancelURL(self):
"""Get the URL to cancel this request.
Useful for creating a "Cancel" button on a web form so that operation
can be carried out directly without another trip through the server.
(Except you probably want to make another trip through the server so
that it... | python | def getCancelURL(self):
"""Get the URL to cancel this request.
Useful for creating a "Cancel" button on a web form so that operation
can be carried out directly without another trip through the server.
(Except you probably want to make another trip through the server so
that it... | [
"def",
"getCancelURL",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"return_to",
":",
"raise",
"NoReturnToError",
"if",
"self",
".",
"immediate",
":",
"raise",
"ValueError",
"(",
"\"Cancel is not an appropriate response to \"",
"\"immediate mode requests.\"",
")",... | Get the URL to cancel this request.
Useful for creating a "Cancel" button on a web form so that operation
can be carried out directly without another trip through the server.
(Except you probably want to make another trip through the server so
that it knows that the user did make a dec... | [
"Get",
"the",
"URL",
"to",
"cancel",
"this",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L917-L941 |
16,551 | openid/python-openid | openid/server/server.py | OpenIDResponse.toFormMarkup | def toFormMarkup(self, form_tag_attrs=None):
"""Returns the form markup for this response.
@param form_tag_attrs: Dictionary of attributes to be added to
the form tag. 'accept-charset' and 'enctype' have defaults
that can be overridden. If a value is supplied for
'ac... | python | def toFormMarkup(self, form_tag_attrs=None):
"""Returns the form markup for this response.
@param form_tag_attrs: Dictionary of attributes to be added to
the form tag. 'accept-charset' and 'enctype' have defaults
that can be overridden. If a value is supplied for
'ac... | [
"def",
"toFormMarkup",
"(",
"self",
",",
"form_tag_attrs",
"=",
"None",
")",
":",
"return",
"self",
".",
"fields",
".",
"toFormMarkup",
"(",
"self",
".",
"request",
".",
"return_to",
",",
"form_tag_attrs",
"=",
"form_tag_attrs",
")"
] | Returns the form markup for this response.
@param form_tag_attrs: Dictionary of attributes to be added to
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.
@return... | [
"Returns",
"the",
"form",
"markup",
"for",
"this",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L990-L1003 |
16,552 | openid/python-openid | openid/server/server.py | Signatory.verify | def verify(self, assoc_handle, message):
"""Verify that the signature for some data is valid.
@param assoc_handle: The handle of the association used to sign the
data.
@type assoc_handle: str
@param message: The signed message to verify
@type message: openid.message... | python | def verify(self, assoc_handle, message):
"""Verify that the signature for some data is valid.
@param assoc_handle: The handle of the association used to sign the
data.
@type assoc_handle: str
@param message: The signed message to verify
@type message: openid.message... | [
"def",
"verify",
"(",
"self",
",",
"assoc_handle",
",",
"message",
")",
":",
"assoc",
"=",
"self",
".",
"getAssociation",
"(",
"assoc_handle",
",",
"dumb",
"=",
"True",
")",
"if",
"not",
"assoc",
":",
"logging",
".",
"error",
"(",
"\"failed to get assoc wi... | Verify that the signature for some data is valid.
@param assoc_handle: The handle of the association used to sign the
data.
@type assoc_handle: str
@param message: The signed message to verify
@type message: openid.message.Message
@returns: C{True} if the signature... | [
"Verify",
"that",
"the",
"signature",
"for",
"some",
"data",
"is",
"valid",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1159-L1186 |
16,553 | openid/python-openid | openid/server/server.py | Signatory.sign | def sign(self, response):
"""Sign a response.
I take a L{OpenIDResponse}, create a signature for everything
in its L{signed<OpenIDResponse.signed>} list, and return a new
copy of the response object with that signature included.
@param response: A response to sign.
@typ... | python | def sign(self, response):
"""Sign a response.
I take a L{OpenIDResponse}, create a signature for everything
in its L{signed<OpenIDResponse.signed>} list, and return a new
copy of the response object with that signature included.
@param response: A response to sign.
@typ... | [
"def",
"sign",
"(",
"self",
",",
"response",
")",
":",
"signed_response",
"=",
"deepcopy",
"(",
"response",
")",
"assoc_handle",
"=",
"response",
".",
"request",
".",
"assoc_handle",
"if",
"assoc_handle",
":",
"# normal mode",
"# disabling expiration check because e... | Sign a response.
I take a L{OpenIDResponse}, create a signature for everything
in its L{signed<OpenIDResponse.signed>} list, and return a new
copy of the response object with that signature included.
@param response: A response to sign.
@type response: L{OpenIDResponse}
... | [
"Sign",
"a",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1189-L1231 |
16,554 | openid/python-openid | openid/server/server.py | Signatory.createAssociation | def createAssociation(self, dumb=True, assoc_type='HMAC-SHA1'):
"""Make a new association.
@param dumb: Is this association for a dumb-mode transaction?
@type dumb: bool
@param assoc_type: The type of association to create. Currently
there is only one type defined, C{HMAC-... | python | def createAssociation(self, dumb=True, assoc_type='HMAC-SHA1'):
"""Make a new association.
@param dumb: Is this association for a dumb-mode transaction?
@type dumb: bool
@param assoc_type: The type of association to create. Currently
there is only one type defined, C{HMAC-... | [
"def",
"createAssociation",
"(",
"self",
",",
"dumb",
"=",
"True",
",",
"assoc_type",
"=",
"'HMAC-SHA1'",
")",
":",
"secret",
"=",
"cryptutil",
".",
"getBytes",
"(",
"getSecretSize",
"(",
"assoc_type",
")",
")",
"uniq",
"=",
"oidutil",
".",
"toBase64",
"("... | Make a new association.
@param dumb: Is this association for a dumb-mode transaction?
@type dumb: bool
@param assoc_type: The type of association to create. Currently
there is only one type defined, C{HMAC-SHA1}.
@type assoc_type: str
@returns: the new association... | [
"Make",
"a",
"new",
"association",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1234-L1259 |
16,555 | openid/python-openid | openid/server/server.py | Signatory.getAssociation | def getAssociation(self, assoc_handle, dumb, checkExpiration=True):
"""Get the association with the specified handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
@returns: the association, or None if no valid association with ... | python | def getAssociation(self, assoc_handle, dumb, checkExpiration=True):
"""Get the association with the specified handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
@returns: the association, or None if no valid association with ... | [
"def",
"getAssociation",
"(",
"self",
",",
"assoc_handle",
",",
"dumb",
",",
"checkExpiration",
"=",
"True",
")",
":",
"# Hmm. We've created an interface that deals almost entirely with",
"# assoc_handles. The only place outside the Signatory that uses this",
"# (and thus the only ... | Get the association with the specified handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
@returns: the association, or None if no valid association with that
handle was found.
@returntype: L{openid.association.As... | [
"Get",
"the",
"association",
"with",
"the",
"specified",
"handle",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1262-L1295 |
16,556 | openid/python-openid | openid/server/server.py | Signatory.invalidate | def invalidate(self, assoc_handle, dumb):
"""Invalidates the association with the given handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
"""
if dumb:
key = self._dumb_key
else:
key = s... | python | def invalidate(self, assoc_handle, dumb):
"""Invalidates the association with the given handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
"""
if dumb:
key = self._dumb_key
else:
key = s... | [
"def",
"invalidate",
"(",
"self",
",",
"assoc_handle",
",",
"dumb",
")",
":",
"if",
"dumb",
":",
"key",
"=",
"self",
".",
"_dumb_key",
"else",
":",
"key",
"=",
"self",
".",
"_normal_key",
"self",
".",
"store",
".",
"removeAssociation",
"(",
"key",
",",... | Invalidates the association with the given handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool | [
"Invalidates",
"the",
"association",
"with",
"the",
"given",
"handle",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1298-L1310 |
16,557 | openid/python-openid | openid/server/server.py | Decoder.defaultDecoder | def defaultDecoder(self, message, server):
"""Called to decode queries when no handler for that mode is found.
@raises ProtocolError: This implementation always raises
L{ProtocolError}.
"""
mode = message.getArg(OPENID_NS, 'mode')
fmt = "Unrecognized OpenID mode %r"
... | python | def defaultDecoder(self, message, server):
"""Called to decode queries when no handler for that mode is found.
@raises ProtocolError: This implementation always raises
L{ProtocolError}.
"""
mode = message.getArg(OPENID_NS, 'mode')
fmt = "Unrecognized OpenID mode %r"
... | [
"def",
"defaultDecoder",
"(",
"self",
",",
"message",
",",
"server",
")",
":",
"mode",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'mode'",
")",
"fmt",
"=",
"\"Unrecognized OpenID mode %r\"",
"raise",
"ProtocolError",
"(",
"message",
",",
"text",
... | Called to decode queries when no handler for that mode is found.
@raises ProtocolError: This implementation always raises
L{ProtocolError}. | [
"Called",
"to",
"decode",
"queries",
"when",
"no",
"handler",
"for",
"that",
"mode",
"is",
"found",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1448-L1456 |
16,558 | openid/python-openid | openid/server/server.py | ProtocolError.toMessage | def toMessage(self):
"""Generate a Message object for sending to the relying party,
after encoding.
"""
namespace = self.openid_message.getOpenIDNamespace()
reply = Message(namespace)
reply.setArg(OPENID_NS, 'mode', 'error')
reply.setArg(OPENID_NS, 'error', str(se... | python | def toMessage(self):
"""Generate a Message object for sending to the relying party,
after encoding.
"""
namespace = self.openid_message.getOpenIDNamespace()
reply = Message(namespace)
reply.setArg(OPENID_NS, 'mode', 'error')
reply.setArg(OPENID_NS, 'error', str(se... | [
"def",
"toMessage",
"(",
"self",
")",
":",
"namespace",
"=",
"self",
".",
"openid_message",
".",
"getOpenIDNamespace",
"(",
")",
"reply",
"=",
"Message",
"(",
"namespace",
")",
"reply",
".",
"setArg",
"(",
"OPENID_NS",
",",
"'mode'",
",",
"'error'",
")",
... | Generate a Message object for sending to the relying party,
after encoding. | [
"Generate",
"a",
"Message",
"object",
"for",
"sending",
"to",
"the",
"relying",
"party",
"after",
"encoding",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1674-L1689 |
16,559 | openid/python-openid | examples/djopenid/consumer/views.py | rpXRDS | def rpXRDS(request):
"""
Return a relying party verification XRDS document
"""
return util.renderXRDS(
request,
[RP_RETURN_TO_URL_TYPE],
[util.getViewURL(request, finishOpenID)]) | python | def rpXRDS(request):
"""
Return a relying party verification XRDS document
"""
return util.renderXRDS(
request,
[RP_RETURN_TO_URL_TYPE],
[util.getViewURL(request, finishOpenID)]) | [
"def",
"rpXRDS",
"(",
"request",
")",
":",
"return",
"util",
".",
"renderXRDS",
"(",
"request",
",",
"[",
"RP_RETURN_TO_URL_TYPE",
"]",
",",
"[",
"util",
".",
"getViewURL",
"(",
"request",
",",
"finishOpenID",
")",
"]",
")"
] | Return a relying party verification XRDS document | [
"Return",
"a",
"relying",
"party",
"verification",
"XRDS",
"document"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/consumer/views.py#L213-L220 |
16,560 | openid/python-openid | examples/consumer.py | OpenIDRequestHandler.getSession | def getSession(self):
"""Return the existing session or a new session"""
if self.session is not None:
return self.session
# Get value of cookie header that was sent
cookie_str = self.headers.get('Cookie')
if cookie_str:
cookie_obj = SimpleCookie(cookie_st... | python | def getSession(self):
"""Return the existing session or a new session"""
if self.session is not None:
return self.session
# Get value of cookie header that was sent
cookie_str = self.headers.get('Cookie')
if cookie_str:
cookie_obj = SimpleCookie(cookie_st... | [
"def",
"getSession",
"(",
"self",
")",
":",
"if",
"self",
".",
"session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"session",
"# Get value of cookie header that was sent",
"cookie_str",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'Cookie'",
")",
"... | Return the existing session or a new session | [
"Return",
"the",
"existing",
"session",
"or",
"a",
"new",
"session"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L77-L107 |
16,561 | openid/python-openid | examples/consumer.py | OpenIDRequestHandler.doProcess | def doProcess(self):
"""Handle the redirect from the OpenID server.
"""
oidconsumer = self.getConsumer()
# Ask the library to check the response that the server sent
# us. Status is a code indicating the response type. info is
# either None or a string containing more i... | python | def doProcess(self):
"""Handle the redirect from the OpenID server.
"""
oidconsumer = self.getConsumer()
# Ask the library to check the response that the server sent
# us. Status is a code indicating the response type. info is
# either None or a string containing more i... | [
"def",
"doProcess",
"(",
"self",
")",
":",
"oidconsumer",
"=",
"self",
".",
"getConsumer",
"(",
")",
"# Ask the library to check the response that the server sent",
"# us. Status is a code indicating the response type. info is",
"# either None or a string containing more information a... | Handle the redirect from the OpenID server. | [
"Handle",
"the",
"redirect",
"from",
"the",
"OpenID",
"server",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L222-L285 |
16,562 | openid/python-openid | examples/consumer.py | OpenIDRequestHandler.notFound | def notFound(self):
"""Render a page with a 404 return code and a message."""
fmt = 'The path <q>%s</q> was not understood by this server.'
msg = fmt % (self.path,)
openid_url = self.query.get('openid_identifier')
self.render(msg, 'error', openid_url, status=404) | python | def notFound(self):
"""Render a page with a 404 return code and a message."""
fmt = 'The path <q>%s</q> was not understood by this server.'
msg = fmt % (self.path,)
openid_url = self.query.get('openid_identifier')
self.render(msg, 'error', openid_url, status=404) | [
"def",
"notFound",
"(",
"self",
")",
":",
"fmt",
"=",
"'The path <q>%s</q> was not understood by this server.'",
"msg",
"=",
"fmt",
"%",
"(",
"self",
".",
"path",
",",
")",
"openid_url",
"=",
"self",
".",
"query",
".",
"get",
"(",
"'openid_identifier'",
")",
... | Render a page with a 404 return code and a message. | [
"Render",
"a",
"page",
"with",
"a",
"404",
"return",
"code",
"and",
"a",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L343-L348 |
16,563 | openid/python-openid | examples/consumer.py | OpenIDRequestHandler.render | def render(self, message=None, css_class='alert', form_contents=None,
status=200, title="Python OpenID Consumer Example",
sreg_data=None, pape_data=None):
"""Render a page."""
self.send_response(status)
self.pageHeader(title)
if message:
self.wfi... | python | def render(self, message=None, css_class='alert', form_contents=None,
status=200, title="Python OpenID Consumer Example",
sreg_data=None, pape_data=None):
"""Render a page."""
self.send_response(status)
self.pageHeader(title)
if message:
self.wfi... | [
"def",
"render",
"(",
"self",
",",
"message",
"=",
"None",
",",
"css_class",
"=",
"'alert'",
",",
"form_contents",
"=",
"None",
",",
"status",
"=",
"200",
",",
"title",
"=",
"\"Python OpenID Consumer Example\"",
",",
"sreg_data",
"=",
"None",
",",
"pape_data... | Render a page. | [
"Render",
"a",
"page",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L350-L367 |
16,564 | openid/python-openid | openid/store/sqlstore.py | SQLStore._callInTransaction | def _callInTransaction(self, func, *args, **kwargs):
"""Execute the given function inside of a transaction, with an
open cursor. If no exception is raised, the transaction is
comitted, otherwise it is rolled back."""
# No nesting of transactions
self.conn.rollback()
try:... | python | def _callInTransaction(self, func, *args, **kwargs):
"""Execute the given function inside of a transaction, with an
open cursor. If no exception is raised, the transaction is
comitted, otherwise it is rolled back."""
# No nesting of transactions
self.conn.rollback()
try:... | [
"def",
"_callInTransaction",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# No nesting of transactions",
"self",
".",
"conn",
".",
"rollback",
"(",
")",
"try",
":",
"self",
".",
"cur",
"=",
"self",
".",
"conn",
".",
... | Execute the given function inside of a transaction, with an
open cursor. If no exception is raised, the transaction is
comitted, otherwise it is rolled back. | [
"Execute",
"the",
"given",
"function",
"inside",
"of",
"a",
"transaction",
"with",
"an",
"open",
"cursor",
".",
"If",
"no",
"exception",
"is",
"raised",
"the",
"transaction",
"is",
"comitted",
"otherwise",
"it",
"is",
"rolled",
"back",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L162-L182 |
16,565 | openid/python-openid | openid/store/sqlstore.py | SQLStore.txn_storeAssociation | def txn_storeAssociation(self, server_url, association):
"""Set the association for the server URL.
Association -> NoneType
"""
a = association
self.db_set_assoc(
server_url,
a.handle,
self.blobEncode(a.secret),
a.issued,
... | python | def txn_storeAssociation(self, server_url, association):
"""Set the association for the server URL.
Association -> NoneType
"""
a = association
self.db_set_assoc(
server_url,
a.handle,
self.blobEncode(a.secret),
a.issued,
... | [
"def",
"txn_storeAssociation",
"(",
"self",
",",
"server_url",
",",
"association",
")",
":",
"a",
"=",
"association",
"self",
".",
"db_set_assoc",
"(",
"server_url",
",",
"a",
".",
"handle",
",",
"self",
".",
"blobEncode",
"(",
"a",
".",
"secret",
")",
"... | Set the association for the server URL.
Association -> NoneType | [
"Set",
"the",
"association",
"for",
"the",
"server",
"URL",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L195-L207 |
16,566 | openid/python-openid | openid/store/sqlstore.py | SQLStore.txn_removeAssociation | def txn_removeAssociation(self, server_url, handle):
"""Remove the association for the given server URL and handle,
returning whether the association existed at all.
(str, str) -> bool
"""
self.db_remove_assoc(server_url, handle)
return self.cur.rowcount > 0 | python | def txn_removeAssociation(self, server_url, handle):
"""Remove the association for the given server URL and handle,
returning whether the association existed at all.
(str, str) -> bool
"""
self.db_remove_assoc(server_url, handle)
return self.cur.rowcount > 0 | [
"def",
"txn_removeAssociation",
"(",
"self",
",",
"server_url",
",",
"handle",
")",
":",
"self",
".",
"db_remove_assoc",
"(",
"server_url",
",",
"handle",
")",
"return",
"self",
".",
"cur",
".",
"rowcount",
">",
"0"
] | Remove the association for the given server URL and handle,
returning whether the association existed at all.
(str, str) -> bool | [
"Remove",
"the",
"association",
"for",
"the",
"given",
"server",
"URL",
"and",
"handle",
"returning",
"whether",
"the",
"association",
"existed",
"at",
"all",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L243-L250 |
16,567 | openid/python-openid | openid/store/sqlstore.py | SQLStore.txn_useNonce | def txn_useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is present, and if it is, then
remove it from the set.
str -> bool"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
try:
self.db_add_nonce(server_url, timestam... | python | def txn_useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is present, and if it is, then
remove it from the set.
str -> bool"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
try:
self.db_add_nonce(server_url, timestam... | [
"def",
"txn_useNonce",
"(",
"self",
",",
"server_url",
",",
"timestamp",
",",
"salt",
")",
":",
"if",
"abs",
"(",
"timestamp",
"-",
"time",
".",
"time",
"(",
")",
")",
">",
"nonce",
".",
"SKEW",
":",
"return",
"False",
"try",
":",
"self",
".",
"db_... | Return whether this nonce is present, and if it is, then
remove it from the set.
str -> bool | [
"Return",
"whether",
"this",
"nonce",
"is",
"present",
"and",
"if",
"it",
"is",
"then",
"remove",
"it",
"from",
"the",
"set",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L254-L269 |
16,568 | openid/python-openid | openid/yadis/xri.py | _escape_xref | def _escape_xref(xref_match):
"""Escape things that need to be escaped if they're in a cross-reference.
"""
xref = xref_match.group()
xref = xref.replace('/', '%2F')
xref = xref.replace('?', '%3F')
xref = xref.replace('#', '%23')
return xref | python | def _escape_xref(xref_match):
"""Escape things that need to be escaped if they're in a cross-reference.
"""
xref = xref_match.group()
xref = xref.replace('/', '%2F')
xref = xref.replace('?', '%3F')
xref = xref.replace('#', '%23')
return xref | [
"def",
"_escape_xref",
"(",
"xref_match",
")",
":",
"xref",
"=",
"xref_match",
".",
"group",
"(",
")",
"xref",
"=",
"xref",
".",
"replace",
"(",
"'/'",
",",
"'%2F'",
")",
"xref",
"=",
"xref",
".",
"replace",
"(",
"'?'",
",",
"'%3F'",
")",
"xref",
"... | Escape things that need to be escaped if they're in a cross-reference. | [
"Escape",
"things",
"that",
"need",
"to",
"be",
"escaped",
"if",
"they",
"re",
"in",
"a",
"cross",
"-",
"reference",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L79-L86 |
16,569 | openid/python-openid | openid/yadis/xri.py | escapeForIRI | def escapeForIRI(xri):
"""Escape things that need to be escaped when transforming to an IRI."""
xri = xri.replace('%', '%25')
xri = _xref_re.sub(_escape_xref, xri)
return xri | python | def escapeForIRI(xri):
"""Escape things that need to be escaped when transforming to an IRI."""
xri = xri.replace('%', '%25')
xri = _xref_re.sub(_escape_xref, xri)
return xri | [
"def",
"escapeForIRI",
"(",
"xri",
")",
":",
"xri",
"=",
"xri",
".",
"replace",
"(",
"'%'",
",",
"'%25'",
")",
"xri",
"=",
"_xref_re",
".",
"sub",
"(",
"_escape_xref",
",",
"xri",
")",
"return",
"xri"
] | Escape things that need to be escaped when transforming to an IRI. | [
"Escape",
"things",
"that",
"need",
"to",
"be",
"escaped",
"when",
"transforming",
"to",
"an",
"IRI",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L89-L93 |
16,570 | openid/python-openid | openid/yadis/xri.py | providerIsAuthoritative | def providerIsAuthoritative(providerID, canonicalID):
"""Is this provider ID authoritative for this XRI?
@returntype: bool
"""
# XXX: can't use rsplit until we require python >= 2.4.
lastbang = canonicalID.rindex('!')
parent = canonicalID[:lastbang]
return parent == providerID | python | def providerIsAuthoritative(providerID, canonicalID):
"""Is this provider ID authoritative for this XRI?
@returntype: bool
"""
# XXX: can't use rsplit until we require python >= 2.4.
lastbang = canonicalID.rindex('!')
parent = canonicalID[:lastbang]
return parent == providerID | [
"def",
"providerIsAuthoritative",
"(",
"providerID",
",",
"canonicalID",
")",
":",
"# XXX: can't use rsplit until we require python >= 2.4.",
"lastbang",
"=",
"canonicalID",
".",
"rindex",
"(",
"'!'",
")",
"parent",
"=",
"canonicalID",
"[",
":",
"lastbang",
"]",
"retu... | Is this provider ID authoritative for this XRI?
@returntype: bool | [
"Is",
"this",
"provider",
"ID",
"authoritative",
"for",
"this",
"XRI?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L112-L120 |
16,571 | openid/python-openid | openid/yadis/xri.py | rootAuthority | def rootAuthority(xri):
"""Return the root authority for an XRI.
Example::
rootAuthority("xri://@example") == "xri://@"
@type xri: unicode
@returntype: unicode
"""
if xri.startswith('xri://'):
xri = xri[6:]
authority = xri.split('/', 1)[0]
if authority[0] == '(':
... | python | def rootAuthority(xri):
"""Return the root authority for an XRI.
Example::
rootAuthority("xri://@example") == "xri://@"
@type xri: unicode
@returntype: unicode
"""
if xri.startswith('xri://'):
xri = xri[6:]
authority = xri.split('/', 1)[0]
if authority[0] == '(':
... | [
"def",
"rootAuthority",
"(",
"xri",
")",
":",
"if",
"xri",
".",
"startswith",
"(",
"'xri://'",
")",
":",
"xri",
"=",
"xri",
"[",
"6",
":",
"]",
"authority",
"=",
"xri",
".",
"split",
"(",
"'/'",
",",
"1",
")",
"[",
"0",
"]",
"if",
"authority",
... | Return the root authority for an XRI.
Example::
rootAuthority("xri://@example") == "xri://@"
@type xri: unicode
@returntype: unicode | [
"Return",
"the",
"root",
"authority",
"for",
"an",
"XRI",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L123-L153 |
16,572 | openid/python-openid | openid/extension.py | Extension.toMessage | def toMessage(self, message=None):
"""Add the arguments from this extension to the provided
message, or create a new message containing only those
arguments.
@returns: The message with the extension arguments added
"""
if message is None:
warnings.warn('Passi... | python | def toMessage(self, message=None):
"""Add the arguments from this extension to the provided
message, or create a new message containing only those
arguments.
@returns: The message with the extension arguments added
"""
if message is None:
warnings.warn('Passi... | [
"def",
"toMessage",
"(",
"self",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
"is",
"None",
":",
"warnings",
".",
"warn",
"(",
"'Passing None to Extension.toMessage is deprecated. '",
"'Creating a message assuming you want OpenID 2.'",
",",
"DeprecationWarning"... | Add the arguments from this extension to the provided
message, or create a new message containing only those
arguments.
@returns: The message with the extension arguments added | [
"Add",
"the",
"arguments",
"from",
"this",
"extension",
"to",
"the",
"provided",
"message",
"or",
"create",
"a",
"new",
"message",
"containing",
"only",
"those",
"arguments",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extension.py#L23-L46 |
16,573 | openid/python-openid | openid/store/filestore.py | _ensureDir | def _ensureDir(dir_name):
"""Create dir_name as a directory if it does not exist. If it
exists, make sure that it is, in fact, a directory.
Can raise OSError
str -> NoneType
"""
try:
os.makedirs(dir_name)
except OSError, why:
if why.errno != EEXIST or not os.path.isdir(dir_... | python | def _ensureDir(dir_name):
"""Create dir_name as a directory if it does not exist. If it
exists, make sure that it is, in fact, a directory.
Can raise OSError
str -> NoneType
"""
try:
os.makedirs(dir_name)
except OSError, why:
if why.errno != EEXIST or not os.path.isdir(dir_... | [
"def",
"_ensureDir",
"(",
"dir_name",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"dir_name",
")",
"except",
"OSError",
",",
"why",
":",
"if",
"why",
".",
"errno",
"!=",
"EEXIST",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"dir_name",
... | Create dir_name as a directory if it does not exist. If it
exists, make sure that it is, in fact, a directory.
Can raise OSError
str -> NoneType | [
"Create",
"dir_name",
"as",
"a",
"directory",
"if",
"it",
"does",
"not",
"exist",
".",
"If",
"it",
"exists",
"make",
"sure",
"that",
"it",
"is",
"in",
"fact",
"a",
"directory",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L96-L108 |
16,574 | openid/python-openid | openid/store/filestore.py | FileOpenIDStore._setup | def _setup(self):
"""Make sure that the directories in which we store our data
exist.
() -> NoneType
"""
_ensureDir(self.nonce_dir)
_ensureDir(self.association_dir)
_ensureDir(self.temp_dir) | python | def _setup(self):
"""Make sure that the directories in which we store our data
exist.
() -> NoneType
"""
_ensureDir(self.nonce_dir)
_ensureDir(self.association_dir)
_ensureDir(self.temp_dir) | [
"def",
"_setup",
"(",
"self",
")",
":",
"_ensureDir",
"(",
"self",
".",
"nonce_dir",
")",
"_ensureDir",
"(",
"self",
".",
"association_dir",
")",
"_ensureDir",
"(",
"self",
".",
"temp_dir",
")"
] | Make sure that the directories in which we store our data
exist.
() -> NoneType | [
"Make",
"sure",
"that",
"the",
"directories",
"in",
"which",
"we",
"store",
"our",
"data",
"exist",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L153-L161 |
16,575 | openid/python-openid | openid/store/filestore.py | FileOpenIDStore._mktemp | def _mktemp(self):
"""Create a temporary file on the same filesystem as
self.association_dir.
The temporary directory should not be cleaned if there are any
processes using the store. If there is no active process using
the store, it is safe to remove all of the files in the
... | python | def _mktemp(self):
"""Create a temporary file on the same filesystem as
self.association_dir.
The temporary directory should not be cleaned if there are any
processes using the store. If there is no active process using
the store, it is safe to remove all of the files in the
... | [
"def",
"_mktemp",
"(",
"self",
")",
":",
"fd",
",",
"name",
"=",
"mkstemp",
"(",
"dir",
"=",
"self",
".",
"temp_dir",
")",
"try",
":",
"file_obj",
"=",
"os",
".",
"fdopen",
"(",
"fd",
",",
"'wb'",
")",
"return",
"file_obj",
",",
"name",
"except",
... | Create a temporary file on the same filesystem as
self.association_dir.
The temporary directory should not be cleaned if there are any
processes using the store. If there is no active process using
the store, it is safe to remove all of the files in the
temporary directory.
... | [
"Create",
"a",
"temporary",
"file",
"on",
"the",
"same",
"filesystem",
"as",
"self",
".",
"association_dir",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L163-L180 |
16,576 | openid/python-openid | openid/store/filestore.py | FileOpenIDStore.getAssociationFilename | def getAssociationFilename(self, server_url, handle):
"""Create a unique filename for a given server url and
handle. This implementation does not assume anything about the
format of the handle. The filename that is returned will
contain the domain name from the server URL for ease of hum... | python | def getAssociationFilename(self, server_url, handle):
"""Create a unique filename for a given server url and
handle. This implementation does not assume anything about the
format of the handle. The filename that is returned will
contain the domain name from the server URL for ease of hum... | [
"def",
"getAssociationFilename",
"(",
"self",
",",
"server_url",
",",
"handle",
")",
":",
"if",
"server_url",
".",
"find",
"(",
"'://'",
")",
"==",
"-",
"1",
":",
"raise",
"ValueError",
"(",
"'Bad server URL: %r'",
"%",
"server_url",
")",
"proto",
",",
"re... | Create a unique filename for a given server url and
handle. This implementation does not assume anything about the
format of the handle. The filename that is returned will
contain the domain name from the server URL for ease of human
inspection of the data directory.
(str, str) ... | [
"Create",
"a",
"unique",
"filename",
"for",
"a",
"given",
"server",
"url",
"and",
"handle",
".",
"This",
"implementation",
"does",
"not",
"assume",
"anything",
"about",
"the",
"format",
"of",
"the",
"handle",
".",
"The",
"filename",
"that",
"is",
"returned",... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L182-L204 |
16,577 | openid/python-openid | openid/store/filestore.py | FileOpenIDStore.getAssociation | def getAssociation(self, server_url, handle=None):
"""Retrieve an association. If no handle is specified, return
the association with the latest expiration.
(str, str or NoneType) -> Association or NoneType
"""
if handle is None:
handle = ''
# The filename w... | python | def getAssociation(self, server_url, handle=None):
"""Retrieve an association. If no handle is specified, return
the association with the latest expiration.
(str, str or NoneType) -> Association or NoneType
"""
if handle is None:
handle = ''
# The filename w... | [
"def",
"getAssociation",
"(",
"self",
",",
"server_url",
",",
"handle",
"=",
"None",
")",
":",
"if",
"handle",
"is",
"None",
":",
"handle",
"=",
"''",
"# The filename with the empty handle is a prefix of all other",
"# associations for the given server URL.",
"filename",
... | Retrieve an association. If no handle is specified, return
the association with the latest expiration.
(str, str or NoneType) -> Association or NoneType | [
"Retrieve",
"an",
"association",
".",
"If",
"no",
"handle",
"is",
"specified",
"return",
"the",
"association",
"with",
"the",
"latest",
"expiration",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L248-L288 |
16,578 | openid/python-openid | openid/store/filestore.py | FileOpenIDStore.removeAssociation | def removeAssociation(self, server_url, handle):
"""Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool
"""
assoc = self.getAssociation(server_url, handle)
if assoc is None:
return 0
else:
filename = self.getAssociati... | python | def removeAssociation(self, server_url, handle):
"""Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool
"""
assoc = self.getAssociation(server_url, handle)
if assoc is None:
return 0
else:
filename = self.getAssociati... | [
"def",
"removeAssociation",
"(",
"self",
",",
"server_url",
",",
"handle",
")",
":",
"assoc",
"=",
"self",
".",
"getAssociation",
"(",
"server_url",
",",
"handle",
")",
"if",
"assoc",
"is",
"None",
":",
"return",
"0",
"else",
":",
"filename",
"=",
"self"... | Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool | [
"Remove",
"an",
"association",
"if",
"it",
"exists",
".",
"Do",
"nothing",
"if",
"it",
"does",
"not",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L318-L328 |
16,579 | openid/python-openid | openid/store/filestore.py | FileOpenIDStore.useNonce | def useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is valid.
str -> bool
"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
if server_url:
proto, rest = server_url.split('://', 1)
else:
# Create ... | python | def useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is valid.
str -> bool
"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
if server_url:
proto, rest = server_url.split('://', 1)
else:
# Create ... | [
"def",
"useNonce",
"(",
"self",
",",
"server_url",
",",
"timestamp",
",",
"salt",
")",
":",
"if",
"abs",
"(",
"timestamp",
"-",
"time",
".",
"time",
"(",
")",
")",
">",
"nonce",
".",
"SKEW",
":",
"return",
"False",
"if",
"server_url",
":",
"proto",
... | Return whether this nonce is valid.
str -> bool | [
"Return",
"whether",
"this",
"nonce",
"is",
"valid",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L330-L362 |
16,580 | openid/python-openid | openid/consumer/discover.py | arrangeByType | def arrangeByType(service_list, preferred_types):
"""Rearrange service_list in a new list so services are ordered by
types listed in preferred_types. Return the new list."""
def enumerate(elts):
"""Return an iterable that pairs the index of an element with
that element.
For Python... | python | def arrangeByType(service_list, preferred_types):
"""Rearrange service_list in a new list so services are ordered by
types listed in preferred_types. Return the new list."""
def enumerate(elts):
"""Return an iterable that pairs the index of an element with
that element.
For Python... | [
"def",
"arrangeByType",
"(",
"service_list",
",",
"preferred_types",
")",
":",
"def",
"enumerate",
"(",
"elts",
")",
":",
"\"\"\"Return an iterable that pairs the index of an element with\n that element.\n\n For Python 2.2 compatibility\"\"\"",
"return",
"zip",
"(",
... | Rearrange service_list in a new list so services are ordered by
types listed in preferred_types. Return the new list. | [
"Rearrange",
"service_list",
"in",
"a",
"new",
"list",
"so",
"services",
"are",
"ordered",
"by",
"types",
"listed",
"in",
"preferred_types",
".",
"Return",
"the",
"new",
"list",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L319-L356 |
16,581 | openid/python-openid | openid/consumer/discover.py | getOPOrUserServices | def getOPOrUserServices(openid_services):
"""Extract OP Identifier services. If none found, return the
rest, sorted with most preferred first according to
OpenIDServiceEndpoint.openid_type_uris.
openid_services is a list of OpenIDServiceEndpoint objects.
Returns a list of OpenIDServiceEndpoint ob... | python | def getOPOrUserServices(openid_services):
"""Extract OP Identifier services. If none found, return the
rest, sorted with most preferred first according to
OpenIDServiceEndpoint.openid_type_uris.
openid_services is a list of OpenIDServiceEndpoint objects.
Returns a list of OpenIDServiceEndpoint ob... | [
"def",
"getOPOrUserServices",
"(",
"openid_services",
")",
":",
"op_services",
"=",
"arrangeByType",
"(",
"openid_services",
",",
"[",
"OPENID_IDP_2_0_TYPE",
"]",
")",
"openid_services",
"=",
"arrangeByType",
"(",
"openid_services",
",",
"OpenIDServiceEndpoint",
".",
... | Extract OP Identifier services. If none found, return the
rest, sorted with most preferred first according to
OpenIDServiceEndpoint.openid_type_uris.
openid_services is a list of OpenIDServiceEndpoint objects.
Returns a list of OpenIDServiceEndpoint objects. | [
"Extract",
"OP",
"Identifier",
"services",
".",
"If",
"none",
"found",
"return",
"the",
"rest",
"sorted",
"with",
"most",
"preferred",
"first",
"according",
"to",
"OpenIDServiceEndpoint",
".",
"openid_type_uris",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L358-L372 |
16,582 | openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.supportsType | def supportsType(self, type_uri):
"""Does this endpoint support this type?
I consider C{/server} endpoints to implicitly support C{/signon}.
"""
return (
(type_uri in self.type_uris) or
(type_uri == OPENID_2_0_TYPE and self.isOPIdentifier())
) | python | def supportsType(self, type_uri):
"""Does this endpoint support this type?
I consider C{/server} endpoints to implicitly support C{/signon}.
"""
return (
(type_uri in self.type_uris) or
(type_uri == OPENID_2_0_TYPE and self.isOPIdentifier())
) | [
"def",
"supportsType",
"(",
"self",
",",
"type_uri",
")",
":",
"return",
"(",
"(",
"type_uri",
"in",
"self",
".",
"type_uris",
")",
"or",
"(",
"type_uri",
"==",
"OPENID_2_0_TYPE",
"and",
"self",
".",
"isOPIdentifier",
"(",
")",
")",
")"
] | Does this endpoint support this type?
I consider C{/server} endpoints to implicitly support C{/signon}. | [
"Does",
"this",
"endpoint",
"support",
"this",
"type?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L76-L84 |
16,583 | openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.parseService | def parseService(self, yadis_url, uri, type_uris, service_element):
"""Set the state of this object based on the contents of the
service element."""
self.type_uris = type_uris
self.server_url = uri
self.used_yadis = True
if not self.isOPIdentifier():
# XXX: T... | python | def parseService(self, yadis_url, uri, type_uris, service_element):
"""Set the state of this object based on the contents of the
service element."""
self.type_uris = type_uris
self.server_url = uri
self.used_yadis = True
if not self.isOPIdentifier():
# XXX: T... | [
"def",
"parseService",
"(",
"self",
",",
"yadis_url",
",",
"uri",
",",
"type_uris",
",",
"service_element",
")",
":",
"self",
".",
"type_uris",
"=",
"type_uris",
"self",
".",
"server_url",
"=",
"uri",
"self",
".",
"used_yadis",
"=",
"True",
"if",
"not",
... | Set the state of this object based on the contents of the
service element. | [
"Set",
"the",
"state",
"of",
"this",
"object",
"based",
"on",
"the",
"contents",
"of",
"the",
"service",
"element",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L102-L116 |
16,584 | openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.getLocalID | def getLocalID(self):
"""Return the identifier that should be sent as the
openid.identity parameter to the server."""
# I looked at this conditional and thought "ah-hah! there's the bug!"
# but Python actually makes that one big expression somehow, i.e.
# "x is x is x" is not the... | python | def getLocalID(self):
"""Return the identifier that should be sent as the
openid.identity parameter to the server."""
# I looked at this conditional and thought "ah-hah! there's the bug!"
# but Python actually makes that one big expression somehow, i.e.
# "x is x is x" is not the... | [
"def",
"getLocalID",
"(",
"self",
")",
":",
"# I looked at this conditional and thought \"ah-hah! there's the bug!\"",
"# but Python actually makes that one big expression somehow, i.e.",
"# \"x is x is x\" is not the same thing as \"(x is x) is x\".",
"# That's pretty weird, dude. -- kmt, 1/07",... | Return the identifier that should be sent as the
openid.identity parameter to the server. | [
"Return",
"the",
"identifier",
"that",
"should",
"be",
"sent",
"as",
"the",
"openid",
".",
"identity",
"parameter",
"to",
"the",
"server",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L118-L128 |
16,585 | openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.fromBasicServiceEndpoint | def fromBasicServiceEndpoint(cls, endpoint):
"""Create a new instance of this class from the endpoint
object passed in.
@return: None or OpenIDServiceEndpoint for this endpoint object"""
type_uris = endpoint.matchTypes(cls.openid_type_uris)
# If any Type URIs match and there is... | python | def fromBasicServiceEndpoint(cls, endpoint):
"""Create a new instance of this class from the endpoint
object passed in.
@return: None or OpenIDServiceEndpoint for this endpoint object"""
type_uris = endpoint.matchTypes(cls.openid_type_uris)
# If any Type URIs match and there is... | [
"def",
"fromBasicServiceEndpoint",
"(",
"cls",
",",
"endpoint",
")",
":",
"type_uris",
"=",
"endpoint",
".",
"matchTypes",
"(",
"cls",
".",
"openid_type_uris",
")",
"# If any Type URIs match and there is an endpoint URI",
"# specified, then this is an OpenID endpoint",
"if",
... | Create a new instance of this class from the endpoint
object passed in.
@return: None or OpenIDServiceEndpoint for this endpoint object | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"from",
"the",
"endpoint",
"object",
"passed",
"in",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L130-L149 |
16,586 | openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.fromDiscoveryResult | def fromDiscoveryResult(cls, discoveryResult):
"""Create endpoints from a DiscoveryResult.
@type discoveryResult: L{DiscoveryResult}
@rtype: list of L{OpenIDServiceEndpoint}
@raises XRDSError: When the XRDS does not parse.
@since: 2.1.0
"""
if discoveryResult.... | python | def fromDiscoveryResult(cls, discoveryResult):
"""Create endpoints from a DiscoveryResult.
@type discoveryResult: L{DiscoveryResult}
@rtype: list of L{OpenIDServiceEndpoint}
@raises XRDSError: When the XRDS does not parse.
@since: 2.1.0
"""
if discoveryResult.... | [
"def",
"fromDiscoveryResult",
"(",
"cls",
",",
"discoveryResult",
")",
":",
"if",
"discoveryResult",
".",
"isXRDS",
"(",
")",
":",
"method",
"=",
"cls",
".",
"fromXRDS",
"else",
":",
"method",
"=",
"cls",
".",
"fromHTML",
"return",
"method",
"(",
"discover... | Create endpoints from a DiscoveryResult.
@type discoveryResult: L{DiscoveryResult}
@rtype: list of L{OpenIDServiceEndpoint}
@raises XRDSError: When the XRDS does not parse.
@since: 2.1.0 | [
"Create",
"endpoints",
"from",
"a",
"DiscoveryResult",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L200-L216 |
16,587 | openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.fromOPEndpointURL | def fromOPEndpointURL(cls, op_endpoint_url):
"""Construct an OP-Identifier OpenIDServiceEndpoint object for
a given OP Endpoint URL
@param op_endpoint_url: The URL of the endpoint
@rtype: OpenIDServiceEndpoint
"""
service = cls()
service.server_url = op_endpoint_... | python | def fromOPEndpointURL(cls, op_endpoint_url):
"""Construct an OP-Identifier OpenIDServiceEndpoint object for
a given OP Endpoint URL
@param op_endpoint_url: The URL of the endpoint
@rtype: OpenIDServiceEndpoint
"""
service = cls()
service.server_url = op_endpoint_... | [
"def",
"fromOPEndpointURL",
"(",
"cls",
",",
"op_endpoint_url",
")",
":",
"service",
"=",
"cls",
"(",
")",
"service",
".",
"server_url",
"=",
"op_endpoint_url",
"service",
".",
"type_uris",
"=",
"[",
"OPENID_IDP_2_0_TYPE",
"]",
"return",
"service"
] | Construct an OP-Identifier OpenIDServiceEndpoint object for
a given OP Endpoint URL
@param op_endpoint_url: The URL of the endpoint
@rtype: OpenIDServiceEndpoint | [
"Construct",
"an",
"OP",
"-",
"Identifier",
"OpenIDServiceEndpoint",
"object",
"for",
"a",
"given",
"OP",
"Endpoint",
"URL"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L221-L231 |
16,588 | openid/python-openid | openid/association.py | SessionNegotiator.setAllowedTypes | def setAllowedTypes(self, allowed_types):
"""Set the allowed association types, checking to make sure
each combination is valid."""
for (assoc_type, session_type) in allowed_types:
checkSessionType(assoc_type, session_type)
self.allowed_types = allowed_types | python | def setAllowedTypes(self, allowed_types):
"""Set the allowed association types, checking to make sure
each combination is valid."""
for (assoc_type, session_type) in allowed_types:
checkSessionType(assoc_type, session_type)
self.allowed_types = allowed_types | [
"def",
"setAllowedTypes",
"(",
"self",
",",
"allowed_types",
")",
":",
"for",
"(",
"assoc_type",
",",
"session_type",
")",
"in",
"allowed_types",
":",
"checkSessionType",
"(",
"assoc_type",
",",
"session_type",
")",
"self",
".",
"allowed_types",
"=",
"allowed_ty... | Set the allowed association types, checking to make sure
each combination is valid. | [
"Set",
"the",
"allowed",
"association",
"types",
"checking",
"to",
"make",
"sure",
"each",
"combination",
"is",
"valid",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L143-L149 |
16,589 | openid/python-openid | openid/association.py | SessionNegotiator.isAllowed | def isAllowed(self, assoc_type, session_type):
"""Is this combination of association type and session type allowed?"""
assoc_good = (assoc_type, session_type) in self.allowed_types
matches = session_type in getSessionTypes(assoc_type)
return assoc_good and matches | python | def isAllowed(self, assoc_type, session_type):
"""Is this combination of association type and session type allowed?"""
assoc_good = (assoc_type, session_type) in self.allowed_types
matches = session_type in getSessionTypes(assoc_type)
return assoc_good and matches | [
"def",
"isAllowed",
"(",
"self",
",",
"assoc_type",
",",
"session_type",
")",
":",
"assoc_good",
"=",
"(",
"assoc_type",
",",
"session_type",
")",
"in",
"self",
".",
"allowed_types",
"matches",
"=",
"session_type",
"in",
"getSessionTypes",
"(",
"assoc_type",
"... | Is this combination of association type and session type allowed? | [
"Is",
"this",
"combination",
"of",
"association",
"type",
"and",
"session",
"type",
"allowed?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L172-L176 |
16,590 | openid/python-openid | openid/association.py | Association.serialize | def serialize(self):
"""
Convert an association to KV form.
@return: String in KV form suitable for deserialization by
deserialize.
@rtype: str
"""
data = {
'version':'2',
'handle':self.handle,
'secret':oidutil.toBase64(se... | python | def serialize(self):
"""
Convert an association to KV form.
@return: String in KV form suitable for deserialization by
deserialize.
@rtype: str
"""
data = {
'version':'2',
'handle':self.handle,
'secret':oidutil.toBase64(se... | [
"def",
"serialize",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'version'",
":",
"'2'",
",",
"'handle'",
":",
"self",
".",
"handle",
",",
"'secret'",
":",
"oidutil",
".",
"toBase64",
"(",
"self",
".",
"secret",
")",
",",
"'issued'",
":",
"str",
"(",
... | Convert an association to KV form.
@return: String in KV form suitable for deserialization by
deserialize.
@rtype: str | [
"Convert",
"an",
"association",
"to",
"KV",
"form",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L398-L421 |
16,591 | openid/python-openid | openid/association.py | Association.getMessageSignature | def getMessageSignature(self, message):
"""Return the signature of a message.
If I am not a sign-all association, the message must have a
signed list.
@return: the signature, base64 encoded
@rtype: str
@raises ValueError: If there is no signed list and I am not a sign... | python | def getMessageSignature(self, message):
"""Return the signature of a message.
If I am not a sign-all association, the message must have a
signed list.
@return: the signature, base64 encoded
@rtype: str
@raises ValueError: If there is no signed list and I am not a sign... | [
"def",
"getMessageSignature",
"(",
"self",
",",
"message",
")",
":",
"pairs",
"=",
"self",
".",
"_makePairs",
"(",
"message",
")",
"return",
"oidutil",
".",
"toBase64",
"(",
"self",
".",
"sign",
"(",
"pairs",
")",
")"
] | Return the signature of a message.
If I am not a sign-all association, the message must have a
signed list.
@return: the signature, base64 encoded
@rtype: str
@raises ValueError: If there is no signed list and I am not a sign-all
type of association. | [
"Return",
"the",
"signature",
"of",
"a",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L482-L496 |
16,592 | openid/python-openid | openid/association.py | Association.checkMessageSignature | def checkMessageSignature(self, message):
"""Given a message with a signature, calculate a new signature
and return whether it matches the signature in the message.
@raises ValueError: if the message has no signature or no signature
can be calculated for it.
"""
mess... | python | def checkMessageSignature(self, message):
"""Given a message with a signature, calculate a new signature
and return whether it matches the signature in the message.
@raises ValueError: if the message has no signature or no signature
can be calculated for it.
"""
mess... | [
"def",
"checkMessageSignature",
"(",
"self",
",",
"message",
")",
":",
"message_sig",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'sig'",
")",
"if",
"not",
"message_sig",
":",
"raise",
"ValueError",
"(",
"\"%s has no sig.\"",
"%",
"(",
"message",
... | Given a message with a signature, calculate a new signature
and return whether it matches the signature in the message.
@raises ValueError: if the message has no signature or no signature
can be calculated for it. | [
"Given",
"a",
"message",
"with",
"a",
"signature",
"calculate",
"a",
"new",
"signature",
"and",
"return",
"whether",
"it",
"matches",
"the",
"signature",
"in",
"the",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L524-L535 |
16,593 | openid/python-openid | openid/extensions/draft/pape2.py | Request.addPolicyURI | def addPolicyURI(self, policy_uri):
"""Add an acceptable authentication policy URI to this request
This method is intended to be used by the relying party to add
acceptable authentication types to the request.
@param policy_uri: The identifier for the preferred type of
auth... | python | def addPolicyURI(self, policy_uri):
"""Add an acceptable authentication policy URI to this request
This method is intended to be used by the relying party to add
acceptable authentication types to the request.
@param policy_uri: The identifier for the preferred type of
auth... | [
"def",
"addPolicyURI",
"(",
"self",
",",
"policy_uri",
")",
":",
"if",
"policy_uri",
"not",
"in",
"self",
".",
"preferred_auth_policies",
":",
"self",
".",
"preferred_auth_policies",
".",
"append",
"(",
"policy_uri",
")"
] | Add an acceptable authentication policy URI to this request
This method is intended to be used by the relying party to add
acceptable authentication types to the request.
@param policy_uri: The identifier for the preferred type of
authentication.
@see: http://openid.net/spe... | [
"Add",
"an",
"acceptable",
"authentication",
"policy",
"URI",
"to",
"this",
"request"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape2.py#L60-L71 |
16,594 | openid/python-openid | openid/extensions/draft/pape5.py | PAPEExtension._addAuthLevelAlias | def _addAuthLevelAlias(self, auth_level_uri, alias=None):
"""Add an auth level URI alias to this request.
@param auth_level_uri: The auth level URI to send in the
request.
@param alias: The namespace alias to use for this auth level
in this message. May be None if the a... | python | def _addAuthLevelAlias(self, auth_level_uri, alias=None):
"""Add an auth level URI alias to this request.
@param auth_level_uri: The auth level URI to send in the
request.
@param alias: The namespace alias to use for this auth level
in this message. May be None if the a... | [
"def",
"_addAuthLevelAlias",
"(",
"self",
",",
"auth_level_uri",
",",
"alias",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"try",
":",
"alias",
"=",
"self",
".",
"_getAlias",
"(",
"auth_level_uri",
")",
"except",
"KeyError",
":",
"alias",
"=... | Add an auth level URI alias to this request.
@param auth_level_uri: The auth level URI to send in the
request.
@param alias: The namespace alias to use for this auth level
in this message. May be None if the alias is not
important. | [
"Add",
"an",
"auth",
"level",
"URI",
"alias",
"to",
"this",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape5.py#L49-L70 |
16,595 | openid/python-openid | openid/extensions/draft/pape5.py | Response.setAuthLevel | def setAuthLevel(self, level_uri, level, alias=None):
"""Set the value for the given auth level type.
@param level: string representation of an authentication level
valid for level_uri
@param alias: An optional namespace alias for the given auth
level URI. May be omitte... | python | def setAuthLevel(self, level_uri, level, alias=None):
"""Set the value for the given auth level type.
@param level: string representation of an authentication level
valid for level_uri
@param alias: An optional namespace alias for the given auth
level URI. May be omitte... | [
"def",
"setAuthLevel",
"(",
"self",
",",
"level_uri",
",",
"level",
",",
"alias",
"=",
"None",
")",
":",
"self",
".",
"_addAuthLevelAlias",
"(",
"level_uri",
",",
"alias",
")",
"self",
".",
"auth_levels",
"[",
"level_uri",
"]",
"=",
"level"
] | Set the value for the given auth level type.
@param level: string representation of an authentication level
valid for level_uri
@param alias: An optional namespace alias for the given auth
level URI. May be omitted if the alias is not
significant. The library will u... | [
"Set",
"the",
"value",
"for",
"the",
"given",
"auth",
"level",
"type",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape5.py#L298-L310 |
16,596 | openid/python-openid | openid/yadis/discover.py | discover | def discover(uri):
"""Discover services for a given URI.
@param uri: The identity URI as a well-formed http or https
URI. The well-formedness and the protocol are not checked, but
the results of this function are undefined if those properties
do not hold.
@return: DiscoveryResult o... | python | def discover(uri):
"""Discover services for a given URI.
@param uri: The identity URI as a well-formed http or https
URI. The well-formedness and the protocol are not checked, but
the results of this function are undefined if those properties
do not hold.
@return: DiscoveryResult o... | [
"def",
"discover",
"(",
"uri",
")",
":",
"result",
"=",
"DiscoveryResult",
"(",
"uri",
")",
"resp",
"=",
"fetchers",
".",
"fetch",
"(",
"uri",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"YADIS_ACCEPT_HEADER",
"}",
")",
"if",
"resp",
".",
"status",
"not... | Discover services for a given URI.
@param uri: The identity URI as a well-formed http or https
URI. The well-formedness and the protocol are not checked, but
the results of this function are undefined if those properties
do not hold.
@return: DiscoveryResult object
@raises Excepti... | [
"Discover",
"services",
"for",
"a",
"given",
"URI",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/discover.py#L57-L98 |
16,597 | openid/python-openid | openid/yadis/discover.py | whereIsYadis | def whereIsYadis(resp):
"""Given a HTTPResponse, return the location of the Yadis document.
May be the URL just retrieved, another URL, or None, if I can't
find any.
[non-blocking]
@returns: str or None
"""
# Attempt to find out where to go to discover the document
# or if we already ... | python | def whereIsYadis(resp):
"""Given a HTTPResponse, return the location of the Yadis document.
May be the URL just retrieved, another URL, or None, if I can't
find any.
[non-blocking]
@returns: str or None
"""
# Attempt to find out where to go to discover the document
# or if we already ... | [
"def",
"whereIsYadis",
"(",
"resp",
")",
":",
"# Attempt to find out where to go to discover the document",
"# or if we already have it",
"content_type",
"=",
"resp",
".",
"headers",
".",
"get",
"(",
"'content-type'",
")",
"# According to the spec, the content-type header must be... | Given a HTTPResponse, return the location of the Yadis document.
May be the URL just retrieved, another URL, or None, if I can't
find any.
[non-blocking]
@returns: str or None | [
"Given",
"a",
"HTTPResponse",
"return",
"the",
"location",
"of",
"the",
"Yadis",
"document",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/discover.py#L102-L154 |
16,598 | openid/python-openid | examples/djopenid/server/views.py | endpoint | def endpoint(request):
"""
Respond to low-level OpenID protocol messages.
"""
s = getServer(request)
query = util.normalDict(request.GET or request.POST)
# First, decode the incoming request into something the OpenID
# library can use.
try:
openid_request = s.decodeRequest(quer... | python | def endpoint(request):
"""
Respond to low-level OpenID protocol messages.
"""
s = getServer(request)
query = util.normalDict(request.GET or request.POST)
# First, decode the incoming request into something the OpenID
# library can use.
try:
openid_request = s.decodeRequest(quer... | [
"def",
"endpoint",
"(",
"request",
")",
":",
"s",
"=",
"getServer",
"(",
"request",
")",
"query",
"=",
"util",
".",
"normalDict",
"(",
"request",
".",
"GET",
"or",
"request",
".",
"POST",
")",
"# First, decode the incoming request into something the OpenID",
"# ... | Respond to low-level OpenID protocol messages. | [
"Respond",
"to",
"low",
"-",
"level",
"OpenID",
"protocol",
"messages",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/server/views.py#L101-L136 |
16,599 | openid/python-openid | examples/djopenid/server/views.py | showDecidePage | def showDecidePage(request, openid_request):
"""
Render a page to the user so a trust decision can be made.
@type openid_request: openid.server.server.CheckIDRequest
"""
trust_root = openid_request.trust_root
return_to = openid_request.return_to
try:
# Stringify because template's ... | python | def showDecidePage(request, openid_request):
"""
Render a page to the user so a trust decision can be made.
@type openid_request: openid.server.server.CheckIDRequest
"""
trust_root = openid_request.trust_root
return_to = openid_request.return_to
try:
# Stringify because template's ... | [
"def",
"showDecidePage",
"(",
"request",
",",
"openid_request",
")",
":",
"trust_root",
"=",
"openid_request",
".",
"trust_root",
"return_to",
"=",
"openid_request",
".",
"return_to",
"try",
":",
"# Stringify because template's ifequal can only compare to strings.",
"trust_... | Render a page to the user so a trust decision can be made.
@type openid_request: openid.server.server.CheckIDRequest | [
"Render",
"a",
"page",
"to",
"the",
"user",
"so",
"a",
"trust",
"decision",
"can",
"be",
"made",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/server/views.py#L179-L206 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.