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,600 | openid/python-openid | examples/djopenid/server/views.py | processTrustResult | def processTrustResult(request):
"""
Handle the result of a trust decision and respond to the RP
accordingly.
"""
# Get the request from the session so we can construct the
# appropriate response.
openid_request = getRequest(request)
# The identifier that this server can vouch for
r... | python | def processTrustResult(request):
"""
Handle the result of a trust decision and respond to the RP
accordingly.
"""
# Get the request from the session so we can construct the
# appropriate response.
openid_request = getRequest(request)
# The identifier that this server can vouch for
r... | [
"def",
"processTrustResult",
"(",
"request",
")",
":",
"# Get the request from the session so we can construct the",
"# appropriate response.",
"openid_request",
"=",
"getRequest",
"(",
"request",
")",
"# The identifier that this server can vouch for",
"response_identity",
"=",
"ge... | Handle the result of a trust decision and respond to the RP
accordingly. | [
"Handle",
"the",
"result",
"of",
"a",
"trust",
"decision",
"and",
"respond",
"to",
"the",
"RP",
"accordingly",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/server/views.py#L208-L250 |
16,601 | openid/python-openid | admin/builddiscover.py | buildDiscover | def buildDiscover(base_url, out_dir):
"""Convert all files in a directory to apache mod_asis files in
another directory."""
test_data = discoverdata.readTests(discoverdata.default_test_file)
def writeTestFile(test_name):
template = test_data[test_name]
data = discoverdata.fillTemplate(... | python | def buildDiscover(base_url, out_dir):
"""Convert all files in a directory to apache mod_asis files in
another directory."""
test_data = discoverdata.readTests(discoverdata.default_test_file)
def writeTestFile(test_name):
template = test_data[test_name]
data = discoverdata.fillTemplate(... | [
"def",
"buildDiscover",
"(",
"base_url",
",",
"out_dir",
")",
":",
"test_data",
"=",
"discoverdata",
".",
"readTests",
"(",
"discoverdata",
".",
"default_test_file",
")",
"def",
"writeTestFile",
"(",
"test_name",
")",
":",
"template",
"=",
"test_data",
"[",
"t... | Convert all files in a directory to apache mod_asis files in
another directory. | [
"Convert",
"all",
"files",
"in",
"a",
"directory",
"to",
"apache",
"mod_asis",
"files",
"in",
"another",
"directory",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/admin/builddiscover.py#L31-L63 |
16,602 | openid/python-openid | openid/store/memstore.py | ServerAssocs.best | def best(self):
"""Returns association with the oldest issued date.
or None if there are no associations.
"""
best = None
for assoc in self.assocs.values():
if best is None or best.issued < assoc.issued:
best = assoc
return best | python | def best(self):
"""Returns association with the oldest issued date.
or None if there are no associations.
"""
best = None
for assoc in self.assocs.values():
if best is None or best.issued < assoc.issued:
best = assoc
return best | [
"def",
"best",
"(",
"self",
")",
":",
"best",
"=",
"None",
"for",
"assoc",
"in",
"self",
".",
"assocs",
".",
"values",
"(",
")",
":",
"if",
"best",
"is",
"None",
"or",
"best",
".",
"issued",
"<",
"assoc",
".",
"issued",
":",
"best",
"=",
"assoc",... | Returns association with the oldest issued date.
or None if there are no associations. | [
"Returns",
"association",
"with",
"the",
"oldest",
"issued",
"date",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/memstore.py#L26-L35 |
16,603 | openid/python-openid | openid/store/nonce.py | split | def split(nonce_string):
"""Extract a timestamp from the given nonce string
@param nonce_string: the nonce from which to extract the timestamp
@type nonce_string: str
@returns: A pair of a Unix timestamp and the salt characters
@returntype: (int, str)
@raises ValueError: if the nonce does not... | python | def split(nonce_string):
"""Extract a timestamp from the given nonce string
@param nonce_string: the nonce from which to extract the timestamp
@type nonce_string: str
@returns: A pair of a Unix timestamp and the salt characters
@returntype: (int, str)
@raises ValueError: if the nonce does not... | [
"def",
"split",
"(",
"nonce_string",
")",
":",
"timestamp_str",
"=",
"nonce_string",
"[",
":",
"time_str_len",
"]",
"try",
":",
"timestamp",
"=",
"timegm",
"(",
"strptime",
"(",
"timestamp_str",
",",
"time_fmt",
")",
")",
"except",
"AssertionError",
":",
"# ... | Extract a timestamp from the given nonce string
@param nonce_string: the nonce from which to extract the timestamp
@type nonce_string: str
@returns: A pair of a Unix timestamp and the salt characters
@returntype: (int, str)
@raises ValueError: if the nonce does not start with a correctly
... | [
"Extract",
"a",
"timestamp",
"from",
"the",
"given",
"nonce",
"string"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/nonce.py#L22-L41 |
16,604 | openid/python-openid | openid/store/nonce.py | checkTimestamp | def checkTimestamp(nonce_string, allowed_skew=SKEW, now=None):
"""Is the timestamp that is part of the specified nonce string
within the allowed clock-skew of the current time?
@param nonce_string: The nonce that is being checked
@type nonce_string: str
@param allowed_skew: How many seconds should... | python | def checkTimestamp(nonce_string, allowed_skew=SKEW, now=None):
"""Is the timestamp that is part of the specified nonce string
within the allowed clock-skew of the current time?
@param nonce_string: The nonce that is being checked
@type nonce_string: str
@param allowed_skew: How many seconds should... | [
"def",
"checkTimestamp",
"(",
"nonce_string",
",",
"allowed_skew",
"=",
"SKEW",
",",
"now",
"=",
"None",
")",
":",
"try",
":",
"stamp",
",",
"_",
"=",
"split",
"(",
"nonce_string",
")",
"except",
"ValueError",
":",
"return",
"False",
"else",
":",
"if",
... | Is the timestamp that is part of the specified nonce string
within the allowed clock-skew of the current time?
@param nonce_string: The nonce that is being checked
@type nonce_string: str
@param allowed_skew: How many seconds should be allowed for
completing the request, allowing for clock ske... | [
"Is",
"the",
"timestamp",
"that",
"is",
"part",
"of",
"the",
"specified",
"nonce",
"string",
"within",
"the",
"allowed",
"clock",
"-",
"skew",
"of",
"the",
"current",
"time?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/nonce.py#L43-L77 |
16,605 | openid/python-openid | openid/store/nonce.py | mkNonce | def mkNonce(when=None):
"""Generate a nonce with the current timestamp
@param when: Unix timestamp representing the issue time of the
nonce. Defaults to the current time.
@type when: int
@returntype: str
@returns: A string that should be usable as a one-way nonce
@see: time
"""
... | python | def mkNonce(when=None):
"""Generate a nonce with the current timestamp
@param when: Unix timestamp representing the issue time of the
nonce. Defaults to the current time.
@type when: int
@returntype: str
@returns: A string that should be usable as a one-way nonce
@see: time
"""
... | [
"def",
"mkNonce",
"(",
"when",
"=",
"None",
")",
":",
"salt",
"=",
"cryptutil",
".",
"randomString",
"(",
"6",
",",
"NONCE_CHARS",
")",
"if",
"when",
"is",
"None",
":",
"t",
"=",
"gmtime",
"(",
")",
"else",
":",
"t",
"=",
"gmtime",
"(",
"when",
"... | Generate a nonce with the current timestamp
@param when: Unix timestamp representing the issue time of the
nonce. Defaults to the current time.
@type when: int
@returntype: str
@returns: A string that should be usable as a one-way nonce
@see: time | [
"Generate",
"a",
"nonce",
"with",
"the",
"current",
"timestamp"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/nonce.py#L79-L98 |
16,606 | openid/python-openid | openid/fetchers.py | fetch | def fetch(url, body=None, headers=None):
"""Invoke the fetch method on the default fetcher. Most users
should need only this method.
@raises Exception: any exceptions that may be raised by the default fetcher
"""
fetcher = getDefaultFetcher()
return fetcher.fetch(url, body, headers) | python | def fetch(url, body=None, headers=None):
"""Invoke the fetch method on the default fetcher. Most users
should need only this method.
@raises Exception: any exceptions that may be raised by the default fetcher
"""
fetcher = getDefaultFetcher()
return fetcher.fetch(url, body, headers) | [
"def",
"fetch",
"(",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"fetcher",
"=",
"getDefaultFetcher",
"(",
")",
"return",
"fetcher",
".",
"fetch",
"(",
"url",
",",
"body",
",",
"headers",
")"
] | Invoke the fetch method on the default fetcher. Most users
should need only this method.
@raises Exception: any exceptions that may be raised by the default fetcher | [
"Invoke",
"the",
"fetch",
"method",
"on",
"the",
"default",
"fetcher",
".",
"Most",
"users",
"should",
"need",
"only",
"this",
"method",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L35-L42 |
16,607 | openid/python-openid | openid/fetchers.py | setDefaultFetcher | def setDefaultFetcher(fetcher, wrap_exceptions=True):
"""Set the default fetcher
@param fetcher: The fetcher to use as the default HTTP fetcher
@type fetcher: HTTPFetcher
@param wrap_exceptions: Whether to wrap exceptions thrown by the
fetcher wil HTTPFetchingError so that they may be caught
... | python | def setDefaultFetcher(fetcher, wrap_exceptions=True):
"""Set the default fetcher
@param fetcher: The fetcher to use as the default HTTP fetcher
@type fetcher: HTTPFetcher
@param wrap_exceptions: Whether to wrap exceptions thrown by the
fetcher wil HTTPFetchingError so that they may be caught
... | [
"def",
"setDefaultFetcher",
"(",
"fetcher",
",",
"wrap_exceptions",
"=",
"True",
")",
":",
"global",
"_default_fetcher",
"if",
"fetcher",
"is",
"None",
"or",
"not",
"wrap_exceptions",
":",
"_default_fetcher",
"=",
"fetcher",
"else",
":",
"_default_fetcher",
"=",
... | Set the default fetcher
@param fetcher: The fetcher to use as the default HTTP fetcher
@type fetcher: HTTPFetcher
@param wrap_exceptions: Whether to wrap exceptions thrown by the
fetcher wil HTTPFetchingError so that they may be caught
easier. By default, exceptions will be wrapped. In gen... | [
"Set",
"the",
"default",
"fetcher"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L74-L92 |
16,608 | openid/python-openid | openid/fetchers.py | usingCurl | def usingCurl():
"""Whether the currently set HTTP fetcher is a Curl HTTP fetcher."""
fetcher = getDefaultFetcher()
if isinstance(fetcher, ExceptionWrappingFetcher):
fetcher = fetcher.fetcher
return isinstance(fetcher, CurlHTTPFetcher) | python | def usingCurl():
"""Whether the currently set HTTP fetcher is a Curl HTTP fetcher."""
fetcher = getDefaultFetcher()
if isinstance(fetcher, ExceptionWrappingFetcher):
fetcher = fetcher.fetcher
return isinstance(fetcher, CurlHTTPFetcher) | [
"def",
"usingCurl",
"(",
")",
":",
"fetcher",
"=",
"getDefaultFetcher",
"(",
")",
"if",
"isinstance",
"(",
"fetcher",
",",
"ExceptionWrappingFetcher",
")",
":",
"fetcher",
"=",
"fetcher",
".",
"fetcher",
"return",
"isinstance",
"(",
"fetcher",
",",
"CurlHTTPFe... | Whether the currently set HTTP fetcher is a Curl HTTP fetcher. | [
"Whether",
"the",
"currently",
"set",
"HTTP",
"fetcher",
"is",
"a",
"Curl",
"HTTP",
"fetcher",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L94-L99 |
16,609 | openid/python-openid | openid/fetchers.py | HTTPLib2Fetcher.fetch | def fetch(self, url, body=None, headers=None):
"""Perform an HTTP request
@raises Exception: Any exception that can be raised by httplib2
@see: C{L{HTTPFetcher.fetch}}
"""
if body:
method = 'POST'
else:
method = 'GET'
if headers is None:... | python | def fetch(self, url, body=None, headers=None):
"""Perform an HTTP request
@raises Exception: Any exception that can be raised by httplib2
@see: C{L{HTTPFetcher.fetch}}
"""
if body:
method = 'POST'
else:
method = 'GET'
if headers is None:... | [
"def",
"fetch",
"(",
"self",
",",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"if",
"body",
":",
"method",
"=",
"'POST'",
"else",
":",
"method",
"=",
"'GET'",
"if",
"headers",
"is",
"None",
":",
"headers",
"=",
"{",
"}... | Perform an HTTP request
@raises Exception: Any exception that can be raised by httplib2
@see: C{L{HTTPFetcher.fetch}} | [
"Perform",
"an",
"HTTP",
"request"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L386-L430 |
16,610 | openid/python-openid | openid/yadis/services.py | getServiceEndpoints | def getServiceEndpoints(input_url, flt=None):
"""Perform the Yadis protocol on the input URL and return an
iterable of resulting endpoint objects.
@param flt: A filter object or something that is convertable to
a filter object (using mkFilter) that will be used to generate
endpoint objects.... | python | def getServiceEndpoints(input_url, flt=None):
"""Perform the Yadis protocol on the input URL and return an
iterable of resulting endpoint objects.
@param flt: A filter object or something that is convertable to
a filter object (using mkFilter) that will be used to generate
endpoint objects.... | [
"def",
"getServiceEndpoints",
"(",
"input_url",
",",
"flt",
"=",
"None",
")",
":",
"result",
"=",
"discover",
"(",
"input_url",
")",
"try",
":",
"endpoints",
"=",
"applyFilter",
"(",
"result",
".",
"normalized_uri",
",",
"result",
".",
"response_text",
",",
... | Perform the Yadis protocol on the input URL and return an
iterable of resulting endpoint objects.
@param flt: A filter object or something that is convertable to
a filter object (using mkFilter) that will be used to generate
endpoint objects. This defaults to generating BasicEndpoint
ob... | [
"Perform",
"the",
"Yadis",
"protocol",
"on",
"the",
"input",
"URL",
"and",
"return",
"an",
"iterable",
"of",
"resulting",
"endpoint",
"objects",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/services.py#L7-L31 |
16,611 | openid/python-openid | openid/yadis/services.py | applyFilter | def applyFilter(normalized_uri, xrd_data, flt=None):
"""Generate an iterable of endpoint objects given this input data,
presumably from the result of performing the Yadis protocol.
@param normalized_uri: The input URL, after following redirects,
as in the Yadis protocol.
@param xrd_data: The ... | python | def applyFilter(normalized_uri, xrd_data, flt=None):
"""Generate an iterable of endpoint objects given this input data,
presumably from the result of performing the Yadis protocol.
@param normalized_uri: The input URL, after following redirects,
as in the Yadis protocol.
@param xrd_data: The ... | [
"def",
"applyFilter",
"(",
"normalized_uri",
",",
"xrd_data",
",",
"flt",
"=",
"None",
")",
":",
"flt",
"=",
"mkFilter",
"(",
"flt",
")",
"et",
"=",
"parseXRDS",
"(",
"xrd_data",
")",
"endpoints",
"=",
"[",
"]",
"for",
"service_element",
"in",
"iterServi... | Generate an iterable of endpoint objects given this input data,
presumably from the result of performing the Yadis protocol.
@param normalized_uri: The input URL, after following redirects,
as in the Yadis protocol.
@param xrd_data: The XML text the XRDS file fetched from the
normalized U... | [
"Generate",
"an",
"iterable",
"of",
"endpoint",
"objects",
"given",
"this",
"input",
"data",
"presumably",
"from",
"the",
"result",
"of",
"performing",
"the",
"Yadis",
"protocol",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/services.py#L33-L54 |
16,612 | openid/python-openid | openid/consumer/html_parse.py | parseLinkAttrs | def parseLinkAttrs(html):
"""Find all link tags in a string representing a HTML document and
return a list of their attributes.
@param html: the text to parse
@type html: str or unicode
@return: A list of dictionaries of attributes, one for each link tag
@rtype: [[(type(html), type(html))]]
... | python | def parseLinkAttrs(html):
"""Find all link tags in a string representing a HTML document and
return a list of their attributes.
@param html: the text to parse
@type html: str or unicode
@return: A list of dictionaries of attributes, one for each link tag
@rtype: [[(type(html), type(html))]]
... | [
"def",
"parseLinkAttrs",
"(",
"html",
")",
":",
"stripped",
"=",
"removed_re",
".",
"sub",
"(",
"''",
",",
"html",
")",
"html_mo",
"=",
"html_find",
".",
"search",
"(",
"stripped",
")",
"if",
"html_mo",
"is",
"None",
"or",
"html_mo",
".",
"start",
"(",... | Find all link tags in a string representing a HTML document and
return a list of their attributes.
@param html: the text to parse
@type html: str or unicode
@return: A list of dictionaries of attributes, one for each link tag
@rtype: [[(type(html), type(html))]] | [
"Find",
"all",
"link",
"tags",
"in",
"a",
"string",
"representing",
"a",
"HTML",
"document",
"and",
"return",
"a",
"list",
"of",
"their",
"attributes",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L174-L215 |
16,613 | openid/python-openid | openid/consumer/html_parse.py | relMatches | def relMatches(rel_attr, target_rel):
"""Does this target_rel appear in the rel_str?"""
# XXX: TESTME
rels = rel_attr.strip().split()
for rel in rels:
rel = rel.lower()
if rel == target_rel:
return 1
return 0 | python | def relMatches(rel_attr, target_rel):
"""Does this target_rel appear in the rel_str?"""
# XXX: TESTME
rels = rel_attr.strip().split()
for rel in rels:
rel = rel.lower()
if rel == target_rel:
return 1
return 0 | [
"def",
"relMatches",
"(",
"rel_attr",
",",
"target_rel",
")",
":",
"# XXX: TESTME",
"rels",
"=",
"rel_attr",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"for",
"rel",
"in",
"rels",
":",
"rel",
"=",
"rel",
".",
"lower",
"(",
")",
"if",
"rel",
"=... | Does this target_rel appear in the rel_str? | [
"Does",
"this",
"target_rel",
"appear",
"in",
"the",
"rel_str?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L217-L226 |
16,614 | openid/python-openid | openid/consumer/html_parse.py | linkHasRel | def linkHasRel(link_attrs, target_rel):
"""Does this link have target_rel as a relationship?"""
# XXX: TESTME
rel_attr = link_attrs.get('rel')
return rel_attr and relMatches(rel_attr, target_rel) | python | def linkHasRel(link_attrs, target_rel):
"""Does this link have target_rel as a relationship?"""
# XXX: TESTME
rel_attr = link_attrs.get('rel')
return rel_attr and relMatches(rel_attr, target_rel) | [
"def",
"linkHasRel",
"(",
"link_attrs",
",",
"target_rel",
")",
":",
"# XXX: TESTME",
"rel_attr",
"=",
"link_attrs",
".",
"get",
"(",
"'rel'",
")",
"return",
"rel_attr",
"and",
"relMatches",
"(",
"rel_attr",
",",
"target_rel",
")"
] | Does this link have target_rel as a relationship? | [
"Does",
"this",
"link",
"have",
"target_rel",
"as",
"a",
"relationship?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L228-L232 |
16,615 | openid/python-openid | openid/consumer/html_parse.py | findFirstHref | def findFirstHref(link_attrs_list, target_rel):
"""Return the value of the href attribute for the first link tag
in the list that has target_rel as a relationship."""
# XXX: TESTME
matches = findLinksRel(link_attrs_list, target_rel)
if not matches:
return None
first = matches[0]
retu... | python | def findFirstHref(link_attrs_list, target_rel):
"""Return the value of the href attribute for the first link tag
in the list that has target_rel as a relationship."""
# XXX: TESTME
matches = findLinksRel(link_attrs_list, target_rel)
if not matches:
return None
first = matches[0]
retu... | [
"def",
"findFirstHref",
"(",
"link_attrs_list",
",",
"target_rel",
")",
":",
"# XXX: TESTME",
"matches",
"=",
"findLinksRel",
"(",
"link_attrs_list",
",",
"target_rel",
")",
"if",
"not",
"matches",
":",
"return",
"None",
"first",
"=",
"matches",
"[",
"0",
"]",... | Return the value of the href attribute for the first link tag
in the list that has target_rel as a relationship. | [
"Return",
"the",
"value",
"of",
"the",
"href",
"attribute",
"for",
"the",
"first",
"link",
"tag",
"in",
"the",
"list",
"that",
"has",
"target_rel",
"as",
"a",
"relationship",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L241-L249 |
16,616 | openid/python-openid | openid/oidutil.py | importElementTree | def importElementTree(module_names=None):
"""Find a working ElementTree implementation, trying the standard
places that such a thing might show up.
>>> ElementTree = importElementTree()
@param module_names: The names of modules to try to use as
ElementTree. Defaults to C{L{elementtree_modules}... | python | def importElementTree(module_names=None):
"""Find a working ElementTree implementation, trying the standard
places that such a thing might show up.
>>> ElementTree = importElementTree()
@param module_names: The names of modules to try to use as
ElementTree. Defaults to C{L{elementtree_modules}... | [
"def",
"importElementTree",
"(",
"module_names",
"=",
"None",
")",
":",
"if",
"module_names",
"is",
"None",
":",
"module_names",
"=",
"elementtree_modules",
"for",
"mod_name",
"in",
"module_names",
":",
"try",
":",
"ElementTree",
"=",
"__import__",
"(",
"mod_nam... | Find a working ElementTree implementation, trying the standard
places that such a thing might show up.
>>> ElementTree = importElementTree()
@param module_names: The names of modules to try to use as
ElementTree. Defaults to C{L{elementtree_modules}}
@returns: An ElementTree module | [
"Find",
"a",
"working",
"ElementTree",
"implementation",
"trying",
"the",
"standard",
"places",
"that",
"such",
"a",
"thing",
"might",
"show",
"up",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/oidutil.py#L55-L89 |
16,617 | openid/python-openid | openid/yadis/etxrd.py | getYadisXRD | def getYadisXRD(xrd_tree):
"""Return the XRD element that should contain the Yadis services"""
xrd = None
# for the side-effect of assigning the last one in the list to the
# xrd variable
for xrd in xrd_tree.findall(xrd_tag):
pass
# There were no elements found, or else xrd would be se... | python | def getYadisXRD(xrd_tree):
"""Return the XRD element that should contain the Yadis services"""
xrd = None
# for the side-effect of assigning the last one in the list to the
# xrd variable
for xrd in xrd_tree.findall(xrd_tag):
pass
# There were no elements found, or else xrd would be se... | [
"def",
"getYadisXRD",
"(",
"xrd_tree",
")",
":",
"xrd",
"=",
"None",
"# for the side-effect of assigning the last one in the list to the",
"# xrd variable",
"for",
"xrd",
"in",
"xrd_tree",
".",
"findall",
"(",
"xrd_tag",
")",
":",
"pass",
"# There were no elements found, ... | Return the XRD element that should contain the Yadis services | [
"Return",
"the",
"XRD",
"element",
"that",
"should",
"contain",
"the",
"Yadis",
"services"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L119-L133 |
16,618 | openid/python-openid | openid/yadis/etxrd.py | getXRDExpiration | def getXRDExpiration(xrd_element, default=None):
"""Return the expiration date of this XRD element, or None if no
expiration was specified.
@type xrd_element: ElementTree node
@param default: The value to use as the expiration if no
expiration was specified in the XRD.
@rtype: datetime.da... | python | def getXRDExpiration(xrd_element, default=None):
"""Return the expiration date of this XRD element, or None if no
expiration was specified.
@type xrd_element: ElementTree node
@param default: The value to use as the expiration if no
expiration was specified in the XRD.
@rtype: datetime.da... | [
"def",
"getXRDExpiration",
"(",
"xrd_element",
",",
"default",
"=",
"None",
")",
":",
"expires_element",
"=",
"xrd_element",
".",
"find",
"(",
"expires_tag",
")",
"if",
"expires_element",
"is",
"None",
":",
"return",
"default",
"else",
":",
"expires_string",
"... | Return the expiration date of this XRD element, or None if no
expiration was specified.
@type xrd_element: ElementTree node
@param default: The value to use as the expiration if no
expiration was specified in the XRD.
@rtype: datetime.datetime
@raises ValueError: If the xrd:Expires eleme... | [
"Return",
"the",
"expiration",
"date",
"of",
"this",
"XRD",
"element",
"or",
"None",
"if",
"no",
"expiration",
"was",
"specified",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L135-L157 |
16,619 | openid/python-openid | openid/yadis/etxrd.py | getCanonicalID | def getCanonicalID(iname, xrd_tree):
"""Return the CanonicalID from this XRDS document.
@param iname: the XRI being resolved.
@type iname: unicode
@param xrd_tree: The XRDS output from the resolver.
@type xrd_tree: ElementTree
@returns: The XRI CanonicalID or None.
@returntype: unicode or... | python | def getCanonicalID(iname, xrd_tree):
"""Return the CanonicalID from this XRDS document.
@param iname: the XRI being resolved.
@type iname: unicode
@param xrd_tree: The XRDS output from the resolver.
@type xrd_tree: ElementTree
@returns: The XRI CanonicalID or None.
@returntype: unicode or... | [
"def",
"getCanonicalID",
"(",
"iname",
",",
"xrd_tree",
")",
":",
"xrd_list",
"=",
"xrd_tree",
".",
"findall",
"(",
"xrd_tag",
")",
"xrd_list",
".",
"reverse",
"(",
")",
"try",
":",
"canonicalID",
"=",
"xri",
".",
"XRI",
"(",
"xrd_list",
"[",
"0",
"]",... | Return the CanonicalID from this XRDS document.
@param iname: the XRI being resolved.
@type iname: unicode
@param xrd_tree: The XRDS output from the resolver.
@type xrd_tree: ElementTree
@returns: The XRI CanonicalID or None.
@returntype: unicode or None | [
"Return",
"the",
"CanonicalID",
"from",
"this",
"XRDS",
"document",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L159-L194 |
16,620 | openid/python-openid | openid/yadis/etxrd.py | getPriorityStrict | def getPriorityStrict(element):
"""Get the priority of this element.
Raises ValueError if the value of the priority is invalid. If no
priority is specified, it returns a value that compares greater
than any other value.
"""
prio_str = element.get('priority')
if prio_str is not None:
... | python | def getPriorityStrict(element):
"""Get the priority of this element.
Raises ValueError if the value of the priority is invalid. If no
priority is specified, it returns a value that compares greater
than any other value.
"""
prio_str = element.get('priority')
if prio_str is not None:
... | [
"def",
"getPriorityStrict",
"(",
"element",
")",
":",
"prio_str",
"=",
"element",
".",
"get",
"(",
"'priority'",
")",
"if",
"prio_str",
"is",
"not",
"None",
":",
"prio_val",
"=",
"int",
"(",
"prio_str",
")",
"if",
"prio_val",
">=",
"0",
":",
"return",
... | Get the priority of this element.
Raises ValueError if the value of the priority is invalid. If no
priority is specified, it returns a value that compares greater
than any other value. | [
"Get",
"the",
"priority",
"of",
"this",
"element",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L211-L227 |
16,621 | openid/python-openid | openid/consumer/consumer.py | makeKVPost | def makeKVPost(request_message, server_url):
"""Make a Direct Request to an OpenID Provider and return the
result as a Message object.
@raises openid.fetchers.HTTPFetchingError: if an error is
encountered in making the HTTP post.
@rtype: L{openid.message.Message}
"""
# XXX: TESTME
... | python | def makeKVPost(request_message, server_url):
"""Make a Direct Request to an OpenID Provider and return the
result as a Message object.
@raises openid.fetchers.HTTPFetchingError: if an error is
encountered in making the HTTP post.
@rtype: L{openid.message.Message}
"""
# XXX: TESTME
... | [
"def",
"makeKVPost",
"(",
"request_message",
",",
"server_url",
")",
":",
"# XXX: TESTME",
"resp",
"=",
"fetchers",
".",
"fetch",
"(",
"server_url",
",",
"body",
"=",
"request_message",
".",
"toURLEncoded",
"(",
")",
")",
"# Process response in separate function tha... | Make a Direct Request to an OpenID Provider and return the
result as a Message object.
@raises openid.fetchers.HTTPFetchingError: if an error is
encountered in making the HTTP post.
@rtype: L{openid.message.Message} | [
"Make",
"a",
"Direct",
"Request",
"to",
"an",
"OpenID",
"Provider",
"and",
"return",
"the",
"result",
"as",
"a",
"Message",
"object",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L217-L230 |
16,622 | openid/python-openid | openid/consumer/consumer.py | _httpResponseToMessage | def _httpResponseToMessage(response, server_url):
"""Adapt a POST response to a Message.
@type response: L{openid.fetchers.HTTPResponse}
@param response: Result of a POST to an OpenID endpoint.
@rtype: L{openid.message.Message}
@raises openid.fetchers.HTTPFetchingError: if the server returned a
... | python | def _httpResponseToMessage(response, server_url):
"""Adapt a POST response to a Message.
@type response: L{openid.fetchers.HTTPResponse}
@param response: Result of a POST to an OpenID endpoint.
@rtype: L{openid.message.Message}
@raises openid.fetchers.HTTPFetchingError: if the server returned a
... | [
"def",
"_httpResponseToMessage",
"(",
"response",
",",
"server_url",
")",
":",
"# Should this function be named Message.fromHTTPResponse instead?",
"response_message",
"=",
"Message",
".",
"fromKVForm",
"(",
"response",
".",
"body",
")",
"if",
"response",
".",
"status",
... | Adapt a POST response to a Message.
@type response: L{openid.fetchers.HTTPResponse}
@param response: Result of a POST to an OpenID endpoint.
@rtype: L{openid.message.Message}
@raises openid.fetchers.HTTPFetchingError: if the server returned a
status of other than 200 or 400.
@raises Serv... | [
"Adapt",
"a",
"POST",
"response",
"to",
"a",
"Message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L233-L256 |
16,623 | openid/python-openid | openid/consumer/consumer.py | Consumer.complete | def complete(self, query, current_url):
"""Called to interpret the server's response to an OpenID
request. It is called in step 4 of the flow described in the
consumer overview.
@param query: A dictionary of the query parameters for this
HTTP request.
@param current... | python | def complete(self, query, current_url):
"""Called to interpret the server's response to an OpenID
request. It is called in step 4 of the flow described in the
consumer overview.
@param query: A dictionary of the query parameters for this
HTTP request.
@param current... | [
"def",
"complete",
"(",
"self",
",",
"query",
",",
"current_url",
")",
":",
"endpoint",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"_token_key",
")",
"message",
"=",
"Message",
".",
"fromPostArgs",
"(",
"query",
")",
"response",
"=",
"s... | Called to interpret the server's response to an OpenID
request. It is called in step 4 of the flow described in the
consumer overview.
@param query: A dictionary of the query parameters for this
HTTP request.
@param current_url: The URL used to invoke the application.
... | [
"Called",
"to",
"interpret",
"the",
"server",
"s",
"response",
"to",
"an",
"OpenID",
"request",
".",
"It",
"is",
"called",
"in",
"step",
"4",
"of",
"the",
"flow",
"described",
"in",
"the",
"consumer",
"overview",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L387-L432 |
16,624 | openid/python-openid | openid/consumer/consumer.py | ServerError.fromMessage | def fromMessage(cls, message):
"""Generate a ServerError instance, extracting the error text
and the error code from the message."""
error_text = message.getArg(
OPENID_NS, 'error', '<no error message supplied>')
error_code = message.getArg(OPENID_NS, 'error_code')
re... | python | def fromMessage(cls, message):
"""Generate a ServerError instance, extracting the error text
and the error code from the message."""
error_text = message.getArg(
OPENID_NS, 'error', '<no error message supplied>')
error_code = message.getArg(OPENID_NS, 'error_code')
re... | [
"def",
"fromMessage",
"(",
"cls",
",",
"message",
")",
":",
"error_text",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'error'",
",",
"'<no error message supplied>'",
")",
"error_code",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'error_co... | Generate a ServerError instance, extracting the error text
and the error code from the message. | [
"Generate",
"a",
"ServerError",
"instance",
"extracting",
"the",
"error",
"text",
"and",
"the",
"error",
"code",
"from",
"the",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L544-L550 |
16,625 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer.begin | def begin(self, service_endpoint):
"""Create an AuthRequest object for the specified
service_endpoint. This method will create an association if
necessary."""
if self.store is None:
assoc = None
else:
assoc = self._getAssociation(service_endpoint)
... | python | def begin(self, service_endpoint):
"""Create an AuthRequest object for the specified
service_endpoint. This method will create an association if
necessary."""
if self.store is None:
assoc = None
else:
assoc = self._getAssociation(service_endpoint)
... | [
"def",
"begin",
"(",
"self",
",",
"service_endpoint",
")",
":",
"if",
"self",
".",
"store",
"is",
"None",
":",
"assoc",
"=",
"None",
"else",
":",
"assoc",
"=",
"self",
".",
"_getAssociation",
"(",
"service_endpoint",
")",
"request",
"=",
"AuthRequest",
"... | Create an AuthRequest object for the specified
service_endpoint. This method will create an association if
necessary. | [
"Create",
"an",
"AuthRequest",
"object",
"for",
"the",
"specified",
"service_endpoint",
".",
"This",
"method",
"will",
"create",
"an",
"association",
"if",
"necessary",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L592-L608 |
16,626 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer.complete | def complete(self, message, endpoint, return_to):
"""Process the OpenID message, using the specified endpoint
and return_to URL as context. This method will handle any
OpenID message that is sent to the return_to URL.
"""
mode = message.getArg(OPENID_NS, 'mode', '<No mode set>')
... | python | def complete(self, message, endpoint, return_to):
"""Process the OpenID message, using the specified endpoint
and return_to URL as context. This method will handle any
OpenID message that is sent to the return_to URL.
"""
mode = message.getArg(OPENID_NS, 'mode', '<No mode set>')
... | [
"def",
"complete",
"(",
"self",
",",
"message",
",",
"endpoint",
",",
"return_to",
")",
":",
"mode",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'mode'",
",",
"'<No mode set>'",
")",
"modeMethod",
"=",
"getattr",
"(",
"self",
",",
"'_complete_'"... | Process the OpenID message, using the specified endpoint
and return_to URL as context. This method will handle any
OpenID message that is sent to the return_to URL. | [
"Process",
"the",
"OpenID",
"message",
"using",
"the",
"specified",
"endpoint",
"and",
"return_to",
"URL",
"as",
"context",
".",
"This",
"method",
"will",
"handle",
"any",
"OpenID",
"message",
"that",
"is",
"sent",
"to",
"the",
"return_to",
"URL",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L610-L620 |
16,627 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._checkSetupNeeded | def _checkSetupNeeded(self, message):
"""Check an id_res message to see if it is a
checkid_immediate cancel response.
@raises SetupNeededError: if it is a checkid_immediate cancellation
"""
# In OpenID 1, we check to see if this is a cancel from
# immediate mode by the p... | python | def _checkSetupNeeded(self, message):
"""Check an id_res message to see if it is a
checkid_immediate cancel response.
@raises SetupNeededError: if it is a checkid_immediate cancellation
"""
# In OpenID 1, we check to see if this is a cancel from
# immediate mode by the p... | [
"def",
"_checkSetupNeeded",
"(",
"self",
",",
"message",
")",
":",
"# In OpenID 1, we check to see if this is a cancel from",
"# immediate mode by the presence of the user_setup_url",
"# parameter.",
"if",
"message",
".",
"isOpenID1",
"(",
")",
":",
"user_setup_url",
"=",
"me... | Check an id_res message to see if it is a
checkid_immediate cancel response.
@raises SetupNeededError: if it is a checkid_immediate cancellation | [
"Check",
"an",
"id_res",
"message",
"to",
"see",
"if",
"it",
"is",
"a",
"checkid_immediate",
"cancel",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L687-L699 |
16,628 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._doIdRes | def _doIdRes(self, message, endpoint, return_to):
"""Handle id_res responses that are not cancellations of
immediate mode requests.
@param message: the response paramaters.
@param endpoint: the discovered endpoint object. May be None.
@raises ProtocolError: If the message conte... | python | def _doIdRes(self, message, endpoint, return_to):
"""Handle id_res responses that are not cancellations of
immediate mode requests.
@param message: the response paramaters.
@param endpoint: the discovered endpoint object. May be None.
@raises ProtocolError: If the message conte... | [
"def",
"_doIdRes",
"(",
"self",
",",
"message",
",",
"endpoint",
",",
"return_to",
")",
":",
"# Checks for presence of appropriate fields (and checks",
"# signed list fields)",
"self",
".",
"_idResCheckForFields",
"(",
"message",
")",
"if",
"not",
"self",
".",
"_check... | Handle id_res responses that are not cancellations of
immediate mode requests.
@param message: the response paramaters.
@param endpoint: the discovered endpoint object. May be None.
@raises ProtocolError: If the message contents are not
well-formed according to the OpenID s... | [
"Handle",
"id_res",
"responses",
"that",
"are",
"not",
"cancellations",
"of",
"immediate",
"mode",
"requests",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L701-L744 |
16,629 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._verifyReturnToArgs | def _verifyReturnToArgs(query):
"""Verify that the arguments in the return_to URL are present in this
response.
"""
message = Message.fromPostArgs(query)
return_to = message.getArg(OPENID_NS, 'return_to')
if return_to is None:
raise ProtocolError('Response ha... | python | def _verifyReturnToArgs(query):
"""Verify that the arguments in the return_to URL are present in this
response.
"""
message = Message.fromPostArgs(query)
return_to = message.getArg(OPENID_NS, 'return_to')
if return_to is None:
raise ProtocolError('Response ha... | [
"def",
"_verifyReturnToArgs",
"(",
"query",
")",
":",
"message",
"=",
"Message",
".",
"fromPostArgs",
"(",
"query",
")",
"return_to",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'return_to'",
")",
"if",
"return_to",
"is",
"None",
":",
"raise",
"... | Verify that the arguments in the return_to URL are present in this
response. | [
"Verify",
"that",
"the",
"arguments",
"in",
"the",
"return_to",
"URL",
"are",
"present",
"in",
"this",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L843-L873 |
16,630 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._verifyDiscoveryResults | def _verifyDiscoveryResults(self, resp_msg, endpoint=None):
"""
Extract the information from an OpenID assertion message and
verify it against the original
@param endpoint: The endpoint that resulted from doing discovery
@param resp_msg: The id_res message object
@retur... | python | def _verifyDiscoveryResults(self, resp_msg, endpoint=None):
"""
Extract the information from an OpenID assertion message and
verify it against the original
@param endpoint: The endpoint that resulted from doing discovery
@param resp_msg: The id_res message object
@retur... | [
"def",
"_verifyDiscoveryResults",
"(",
"self",
",",
"resp_msg",
",",
"endpoint",
"=",
"None",
")",
":",
"if",
"resp_msg",
".",
"getOpenIDNamespace",
"(",
")",
"==",
"OPENID2_NS",
":",
"return",
"self",
".",
"_verifyDiscoveryResultsOpenID2",
"(",
"resp_msg",
",",... | Extract the information from an OpenID assertion message and
verify it against the original
@param endpoint: The endpoint that resulted from doing discovery
@param resp_msg: The id_res message object
@returns: the verified endpoint | [
"Extract",
"the",
"information",
"from",
"an",
"OpenID",
"assertion",
"message",
"and",
"verify",
"it",
"against",
"the",
"original"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L877-L890 |
16,631 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._verifyDiscoverySingle | def _verifyDiscoverySingle(self, endpoint, to_match):
"""Verify that the given endpoint matches the information
extracted from the OpenID assertion, and raise an exception if
there is a mismatch.
@type endpoint: openid.consumer.discover.OpenIDServiceEndpoint
@type to_match: open... | python | def _verifyDiscoverySingle(self, endpoint, to_match):
"""Verify that the given endpoint matches the information
extracted from the OpenID assertion, and raise an exception if
there is a mismatch.
@type endpoint: openid.consumer.discover.OpenIDServiceEndpoint
@type to_match: open... | [
"def",
"_verifyDiscoverySingle",
"(",
"self",
",",
"endpoint",
",",
"to_match",
")",
":",
"# Every type URI that's in the to_match endpoint has to be",
"# present in the discovered endpoint.",
"for",
"type_uri",
"in",
"to_match",
".",
"type_uris",
":",
"if",
"not",
"endpoin... | Verify that the given endpoint matches the information
extracted from the OpenID assertion, and raise an exception if
there is a mismatch.
@type endpoint: openid.consumer.discover.OpenIDServiceEndpoint
@type to_match: openid.consumer.discover.OpenIDServiceEndpoint
@rtype: NoneT... | [
"Verify",
"that",
"the",
"given",
"endpoint",
"matches",
"the",
"information",
"extracted",
"from",
"the",
"OpenID",
"assertion",
"and",
"raise",
"an",
"exception",
"if",
"there",
"is",
"a",
"mismatch",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L989-L1035 |
16,632 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._discoverAndVerify | def _discoverAndVerify(self, claimed_id, to_match_endpoints):
"""Given an endpoint object created from the information in an
OpenID response, perform discovery and verify the discovery
results, returning the matching endpoint that is the result of
doing that discovery.
@type to_... | python | def _discoverAndVerify(self, claimed_id, to_match_endpoints):
"""Given an endpoint object created from the information in an
OpenID response, perform discovery and verify the discovery
results, returning the matching endpoint that is the result of
doing that discovery.
@type to_... | [
"def",
"_discoverAndVerify",
"(",
"self",
",",
"claimed_id",
",",
"to_match_endpoints",
")",
":",
"logging",
".",
"info",
"(",
"'Performing discovery on %s'",
"%",
"(",
"claimed_id",
",",
")",
")",
"_",
",",
"services",
"=",
"self",
".",
"_discover",
"(",
"c... | Given an endpoint object created from the information in an
OpenID response, perform discovery and verify the discovery
results, returning the matching endpoint that is the result of
doing that discovery.
@type to_match: openid.consumer.discover.OpenIDServiceEndpoint
@param to_m... | [
"Given",
"an",
"endpoint",
"object",
"created",
"from",
"the",
"information",
"in",
"an",
"OpenID",
"response",
"perform",
"discovery",
"and",
"verify",
"the",
"discovery",
"results",
"returning",
"the",
"matching",
"endpoint",
"that",
"is",
"the",
"result",
"of... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1037-L1058 |
16,633 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._processCheckAuthResponse | def _processCheckAuthResponse(self, response, server_url):
"""Process the response message from a check_authentication
request, invalidating associations if requested.
"""
is_valid = response.getArg(OPENID_NS, 'is_valid', 'false')
invalidate_handle = response.getArg(OPENID_NS, '... | python | def _processCheckAuthResponse(self, response, server_url):
"""Process the response message from a check_authentication
request, invalidating associations if requested.
"""
is_valid = response.getArg(OPENID_NS, 'is_valid', 'false')
invalidate_handle = response.getArg(OPENID_NS, '... | [
"def",
"_processCheckAuthResponse",
"(",
"self",
",",
"response",
",",
"server_url",
")",
":",
"is_valid",
"=",
"response",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'is_valid'",
",",
"'false'",
")",
"invalidate_handle",
"=",
"response",
".",
"getArg",
"(",
"OPEN... | Process the response message from a check_authentication
request, invalidating associations if requested. | [
"Process",
"the",
"response",
"message",
"from",
"a",
"check_authentication",
"request",
"invalidating",
"associations",
"if",
"requested",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1125-L1145 |
16,634 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._getAssociation | def _getAssociation(self, endpoint):
"""Get an association for the endpoint's server_url.
First try seeing if we have a good association in the
store. If we do not, then attempt to negotiate an association
with the server.
If we negotiate a good association, it will get stored.... | python | def _getAssociation(self, endpoint):
"""Get an association for the endpoint's server_url.
First try seeing if we have a good association in the
store. If we do not, then attempt to negotiate an association
with the server.
If we negotiate a good association, it will get stored.... | [
"def",
"_getAssociation",
"(",
"self",
",",
"endpoint",
")",
":",
"assoc",
"=",
"self",
".",
"store",
".",
"getAssociation",
"(",
"endpoint",
".",
"server_url",
")",
"if",
"assoc",
"is",
"None",
"or",
"assoc",
".",
"expiresIn",
"<=",
"0",
":",
"assoc",
... | Get an association for the endpoint's server_url.
First try seeing if we have a good association in the
store. If we do not, then attempt to negotiate an association
with the server.
If we negotiate a good association, it will get stored.
@returns: A valid association for the ... | [
"Get",
"an",
"association",
"for",
"the",
"endpoint",
"s",
"server_url",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1147-L1166 |
16,635 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._extractSupportedAssociationType | def _extractSupportedAssociationType(self, server_error, endpoint,
assoc_type):
"""Handle ServerErrors resulting from association requests.
@returns: If server replied with an C{unsupported-type} error,
return a tuple of supported C{association_type}... | python | def _extractSupportedAssociationType(self, server_error, endpoint,
assoc_type):
"""Handle ServerErrors resulting from association requests.
@returns: If server replied with an C{unsupported-type} error,
return a tuple of supported C{association_type}... | [
"def",
"_extractSupportedAssociationType",
"(",
"self",
",",
"server_error",
",",
"endpoint",
",",
"assoc_type",
")",
":",
"# Any error message whose code is not 'unsupported-type'",
"# should be considered a total failure.",
"if",
"server_error",
".",
"error_code",
"!=",
"'uns... | Handle ServerErrors resulting from association requests.
@returns: If server replied with an C{unsupported-type} error,
return a tuple of supported C{association_type}, C{session_type}.
Otherwise logs the error and returns None.
@rtype: tuple or None | [
"Handle",
"ServerErrors",
"resulting",
"from",
"association",
"requests",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1207-L1247 |
16,636 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._requestAssociation | def _requestAssociation(self, endpoint, assoc_type, session_type):
"""Make and process one association request to this endpoint's
OP endpoint URL.
@returns: An association object or None if the association
processing failed.
@raises ServerError: when the remote OpenID serve... | python | def _requestAssociation(self, endpoint, assoc_type, session_type):
"""Make and process one association request to this endpoint's
OP endpoint URL.
@returns: An association object or None if the association
processing failed.
@raises ServerError: when the remote OpenID serve... | [
"def",
"_requestAssociation",
"(",
"self",
",",
"endpoint",
",",
"assoc_type",
",",
"session_type",
")",
":",
"assoc_session",
",",
"args",
"=",
"self",
".",
"_createAssociateRequest",
"(",
"endpoint",
",",
"assoc_type",
",",
"session_type",
")",
"try",
":",
"... | Make and process one association request to this endpoint's
OP endpoint URL.
@returns: An association object or None if the association
processing failed.
@raises ServerError: when the remote OpenID server returns an error. | [
"Make",
"and",
"process",
"one",
"association",
"request",
"to",
"this",
"endpoint",
"s",
"OP",
"endpoint",
"URL",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1250-L1279 |
16,637 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._createAssociateRequest | def _createAssociateRequest(self, endpoint, assoc_type, session_type):
"""Create an association request for the given assoc_type and
session_type.
@param endpoint: The endpoint whose server_url will be
queried. The important bit about the endpoint is whether
it's in comp... | python | def _createAssociateRequest(self, endpoint, assoc_type, session_type):
"""Create an association request for the given assoc_type and
session_type.
@param endpoint: The endpoint whose server_url will be
queried. The important bit about the endpoint is whether
it's in comp... | [
"def",
"_createAssociateRequest",
"(",
"self",
",",
"endpoint",
",",
"assoc_type",
",",
"session_type",
")",
":",
"session_type_class",
"=",
"self",
".",
"session_types",
"[",
"session_type",
"]",
"assoc_session",
"=",
"session_type_class",
"(",
")",
"args",
"=",
... | Create an association request for the given assoc_type and
session_type.
@param endpoint: The endpoint whose server_url will be
queried. The important bit about the endpoint is whether
it's in compatiblity mode (OpenID 1.1)
@param assoc_type: The association type that t... | [
"Create",
"an",
"association",
"request",
"for",
"the",
"given",
"assoc_type",
"and",
"session_type",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1281-L1324 |
16,638 | openid/python-openid | openid/consumer/consumer.py | GenericConsumer._extractAssociation | def _extractAssociation(self, assoc_response, assoc_session):
"""Attempt to extract an association from the response, given
the association response message and the established
association session.
@param assoc_response: The association response message from
the server
... | python | def _extractAssociation(self, assoc_response, assoc_session):
"""Attempt to extract an association from the response, given
the association response message and the established
association session.
@param assoc_response: The association response message from
the server
... | [
"def",
"_extractAssociation",
"(",
"self",
",",
"assoc_response",
",",
"assoc_session",
")",
":",
"# Extract the common fields from the response, raising an",
"# exception if they are not found",
"assoc_type",
"=",
"assoc_response",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'ass... | Attempt to extract an association from the response, given
the association response message and the established
association session.
@param assoc_response: The association response message from
the server
@type assoc_response: openid.message.Message
@param assoc_ses... | [
"Attempt",
"to",
"extract",
"an",
"association",
"from",
"the",
"response",
"given",
"the",
"association",
"response",
"message",
"and",
"the",
"established",
"association",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1364-L1440 |
16,639 | openid/python-openid | openid/consumer/consumer.py | AuthRequest.setAnonymous | def setAnonymous(self, is_anonymous):
"""Set whether this request should be made anonymously. If a
request is anonymous, the identifier will not be sent in the
request. This is only useful if you are making another kind of
request with an extension in this request.
Anonymous req... | python | def setAnonymous(self, is_anonymous):
"""Set whether this request should be made anonymously. If a
request is anonymous, the identifier will not be sent in the
request. This is only useful if you are making another kind of
request with an extension in this request.
Anonymous req... | [
"def",
"setAnonymous",
"(",
"self",
",",
"is_anonymous",
")",
":",
"if",
"is_anonymous",
"and",
"self",
".",
"message",
".",
"isOpenID1",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'OpenID 1 requests MUST include the '",
"'identifier in the request'",
")",
"else",
... | Set whether this request should be made anonymously. If a
request is anonymous, the identifier will not be sent in the
request. This is only useful if you are making another kind of
request with an extension in this request.
Anonymous requests are not allowed when the request is made
... | [
"Set",
"whether",
"this",
"request",
"should",
"be",
"made",
"anonymously",
".",
"If",
"a",
"request",
"is",
"anonymous",
"the",
"identifier",
"will",
"not",
"be",
"sent",
"in",
"the",
"request",
".",
"This",
"is",
"only",
"useful",
"if",
"you",
"are",
"... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1469-L1485 |
16,640 | openid/python-openid | openid/consumer/consumer.py | AuthRequest.addExtensionArg | def addExtensionArg(self, namespace, key, value):
"""Add an extension argument to this OpenID authentication
request.
Use caution when adding arguments, because they will be
URL-escaped and appended to the redirect URL, which can easily
get quite long.
@param namespace:... | python | def addExtensionArg(self, namespace, key, value):
"""Add an extension argument to this OpenID authentication
request.
Use caution when adding arguments, because they will be
URL-escaped and appended to the redirect URL, which can easily
get quite long.
@param namespace:... | [
"def",
"addExtensionArg",
"(",
"self",
",",
"namespace",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"message",
".",
"setArg",
"(",
"namespace",
",",
"key",
",",
"value",
")"
] | Add an extension argument to this OpenID authentication
request.
Use caution when adding arguments, because they will be
URL-escaped and appended to the redirect URL, which can easily
get quite long.
@param namespace: The namespace for the extension. For
example, th... | [
"Add",
"an",
"extension",
"argument",
"to",
"this",
"OpenID",
"authentication",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1496-L1521 |
16,641 | openid/python-openid | openid/consumer/consumer.py | AuthRequest.redirectURL | def redirectURL(self, realm, return_to=None, immediate=False):
"""Returns a URL with an encoded OpenID request.
The resulting URL is the OpenID provider's endpoint URL with
parameters appended as query arguments. You should redirect
the user agent to this URL.
OpenID 2.0 endpo... | python | def redirectURL(self, realm, return_to=None, immediate=False):
"""Returns a URL with an encoded OpenID request.
The resulting URL is the OpenID provider's endpoint URL with
parameters appended as query arguments. You should redirect
the user agent to this URL.
OpenID 2.0 endpo... | [
"def",
"redirectURL",
"(",
"self",
",",
"realm",
",",
"return_to",
"=",
"None",
",",
"immediate",
"=",
"False",
")",
":",
"message",
"=",
"self",
".",
"getMessage",
"(",
"realm",
",",
"return_to",
",",
"immediate",
")",
"return",
"message",
".",
"toURL",... | Returns a URL with an encoded OpenID request.
The resulting URL is the OpenID provider's endpoint URL with
parameters appended as query arguments. You should redirect
the user agent to this URL.
OpenID 2.0 endpoints also accept POST requests, see
C{L{shouldSendRedirect}} and C... | [
"Returns",
"a",
"URL",
"with",
"an",
"encoded",
"OpenID",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1608-L1647 |
16,642 | openid/python-openid | openid/consumer/consumer.py | AuthRequest.formMarkup | def formMarkup(self, realm, return_to=None, immediate=False,
form_tag_attrs=None):
"""Get html for a form to submit this request to the IDP.
@param form_tag_attrs: Dictionary of attributes to be added to
the form tag. 'accept-charset' and 'enctype' have defaults
that... | python | def formMarkup(self, realm, return_to=None, immediate=False,
form_tag_attrs=None):
"""Get html for a form to submit this request to the IDP.
@param form_tag_attrs: Dictionary of attributes to be added to
the form tag. 'accept-charset' and 'enctype' have defaults
that... | [
"def",
"formMarkup",
"(",
"self",
",",
"realm",
",",
"return_to",
"=",
"None",
",",
"immediate",
"=",
"False",
",",
"form_tag_attrs",
"=",
"None",
")",
":",
"message",
"=",
"self",
".",
"getMessage",
"(",
"realm",
",",
"return_to",
",",
"immediate",
")",... | Get html for a form to submit this request to the IDP.
@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.
... | [
"Get",
"html",
"for",
"a",
"form",
"to",
"submit",
"this",
"request",
"to",
"the",
"IDP",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1649-L1661 |
16,643 | openid/python-openid | openid/consumer/consumer.py | AuthRequest.htmlMarkup | def htmlMarkup(self, realm, return_to=None, immediate=False,
form_tag_attrs=None):
"""Get an autosubmitting HTML page that submits this request to the
IDP. This is just a wrapper for formMarkup.
@see: formMarkup
@returns: str
"""
return oidutil.autoSubmitHT... | python | def htmlMarkup(self, realm, return_to=None, immediate=False,
form_tag_attrs=None):
"""Get an autosubmitting HTML page that submits this request to the
IDP. This is just a wrapper for formMarkup.
@see: formMarkup
@returns: str
"""
return oidutil.autoSubmitHT... | [
"def",
"htmlMarkup",
"(",
"self",
",",
"realm",
",",
"return_to",
"=",
"None",
",",
"immediate",
"=",
"False",
",",
"form_tag_attrs",
"=",
"None",
")",
":",
"return",
"oidutil",
".",
"autoSubmitHTML",
"(",
"self",
".",
"formMarkup",
"(",
"realm",
",",
"r... | Get an autosubmitting HTML page that submits this request to the
IDP. This is just a wrapper for formMarkup.
@see: formMarkup
@returns: str | [
"Get",
"an",
"autosubmitting",
"HTML",
"page",
"that",
"submits",
"this",
"request",
"to",
"the",
"IDP",
".",
"This",
"is",
"just",
"a",
"wrapper",
"for",
"formMarkup",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1663-L1675 |
16,644 | openid/python-openid | openid/consumer/consumer.py | SuccessResponse.isSigned | def isSigned(self, ns_uri, ns_key):
"""Return whether a particular key is signed, regardless of
its namespace alias
"""
return self.message.getKey(ns_uri, ns_key) in self.signed_fields | python | def isSigned(self, ns_uri, ns_key):
"""Return whether a particular key is signed, regardless of
its namespace alias
"""
return self.message.getKey(ns_uri, ns_key) in self.signed_fields | [
"def",
"isSigned",
"(",
"self",
",",
"ns_uri",
",",
"ns_key",
")",
":",
"return",
"self",
".",
"message",
".",
"getKey",
"(",
"ns_uri",
",",
"ns_key",
")",
"in",
"self",
".",
"signed_fields"
] | Return whether a particular key is signed, regardless of
its namespace alias | [
"Return",
"whether",
"a",
"particular",
"key",
"is",
"signed",
"regardless",
"of",
"its",
"namespace",
"alias"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1759-L1763 |
16,645 | openid/python-openid | openid/consumer/consumer.py | SuccessResponse.getSigned | def getSigned(self, ns_uri, ns_key, default=None):
"""Return the specified signed field if available,
otherwise return default
"""
if self.isSigned(ns_uri, ns_key):
return self.message.getArg(ns_uri, ns_key, default)
else:
return default | python | def getSigned(self, ns_uri, ns_key, default=None):
"""Return the specified signed field if available,
otherwise return default
"""
if self.isSigned(ns_uri, ns_key):
return self.message.getArg(ns_uri, ns_key, default)
else:
return default | [
"def",
"getSigned",
"(",
"self",
",",
"ns_uri",
",",
"ns_key",
",",
"default",
"=",
"None",
")",
":",
"if",
"self",
".",
"isSigned",
"(",
"ns_uri",
",",
"ns_key",
")",
":",
"return",
"self",
".",
"message",
".",
"getArg",
"(",
"ns_uri",
",",
"ns_key"... | Return the specified signed field if available,
otherwise return default | [
"Return",
"the",
"specified",
"signed",
"field",
"if",
"available",
"otherwise",
"return",
"default"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1765-L1772 |
16,646 | openid/python-openid | openid/consumer/consumer.py | SuccessResponse.getSignedNS | def getSignedNS(self, ns_uri):
"""Get signed arguments from the response message. Return a
dict of all arguments in the specified namespace. If any of
the arguments are not signed, return None.
"""
msg_args = self.message.getArgs(ns_uri)
for key in msg_args.iterkeys():... | python | def getSignedNS(self, ns_uri):
"""Get signed arguments from the response message. Return a
dict of all arguments in the specified namespace. If any of
the arguments are not signed, return None.
"""
msg_args = self.message.getArgs(ns_uri)
for key in msg_args.iterkeys():... | [
"def",
"getSignedNS",
"(",
"self",
",",
"ns_uri",
")",
":",
"msg_args",
"=",
"self",
".",
"message",
".",
"getArgs",
"(",
"ns_uri",
")",
"for",
"key",
"in",
"msg_args",
".",
"iterkeys",
"(",
")",
":",
"if",
"not",
"self",
".",
"isSigned",
"(",
"ns_ur... | Get signed arguments from the response message. Return a
dict of all arguments in the specified namespace. If any of
the arguments are not signed, return None. | [
"Get",
"signed",
"arguments",
"from",
"the",
"response",
"message",
".",
"Return",
"a",
"dict",
"of",
"all",
"arguments",
"in",
"the",
"specified",
"namespace",
".",
"If",
"any",
"of",
"the",
"arguments",
"are",
"not",
"signed",
"return",
"None",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1774-L1787 |
16,647 | openid/python-openid | openid/consumer/consumer.py | SuccessResponse.extensionResponse | def extensionResponse(self, namespace_uri, require_signed):
"""Return response arguments in the specified namespace.
@param namespace_uri: The namespace URI of the arguments to be
returned.
@param require_signed: True if the arguments should be among
those signed in the respons... | python | def extensionResponse(self, namespace_uri, require_signed):
"""Return response arguments in the specified namespace.
@param namespace_uri: The namespace URI of the arguments to be
returned.
@param require_signed: True if the arguments should be among
those signed in the respons... | [
"def",
"extensionResponse",
"(",
"self",
",",
"namespace_uri",
",",
"require_signed",
")",
":",
"if",
"require_signed",
":",
"return",
"self",
".",
"getSignedNS",
"(",
"namespace_uri",
")",
"else",
":",
"return",
"self",
".",
"message",
".",
"getArgs",
"(",
... | Return response arguments in the specified namespace.
@param namespace_uri: The namespace URI of the arguments to be
returned.
@param require_signed: True if the arguments should be among
those signed in the response, False if you don't care.
If require_signed is True and the ... | [
"Return",
"response",
"arguments",
"in",
"the",
"specified",
"namespace",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1789-L1804 |
16,648 | openid/python-openid | openid/yadis/filters.py | mkFilter | def mkFilter(parts):
"""Convert a filter-convertable thing into a filter
@param parts: a filter, an endpoint, a callable, or a list of any of these.
"""
# Convert the parts into a list, and pass to mkCompoundFilter
if parts is None:
parts = [BasicServiceEndpoint]
try:
parts = l... | python | def mkFilter(parts):
"""Convert a filter-convertable thing into a filter
@param parts: a filter, an endpoint, a callable, or a list of any of these.
"""
# Convert the parts into a list, and pass to mkCompoundFilter
if parts is None:
parts = [BasicServiceEndpoint]
try:
parts = l... | [
"def",
"mkFilter",
"(",
"parts",
")",
":",
"# Convert the parts into a list, and pass to mkCompoundFilter",
"if",
"parts",
"is",
"None",
":",
"parts",
"=",
"[",
"BasicServiceEndpoint",
"]",
"try",
":",
"parts",
"=",
"list",
"(",
"parts",
")",
"except",
"TypeError"... | Convert a filter-convertable thing into a filter
@param parts: a filter, an endpoint, a callable, or a list of any of these. | [
"Convert",
"a",
"filter",
"-",
"convertable",
"thing",
"into",
"a",
"filter"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L146-L160 |
16,649 | openid/python-openid | openid/yadis/filters.py | TransformFilterMaker.getServiceEndpoints | def getServiceEndpoints(self, yadis_url, service_element):
"""Returns an iterator of endpoint objects produced by the
filter functions."""
endpoints = []
# Do an expansion of the service element by xrd:Type and xrd:URI
for type_uris, uri, _ in expandService(service_element):
... | python | def getServiceEndpoints(self, yadis_url, service_element):
"""Returns an iterator of endpoint objects produced by the
filter functions."""
endpoints = []
# Do an expansion of the service element by xrd:Type and xrd:URI
for type_uris, uri, _ in expandService(service_element):
... | [
"def",
"getServiceEndpoints",
"(",
"self",
",",
"yadis_url",
",",
"service_element",
")",
":",
"endpoints",
"=",
"[",
"]",
"# Do an expansion of the service element by xrd:Type and xrd:URI",
"for",
"type_uris",
",",
"uri",
",",
"_",
"in",
"expandService",
"(",
"servic... | Returns an iterator of endpoint objects produced by the
filter functions. | [
"Returns",
"an",
"iterator",
"of",
"endpoint",
"objects",
"produced",
"by",
"the",
"filter",
"functions",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L95-L112 |
16,650 | openid/python-openid | openid/yadis/filters.py | TransformFilterMaker.applyFilters | def applyFilters(self, endpoint):
"""Apply filter functions to an endpoint until one of them
returns non-None."""
for filter_function in self.filter_functions:
e = filter_function(endpoint)
if e is not None:
# Once one of the filters has returned an
... | python | def applyFilters(self, endpoint):
"""Apply filter functions to an endpoint until one of them
returns non-None."""
for filter_function in self.filter_functions:
e = filter_function(endpoint)
if e is not None:
# Once one of the filters has returned an
... | [
"def",
"applyFilters",
"(",
"self",
",",
"endpoint",
")",
":",
"for",
"filter_function",
"in",
"self",
".",
"filter_functions",
":",
"e",
"=",
"filter_function",
"(",
"endpoint",
")",
"if",
"e",
"is",
"not",
"None",
":",
"# Once one of the filters has returned a... | Apply filter functions to an endpoint until one of them
returns non-None. | [
"Apply",
"filter",
"functions",
"to",
"an",
"endpoint",
"until",
"one",
"of",
"them",
"returns",
"non",
"-",
"None",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L114-L124 |
16,651 | openid/python-openid | openid/yadis/filters.py | CompoundFilter.getServiceEndpoints | def getServiceEndpoints(self, yadis_url, service_element):
"""Generate all endpoint objects for all of the subfilters of
this filter and return their concatenation."""
endpoints = []
for subfilter in self.subfilters:
endpoints.extend(
subfilter.getServiceEndpo... | python | def getServiceEndpoints(self, yadis_url, service_element):
"""Generate all endpoint objects for all of the subfilters of
this filter and return their concatenation."""
endpoints = []
for subfilter in self.subfilters:
endpoints.extend(
subfilter.getServiceEndpo... | [
"def",
"getServiceEndpoints",
"(",
"self",
",",
"yadis_url",
",",
"service_element",
")",
":",
"endpoints",
"=",
"[",
"]",
"for",
"subfilter",
"in",
"self",
".",
"subfilters",
":",
"endpoints",
".",
"extend",
"(",
"subfilter",
".",
"getServiceEndpoints",
"(",
... | Generate all endpoint objects for all of the subfilters of
this filter and return their concatenation. | [
"Generate",
"all",
"endpoint",
"objects",
"for",
"all",
"of",
"the",
"subfilters",
"of",
"this",
"filter",
"and",
"return",
"their",
"concatenation",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L133-L140 |
16,652 | openid/python-openid | openid/cryptutil.py | randomString | def randomString(length, chrs=None):
"""Produce a string of length random bytes, chosen from chrs."""
if chrs is None:
return getBytes(length)
else:
n = len(chrs)
return ''.join([chrs[randrange(n)] for _ in xrange(length)]) | python | def randomString(length, chrs=None):
"""Produce a string of length random bytes, chosen from chrs."""
if chrs is None:
return getBytes(length)
else:
n = len(chrs)
return ''.join([chrs[randrange(n)] for _ in xrange(length)]) | [
"def",
"randomString",
"(",
"length",
",",
"chrs",
"=",
"None",
")",
":",
"if",
"chrs",
"is",
"None",
":",
"return",
"getBytes",
"(",
"length",
")",
"else",
":",
"n",
"=",
"len",
"(",
"chrs",
")",
"return",
"''",
".",
"join",
"(",
"[",
"chrs",
"[... | Produce a string of length random bytes, chosen from chrs. | [
"Produce",
"a",
"string",
"of",
"length",
"random",
"bytes",
"chosen",
"from",
"chrs",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/cryptutil.py#L214-L220 |
16,653 | ethereum/eth-hash | eth_hash/main.py | Keccak256._hasher_first_run | def _hasher_first_run(self, preimage):
'''
Invoke the backend on-demand, and check an expected hash result,
then replace this first run with the new hasher method.
This is a bit of a hacky way to minimize overhead on hash calls after this first one.
'''
new_hasher = self.... | python | def _hasher_first_run(self, preimage):
'''
Invoke the backend on-demand, and check an expected hash result,
then replace this first run with the new hasher method.
This is a bit of a hacky way to minimize overhead on hash calls after this first one.
'''
new_hasher = self.... | [
"def",
"_hasher_first_run",
"(",
"self",
",",
"preimage",
")",
":",
"new_hasher",
"=",
"self",
".",
"_backend",
".",
"keccak256",
"assert",
"new_hasher",
"(",
"b''",
")",
"==",
"b\"\\xc5\\xd2F\\x01\\x86\\xf7#<\\x92~}\\xb2\\xdc\\xc7\\x03\\xc0\\xe5\\x00\\xb6S\\xca\\x82';\\x7b... | Invoke the backend on-demand, and check an expected hash result,
then replace this first run with the new hasher method.
This is a bit of a hacky way to minimize overhead on hash calls after this first one. | [
"Invoke",
"the",
"backend",
"on",
"-",
"demand",
"and",
"check",
"an",
"expected",
"hash",
"result",
"then",
"replace",
"this",
"first",
"run",
"with",
"the",
"new",
"hasher",
"method",
".",
"This",
"is",
"a",
"bit",
"of",
"a",
"hacky",
"way",
"to",
"m... | d05c8ac0710e2dc16aae2c8a1e406ee7cbe78871 | https://github.com/ethereum/eth-hash/blob/d05c8ac0710e2dc16aae2c8a1e406ee7cbe78871/eth_hash/main.py#L16-L25 |
16,654 | lukasgeiter/mkdocs-awesome-pages-plugin | mkdocs_awesome_pages_plugin/utils.py | dirname | def dirname(path: Optional[str]) -> Optional[str]:
""" Returns the directory component of a pathname and None if the argument is None """
if path is not None:
return os.path.dirname(path) | python | def dirname(path: Optional[str]) -> Optional[str]:
""" Returns the directory component of a pathname and None if the argument is None """
if path is not None:
return os.path.dirname(path) | [
"def",
"dirname",
"(",
"path",
":",
"Optional",
"[",
"str",
"]",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"path",
"is",
"not",
"None",
":",
"return",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")"
] | Returns the directory component of a pathname and None if the argument is None | [
"Returns",
"the",
"directory",
"component",
"of",
"a",
"pathname",
"and",
"None",
"if",
"the",
"argument",
"is",
"None"
] | f5693418b71a0849c5fee3b3307e117983c4e2d8 | https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L19-L22 |
16,655 | lukasgeiter/mkdocs-awesome-pages-plugin | mkdocs_awesome_pages_plugin/utils.py | basename | def basename(path: Optional[str]) -> Optional[str]:
""" Returns the final component of a pathname and None if the argument is None """
if path is not None:
return os.path.basename(path) | python | def basename(path: Optional[str]) -> Optional[str]:
""" Returns the final component of a pathname and None if the argument is None """
if path is not None:
return os.path.basename(path) | [
"def",
"basename",
"(",
"path",
":",
"Optional",
"[",
"str",
"]",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"path",
"is",
"not",
"None",
":",
"return",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")"
] | Returns the final component of a pathname and None if the argument is None | [
"Returns",
"the",
"final",
"component",
"of",
"a",
"pathname",
"and",
"None",
"if",
"the",
"argument",
"is",
"None"
] | f5693418b71a0849c5fee3b3307e117983c4e2d8 | https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L25-L28 |
16,656 | lukasgeiter/mkdocs-awesome-pages-plugin | mkdocs_awesome_pages_plugin/utils.py | normpath | def normpath(path: Optional[str]) -> Optional[str]:
""" Normalizes the path, returns None if the argument is None """
if path is not None:
return os.path.normpath(path) | python | def normpath(path: Optional[str]) -> Optional[str]:
""" Normalizes the path, returns None if the argument is None """
if path is not None:
return os.path.normpath(path) | [
"def",
"normpath",
"(",
"path",
":",
"Optional",
"[",
"str",
"]",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"path",
"is",
"not",
"None",
":",
"return",
"os",
".",
"path",
".",
"normpath",
"(",
"path",
")"
] | Normalizes the path, returns None if the argument is None | [
"Normalizes",
"the",
"path",
"returns",
"None",
"if",
"the",
"argument",
"is",
"None"
] | f5693418b71a0849c5fee3b3307e117983c4e2d8 | https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L31-L34 |
16,657 | lukasgeiter/mkdocs-awesome-pages-plugin | mkdocs_awesome_pages_plugin/utils.py | join_paths | def join_paths(path1: Optional[str], path2: Optional[str]) -> Optional[str]:
""" Joins two paths if neither of them is None """
if path1 is not None and path2 is not None:
return os.path.join(path1, path2) | python | def join_paths(path1: Optional[str], path2: Optional[str]) -> Optional[str]:
""" Joins two paths if neither of them is None """
if path1 is not None and path2 is not None:
return os.path.join(path1, path2) | [
"def",
"join_paths",
"(",
"path1",
":",
"Optional",
"[",
"str",
"]",
",",
"path2",
":",
"Optional",
"[",
"str",
"]",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"path1",
"is",
"not",
"None",
"and",
"path2",
"is",
"not",
"None",
":",
"return"... | Joins two paths if neither of them is None | [
"Joins",
"two",
"paths",
"if",
"neither",
"of",
"them",
"is",
"None"
] | f5693418b71a0849c5fee3b3307e117983c4e2d8 | https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L37-L40 |
16,658 | msiemens/PyGitUp | PyGitUp/git_wrapper.py | GitWrapper.stasher | def stasher(self):
"""
A stashing contextmanager.
"""
# nonlocal for python2
stashed = [False]
clean = [False]
def stash():
if clean[0] or not self.repo.is_dirty(submodules=False):
clean[0] = True
return
... | python | def stasher(self):
"""
A stashing contextmanager.
"""
# nonlocal for python2
stashed = [False]
clean = [False]
def stash():
if clean[0] or not self.repo.is_dirty(submodules=False):
clean[0] = True
return
... | [
"def",
"stasher",
"(",
"self",
")",
":",
"# nonlocal for python2\r",
"stashed",
"=",
"[",
"False",
"]",
"clean",
"=",
"[",
"False",
"]",
"def",
"stash",
"(",
")",
":",
"if",
"clean",
"[",
"0",
"]",
"or",
"not",
"self",
".",
"repo",
".",
"is_dirty",
... | A stashing contextmanager. | [
"A",
"stashing",
"contextmanager",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L117-L154 |
16,659 | msiemens/PyGitUp | PyGitUp/git_wrapper.py | GitWrapper.checkout | def checkout(self, branch_name):
""" Checkout a branch by name. """
try:
find(
self.repo.branches, lambda b: b.name == branch_name
).checkout()
except OrigCheckoutError as e:
raise CheckoutError(branch_name, details=e) | python | def checkout(self, branch_name):
""" Checkout a branch by name. """
try:
find(
self.repo.branches, lambda b: b.name == branch_name
).checkout()
except OrigCheckoutError as e:
raise CheckoutError(branch_name, details=e) | [
"def",
"checkout",
"(",
"self",
",",
"branch_name",
")",
":",
"try",
":",
"find",
"(",
"self",
".",
"repo",
".",
"branches",
",",
"lambda",
"b",
":",
"b",
".",
"name",
"==",
"branch_name",
")",
".",
"checkout",
"(",
")",
"except",
"OrigCheckoutError",
... | Checkout a branch by name. | [
"Checkout",
"a",
"branch",
"by",
"name",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L156-L163 |
16,660 | msiemens/PyGitUp | PyGitUp/git_wrapper.py | GitWrapper.rebase | def rebase(self, target_branch):
""" Rebase to target branch. """
current_branch = self.repo.active_branch
arguments = (
([self.config('git-up.rebase.arguments')] or []) +
[target_branch.name]
)
try:
self._run('rebase', *argum... | python | def rebase(self, target_branch):
""" Rebase to target branch. """
current_branch = self.repo.active_branch
arguments = (
([self.config('git-up.rebase.arguments')] or []) +
[target_branch.name]
)
try:
self._run('rebase', *argum... | [
"def",
"rebase",
"(",
"self",
",",
"target_branch",
")",
":",
"current_branch",
"=",
"self",
".",
"repo",
".",
"active_branch",
"arguments",
"=",
"(",
"(",
"[",
"self",
".",
"config",
"(",
"'git-up.rebase.arguments'",
")",
"]",
"or",
"[",
"]",
")",
"+",
... | Rebase to target branch. | [
"Rebase",
"to",
"target",
"branch",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L165-L177 |
16,661 | msiemens/PyGitUp | PyGitUp/git_wrapper.py | GitWrapper.push | def push(self, *args, **kwargs):
''' Push commits to remote '''
stdout = six.b('')
# Execute command
cmd = self.git.push(as_process=True, *args, **kwargs)
# Capture output
while True:
output = cmd.stdout.read(1)
sys.stdout.write(outpu... | python | def push(self, *args, **kwargs):
''' Push commits to remote '''
stdout = six.b('')
# Execute command
cmd = self.git.push(as_process=True, *args, **kwargs)
# Capture output
while True:
output = cmd.stdout.read(1)
sys.stdout.write(outpu... | [
"def",
"push",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"stdout",
"=",
"six",
".",
"b",
"(",
"''",
")",
"# Execute command\r",
"cmd",
"=",
"self",
".",
"git",
".",
"push",
"(",
"as_process",
"=",
"True",
",",
"*",
"args",... | Push commits to remote | [
"Push",
"commits",
"to",
"remote"
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L220-L252 |
16,662 | msiemens/PyGitUp | PyGitUp/git_wrapper.py | GitWrapper.change_count | def change_count(self):
""" The number of changes in the working directory. """
status = self.git.status(porcelain=True, untracked_files='no').strip()
if not status:
return 0
else:
return len(status.split('\n')) | python | def change_count(self):
""" The number of changes in the working directory. """
status = self.git.status(porcelain=True, untracked_files='no').strip()
if not status:
return 0
else:
return len(status.split('\n')) | [
"def",
"change_count",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"git",
".",
"status",
"(",
"porcelain",
"=",
"True",
",",
"untracked_files",
"=",
"'no'",
")",
".",
"strip",
"(",
")",
"if",
"not",
"status",
":",
"return",
"0",
"else",
":",
... | The number of changes in the working directory. | [
"The",
"number",
"of",
"changes",
"in",
"the",
"working",
"directory",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L262-L268 |
16,663 | msiemens/PyGitUp | PyGitUp/utils.py | uniq | def uniq(seq):
""" Return a copy of seq without duplicates. """
seen = set()
return [x for x in seq if str(x) not in seen and not seen.add(str(x))] | python | def uniq(seq):
""" Return a copy of seq without duplicates. """
seen = set()
return [x for x in seq if str(x) not in seen and not seen.add(str(x))] | [
"def",
"uniq",
"(",
"seq",
")",
":",
"seen",
"=",
"set",
"(",
")",
"return",
"[",
"x",
"for",
"x",
"in",
"seq",
"if",
"str",
"(",
"x",
")",
"not",
"in",
"seen",
"and",
"not",
"seen",
".",
"add",
"(",
"str",
"(",
"x",
")",
")",
"]"
] | Return a copy of seq without duplicates. | [
"Return",
"a",
"copy",
"of",
"seq",
"without",
"duplicates",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/utils.py#L24-L27 |
16,664 | msiemens/PyGitUp | release.py | current_version | def current_version():
"""
Get the current version number from setup.py
"""
# Monkeypatch setuptools.setup so we get the verison number
import setuptools
version = [None]
def monkey_setup(**settings):
version[0] = settings['version']
old_setup = setuptools.setup
setuptools... | python | def current_version():
"""
Get the current version number from setup.py
"""
# Monkeypatch setuptools.setup so we get the verison number
import setuptools
version = [None]
def monkey_setup(**settings):
version[0] = settings['version']
old_setup = setuptools.setup
setuptools... | [
"def",
"current_version",
"(",
")",
":",
"# Monkeypatch setuptools.setup so we get the verison number",
"import",
"setuptools",
"version",
"=",
"[",
"None",
"]",
"def",
"monkey_setup",
"(",
"*",
"*",
"settings",
")",
":",
"version",
"[",
"0",
"]",
"=",
"settings",... | Get the current version number from setup.py | [
"Get",
"the",
"current",
"version",
"number",
"from",
"setup",
".",
"py"
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/release.py#L22-L41 |
16,665 | msiemens/PyGitUp | PyGitUp/gitup.py | run | def run(version, quiet, no_fetch, push, **kwargs): # pragma: no cover
"""
A nicer `git pull`.
"""
if version:
if NO_DISTRIBUTE:
print(colored('Please install \'git-up\' via pip in order to '
'get version information.', 'yellow'))
else:
... | python | def run(version, quiet, no_fetch, push, **kwargs): # pragma: no cover
"""
A nicer `git pull`.
"""
if version:
if NO_DISTRIBUTE:
print(colored('Please install \'git-up\' via pip in order to '
'get version information.', 'yellow'))
else:
... | [
"def",
"run",
"(",
"version",
",",
"quiet",
",",
"no_fetch",
",",
"push",
",",
"*",
"*",
"kwargs",
")",
":",
"# pragma: no cover\r",
"if",
"version",
":",
"if",
"NO_DISTRIBUTE",
":",
"print",
"(",
"colored",
"(",
"'Please install \\'git-up\\' via pip in order to... | A nicer `git pull`. | [
"A",
"nicer",
"git",
"pull",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L628-L656 |
16,666 | msiemens/PyGitUp | PyGitUp/gitup.py | GitUp.run | def run(self):
""" Run all the git-up stuff. """
try:
if self.should_fetch:
self.fetch()
self.rebase_all_branches()
if self.with_bundler():
self.check_bundler()
if self.settings['push.auto']:
s... | python | def run(self):
""" Run all the git-up stuff. """
try:
if self.should_fetch:
self.fetch()
self.rebase_all_branches()
if self.with_bundler():
self.check_bundler()
if self.settings['push.auto']:
s... | [
"def",
"run",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"should_fetch",
":",
"self",
".",
"fetch",
"(",
")",
"self",
".",
"rebase_all_branches",
"(",
")",
"if",
"self",
".",
"with_bundler",
"(",
")",
":",
"self",
".",
"check_bundler",
"("... | Run all the git-up stuff. | [
"Run",
"all",
"the",
"git",
"-",
"up",
"stuff",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L193-L214 |
16,667 | msiemens/PyGitUp | PyGitUp/gitup.py | GitUp.fetch | def fetch(self):
"""
Fetch the recent refs from the remotes.
Unless git-up.fetch.all is set to true, all remotes with
locally existent branches will be fetched.
"""
fetch_kwargs = {'multiple': True}
fetch_args = []
if self.is_prune():
... | python | def fetch(self):
"""
Fetch the recent refs from the remotes.
Unless git-up.fetch.all is set to true, all remotes with
locally existent branches will be fetched.
"""
fetch_kwargs = {'multiple': True}
fetch_args = []
if self.is_prune():
... | [
"def",
"fetch",
"(",
"self",
")",
":",
"fetch_kwargs",
"=",
"{",
"'multiple'",
":",
"True",
"}",
"fetch_args",
"=",
"[",
"]",
"if",
"self",
".",
"is_prune",
"(",
")",
":",
"fetch_kwargs",
"[",
"'prune'",
"]",
"=",
"True",
"if",
"self",
".",
"settings... | Fetch the recent refs from the remotes.
Unless git-up.fetch.all is set to true, all remotes with
locally existent branches will be fetched. | [
"Fetch",
"the",
"recent",
"refs",
"from",
"the",
"remotes",
".",
"Unless",
"git",
"-",
"up",
".",
"fetch",
".",
"all",
"is",
"set",
"to",
"true",
"all",
"remotes",
"with",
"locally",
"existent",
"branches",
"will",
"be",
"fetched",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L311-L341 |
16,668 | msiemens/PyGitUp | PyGitUp/gitup.py | GitUp.log | def log(self, branch, remote):
""" Call a log-command, if set by git-up.fetch.all. """
log_hook = self.settings['rebase.log-hook']
if log_hook:
if ON_WINDOWS: # pragma: no cover
# Running a string in CMD from Python is not that easy on
# Windo... | python | def log(self, branch, remote):
""" Call a log-command, if set by git-up.fetch.all. """
log_hook = self.settings['rebase.log-hook']
if log_hook:
if ON_WINDOWS: # pragma: no cover
# Running a string in CMD from Python is not that easy on
# Windo... | [
"def",
"log",
"(",
"self",
",",
"branch",
",",
"remote",
")",
":",
"log_hook",
"=",
"self",
".",
"settings",
"[",
"'rebase.log-hook'",
"]",
"if",
"log_hook",
":",
"if",
"ON_WINDOWS",
":",
"# pragma: no cover\r",
"# Running a string in CMD from Python is not that eas... | Call a log-command, if set by git-up.fetch.all. | [
"Call",
"a",
"log",
"-",
"command",
"if",
"set",
"by",
"git",
"-",
"up",
".",
"fetch",
".",
"all",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L374-L424 |
16,669 | msiemens/PyGitUp | PyGitUp/gitup.py | GitUp.version_info | def version_info(self):
""" Tell, what version we're running at and if it's up to date. """
# Retrive and show local version info
package = pkg.get_distribution('git-up')
local_version_str = package.version
local_version = package.parsed_version
print('GitUp ver... | python | def version_info(self):
""" Tell, what version we're running at and if it's up to date. """
# Retrive and show local version info
package = pkg.get_distribution('git-up')
local_version_str = package.version
local_version = package.parsed_version
print('GitUp ver... | [
"def",
"version_info",
"(",
"self",
")",
":",
"# Retrive and show local version info\r",
"package",
"=",
"pkg",
".",
"get_distribution",
"(",
"'git-up'",
")",
"local_version_str",
"=",
"package",
".",
"version",
"local_version",
"=",
"package",
".",
"parsed_version",
... | Tell, what version we're running at and if it's up to date. | [
"Tell",
"what",
"version",
"we",
"re",
"running",
"at",
"and",
"if",
"it",
"s",
"up",
"to",
"date",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L426-L461 |
16,670 | msiemens/PyGitUp | PyGitUp/gitup.py | GitUp.load_config | def load_config(self):
"""
Load the configuration from git config.
"""
for key in self.settings:
value = self.config(key)
# Parse true/false
if value == '' or value is None:
continue # Not set by user, go on
if val... | python | def load_config(self):
"""
Load the configuration from git config.
"""
for key in self.settings:
value = self.config(key)
# Parse true/false
if value == '' or value is None:
continue # Not set by user, go on
if val... | [
"def",
"load_config",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"settings",
":",
"value",
"=",
"self",
".",
"config",
"(",
"key",
")",
"# Parse true/false\r",
"if",
"value",
"==",
"''",
"or",
"value",
"is",
"None",
":",
"continue",
"# Not... | Load the configuration from git config. | [
"Load",
"the",
"configuration",
"from",
"git",
"config",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L467-L483 |
16,671 | msiemens/PyGitUp | PyGitUp/gitup.py | GitUp.check_bundler | def check_bundler(self):
"""
Run the bundler check.
"""
def get_config(name):
return name if self.config('bundler.' + name) else ''
from pkg_resources import Requirement, resource_filename
relative_path = os.path.join('PyGitUp', 'check-bundler.rb')
... | python | def check_bundler(self):
"""
Run the bundler check.
"""
def get_config(name):
return name if self.config('bundler.' + name) else ''
from pkg_resources import Requirement, resource_filename
relative_path = os.path.join('PyGitUp', 'check-bundler.rb')
... | [
"def",
"check_bundler",
"(",
"self",
")",
":",
"def",
"get_config",
"(",
"name",
")",
":",
"return",
"name",
"if",
"self",
".",
"config",
"(",
"'bundler.'",
"+",
"name",
")",
"else",
"''",
"from",
"pkg_resources",
"import",
"Requirement",
",",
"resource_fi... | Run the bundler check. | [
"Run",
"the",
"bundler",
"check",
"."
] | b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c | https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L555-L576 |
16,672 | mikemaccana/python-docx | docx.py | opendocx | def opendocx(file):
'''Open a docx file, return a document XML tree'''
mydoc = zipfile.ZipFile(file)
xmlcontent = mydoc.read('word/document.xml')
document = etree.fromstring(xmlcontent)
return document | python | def opendocx(file):
'''Open a docx file, return a document XML tree'''
mydoc = zipfile.ZipFile(file)
xmlcontent = mydoc.read('word/document.xml')
document = etree.fromstring(xmlcontent)
return document | [
"def",
"opendocx",
"(",
"file",
")",
":",
"mydoc",
"=",
"zipfile",
".",
"ZipFile",
"(",
"file",
")",
"xmlcontent",
"=",
"mydoc",
".",
"read",
"(",
"'word/document.xml'",
")",
"document",
"=",
"etree",
".",
"fromstring",
"(",
"xmlcontent",
")",
"return",
... | Open a docx file, return a document XML tree | [
"Open",
"a",
"docx",
"file",
"return",
"a",
"document",
"XML",
"tree"
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L81-L86 |
16,673 | mikemaccana/python-docx | docx.py | makeelement | def makeelement(tagname, tagtext=None, nsprefix='w', attributes=None,
attrnsprefix=None):
'''Create an element & return it'''
# Deal with list of nsprefix by making namespacemap
namespacemap = None
if isinstance(nsprefix, list):
namespacemap = {}
for prefix in nsprefix:
... | python | def makeelement(tagname, tagtext=None, nsprefix='w', attributes=None,
attrnsprefix=None):
'''Create an element & return it'''
# Deal with list of nsprefix by making namespacemap
namespacemap = None
if isinstance(nsprefix, list):
namespacemap = {}
for prefix in nsprefix:
... | [
"def",
"makeelement",
"(",
"tagname",
",",
"tagtext",
"=",
"None",
",",
"nsprefix",
"=",
"'w'",
",",
"attributes",
"=",
"None",
",",
"attrnsprefix",
"=",
"None",
")",
":",
"# Deal with list of nsprefix by making namespacemap",
"namespacemap",
"=",
"None",
"if",
... | Create an element & return it | [
"Create",
"an",
"element",
"&",
"return",
"it"
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L95-L131 |
16,674 | mikemaccana/python-docx | docx.py | heading | def heading(headingtext, headinglevel, lang='en'):
'''Make a new heading, return the heading element'''
lmap = {'en': 'Heading', 'it': 'Titolo'}
# Make our elements
paragraph = makeelement('p')
pr = makeelement('pPr')
pStyle = makeelement(
'pStyle', attributes={'val': lmap[lang]+str(head... | python | def heading(headingtext, headinglevel, lang='en'):
'''Make a new heading, return the heading element'''
lmap = {'en': 'Heading', 'it': 'Titolo'}
# Make our elements
paragraph = makeelement('p')
pr = makeelement('pPr')
pStyle = makeelement(
'pStyle', attributes={'val': lmap[lang]+str(head... | [
"def",
"heading",
"(",
"headingtext",
",",
"headinglevel",
",",
"lang",
"=",
"'en'",
")",
":",
"lmap",
"=",
"{",
"'en'",
":",
"'Heading'",
",",
"'it'",
":",
"'Titolo'",
"}",
"# Make our elements",
"paragraph",
"=",
"makeelement",
"(",
"'p'",
")",
"pr",
"... | Make a new heading, return the heading element | [
"Make",
"a",
"new",
"heading",
"return",
"the",
"heading",
"element"
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L278-L294 |
16,675 | mikemaccana/python-docx | docx.py | clean | def clean(document):
""" Perform misc cleaning operations on documents.
Returns cleaned document.
"""
newdocument = document
# Clean empty text and r tags
for t in ('t', 'r'):
rmlist = []
for element in newdocument.iter():
if element.tag == '{%s}%s' % (nsprefixe... | python | def clean(document):
""" Perform misc cleaning operations on documents.
Returns cleaned document.
"""
newdocument = document
# Clean empty text and r tags
for t in ('t', 'r'):
rmlist = []
for element in newdocument.iter():
if element.tag == '{%s}%s' % (nsprefixe... | [
"def",
"clean",
"(",
"document",
")",
":",
"newdocument",
"=",
"document",
"# Clean empty text and r tags",
"for",
"t",
"in",
"(",
"'t'",
",",
"'r'",
")",
":",
"rmlist",
"=",
"[",
"]",
"for",
"element",
"in",
"newdocument",
".",
"iter",
"(",
")",
":",
... | Perform misc cleaning operations on documents.
Returns cleaned document. | [
"Perform",
"misc",
"cleaning",
"operations",
"on",
"documents",
".",
"Returns",
"cleaned",
"document",
"."
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L644-L661 |
16,676 | mikemaccana/python-docx | docx.py | findTypeParent | def findTypeParent(element, tag):
""" Finds fist parent of element of the given type
@param object element: etree element
@param string the tag parent to search for
@return object element: the found parent or None when not found
"""
p = element
while True:
p = p.getparent()
... | python | def findTypeParent(element, tag):
""" Finds fist parent of element of the given type
@param object element: etree element
@param string the tag parent to search for
@return object element: the found parent or None when not found
"""
p = element
while True:
p = p.getparent()
... | [
"def",
"findTypeParent",
"(",
"element",
",",
"tag",
")",
":",
"p",
"=",
"element",
"while",
"True",
":",
"p",
"=",
"p",
".",
"getparent",
"(",
")",
"if",
"p",
".",
"tag",
"==",
"tag",
":",
"return",
"p",
"# Not found",
"return",
"None"
] | Finds fist parent of element of the given type
@param object element: etree element
@param string the tag parent to search for
@return object element: the found parent or None when not found | [
"Finds",
"fist",
"parent",
"of",
"element",
"of",
"the",
"given",
"type"
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L664-L680 |
16,677 | mikemaccana/python-docx | docx.py | AdvSearch | def AdvSearch(document, search, bs=3):
'''Return set of all regex matches
This is an advanced version of python-docx.search() that takes into
account blocks of <bs> elements at a time.
What it does:
It searches the entire document body for text blocks.
Since the text to search could be spawned... | python | def AdvSearch(document, search, bs=3):
'''Return set of all regex matches
This is an advanced version of python-docx.search() that takes into
account blocks of <bs> elements at a time.
What it does:
It searches the entire document body for text blocks.
Since the text to search could be spawned... | [
"def",
"AdvSearch",
"(",
"document",
",",
"search",
",",
"bs",
"=",
"3",
")",
":",
"# Compile the search regexp",
"searchre",
"=",
"re",
".",
"compile",
"(",
"search",
")",
"matches",
"=",
"[",
"]",
"# Will match against searchels. Searchels is a list that contains ... | Return set of all regex matches
This is an advanced version of python-docx.search() that takes into
account blocks of <bs> elements at a time.
What it does:
It searches the entire document body for text blocks.
Since the text to search could be spawned across multiple text blocks,
we need to a... | [
"Return",
"set",
"of",
"all",
"regex",
"matches"
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L683-L756 |
16,678 | mikemaccana/python-docx | docx.py | getdocumenttext | def getdocumenttext(document):
'''Return the raw text of a document, as a list of paragraphs.'''
paratextlist = []
# Compile a list of all paragraph (p) elements
paralist = []
for element in document.iter():
# Find p (paragraph) elements
if element.tag == '{'+nsprefixes['w']+'}p':
... | python | def getdocumenttext(document):
'''Return the raw text of a document, as a list of paragraphs.'''
paratextlist = []
# Compile a list of all paragraph (p) elements
paralist = []
for element in document.iter():
# Find p (paragraph) elements
if element.tag == '{'+nsprefixes['w']+'}p':
... | [
"def",
"getdocumenttext",
"(",
"document",
")",
":",
"paratextlist",
"=",
"[",
"]",
"# Compile a list of all paragraph (p) elements",
"paralist",
"=",
"[",
"]",
"for",
"element",
"in",
"document",
".",
"iter",
"(",
")",
":",
"# Find p (paragraph) elements",
"if",
... | Return the raw text of a document, as a list of paragraphs. | [
"Return",
"the",
"raw",
"text",
"of",
"a",
"document",
"as",
"a",
"list",
"of",
"paragraphs",
"."
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L910-L935 |
16,679 | mikemaccana/python-docx | docx.py | wordrelationships | def wordrelationships(relationshiplist):
'''Generate a Word relationships file'''
# Default list of relationships
# FIXME: using string hack instead of making element
#relationships = makeelement('Relationships', nsprefix='pr')
relationships = etree.fromstring(
'<Relationships xmlns="http://... | python | def wordrelationships(relationshiplist):
'''Generate a Word relationships file'''
# Default list of relationships
# FIXME: using string hack instead of making element
#relationships = makeelement('Relationships', nsprefix='pr')
relationships = etree.fromstring(
'<Relationships xmlns="http://... | [
"def",
"wordrelationships",
"(",
"relationshiplist",
")",
":",
"# Default list of relationships",
"# FIXME: using string hack instead of making element",
"#relationships = makeelement('Relationships', nsprefix='pr')",
"relationships",
"=",
"etree",
".",
"fromstring",
"(",
"'<Relationsh... | Generate a Word relationships file | [
"Generate",
"a",
"Word",
"relationships",
"file"
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L1031-L1049 |
16,680 | mikemaccana/python-docx | docx.py | savedocx | def savedocx(
document, coreprops, appprops, contenttypes, websettings,
wordrelationships, output, imagefiledict=None):
"""
Save a modified document
"""
if imagefiledict is None:
warn(
'Using savedocx() without imagefiledict parameter will be deprec'
'ated... | python | def savedocx(
document, coreprops, appprops, contenttypes, websettings,
wordrelationships, output, imagefiledict=None):
"""
Save a modified document
"""
if imagefiledict is None:
warn(
'Using savedocx() without imagefiledict parameter will be deprec'
'ated... | [
"def",
"savedocx",
"(",
"document",
",",
"coreprops",
",",
"appprops",
",",
"contenttypes",
",",
"websettings",
",",
"wordrelationships",
",",
"output",
",",
"imagefiledict",
"=",
"None",
")",
":",
"if",
"imagefiledict",
"is",
"None",
":",
"warn",
"(",
"'Usi... | Save a modified document | [
"Save",
"a",
"modified",
"document"
] | 4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe | https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L1052-L1107 |
16,681 | couchbase/couchbase-python-client | couchbase/bucket.py | _depr | def _depr(fn, usage, stacklevel=3):
"""Internal convenience function for deprecation warnings"""
warn('{0} is deprecated. Use {1} instead'.format(fn, usage),
stacklevel=stacklevel, category=DeprecationWarning) | python | def _depr(fn, usage, stacklevel=3):
"""Internal convenience function for deprecation warnings"""
warn('{0} is deprecated. Use {1} instead'.format(fn, usage),
stacklevel=stacklevel, category=DeprecationWarning) | [
"def",
"_depr",
"(",
"fn",
",",
"usage",
",",
"stacklevel",
"=",
"3",
")",
":",
"warn",
"(",
"'{0} is deprecated. Use {1} instead'",
".",
"format",
"(",
"fn",
",",
"usage",
")",
",",
"stacklevel",
"=",
"stacklevel",
",",
"category",
"=",
"DeprecationWarning"... | Internal convenience function for deprecation warnings | [
"Internal",
"convenience",
"function",
"for",
"deprecation",
"warnings"
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L44-L47 |
16,682 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.upsert | def upsert(self, key, value, cas=0, ttl=0, format=None,
persist_to=0, replicate_to=0):
"""Unconditionally store the object in Couchbase.
:param key:
The key to set the value with. By default, the key must be
either a :class:`bytes` or :class:`str` object encodable... | python | def upsert(self, key, value, cas=0, ttl=0, format=None,
persist_to=0, replicate_to=0):
"""Unconditionally store the object in Couchbase.
:param key:
The key to set the value with. By default, the key must be
either a :class:`bytes` or :class:`str` object encodable... | [
"def",
"upsert",
"(",
"self",
",",
"key",
",",
"value",
",",
"cas",
"=",
"0",
",",
"ttl",
"=",
"0",
",",
"format",
"=",
"None",
",",
"persist_to",
"=",
"0",
",",
"replicate_to",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"upsert",
"(",
"self",
... | Unconditionally store the object in Couchbase.
:param key:
The key to set the value with. By default, the key must be
either a :class:`bytes` or :class:`str` object encodable as
UTF-8. If a custom `transcoder` class is used (see
:meth:`~__init__`), then the key o... | [
"Unconditionally",
"store",
"the",
"object",
"in",
"Couchbase",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L328-L410 |
16,683 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.insert | def insert(self, key, value, ttl=0, format=None, persist_to=0, replicate_to=0):
"""Store an object in Couchbase unless it already exists.
Follows the same conventions as :meth:`upsert` but the value is
stored only if it does not exist already. Conversely, the value
is not stored if the ... | python | def insert(self, key, value, ttl=0, format=None, persist_to=0, replicate_to=0):
"""Store an object in Couchbase unless it already exists.
Follows the same conventions as :meth:`upsert` but the value is
stored only if it does not exist already. Conversely, the value
is not stored if the ... | [
"def",
"insert",
"(",
"self",
",",
"key",
",",
"value",
",",
"ttl",
"=",
"0",
",",
"format",
"=",
"None",
",",
"persist_to",
"=",
"0",
",",
"replicate_to",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"insert",
"(",
"self",
",",
"key",
",",
"value... | Store an object in Couchbase unless it already exists.
Follows the same conventions as :meth:`upsert` but the value is
stored only if it does not exist already. Conversely, the value
is not stored if the key already exists.
Notably missing from this method is the `cas` parameter, this ... | [
"Store",
"an",
"object",
"in",
"Couchbase",
"unless",
"it",
"already",
"exists",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L412-L428 |
16,684 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.prepend | def prepend(self, key, value, cas=0, format=None,
persist_to=0, replicate_to=0):
"""Prepend a string to an existing value in Couchbase.
.. seealso:: :meth:`append`, :meth:`prepend_multi`
"""
return _Base.prepend(self, key, value, cas=cas, format=format,
... | python | def prepend(self, key, value, cas=0, format=None,
persist_to=0, replicate_to=0):
"""Prepend a string to an existing value in Couchbase.
.. seealso:: :meth:`append`, :meth:`prepend_multi`
"""
return _Base.prepend(self, key, value, cas=cas, format=format,
... | [
"def",
"prepend",
"(",
"self",
",",
"key",
",",
"value",
",",
"cas",
"=",
"0",
",",
"format",
"=",
"None",
",",
"persist_to",
"=",
"0",
",",
"replicate_to",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"prepend",
"(",
"self",
",",
"key",
",",
"val... | Prepend a string to an existing value in Couchbase.
.. seealso:: :meth:`append`, :meth:`prepend_multi` | [
"Prepend",
"a",
"string",
"to",
"an",
"existing",
"value",
"in",
"Couchbase",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L475-L482 |
16,685 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.get | def get(self, key, ttl=0, quiet=None, replica=False, no_format=False):
"""Obtain an object stored in Couchbase by given key.
:param string key: The key to fetch. The type of key is the same
as mentioned in :meth:`upsert`
:param int ttl: If specified, indicates that the key's expira... | python | def get(self, key, ttl=0, quiet=None, replica=False, no_format=False):
"""Obtain an object stored in Couchbase by given key.
:param string key: The key to fetch. The type of key is the same
as mentioned in :meth:`upsert`
:param int ttl: If specified, indicates that the key's expira... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"ttl",
"=",
"0",
",",
"quiet",
"=",
"None",
",",
"replica",
"=",
"False",
",",
"no_format",
"=",
"False",
")",
":",
"return",
"_Base",
".",
"get",
"(",
"self",
",",
"key",
",",
"ttl",
"=",
"ttl",
",",... | Obtain an object stored in Couchbase by given key.
:param string key: The key to fetch. The type of key is the same
as mentioned in :meth:`upsert`
:param int ttl: If specified, indicates that the key's expiration
time should be *modified* when retrieving the value.
:pa... | [
"Obtain",
"an",
"object",
"stored",
"in",
"Couchbase",
"by",
"given",
"key",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L484-L554 |
16,686 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.touch | def touch(self, key, ttl=0):
"""Update a key's expiration time
:param string key: The key whose expiration time should be
modified
:param int ttl: The new expiration time. If the expiration time
is `0` then the key never expires (and any existing
expiration i... | python | def touch(self, key, ttl=0):
"""Update a key's expiration time
:param string key: The key whose expiration time should be
modified
:param int ttl: The new expiration time. If the expiration time
is `0` then the key never expires (and any existing
expiration i... | [
"def",
"touch",
"(",
"self",
",",
"key",
",",
"ttl",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"touch",
"(",
"self",
",",
"key",
",",
"ttl",
"=",
"ttl",
")"
] | Update a key's expiration time
:param string key: The key whose expiration time should be
modified
:param int ttl: The new expiration time. If the expiration time
is `0` then the key never expires (and any existing
expiration is removed)
:return: :class:`.Ope... | [
"Update",
"a",
"key",
"s",
"expiration",
"time"
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L556-L578 |
16,687 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.lock | def lock(self, key, ttl=0):
"""Lock and retrieve a key-value entry in Couchbase.
:param key: A string which is the key to lock.
:param ttl: a TTL for which the lock should be valid.
While the lock is active, attempts to access the key (via
other :meth:`lock`, :meth:`ups... | python | def lock(self, key, ttl=0):
"""Lock and retrieve a key-value entry in Couchbase.
:param key: A string which is the key to lock.
:param ttl: a TTL for which the lock should be valid.
While the lock is active, attempts to access the key (via
other :meth:`lock`, :meth:`ups... | [
"def",
"lock",
"(",
"self",
",",
"key",
",",
"ttl",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"lock",
"(",
"self",
",",
"key",
",",
"ttl",
"=",
"ttl",
")"
] | Lock and retrieve a key-value entry in Couchbase.
:param key: A string which is the key to lock.
:param ttl: a TTL for which the lock should be valid.
While the lock is active, attempts to access the key (via
other :meth:`lock`, :meth:`upsert` or other mutation calls)
... | [
"Lock",
"and",
"retrieve",
"a",
"key",
"-",
"value",
"entry",
"in",
"Couchbase",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L580-L647 |
16,688 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.unlock | def unlock(self, key, cas):
"""Unlock a Locked Key in Couchbase.
This unlocks an item previously locked by :meth:`lock`
:param key: The key to unlock
:param cas: The cas returned from :meth:`lock`'s
:class:`.Result` object.
See :meth:`lock` for an example.
... | python | def unlock(self, key, cas):
"""Unlock a Locked Key in Couchbase.
This unlocks an item previously locked by :meth:`lock`
:param key: The key to unlock
:param cas: The cas returned from :meth:`lock`'s
:class:`.Result` object.
See :meth:`lock` for an example.
... | [
"def",
"unlock",
"(",
"self",
",",
"key",
",",
"cas",
")",
":",
"return",
"_Base",
".",
"unlock",
"(",
"self",
",",
"key",
",",
"cas",
"=",
"cas",
")"
] | Unlock a Locked Key in Couchbase.
This unlocks an item previously locked by :meth:`lock`
:param key: The key to unlock
:param cas: The cas returned from :meth:`lock`'s
:class:`.Result` object.
See :meth:`lock` for an example.
:raise: :exc:`.TemporaryFailError` if ... | [
"Unlock",
"a",
"Locked",
"Key",
"in",
"Couchbase",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L649-L666 |
16,689 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.remove | def remove(self, key, cas=0, quiet=None, persist_to=0, replicate_to=0):
"""Remove the key-value entry for a given key in Couchbase.
:param key: A string which is the key to remove. The format and
type of the key follows the same conventions as in
:meth:`upsert`
:type key... | python | def remove(self, key, cas=0, quiet=None, persist_to=0, replicate_to=0):
"""Remove the key-value entry for a given key in Couchbase.
:param key: A string which is the key to remove. The format and
type of the key follows the same conventions as in
:meth:`upsert`
:type key... | [
"def",
"remove",
"(",
"self",
",",
"key",
",",
"cas",
"=",
"0",
",",
"quiet",
"=",
"None",
",",
"persist_to",
"=",
"0",
",",
"replicate_to",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"remove",
"(",
"self",
",",
"key",
",",
"cas",
"=",
"cas",
... | Remove the key-value entry for a given key in Couchbase.
:param key: A string which is the key to remove. The format and
type of the key follows the same conventions as in
:meth:`upsert`
:type key: string, dict, or tuple/list
:param int cas: The CAS to use for the remov... | [
"Remove",
"the",
"key",
"-",
"value",
"entry",
"for",
"a",
"given",
"key",
"in",
"Couchbase",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L668-L725 |
16,690 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.counter | def counter(self, key, delta=1, initial=None, ttl=0):
"""Increment or decrement the numeric value of an item.
This method instructs the server to treat the item stored under
the given key as a numeric counter.
Counter operations require that the stored value
exists as a string ... | python | def counter(self, key, delta=1, initial=None, ttl=0):
"""Increment or decrement the numeric value of an item.
This method instructs the server to treat the item stored under
the given key as a numeric counter.
Counter operations require that the stored value
exists as a string ... | [
"def",
"counter",
"(",
"self",
",",
"key",
",",
"delta",
"=",
"1",
",",
"initial",
"=",
"None",
",",
"ttl",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"counter",
"(",
"self",
",",
"key",
",",
"delta",
"=",
"delta",
",",
"initial",
"=",
"initial"... | Increment or decrement the numeric value of an item.
This method instructs the server to treat the item stored under
the given key as a numeric counter.
Counter operations require that the stored value
exists as a string representation of a number (e.g. ``123``). If
storing ite... | [
"Increment",
"or",
"decrement",
"the",
"numeric",
"value",
"of",
"an",
"item",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L727-L784 |
16,691 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.mutate_in | def mutate_in(self, key, *specs, **kwargs):
"""Perform multiple atomic modifications within a document.
:param key: The key of the document to modify
:param specs: A list of specs (See :mod:`.couchbase.subdocument`)
:param bool create_doc:
Whether the document should be crea... | python | def mutate_in(self, key, *specs, **kwargs):
"""Perform multiple atomic modifications within a document.
:param key: The key of the document to modify
:param specs: A list of specs (See :mod:`.couchbase.subdocument`)
:param bool create_doc:
Whether the document should be crea... | [
"def",
"mutate_in",
"(",
"self",
",",
"key",
",",
"*",
"specs",
",",
"*",
"*",
"kwargs",
")",
":",
"# Note we don't verify the validity of the options. lcb does that for",
"# us.",
"sdflags",
"=",
"kwargs",
".",
"pop",
"(",
"'_sd_doc_flags'",
",",
"0",
")",
"if"... | Perform multiple atomic modifications within a document.
:param key: The key of the document to modify
:param specs: A list of specs (See :mod:`.couchbase.subdocument`)
:param bool create_doc:
Whether the document should be create if it doesn't exist
:param bool insert_doc: ... | [
"Perform",
"multiple",
"atomic",
"modifications",
"within",
"a",
"document",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L786-L828 |
16,692 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.lookup_in | def lookup_in(self, key, *specs, **kwargs):
"""Atomically retrieve one or more paths from a document.
:param key: The key of the document to lookup
:param spec: A list of specs (see :mod:`.couchbase.subdocument`)
:return: A :class:`.couchbase.result.SubdocResult` object.
Thi... | python | def lookup_in(self, key, *specs, **kwargs):
"""Atomically retrieve one or more paths from a document.
:param key: The key of the document to lookup
:param spec: A list of specs (see :mod:`.couchbase.subdocument`)
:return: A :class:`.couchbase.result.SubdocResult` object.
Thi... | [
"def",
"lookup_in",
"(",
"self",
",",
"key",
",",
"*",
"specs",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"Bucket",
",",
"self",
")",
".",
"lookup_in",
"(",
"{",
"key",
":",
"specs",
"}",
",",
"*",
"*",
"kwargs",
")"
] | Atomically retrieve one or more paths from a document.
:param key: The key of the document to lookup
:param spec: A list of specs (see :mod:`.couchbase.subdocument`)
:return: A :class:`.couchbase.result.SubdocResult` object.
This object contains the results and any errors of the
... | [
"Atomically",
"retrieve",
"one",
"or",
"more",
"paths",
"from",
"a",
"document",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L830-L853 |
16,693 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.retrieve_in | def retrieve_in(self, key, *paths, **kwargs):
"""Atomically fetch one or more paths from a document.
Convenience method for retrieval operations. This functions
identically to :meth:`lookup_in`. As such, the following two
forms are equivalent:
.. code-block:: python
... | python | def retrieve_in(self, key, *paths, **kwargs):
"""Atomically fetch one or more paths from a document.
Convenience method for retrieval operations. This functions
identically to :meth:`lookup_in`. As such, the following two
forms are equivalent:
.. code-block:: python
... | [
"def",
"retrieve_in",
"(",
"self",
",",
"key",
",",
"*",
"paths",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"couchbase",
".",
"subdocument",
"as",
"SD",
"return",
"self",
".",
"lookup_in",
"(",
"key",
",",
"*",
"tuple",
"(",
"SD",
".",
"get",
"(... | Atomically fetch one or more paths from a document.
Convenience method for retrieval operations. This functions
identically to :meth:`lookup_in`. As such, the following two
forms are equivalent:
.. code-block:: python
import couchbase.subdocument as SD
rv = cb.... | [
"Atomically",
"fetch",
"one",
"or",
"more",
"paths",
"from",
"a",
"document",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L855-L880 |
16,694 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.stats | def stats(self, keys=None, keystats=False):
"""Request server statistics.
Fetches stats from each node in the cluster. Without a key
specified the server will respond with a default set of
statistical information. It returns the a `dict` with stats keys
and node-value pairs as a... | python | def stats(self, keys=None, keystats=False):
"""Request server statistics.
Fetches stats from each node in the cluster. Without a key
specified the server will respond with a default set of
statistical information. It returns the a `dict` with stats keys
and node-value pairs as a... | [
"def",
"stats",
"(",
"self",
",",
"keys",
"=",
"None",
",",
"keystats",
"=",
"False",
")",
":",
"if",
"keys",
"and",
"not",
"isinstance",
"(",
"keys",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"keys",
"=",
"(",
"keys",
",",
")",
"return",
... | Request server statistics.
Fetches stats from each node in the cluster. Without a key
specified the server will respond with a default set of
statistical information. It returns the a `dict` with stats keys
and node-value pairs as a value.
:param keys: One or several stats to q... | [
"Request",
"server",
"statistics",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L898-L925 |
16,695 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.observe | def observe(self, key, master_only=False):
"""Return storage information for a key.
It returns a :class:`.ValueResult` object with the ``value``
field set to a list of :class:`~.ObserveInfo` objects. Each
element in the list responds to the storage status for the key
on the give... | python | def observe(self, key, master_only=False):
"""Return storage information for a key.
It returns a :class:`.ValueResult` object with the ``value``
field set to a list of :class:`~.ObserveInfo` objects. Each
element in the list responds to the storage status for the key
on the give... | [
"def",
"observe",
"(",
"self",
",",
"key",
",",
"master_only",
"=",
"False",
")",
":",
"return",
"_Base",
".",
"observe",
"(",
"self",
",",
"key",
",",
"master_only",
"=",
"master_only",
")"
] | Return storage information for a key.
It returns a :class:`.ValueResult` object with the ``value``
field set to a list of :class:`~.ObserveInfo` objects. Each
element in the list responds to the storage status for the key
on the given node. The length of the list (and thus the number
... | [
"Return",
"storage",
"information",
"for",
"a",
"key",
"."
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L977-L993 |
16,696 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.endure | def endure(self, key, persist_to=-1, replicate_to=-1, cas=0,
check_removed=False, timeout=5.0, interval=0.010):
"""Wait until a key has been distributed to one or more nodes
By default, when items are stored to Couchbase, the operation is
considered successful if the vBucket mast... | python | def endure(self, key, persist_to=-1, replicate_to=-1, cas=0,
check_removed=False, timeout=5.0, interval=0.010):
"""Wait until a key has been distributed to one or more nodes
By default, when items are stored to Couchbase, the operation is
considered successful if the vBucket mast... | [
"def",
"endure",
"(",
"self",
",",
"key",
",",
"persist_to",
"=",
"-",
"1",
",",
"replicate_to",
"=",
"-",
"1",
",",
"cas",
"=",
"0",
",",
"check_removed",
"=",
"False",
",",
"timeout",
"=",
"5.0",
",",
"interval",
"=",
"0.010",
")",
":",
"# We rea... | Wait until a key has been distributed to one or more nodes
By default, when items are stored to Couchbase, the operation is
considered successful if the vBucket master (i.e. the "primary"
node) for the key has successfully stored the item in its
memory.
In most situations, this... | [
"Wait",
"until",
"a",
"key",
"has",
"been",
"distributed",
"to",
"one",
"or",
"more",
"nodes"
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L995-L1077 |
16,697 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.endure_multi | def endure_multi(self, keys, persist_to=-1, replicate_to=-1,
timeout=5.0, interval=0.010, check_removed=False):
"""Check durability requirements for multiple keys
:param keys: The keys to check
The type of keys may be one of the following:
* Sequence of keys
... | python | def endure_multi(self, keys, persist_to=-1, replicate_to=-1,
timeout=5.0, interval=0.010, check_removed=False):
"""Check durability requirements for multiple keys
:param keys: The keys to check
The type of keys may be one of the following:
* Sequence of keys
... | [
"def",
"endure_multi",
"(",
"self",
",",
"keys",
",",
"persist_to",
"=",
"-",
"1",
",",
"replicate_to",
"=",
"-",
"1",
",",
"timeout",
"=",
"5.0",
",",
"interval",
"=",
"0.010",
",",
"check_removed",
"=",
"False",
")",
":",
"return",
"_Base",
".",
"e... | Check durability requirements for multiple keys
:param keys: The keys to check
The type of keys may be one of the following:
* Sequence of keys
* A :class:`~couchbase.result.MultiResult` object
* A ``dict`` with CAS values as the dictionary value
* A seq... | [
"Check",
"durability",
"requirements",
"for",
"multiple",
"keys"
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1274-L1294 |
16,698 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.remove_multi | def remove_multi(self, kvs, quiet=None):
"""Remove multiple items from the cluster
:param kvs: Iterable of keys to delete from the cluster. If you wish
to specify a CAS for each item, then you may pass a dictionary
of keys mapping to cas, like `remove_multi({k1:cas1, k2:cas2}`)
... | python | def remove_multi(self, kvs, quiet=None):
"""Remove multiple items from the cluster
:param kvs: Iterable of keys to delete from the cluster. If you wish
to specify a CAS for each item, then you may pass a dictionary
of keys mapping to cas, like `remove_multi({k1:cas1, k2:cas2}`)
... | [
"def",
"remove_multi",
"(",
"self",
",",
"kvs",
",",
"quiet",
"=",
"None",
")",
":",
"return",
"_Base",
".",
"remove_multi",
"(",
"self",
",",
"kvs",
",",
"quiet",
"=",
"quiet",
")"
] | Remove multiple items from the cluster
:param kvs: Iterable of keys to delete from the cluster. If you wish
to specify a CAS for each item, then you may pass a dictionary
of keys mapping to cas, like `remove_multi({k1:cas1, k2:cas2}`)
:param quiet: Whether an exception should be... | [
"Remove",
"multiple",
"items",
"from",
"the",
"cluster"
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1296-L1307 |
16,699 | couchbase/couchbase-python-client | couchbase/bucket.py | Bucket.counter_multi | def counter_multi(self, kvs, initial=None, delta=1, ttl=0):
"""Perform counter operations on multiple items
:param kvs: Keys to operate on. See below for more options
:param initial: Initial value to use for all keys.
:param delta: Delta value for all keys.
:param ttl: Expiratio... | python | def counter_multi(self, kvs, initial=None, delta=1, ttl=0):
"""Perform counter operations on multiple items
:param kvs: Keys to operate on. See below for more options
:param initial: Initial value to use for all keys.
:param delta: Delta value for all keys.
:param ttl: Expiratio... | [
"def",
"counter_multi",
"(",
"self",
",",
"kvs",
",",
"initial",
"=",
"None",
",",
"delta",
"=",
"1",
",",
"ttl",
"=",
"0",
")",
":",
"return",
"_Base",
".",
"counter_multi",
"(",
"self",
",",
"kvs",
",",
"initial",
"=",
"initial",
",",
"delta",
"=... | Perform counter operations on multiple items
:param kvs: Keys to operate on. See below for more options
:param initial: Initial value to use for all keys.
:param delta: Delta value for all keys.
:param ttl: Expiration value to use for all keys
:return: A :class:`~.MultiResult` ... | [
"Perform",
"counter",
"operations",
"on",
"multiple",
"items"
] | a7bada167785bf79a29c39f820d932a433a6a535 | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1309-L1352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.