partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | HtmlMixin.drop_tag | Remove the tag, but not its children or text. The children and text
are merged into the parent.
Example::
>>> h = fragment_fromstring('<div>Hello <b>World!</b></div>')
>>> h.find('.//b').drop_tag()
>>> print(tostring(h, encoding='unicode'))
<div>Hello W... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def drop_tag(self):
"""
Remove the tag, but not its children or text. The children and text
are merged into the parent.
Example::
>>> h = fragment_fromstring('<div>Hello <b>World!</b></div>')
>>> h.find('.//b').drop_tag()
>>> print(tostring(h, encod... | def drop_tag(self):
"""
Remove the tag, but not its children or text. The children and text
are merged into the parent.
Example::
>>> h = fragment_fromstring('<div>Hello <b>World!</b></div>')
>>> h.find('.//b').drop_tag()
>>> print(tostring(h, encod... | [
"Remove",
"the",
"tag",
"but",
"not",
"its",
"children",
"or",
"text",
".",
"The",
"children",
"and",
"text",
"are",
"merged",
"into",
"the",
"parent",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L210-L240 | [
"def",
"drop_tag",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"getparent",
"(",
")",
"assert",
"parent",
"is",
"not",
"None",
"previous",
"=",
"self",
".",
"getprevious",
"(",
")",
"if",
"self",
".",
"text",
"and",
"isinstance",
"(",
"self",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.find_rel_links | Find any links like ``<a rel="{rel}">...</a>``; returns a list of elements. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def find_rel_links(self, rel):
"""
Find any links like ``<a rel="{rel}">...</a>``; returns a list of elements.
"""
rel = rel.lower()
return [el for el in _rel_links_xpath(self)
if el.get('rel').lower() == rel] | def find_rel_links(self, rel):
"""
Find any links like ``<a rel="{rel}">...</a>``; returns a list of elements.
"""
rel = rel.lower()
return [el for el in _rel_links_xpath(self)
if el.get('rel').lower() == rel] | [
"Find",
"any",
"links",
"like",
"<a",
"rel",
"=",
"{",
"rel",
"}",
">",
"...",
"<",
"/",
"a",
">",
";",
"returns",
"a",
"list",
"of",
"elements",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L242-L248 | [
"def",
"find_rel_links",
"(",
"self",
",",
"rel",
")",
":",
"rel",
"=",
"rel",
".",
"lower",
"(",
")",
"return",
"[",
"el",
"for",
"el",
"in",
"_rel_links_xpath",
"(",
"self",
")",
"if",
"el",
".",
"get",
"(",
"'rel'",
")",
".",
"lower",
"(",
")"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.get_element_by_id | Get the first element in a document with the given id. If none is
found, return the default argument if provided or raise KeyError
otherwise.
Note that there can be more than one element with the same id,
and this isn't uncommon in HTML documents found in the wild.
Browsers ret... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def get_element_by_id(self, id, *default):
"""
Get the first element in a document with the given id. If none is
found, return the default argument if provided or raise KeyError
otherwise.
Note that there can be more than one element with the same id,
and this isn't unc... | def get_element_by_id(self, id, *default):
"""
Get the first element in a document with the given id. If none is
found, return the default argument if provided or raise KeyError
otherwise.
Note that there can be more than one element with the same id,
and this isn't unc... | [
"Get",
"the",
"first",
"element",
"in",
"a",
"document",
"with",
"the",
"given",
"id",
".",
"If",
"none",
"is",
"found",
"return",
"the",
"default",
"argument",
"if",
"provided",
"or",
"raise",
"KeyError",
"otherwise",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L256-L275 | [
"def",
"get_element_by_id",
"(",
"self",
",",
"id",
",",
"*",
"default",
")",
":",
"try",
":",
"# FIXME: should this check for multiple matches?",
"# browsers just return the first one",
"return",
"_id_xpath",
"(",
"self",
",",
"id",
"=",
"id",
")",
"[",
"0",
"]",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.cssselect | Run the CSS expression on this element and its children,
returning a list of the results.
Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self)
-- note that pre-compiling the expression can provide a substantial
speedup. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def cssselect(self, expr, translator='html'):
"""
Run the CSS expression on this element and its children,
returning a list of the results.
Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self)
-- note that pre-compiling the expression can provide a substantial
... | def cssselect(self, expr, translator='html'):
"""
Run the CSS expression on this element and its children,
returning a list of the results.
Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self)
-- note that pre-compiling the expression can provide a substantial
... | [
"Run",
"the",
"CSS",
"expression",
"on",
"this",
"element",
"and",
"its",
"children",
"returning",
"a",
"list",
"of",
"the",
"results",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L283-L294 | [
"def",
"cssselect",
"(",
"self",
",",
"expr",
",",
"translator",
"=",
"'html'",
")",
":",
"# Do the import here to make the dependency optional.",
"from",
"lxml",
".",
"cssselect",
"import",
"CSSSelector",
"return",
"CSSSelector",
"(",
"expr",
",",
"translator",
"="... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.make_links_absolute | Make all links in the document absolute, given the
``base_url`` for the document (the full URL where the document
came from), or if no ``base_url`` is given, then the ``.base_url``
of the document.
If ``resolve_base_href`` is true, then any ``<base href>``
tags in the document a... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def make_links_absolute(self, base_url=None, resolve_base_href=True,
handle_failures=None):
"""
Make all links in the document absolute, given the
``base_url`` for the document (the full URL where the document
came from), or if no ``base_url`` is given, then t... | def make_links_absolute(self, base_url=None, resolve_base_href=True,
handle_failures=None):
"""
Make all links in the document absolute, given the
``base_url`` for the document (the full URL where the document
came from), or if no ``base_url`` is given, then t... | [
"Make",
"all",
"links",
"in",
"the",
"document",
"absolute",
"given",
"the",
"base_url",
"for",
"the",
"document",
"(",
"the",
"full",
"URL",
"where",
"the",
"document",
"came",
"from",
")",
"or",
"if",
"no",
"base_url",
"is",
"given",
"then",
"the",
"."... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L300-L343 | [
"def",
"make_links_absolute",
"(",
"self",
",",
"base_url",
"=",
"None",
",",
"resolve_base_href",
"=",
"True",
",",
"handle_failures",
"=",
"None",
")",
":",
"if",
"base_url",
"is",
"None",
":",
"base_url",
"=",
"self",
".",
"base_url",
"if",
"base_url",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.resolve_base_href | Find any ``<base href>`` tag in the document, and apply its
values to all links found in the document. Also remove the
tag once it has been applied.
If ``handle_failures`` is None (default), a failure to process
a URL will abort the processing. If set to 'ignore', errors
are i... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def resolve_base_href(self, handle_failures=None):
"""
Find any ``<base href>`` tag in the document, and apply its
values to all links found in the document. Also remove the
tag once it has been applied.
If ``handle_failures`` is None (default), a failure to process
a U... | def resolve_base_href(self, handle_failures=None):
"""
Find any ``<base href>`` tag in the document, and apply its
values to all links found in the document. Also remove the
tag once it has been applied.
If ``handle_failures`` is None (default), a failure to process
a U... | [
"Find",
"any",
"<base",
"href",
">",
"tag",
"in",
"the",
"document",
"and",
"apply",
"its",
"values",
"to",
"all",
"links",
"found",
"in",
"the",
"document",
".",
"Also",
"remove",
"the",
"tag",
"once",
"it",
"has",
"been",
"applied",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L345-L364 | [
"def",
"resolve_base_href",
"(",
"self",
",",
"handle_failures",
"=",
"None",
")",
":",
"base_href",
"=",
"None",
"basetags",
"=",
"self",
".",
"xpath",
"(",
"'//base[@href]|//x:base[@href]'",
",",
"namespaces",
"=",
"{",
"'x'",
":",
"XHTML_NAMESPACE",
"}",
")... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.iterlinks | Yield (element, attribute, link, pos), where attribute may be None
(indicating the link is in the text). ``pos`` is the position
where the link occurs; often 0, but sometimes something else in
the case of links in stylesheets or style tags.
Note: <base href> is *not* taken into account... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def iterlinks(self):
"""
Yield (element, attribute, link, pos), where attribute may be None
(indicating the link is in the text). ``pos`` is the position
where the link occurs; often 0, but sometimes something else in
the case of links in stylesheets or style tags.
Note... | def iterlinks(self):
"""
Yield (element, attribute, link, pos), where attribute may be None
(indicating the link is in the text). ``pos`` is the position
where the link occurs; often 0, but sometimes something else in
the case of links in stylesheets or style tags.
Note... | [
"Yield",
"(",
"element",
"attribute",
"link",
"pos",
")",
"where",
"attribute",
"may",
"be",
"None",
"(",
"indicating",
"the",
"link",
"is",
"in",
"the",
"text",
")",
".",
"pos",
"is",
"the",
"position",
"where",
"the",
"link",
"occurs",
";",
"often",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L366-L454 | [
"def",
"iterlinks",
"(",
"self",
")",
":",
"link_attrs",
"=",
"defs",
".",
"link_attrs",
"for",
"el",
"in",
"self",
".",
"iter",
"(",
"etree",
".",
"Element",
")",
":",
"attribs",
"=",
"el",
".",
"attrib",
"tag",
"=",
"_nons",
"(",
"el",
".",
"tag"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.rewrite_links | Rewrite all the links in the document. For each link
``link_repl_func(link)`` will be called, and the return value
will replace the old link.
Note that links may not be absolute (unless you first called
``make_links_absolute()``), and may be internal (e.g.,
``'#anchor'``). The... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def rewrite_links(self, link_repl_func, resolve_base_href=True,
base_href=None):
"""
Rewrite all the links in the document. For each link
``link_repl_func(link)`` will be called, and the return value
will replace the old link.
Note that links may not be ab... | def rewrite_links(self, link_repl_func, resolve_base_href=True,
base_href=None):
"""
Rewrite all the links in the document. For each link
``link_repl_func(link)`` will be called, and the return value
will replace the old link.
Note that links may not be ab... | [
"Rewrite",
"all",
"the",
"links",
"in",
"the",
"document",
".",
"For",
"each",
"link",
"link_repl_func",
"(",
"link",
")",
"will",
"be",
"called",
"and",
"the",
"return",
"value",
"will",
"replace",
"the",
"old",
"link",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L456-L503 | [
"def",
"rewrite_links",
"(",
"self",
",",
"link_repl_func",
",",
"resolve_base_href",
"=",
"True",
",",
"base_href",
"=",
"None",
")",
":",
"if",
"base_href",
"is",
"not",
"None",
":",
"# FIXME: this can be done in one pass with a wrapper",
"# around link_repl_func",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | FormElement.form_values | Return a list of tuples of the field values for the form.
This is suitable to be passed to ``urllib.urlencode()``. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def form_values(self):
"""
Return a list of tuples of the field values for the form.
This is suitable to be passed to ``urllib.urlencode()``.
"""
results = []
for el in self.inputs:
name = el.name
if not name:
continue
t... | def form_values(self):
"""
Return a list of tuples of the field values for the form.
This is suitable to be passed to ``urllib.urlencode()``.
"""
results = []
for el in self.inputs:
name = el.name
if not name:
continue
t... | [
"Return",
"a",
"list",
"of",
"tuples",
"of",
"the",
"field",
"values",
"for",
"the",
"form",
".",
"This",
"is",
"suitable",
"to",
"be",
"passed",
"to",
"urllib",
".",
"urlencode",
"()",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L857-L887 | [
"def",
"form_values",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"for",
"el",
"in",
"self",
".",
"inputs",
":",
"name",
"=",
"el",
".",
"name",
"if",
"not",
"name",
":",
"continue",
"tag",
"=",
"_nons",
"(",
"el",
".",
"tag",
")",
"if",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | FormElement._action__get | Get/set the form's ``action`` attribute. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def _action__get(self):
"""
Get/set the form's ``action`` attribute.
"""
base_url = self.base_url
action = self.get('action')
if base_url and action is not None:
return urljoin(base_url, action)
else:
return action | def _action__get(self):
"""
Get/set the form's ``action`` attribute.
"""
base_url = self.base_url
action = self.get('action')
if base_url and action is not None:
return urljoin(base_url, action)
else:
return action | [
"Get",
"/",
"set",
"the",
"form",
"s",
"action",
"attribute",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L889-L898 | [
"def",
"_action__get",
"(",
"self",
")",
":",
"base_url",
"=",
"self",
".",
"base_url",
"action",
"=",
"self",
".",
"get",
"(",
"'action'",
")",
"if",
"base_url",
"and",
"action",
"is",
"not",
"None",
":",
"return",
"urljoin",
"(",
"base_url",
",",
"ac... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | TextareaElement._value__get | Get/set the value (which is the contents of this element) | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def _value__get(self):
"""
Get/set the value (which is the contents of this element)
"""
content = self.text or ''
if self.tag.startswith("{%s}" % XHTML_NAMESPACE):
serialisation_method = 'xml'
else:
serialisation_method = 'html'
for el in ... | def _value__get(self):
"""
Get/set the value (which is the contents of this element)
"""
content = self.text or ''
if self.tag.startswith("{%s}" % XHTML_NAMESPACE):
serialisation_method = 'xml'
else:
serialisation_method = 'html'
for el in ... | [
"Get",
"/",
"set",
"the",
"value",
"(",
"which",
"is",
"the",
"contents",
"of",
"this",
"element",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1100-L1113 | [
"def",
"_value__get",
"(",
"self",
")",
":",
"content",
"=",
"self",
".",
"text",
"or",
"''",
"if",
"self",
".",
"tag",
".",
"startswith",
"(",
"\"{%s}\"",
"%",
"XHTML_NAMESPACE",
")",
":",
"serialisation_method",
"=",
"'xml'",
"else",
":",
"serialisation_... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | SelectElement._value__get | Get/set the value of this select (the selected option).
If this is a multi-select, this is a set-like object that
represents all the selected options. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def _value__get(self):
"""
Get/set the value of this select (the selected option).
If this is a multi-select, this is a set-like object that
represents all the selected options.
"""
if self.multiple:
return MultipleSelectOptions(self)
for el in _optio... | def _value__get(self):
"""
Get/set the value of this select (the selected option).
If this is a multi-select, this is a set-like object that
represents all the selected options.
"""
if self.multiple:
return MultipleSelectOptions(self)
for el in _optio... | [
"Get",
"/",
"set",
"the",
"value",
"of",
"this",
"select",
"(",
"the",
"selected",
"option",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1137-L1154 | [
"def",
"_value__get",
"(",
"self",
")",
":",
"if",
"self",
".",
"multiple",
":",
"return",
"MultipleSelectOptions",
"(",
"self",
")",
"for",
"el",
"in",
"_options_xpath",
"(",
"self",
")",
":",
"if",
"el",
".",
"get",
"(",
"'selected'",
")",
"is",
"not... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | SelectElement.value_options | All the possible values this select can have (the ``value``
attribute of all the ``<option>`` elements. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def value_options(self):
"""
All the possible values this select can have (the ``value``
attribute of all the ``<option>`` elements.
"""
options = []
for el in _options_xpath(self):
value = el.get('value')
if value is None:
value = ... | def value_options(self):
"""
All the possible values this select can have (the ``value``
attribute of all the ``<option>`` elements.
"""
options = []
for el in _options_xpath(self):
value = el.get('value')
if value is None:
value = ... | [
"All",
"the",
"possible",
"values",
"this",
"select",
"can",
"have",
"(",
"the",
"value",
"attribute",
"of",
"all",
"the",
"<option",
">",
"elements",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1193-L1206 | [
"def",
"value_options",
"(",
"self",
")",
":",
"options",
"=",
"[",
"]",
"for",
"el",
"in",
"_options_xpath",
"(",
"self",
")",
":",
"value",
"=",
"el",
".",
"get",
"(",
"'value'",
")",
"if",
"value",
"is",
"None",
":",
"value",
"=",
"el",
".",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | InputElement._value__get | Get/set the value of this element, using the ``value`` attribute.
Also, if this is a checkbox and it has no value, this defaults
to ``'on'``. If it is a checkbox or radio that is not
checked, this returns None. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def _value__get(self):
"""
Get/set the value of this element, using the ``value`` attribute.
Also, if this is a checkbox and it has no value, this defaults
to ``'on'``. If it is a checkbox or radio that is not
checked, this returns None.
"""
if self.checkable:
... | def _value__get(self):
"""
Get/set the value of this element, using the ``value`` attribute.
Also, if this is a checkbox and it has no value, this defaults
to ``'on'``. If it is a checkbox or radio that is not
checked, this returns None.
"""
if self.checkable:
... | [
"Get",
"/",
"set",
"the",
"value",
"of",
"this",
"element",
"using",
"the",
"value",
"attribute",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1439-L1452 | [
"def",
"_value__get",
"(",
"self",
")",
":",
"if",
"self",
".",
"checkable",
":",
"if",
"self",
".",
"checked",
":",
"return",
"self",
".",
"get",
"(",
"'value'",
")",
"or",
"'on'",
"else",
":",
"return",
"None",
"return",
"self",
".",
"get",
"(",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | LabelElement._for_element__get | Get/set the element this label points to. Return None if it
can't be found. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def _for_element__get(self):
"""
Get/set the element this label points to. Return None if it
can't be found.
"""
id = self.get('for')
if not id:
return None
return self.body.get_element_by_id(id) | def _for_element__get(self):
"""
Get/set the element this label points to. Return None if it
can't be found.
"""
id = self.get('for')
if not id:
return None
return self.body.get_element_by_id(id) | [
"Get",
"/",
"set",
"the",
"element",
"this",
"label",
"points",
"to",
".",
"Return",
"None",
"if",
"it",
"can",
"t",
"be",
"found",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1517-L1525 | [
"def",
"_for_element__get",
"(",
"self",
")",
":",
"id",
"=",
"self",
".",
"get",
"(",
"'for'",
")",
"if",
"not",
"id",
":",
"return",
"None",
"return",
"self",
".",
"body",
".",
"get_element_by_id",
"(",
"id",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | classpath | given a class/instance return the full class path (eg, prefix.module.Classname)
:param v: class or instance
:returns: string, the full classpath of v | pyt/utils.py | def classpath(v):
"""given a class/instance return the full class path (eg, prefix.module.Classname)
:param v: class or instance
:returns: string, the full classpath of v
"""
if isinstance(v, type):
ret = strclass(v)
else:
ret = strclass(v.__class__)
return ret | def classpath(v):
"""given a class/instance return the full class path (eg, prefix.module.Classname)
:param v: class or instance
:returns: string, the full classpath of v
"""
if isinstance(v, type):
ret = strclass(v)
else:
ret = strclass(v.__class__)
return ret | [
"given",
"a",
"class",
"/",
"instance",
"return",
"the",
"full",
"class",
"path",
"(",
"eg",
"prefix",
".",
"module",
".",
"Classname",
")"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/utils.py#L24-L34 | [
"def",
"classpath",
"(",
"v",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"type",
")",
":",
"ret",
"=",
"strclass",
"(",
"v",
")",
"else",
":",
"ret",
"=",
"strclass",
"(",
"v",
".",
"__class__",
")",
"return",
"ret"
] | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | loghandler_members | iterate through the attributes of every logger's handler
this is used to switch out stderr and stdout in tests when buffer is True
:returns: generator of tuples, each tuple has (name, handler, member_name, member_val) | pyt/utils.py | def loghandler_members():
"""iterate through the attributes of every logger's handler
this is used to switch out stderr and stdout in tests when buffer is True
:returns: generator of tuples, each tuple has (name, handler, member_name, member_val)
"""
Members = namedtuple("Members", ["name", "handl... | def loghandler_members():
"""iterate through the attributes of every logger's handler
this is used to switch out stderr and stdout in tests when buffer is True
:returns: generator of tuples, each tuple has (name, handler, member_name, member_val)
"""
Members = namedtuple("Members", ["name", "handl... | [
"iterate",
"through",
"the",
"attributes",
"of",
"every",
"logger",
"s",
"handler"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/utils.py#L56-L77 | [
"def",
"loghandler_members",
"(",
")",
":",
"Members",
"=",
"namedtuple",
"(",
"\"Members\"",
",",
"[",
"\"name\"",
",",
"\"handler\"",
",",
"\"member_name\"",
",",
"\"member\"",
"]",
")",
"log_manager",
"=",
"logging",
".",
"Logger",
".",
"manager",
"loggers"... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | get_counts | return test counts that are set via pyt environment variables when pyt
runs the test
:returns: dict, 3 keys (classes, tests, modules) and how many tests of each
were found by pyt | pyt/__init__.py | def get_counts():
"""return test counts that are set via pyt environment variables when pyt
runs the test
:returns: dict, 3 keys (classes, tests, modules) and how many tests of each
were found by pyt
"""
counts = {}
ks = [
('PYT_TEST_CLASS_COUNT', "classes"),
('PYT_TEST... | def get_counts():
"""return test counts that are set via pyt environment variables when pyt
runs the test
:returns: dict, 3 keys (classes, tests, modules) and how many tests of each
were found by pyt
"""
counts = {}
ks = [
('PYT_TEST_CLASS_COUNT', "classes"),
('PYT_TEST... | [
"return",
"test",
"counts",
"that",
"are",
"set",
"via",
"pyt",
"environment",
"variables",
"when",
"pyt",
"runs",
"the",
"test"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/__init__.py#L23-L40 | [
"def",
"get_counts",
"(",
")",
":",
"counts",
"=",
"{",
"}",
"ks",
"=",
"[",
"(",
"'PYT_TEST_CLASS_COUNT'",
",",
"\"classes\"",
")",
",",
"(",
"'PYT_TEST_COUNT'",
",",
"\"tests\"",
")",
",",
"(",
"'PYT_TEST_MODULE_COUNT'",
",",
"\"modules\"",
")",
",",
"]"... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | is_single_class | Returns True if only a single class is being run or some tests within a single class | pyt/__init__.py | def is_single_class():
"""Returns True if only a single class is being run or some tests within a single class"""
ret = False
counts = get_counts()
if counts["classes"] < 1 and counts["modules"] < 1:
ret = counts["tests"] > 0
else:
ret = counts["classes"] <= 1 and counts["modules"] <... | def is_single_class():
"""Returns True if only a single class is being run or some tests within a single class"""
ret = False
counts = get_counts()
if counts["classes"] < 1 and counts["modules"] < 1:
ret = counts["tests"] > 0
else:
ret = counts["classes"] <= 1 and counts["modules"] <... | [
"Returns",
"True",
"if",
"only",
"a",
"single",
"class",
"is",
"being",
"run",
"or",
"some",
"tests",
"within",
"a",
"single",
"class"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/__init__.py#L43-L51 | [
"def",
"is_single_class",
"(",
")",
":",
"ret",
"=",
"False",
"counts",
"=",
"get_counts",
"(",
")",
"if",
"counts",
"[",
"\"classes\"",
"]",
"<",
"1",
"and",
"counts",
"[",
"\"modules\"",
"]",
"<",
"1",
":",
"ret",
"=",
"counts",
"[",
"\"tests\"",
"... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | is_single_module | Returns True if only a module is being run | pyt/__init__.py | def is_single_module():
"""Returns True if only a module is being run"""
ret = False
counts = get_counts()
if counts["modules"] == 1:
ret = True
elif counts["modules"] < 1:
ret = is_single_class()
return ret | def is_single_module():
"""Returns True if only a module is being run"""
ret = False
counts = get_counts()
if counts["modules"] == 1:
ret = True
elif counts["modules"] < 1:
ret = is_single_class()
return ret | [
"Returns",
"True",
"if",
"only",
"a",
"module",
"is",
"being",
"run"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/__init__.py#L60-L70 | [
"def",
"is_single_module",
"(",
")",
":",
"ret",
"=",
"False",
"counts",
"=",
"get_counts",
"(",
")",
"if",
"counts",
"[",
"\"modules\"",
"]",
"==",
"1",
":",
"ret",
"=",
"True",
"elif",
"counts",
"[",
"\"modules\"",
"]",
"<",
"1",
":",
"ret",
"=",
... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | validate_params | Validate request params. | service_factory/validation.py | def validate_params(request):
"""Validate request params."""
if 'params' in request:
correct_params = isinstance(request['params'], (list, dict))
error = 'Incorrect parameter values'
assert correct_params, error | def validate_params(request):
"""Validate request params."""
if 'params' in request:
correct_params = isinstance(request['params'], (list, dict))
error = 'Incorrect parameter values'
assert correct_params, error | [
"Validate",
"request",
"params",
"."
] | proofit404/service-factory | python | https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/validation.py#L34-L40 | [
"def",
"validate_params",
"(",
"request",
")",
":",
"if",
"'params'",
"in",
"request",
":",
"correct_params",
"=",
"isinstance",
"(",
"request",
"[",
"'params'",
"]",
",",
"(",
"list",
",",
"dict",
")",
")",
"error",
"=",
"'Incorrect parameter values'",
"ass... | a09d4e097e5599244564a2a7f0611e58efb4156a |
test | validate_id | Validate request id. | service_factory/validation.py | def validate_id(request):
"""Validate request id."""
if 'id' in request:
correct_id = isinstance(
request['id'],
(string_types, int, None),
)
error = 'Incorrect identifier'
assert correct_id, error | def validate_id(request):
"""Validate request id."""
if 'id' in request:
correct_id = isinstance(
request['id'],
(string_types, int, None),
)
error = 'Incorrect identifier'
assert correct_id, error | [
"Validate",
"request",
"id",
"."
] | proofit404/service-factory | python | https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/validation.py#L43-L52 | [
"def",
"validate_id",
"(",
"request",
")",
":",
"if",
"'id'",
"in",
"request",
":",
"correct_id",
"=",
"isinstance",
"(",
"request",
"[",
"'id'",
"]",
",",
"(",
"string_types",
",",
"int",
",",
"None",
")",
",",
")",
"error",
"=",
"'Incorrect identifier'... | a09d4e097e5599244564a2a7f0611e58efb4156a |
test | filesys_decode | Ensure that the given path is decoded,
NONE when no expected encoding works | capybara/virtualenv/lib/python2.7/site-packages/setuptools/unicode_utils.py | def filesys_decode(path):
"""
Ensure that the given path is decoded,
NONE when no expected encoding works
"""
fs_enc = sys.getfilesystemencoding()
if isinstance(path, decoded_string):
return path
for enc in (fs_enc, "utf-8"):
try:
return path.decode(enc)
... | def filesys_decode(path):
"""
Ensure that the given path is decoded,
NONE when no expected encoding works
"""
fs_enc = sys.getfilesystemencoding()
if isinstance(path, decoded_string):
return path
for enc in (fs_enc, "utf-8"):
try:
return path.decode(enc)
... | [
"Ensure",
"that",
"the",
"given",
"path",
"is",
"decoded",
"NONE",
"when",
"no",
"expected",
"encoding",
"works"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/unicode_utils.py#L19-L33 | [
"def",
"filesys_decode",
"(",
"path",
")",
":",
"fs_enc",
"=",
"sys",
".",
"getfilesystemencoding",
"(",
")",
"if",
"isinstance",
"(",
"path",
",",
"decoded_string",
")",
":",
"return",
"path",
"for",
"enc",
"in",
"(",
"fs_enc",
",",
"\"utf-8\"",
")",
":... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _escape_argspec | Helper for various string-wrapped functions. | capybara/virtualenv/lib/python2.7/site-packages/markupsafe/__init__.py | def _escape_argspec(obj, iterable, escape):
"""Helper for various string-wrapped functions."""
for key, value in iterable:
if hasattr(value, '__html__') or isinstance(value, string_types):
obj[key] = escape(value)
return obj | def _escape_argspec(obj, iterable, escape):
"""Helper for various string-wrapped functions."""
for key, value in iterable:
if hasattr(value, '__html__') or isinstance(value, string_types):
obj[key] = escape(value)
return obj | [
"Helper",
"for",
"various",
"string",
"-",
"wrapped",
"functions",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/markupsafe/__init__.py#L267-L272 | [
"def",
"_escape_argspec",
"(",
"obj",
",",
"iterable",
",",
"escape",
")",
":",
"for",
"key",
",",
"value",
"in",
"iterable",
":",
"if",
"hasattr",
"(",
"value",
",",
"'__html__'",
")",
"or",
"isinstance",
"(",
"value",
",",
"string_types",
")",
":",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | codecName | Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding. | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/inputstream.py | def codecName(encoding):
"""Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding."""
if isinstance(encoding, bytes):
try:
encoding = encoding.decode("ascii")
except UnicodeDecodeError:
return None
i... | def codecName(encoding):
"""Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding."""
if isinstance(encoding, bytes):
try:
encoding = encoding.decode("ascii")
except UnicodeDecodeError:
return None
i... | [
"Return",
"the",
"python",
"codec",
"name",
"corresponding",
"to",
"an",
"encoding",
"or",
"None",
"if",
"the",
"string",
"doesn",
"t",
"correspond",
"to",
"a",
"valid",
"encoding",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/inputstream.py#L891-L903 | [
"def",
"codecName",
"(",
"encoding",
")",
":",
"if",
"isinstance",
"(",
"encoding",
",",
"bytes",
")",
":",
"try",
":",
"encoding",
"=",
"encoding",
".",
"decode",
"(",
"\"ascii\"",
")",
"except",
"UnicodeDecodeError",
":",
"return",
"None",
"if",
"encodin... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HTMLBinaryInputStream.detectBOM | Attempts to detect at BOM at the start of the stream. If
an encoding can be determined from the BOM return the name of the
encoding otherwise return None | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/inputstream.py | def detectBOM(self):
"""Attempts to detect at BOM at the start of the stream. If
an encoding can be determined from the BOM return the name of the
encoding otherwise return None"""
bomDict = {
codecs.BOM_UTF8: 'utf-8',
codecs.BOM_UTF16_LE: 'utf-16-le', codecs.BOM_... | def detectBOM(self):
"""Attempts to detect at BOM at the start of the stream. If
an encoding can be determined from the BOM return the name of the
encoding otherwise return None"""
bomDict = {
codecs.BOM_UTF8: 'utf-8',
codecs.BOM_UTF16_LE: 'utf-16-le', codecs.BOM_... | [
"Attempts",
"to",
"detect",
"at",
"BOM",
"at",
"the",
"start",
"of",
"the",
"stream",
".",
"If",
"an",
"encoding",
"can",
"be",
"determined",
"from",
"the",
"BOM",
"return",
"the",
"name",
"of",
"the",
"encoding",
"otherwise",
"return",
"None"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/inputstream.py#L522-L551 | [
"def",
"detectBOM",
"(",
"self",
")",
":",
"bomDict",
"=",
"{",
"codecs",
".",
"BOM_UTF8",
":",
"'utf-8'",
",",
"codecs",
".",
"BOM_UTF16_LE",
":",
"'utf-16-le'",
",",
"codecs",
".",
"BOM_UTF16_BE",
":",
"'utf-16-be'",
",",
"codecs",
".",
"BOM_UTF32_LE",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | ProxyFix.get_remote_addr | Selects the new remote addr from the given list of ips in
X-Forwarded-For. By default it picks the one that the `num_proxies`
proxy server provides. Before 0.9 it would always pick the first.
.. versionadded:: 0.8 | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/fixers.py | def get_remote_addr(self, forwarded_for):
"""Selects the new remote addr from the given list of ips in
X-Forwarded-For. By default it picks the one that the `num_proxies`
proxy server provides. Before 0.9 it would always pick the first.
.. versionadded:: 0.8
"""
if len... | def get_remote_addr(self, forwarded_for):
"""Selects the new remote addr from the given list of ips in
X-Forwarded-For. By default it picks the one that the `num_proxies`
proxy server provides. Before 0.9 it would always pick the first.
.. versionadded:: 0.8
"""
if len... | [
"Selects",
"the",
"new",
"remote",
"addr",
"from",
"the",
"given",
"list",
"of",
"ips",
"in",
"X",
"-",
"Forwarded",
"-",
"For",
".",
"By",
"default",
"it",
"picks",
"the",
"one",
"that",
"the",
"num_proxies",
"proxy",
"server",
"provides",
".",
"Before"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/fixers.py#L120-L128 | [
"def",
"get_remote_addr",
"(",
"self",
",",
"forwarded_for",
")",
":",
"if",
"len",
"(",
"forwarded_for",
")",
">=",
"self",
".",
"num_proxies",
":",
"return",
"forwarded_for",
"[",
"-",
"1",
"*",
"self",
".",
"num_proxies",
"]"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | sub_symbols | Substitutes symbols in CLDR number pattern. | pricing/price.py | def sub_symbols(pattern, code, symbol):
"""Substitutes symbols in CLDR number pattern."""
return pattern.replace('¤¤', code).replace('¤', symbol) | def sub_symbols(pattern, code, symbol):
"""Substitutes symbols in CLDR number pattern."""
return pattern.replace('¤¤', code).replace('¤', symbol) | [
"Substitutes",
"symbols",
"in",
"CLDR",
"number",
"pattern",
"."
] | joeblackwaslike/pricing | python | https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/price.py#L31-L33 | [
"def",
"sub_symbols",
"(",
"pattern",
",",
"code",
",",
"symbol",
")",
":",
"return",
"pattern",
".",
"replace",
"(",
"'¤¤', ",
"c",
"de).",
"r",
"e",
"place('",
"¤",
"', s",
"y",
"bol)",
""
] | be988b0851b4313af81f1db475bc33248700e39c |
test | amount_converter | Converts amount value from several types into Decimal. | pricing/price.py | def amount_converter(obj):
"""Converts amount value from several types into Decimal."""
if isinstance(obj, Decimal):
return obj
elif isinstance(obj, (str, int, float)):
return Decimal(str(obj))
else:
raise ValueError('do not know how to convert: {}'.format(type(obj))) | def amount_converter(obj):
"""Converts amount value from several types into Decimal."""
if isinstance(obj, Decimal):
return obj
elif isinstance(obj, (str, int, float)):
return Decimal(str(obj))
else:
raise ValueError('do not know how to convert: {}'.format(type(obj))) | [
"Converts",
"amount",
"value",
"from",
"several",
"types",
"into",
"Decimal",
"."
] | joeblackwaslike/pricing | python | https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/price.py#L36-L43 | [
"def",
"amount_converter",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"Decimal",
")",
":",
"return",
"obj",
"elif",
"isinstance",
"(",
"obj",
",",
"(",
"str",
",",
"int",
",",
"float",
")",
")",
":",
"return",
"Decimal",
"(",
"str",
... | be988b0851b4313af81f1db475bc33248700e39c |
test | fromstring | Parse a string of HTML data into an Element tree using the
BeautifulSoup parser.
Returns the root ``<html>`` Element of the tree.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword. By default... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py | def fromstring(data, beautifulsoup=None, makeelement=None, **bsargs):
"""Parse a string of HTML data into an Element tree using the
BeautifulSoup parser.
Returns the root ``<html>`` Element of the tree.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffen... | def fromstring(data, beautifulsoup=None, makeelement=None, **bsargs):
"""Parse a string of HTML data into an Element tree using the
BeautifulSoup parser.
Returns the root ``<html>`` Element of the tree.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffen... | [
"Parse",
"a",
"string",
"of",
"HTML",
"data",
"into",
"an",
"Element",
"tree",
"using",
"the",
"BeautifulSoup",
"parser",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py#L11-L23 | [
"def",
"fromstring",
"(",
"data",
",",
"beautifulsoup",
"=",
"None",
",",
"makeelement",
"=",
"None",
",",
"*",
"*",
"bsargs",
")",
":",
"return",
"_parse",
"(",
"data",
",",
"beautifulsoup",
",",
"makeelement",
",",
"*",
"*",
"bsargs",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse | Parse a file into an ElemenTree using the BeautifulSoup parser.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword. By default, the standard
``BeautifulSoup`` class and the default factory of `lxml... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py | def parse(file, beautifulsoup=None, makeelement=None, **bsargs):
"""Parse a file into an ElemenTree using the BeautifulSoup parser.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword. By default, t... | def parse(file, beautifulsoup=None, makeelement=None, **bsargs):
"""Parse a file into an ElemenTree using the BeautifulSoup parser.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword. By default, t... | [
"Parse",
"a",
"file",
"into",
"an",
"ElemenTree",
"using",
"the",
"BeautifulSoup",
"parser",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py#L25-L37 | [
"def",
"parse",
"(",
"file",
",",
"beautifulsoup",
"=",
"None",
",",
"makeelement",
"=",
"None",
",",
"*",
"*",
"bsargs",
")",
":",
"if",
"not",
"hasattr",
"(",
"file",
",",
"'read'",
")",
":",
"file",
"=",
"open",
"(",
"file",
")",
"root",
"=",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | convert_tree | Convert a BeautifulSoup tree to a list of Element trees.
Returns a list instead of a single root Element to support
HTML-like soup with more than one root element.
You can pass a different Element factory through the `makeelement`
keyword. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py | def convert_tree(beautiful_soup_tree, makeelement=None):
"""Convert a BeautifulSoup tree to a list of Element trees.
Returns a list instead of a single root Element to support
HTML-like soup with more than one root element.
You can pass a different Element factory through the `makeelement`
keyword... | def convert_tree(beautiful_soup_tree, makeelement=None):
"""Convert a BeautifulSoup tree to a list of Element trees.
Returns a list instead of a single root Element to support
HTML-like soup with more than one root element.
You can pass a different Element factory through the `makeelement`
keyword... | [
"Convert",
"a",
"BeautifulSoup",
"tree",
"to",
"a",
"list",
"of",
"Element",
"trees",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/soupparser.py#L39-L54 | [
"def",
"convert_tree",
"(",
"beautiful_soup_tree",
",",
"makeelement",
"=",
"None",
")",
":",
"if",
"makeelement",
"is",
"None",
":",
"makeelement",
"=",
"html",
".",
"html_parser",
".",
"makeelement",
"root",
"=",
"_convert_tree",
"(",
"beautiful_soup_tree",
",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | get_current_traceback | Get the current exception info as `Traceback` object. Per default
calling this method will reraise system exceptions such as generator exit,
system exit or others. This behavior can be disabled by passing `False`
to the function as first parameter. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py | def get_current_traceback(ignore_system_exceptions=False,
show_hidden_frames=False, skip=0):
"""Get the current exception info as `Traceback` object. Per default
calling this method will reraise system exceptions such as generator exit,
system exit or others. This behavior can be... | def get_current_traceback(ignore_system_exceptions=False,
show_hidden_frames=False, skip=0):
"""Get the current exception info as `Traceback` object. Per default
calling this method will reraise system exceptions such as generator exit,
system exit or others. This behavior can be... | [
"Get",
"the",
"current",
"exception",
"info",
"as",
"Traceback",
"object",
".",
"Per",
"default",
"calling",
"this",
"method",
"will",
"reraise",
"system",
"exceptions",
"such",
"as",
"generator",
"exit",
"system",
"exit",
"or",
"others",
".",
"This",
"behavio... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L152-L169 | [
"def",
"get_current_traceback",
"(",
"ignore_system_exceptions",
"=",
"False",
",",
"show_hidden_frames",
"=",
"False",
",",
"skip",
"=",
"0",
")",
":",
"exc_type",
",",
"exc_value",
",",
"tb",
"=",
"sys",
".",
"exc_info",
"(",
")",
"if",
"ignore_system_except... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Traceback.exception | String representation of the exception. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py | def exception(self):
"""String representation of the exception."""
buf = traceback.format_exception_only(self.exc_type, self.exc_value)
rv = ''.join(buf).strip()
return rv.decode('utf-8', 'replace') if PY2 else rv | def exception(self):
"""String representation of the exception."""
buf = traceback.format_exception_only(self.exc_type, self.exc_value)
rv = ''.join(buf).strip()
return rv.decode('utf-8', 'replace') if PY2 else rv | [
"String",
"representation",
"of",
"the",
"exception",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L260-L264 | [
"def",
"exception",
"(",
"self",
")",
":",
"buf",
"=",
"traceback",
".",
"format_exception_only",
"(",
"self",
".",
"exc_type",
",",
"self",
".",
"exc_value",
")",
"rv",
"=",
"''",
".",
"join",
"(",
"buf",
")",
".",
"strip",
"(",
")",
"return",
"rv",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Traceback.render_summary | Render the traceback for the interactive console. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py | def render_summary(self, include_title=True):
"""Render the traceback for the interactive console."""
title = ''
frames = []
classes = ['traceback']
if not self.frames:
classes.append('noframe-traceback')
if include_title:
if self.is_syntax_error:... | def render_summary(self, include_title=True):
"""Render the traceback for the interactive console."""
title = ''
frames = []
classes = ['traceback']
if not self.frames:
classes.append('noframe-traceback')
if include_title:
if self.is_syntax_error:... | [
"Render",
"the",
"traceback",
"for",
"the",
"interactive",
"console",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L299-L329 | [
"def",
"render_summary",
"(",
"self",
",",
"include_title",
"=",
"True",
")",
":",
"title",
"=",
"''",
"frames",
"=",
"[",
"]",
"classes",
"=",
"[",
"'traceback'",
"]",
"if",
"not",
"self",
".",
"frames",
":",
"classes",
".",
"append",
"(",
"'noframe-t... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Traceback.generate_plaintext_traceback | Like the plaintext attribute but returns a generator | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py | def generate_plaintext_traceback(self):
"""Like the plaintext attribute but returns a generator"""
yield u'Traceback (most recent call last):'
for frame in self.frames:
yield u' File "%s", line %s, in %s' % (
frame.filename,
frame.lineno,
... | def generate_plaintext_traceback(self):
"""Like the plaintext attribute but returns a generator"""
yield u'Traceback (most recent call last):'
for frame in self.frames:
yield u' File "%s", line %s, in %s' % (
frame.filename,
frame.lineno,
... | [
"Like",
"the",
"plaintext",
"attribute",
"but",
"returns",
"a",
"generator"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L347-L357 | [
"def",
"generate_plaintext_traceback",
"(",
"self",
")",
":",
"yield",
"u'Traceback (most recent call last):'",
"for",
"frame",
"in",
"self",
".",
"frames",
":",
"yield",
"u' File \"%s\", line %s, in %s'",
"%",
"(",
"frame",
".",
"filename",
",",
"frame",
".",
"lin... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Frame.get_annotated_lines | Helper function that returns lines with extra information. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py | def get_annotated_lines(self):
"""Helper function that returns lines with extra information."""
lines = [Line(idx + 1, x) for idx, x in enumerate(self.sourcelines)]
# find function definition and mark lines
if hasattr(self.code, 'co_firstlineno'):
lineno = self.code.co_first... | def get_annotated_lines(self):
"""Helper function that returns lines with extra information."""
lines = [Line(idx + 1, x) for idx, x in enumerate(self.sourcelines)]
# find function definition and mark lines
if hasattr(self.code, 'co_firstlineno'):
lineno = self.code.co_first... | [
"Helper",
"function",
"that",
"returns",
"lines",
"with",
"extra",
"information",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L406-L431 | [
"def",
"get_annotated_lines",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"Line",
"(",
"idx",
"+",
"1",
",",
"x",
")",
"for",
"idx",
",",
"x",
"in",
"enumerate",
"(",
"self",
".",
"sourcelines",
")",
"]",
"# find function definition and mark lines",
"if",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Frame.render_source | Render the sourcecode. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py | def render_source(self):
"""Render the sourcecode."""
return SOURCE_TABLE_HTML % u'\n'.join(line.render() for line in
self.get_annotated_lines()) | def render_source(self):
"""Render the sourcecode."""
return SOURCE_TABLE_HTML % u'\n'.join(line.render() for line in
self.get_annotated_lines()) | [
"Render",
"the",
"sourcecode",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/debug/tbtools.py#L433-L436 | [
"def",
"render_source",
"(",
"self",
")",
":",
"return",
"SOURCE_TABLE_HTML",
"%",
"u'\\n'",
".",
"join",
"(",
"line",
".",
"render",
"(",
")",
"for",
"line",
"in",
"self",
".",
"get_annotated_lines",
"(",
")",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | egg_info_matches | Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param search_name: The name of the package this belongs to. None to
infer the name. Note that this cannot unambiguously parse strings
like foo-2-2 which might be foo, 2-2 or foo-2, 2.
:param link: The... | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def egg_info_matches(
egg_info, search_name, link,
_egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
"""Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param search_name: The name of the package this belongs to. None to
inf... | def egg_info_matches(
egg_info, search_name, link,
_egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
"""Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param search_name: The name of the package this belongs to. None to
inf... | [
"Pull",
"the",
"version",
"part",
"out",
"of",
"a",
"string",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L813-L839 | [
"def",
"egg_info_matches",
"(",
"egg_info",
",",
"search_name",
",",
"link",
",",
"_egg_info_re",
"=",
"re",
".",
"compile",
"(",
"r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)'",
",",
"re",
".",
"I",
")",
")",
":",
"match",
"=",
"_egg_info_re",
".",
"search",
"(",
"egg_... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._sort_locations | Sort locations into "files" (archives) and "urls", and return
a pair of lists (files,urls) | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _sort_locations(locations, expand_dir=False):
"""
Sort locations into "files" (archives) and "urls", and return
a pair of lists (files,urls)
"""
files = []
urls = []
# puts the url for the given file path into the appropriate list
def sort_path(path):... | def _sort_locations(locations, expand_dir=False):
"""
Sort locations into "files" (archives) and "urls", and return
a pair of lists (files,urls)
"""
files = []
urls = []
# puts the url for the given file path into the appropriate list
def sort_path(path):... | [
"Sort",
"locations",
"into",
"files",
"(",
"archives",
")",
"and",
"urls",
"and",
"return",
"a",
"pair",
"of",
"lists",
"(",
"files",
"urls",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L204-L242 | [
"def",
"_sort_locations",
"(",
"locations",
",",
"expand_dir",
"=",
"False",
")",
":",
"files",
"=",
"[",
"]",
"urls",
"=",
"[",
"]",
"# puts the url for the given file path into the appropriate list",
"def",
"sort_path",
"(",
"path",
")",
":",
"url",
"=",
"path... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._candidate_sort_key | Function used to generate link sort key for link tuples.
The greater the return value, the more preferred it is.
If not finding wheels, then sorted by version only.
If finding wheels, then the sort order is by version, then:
1. existing installs
2. wheels ordered via Wheel.su... | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _candidate_sort_key(self, candidate):
"""
Function used to generate link sort key for link tuples.
The greater the return value, the more preferred it is.
If not finding wheels, then sorted by version only.
If finding wheels, then the sort order is by version, then:
... | def _candidate_sort_key(self, candidate):
"""
Function used to generate link sort key for link tuples.
The greater the return value, the more preferred it is.
If not finding wheels, then sorted by version only.
If finding wheels, then the sort order is by version, then:
... | [
"Function",
"used",
"to",
"generate",
"link",
"sort",
"key",
"for",
"link",
"tuples",
".",
"The",
"greater",
"the",
"return",
"value",
"the",
"more",
"preferred",
"it",
"is",
".",
"If",
"not",
"finding",
"wheels",
"then",
"sorted",
"by",
"version",
"only",... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L244-L271 | [
"def",
"_candidate_sort_key",
"(",
"self",
",",
"candidate",
")",
":",
"support_num",
"=",
"len",
"(",
"supported_tags",
")",
"if",
"candidate",
".",
"location",
"==",
"INSTALLED_VERSION",
":",
"pri",
"=",
"1",
"elif",
"candidate",
".",
"location",
".",
"is_... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._sort_versions | Bring the latest version (and wheels) to the front, but maintain the
existing ordering as secondary. See the docstring for `_link_sort_key`
for details. This function is isolated for easier unit testing. | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _sort_versions(self, applicable_versions):
"""
Bring the latest version (and wheels) to the front, but maintain the
existing ordering as secondary. See the docstring for `_link_sort_key`
for details. This function is isolated for easier unit testing.
"""
return sorted... | def _sort_versions(self, applicable_versions):
"""
Bring the latest version (and wheels) to the front, but maintain the
existing ordering as secondary. See the docstring for `_link_sort_key`
for details. This function is isolated for easier unit testing.
"""
return sorted... | [
"Bring",
"the",
"latest",
"version",
"(",
"and",
"wheels",
")",
"to",
"the",
"front",
"but",
"maintain",
"the",
"existing",
"ordering",
"as",
"secondary",
".",
"See",
"the",
"docstring",
"for",
"_link_sort_key",
"for",
"details",
".",
"This",
"function",
"is... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L273-L283 | [
"def",
"_sort_versions",
"(",
"self",
",",
"applicable_versions",
")",
":",
"return",
"sorted",
"(",
"applicable_versions",
",",
"key",
"=",
"self",
".",
"_candidate_sort_key",
",",
"reverse",
"=",
"True",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._get_index_urls_locations | Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _get_index_urls_locations(self, project_name):
"""Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations
"""
def mkurl_pypi_url(url):
loc = posixpath.join(url, proj... | def _get_index_urls_locations(self, project_name):
"""Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations
"""
def mkurl_pypi_url(url):
loc = posixpath.join(url, proj... | [
"Returns",
"the",
"locations",
"found",
"via",
"self",
".",
"index_urls"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L349-L394 | [
"def",
"_get_index_urls_locations",
"(",
"self",
",",
"project_name",
")",
":",
"def",
"mkurl_pypi_url",
"(",
"url",
")",
":",
"loc",
"=",
"posixpath",
".",
"join",
"(",
"url",
",",
"project_url_name",
")",
"# For maximum compatibility with easy_install, ensure the pa... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._find_all_versions | Find all available versions for project_name
This checks index_urls, find_links and dependency_links
All versions found are returned
See _link_package_versions for details on which files are accepted | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _find_all_versions(self, project_name):
"""Find all available versions for project_name
This checks index_urls, find_links and dependency_links
All versions found are returned
See _link_package_versions for details on which files are accepted
"""
index_locations = s... | def _find_all_versions(self, project_name):
"""Find all available versions for project_name
This checks index_urls, find_links and dependency_links
All versions found are returned
See _link_package_versions for details on which files are accepted
"""
index_locations = s... | [
"Find",
"all",
"available",
"versions",
"for",
"project_name"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L396-L477 | [
"def",
"_find_all_versions",
"(",
"self",
",",
"project_name",
")",
":",
"index_locations",
"=",
"self",
".",
"_get_index_urls_locations",
"(",
"project_name",
")",
"index_file_loc",
",",
"index_url_loc",
"=",
"self",
".",
"_sort_locations",
"(",
"index_locations",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder.find_requirement | Try to find an InstallationCandidate for req
Expects req, an InstallRequirement and upgrade, a boolean
Returns an InstallationCandidate or None
May raise DistributionNotFound or BestVersionAlreadyInstalled | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def find_requirement(self, req, upgrade):
"""Try to find an InstallationCandidate for req
Expects req, an InstallRequirement and upgrade, a boolean
Returns an InstallationCandidate or None
May raise DistributionNotFound or BestVersionAlreadyInstalled
"""
all_versions = s... | def find_requirement(self, req, upgrade):
"""Try to find an InstallationCandidate for req
Expects req, an InstallRequirement and upgrade, a boolean
Returns an InstallationCandidate or None
May raise DistributionNotFound or BestVersionAlreadyInstalled
"""
all_versions = s... | [
"Try",
"to",
"find",
"an",
"InstallationCandidate",
"for",
"req"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L479-L592 | [
"def",
"find_requirement",
"(",
"self",
",",
"req",
",",
"upgrade",
")",
":",
"all_versions",
"=",
"self",
".",
"_find_all_versions",
"(",
"req",
".",
"name",
")",
"# Filter out anything which doesn't match our specifier",
"_versions",
"=",
"set",
"(",
"req",
".",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._get_pages | Yields (page, page_url) from the given locations, skipping
locations that have errors, and adding download/homepage links | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _get_pages(self, locations, project_name):
"""
Yields (page, page_url) from the given locations, skipping
locations that have errors, and adding download/homepage links
"""
all_locations = list(locations)
seen = set()
normalized = normalize_name(project_name)
... | def _get_pages(self, locations, project_name):
"""
Yields (page, page_url) from the given locations, skipping
locations that have errors, and adding download/homepage links
"""
all_locations = list(locations)
seen = set()
normalized = normalize_name(project_name)
... | [
"Yields",
"(",
"page",
"page_url",
")",
"from",
"the",
"given",
"locations",
"skipping",
"locations",
"that",
"have",
"errors",
"and",
"adding",
"download",
"/",
"homepage",
"links"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L618-L663 | [
"def",
"_get_pages",
"(",
"self",
",",
"locations",
",",
"project_name",
")",
":",
"all_locations",
"=",
"list",
"(",
"locations",
")",
"seen",
"=",
"set",
"(",
")",
"normalized",
"=",
"normalize_name",
"(",
"project_name",
")",
"while",
"all_locations",
":"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._sort_links | Returns elements of links in order, non-egg links first, egg links
second, while eliminating duplicates | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _sort_links(self, links):
"""
Returns elements of links in order, non-egg links first, egg links
second, while eliminating duplicates
"""
eggs, no_eggs = [], []
seen = set()
for link in links:
if link not in seen:
seen.add(link)
... | def _sort_links(self, links):
"""
Returns elements of links in order, non-egg links first, egg links
second, while eliminating duplicates
"""
eggs, no_eggs = [], []
seen = set()
for link in links:
if link not in seen:
seen.add(link)
... | [
"Returns",
"elements",
"of",
"links",
"in",
"order",
"non",
"-",
"egg",
"links",
"first",
"egg",
"links",
"second",
"while",
"eliminating",
"duplicates"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L667-L681 | [
"def",
"_sort_links",
"(",
"self",
",",
"links",
")",
":",
"eggs",
",",
"no_eggs",
"=",
"[",
"]",
",",
"[",
"]",
"seen",
"=",
"set",
"(",
")",
"for",
"link",
"in",
"links",
":",
"if",
"link",
"not",
"in",
"seen",
":",
"seen",
".",
"add",
"(",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageFinder._link_package_versions | Return an InstallationCandidate or None | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _link_package_versions(self, link, search):
"""Return an InstallationCandidate or None"""
platform = get_platform()
version = None
if link.egg_fragment:
egg_info = link.egg_fragment
ext = link.ext
else:
egg_info, ext = link.splitext()
... | def _link_package_versions(self, link, search):
"""Return an InstallationCandidate or None"""
platform = get_platform()
version = None
if link.egg_fragment:
egg_info = link.egg_fragment
ext = link.ext
else:
egg_info, ext = link.splitext()
... | [
"Return",
"an",
"InstallationCandidate",
"or",
"None"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L696-L807 | [
"def",
"_link_package_versions",
"(",
"self",
",",
"link",
",",
"search",
")",
":",
"platform",
"=",
"get_platform",
"(",
")",
"version",
"=",
"None",
"if",
"link",
".",
"egg_fragment",
":",
"egg_info",
"=",
"link",
".",
"egg_fragment",
"ext",
"=",
"link",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HTMLPage._get_content_type | Get the Content-Type of the given url, using a HEAD request | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def _get_content_type(url, session):
"""Get the Content-Type of the given url, using a HEAD request"""
scheme, netloc, path, query, fragment = urllib_parse.urlsplit(url)
if scheme not in ('http', 'https'):
# FIXME: some warning or something?
# assertion error?
... | def _get_content_type(url, session):
"""Get the Content-Type of the given url, using a HEAD request"""
scheme, netloc, path, query, fragment = urllib_parse.urlsplit(url)
if scheme not in ('http', 'https'):
# FIXME: some warning or something?
# assertion error?
... | [
"Get",
"the",
"Content",
"-",
"Type",
"of",
"the",
"given",
"url",
"using",
"a",
"HEAD",
"request"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L965-L976 | [
"def",
"_get_content_type",
"(",
"url",
",",
"session",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"query",
",",
"fragment",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
"if",
"scheme",
"not",
"in",
"(",
"'http'",
",",
"'https'",
")... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HTMLPage.links | Yields all links in the page | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def links(self):
"""Yields all links in the page"""
for anchor in self.parsed.findall(".//a"):
if anchor.get("href"):
href = anchor.get("href")
url = self.clean_link(
urllib_parse.urljoin(self.base_url, href)
)
... | def links(self):
"""Yields all links in the page"""
for anchor in self.parsed.findall(".//a"):
if anchor.get("href"):
href = anchor.get("href")
url = self.clean_link(
urllib_parse.urljoin(self.base_url, href)
)
... | [
"Yields",
"all",
"links",
"in",
"the",
"page"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L1004-L1025 | [
"def",
"links",
"(",
"self",
")",
":",
"for",
"anchor",
"in",
"self",
".",
"parsed",
".",
"findall",
"(",
"\".//a\"",
")",
":",
"if",
"anchor",
".",
"get",
"(",
"\"href\"",
")",
":",
"href",
"=",
"anchor",
".",
"get",
"(",
"\"href\"",
")",
"url",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Link.verifiable | Returns True if this link can be verified after download, False if it
cannot, and None if we cannot determine. | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def verifiable(self):
"""
Returns True if this link can be verified after download, False if it
cannot, and None if we cannot determine.
"""
trusted = self.trusted or getattr(self.comes_from, "trusted", None)
if trusted is not None and trusted:
# This link cam... | def verifiable(self):
"""
Returns True if this link can be verified after download, False if it
cannot, and None if we cannot determine.
"""
trusted = self.trusted or getattr(self.comes_from, "trusted", None)
if trusted is not None and trusted:
# This link cam... | [
"Returns",
"True",
"if",
"this",
"link",
"can",
"be",
"verified",
"after",
"download",
"False",
"if",
"it",
"cannot",
"and",
"None",
"if",
"we",
"cannot",
"determine",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L1172-L1204 | [
"def",
"verifiable",
"(",
"self",
")",
":",
"trusted",
"=",
"self",
".",
"trusted",
"or",
"getattr",
"(",
"self",
".",
"comes_from",
",",
"\"trusted\"",
",",
"None",
")",
"if",
"trusted",
"is",
"not",
"None",
"and",
"trusted",
":",
"# This link came from a... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Link.is_artifact | Determines if this points to an actual artifact (e.g. a tarball) or if
it points to an "abstract" thing like a path or a VCS location. | capybara/virtualenv/lib/python2.7/site-packages/pip/index.py | def is_artifact(self):
"""
Determines if this points to an actual artifact (e.g. a tarball) or if
it points to an "abstract" thing like a path or a VCS location.
"""
from pip.vcs import vcs
if self.scheme in vcs.all_schemes:
return False
return True | def is_artifact(self):
"""
Determines if this points to an actual artifact (e.g. a tarball) or if
it points to an "abstract" thing like a path or a VCS location.
"""
from pip.vcs import vcs
if self.scheme in vcs.all_schemes:
return False
return True | [
"Determines",
"if",
"this",
"points",
"to",
"an",
"actual",
"artifact",
"(",
"e",
".",
"g",
".",
"a",
"tarball",
")",
"or",
"if",
"it",
"points",
"to",
"an",
"abstract",
"thing",
"like",
"a",
"path",
"or",
"a",
"VCS",
"location",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/index.py#L1211-L1221 | [
"def",
"is_artifact",
"(",
"self",
")",
":",
"from",
"pip",
".",
"vcs",
"import",
"vcs",
"if",
"self",
".",
"scheme",
"in",
"vcs",
".",
"all_schemes",
":",
"return",
"False",
"return",
"True"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | build_py._get_data_files | Generate list of '(package,src_dir,build_dir,filenames)' tuples | capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py | def _get_data_files(self):
"""Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
self.analyze_manifest()
data = []
for package in self.packages or ():
# Locate package source directory
src_dir = self.get_package_dir(package)
# Compute ... | def _get_data_files(self):
"""Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
self.analyze_manifest()
data = []
for package in self.packages or ():
# Locate package source directory
src_dir = self.get_package_dir(package)
# Compute ... | [
"Generate",
"list",
"of",
"(",
"package",
"src_dir",
"build_dir",
"filenames",
")",
"tuples"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py#L70-L89 | [
"def",
"_get_data_files",
"(",
"self",
")",
":",
"self",
".",
"analyze_manifest",
"(",
")",
"data",
"=",
"[",
"]",
"for",
"package",
"in",
"self",
".",
"packages",
"or",
"(",
")",
":",
"# Locate package source directory",
"src_dir",
"=",
"self",
".",
"get_... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | build_py.find_data_files | Return filenames for package's data files in 'src_dir | capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py | def find_data_files(self, package, src_dir):
"""Return filenames for package's data files in 'src_dir'"""
globs = (self.package_data.get('', [])
+ self.package_data.get(package, []))
files = self.manifest_files.get(package, [])[:]
for pattern in globs:
# Each... | def find_data_files(self, package, src_dir):
"""Return filenames for package's data files in 'src_dir'"""
globs = (self.package_data.get('', [])
+ self.package_data.get(package, []))
files = self.manifest_files.get(package, [])[:]
for pattern in globs:
# Each... | [
"Return",
"filenames",
"for",
"package",
"s",
"data",
"files",
"in",
"src_dir"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py#L91-L99 | [
"def",
"find_data_files",
"(",
"self",
",",
"package",
",",
"src_dir",
")",
":",
"globs",
"=",
"(",
"self",
".",
"package_data",
".",
"get",
"(",
"''",
",",
"[",
"]",
")",
"+",
"self",
".",
"package_data",
".",
"get",
"(",
"package",
",",
"[",
"]",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | build_py.check_package | Check namespace packages' __init__ for declare_namespace | capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py | def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
return self.packages_checked[package]
except KeyError:
pass
init_py = orig.build_py.check_package(self, package, package_dir)
self.packages_... | def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
return self.packages_checked[package]
except KeyError:
pass
init_py = orig.build_py.check_package(self, package, package_dir)
self.packages_... | [
"Check",
"namespace",
"packages",
"__init__",
"for",
"declare_namespace"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py#L141-L171 | [
"def",
"check_package",
"(",
"self",
",",
"package",
",",
"package_dir",
")",
":",
"try",
":",
"return",
"self",
".",
"packages_checked",
"[",
"package",
"]",
"except",
"KeyError",
":",
"pass",
"init_py",
"=",
"orig",
".",
"build_py",
".",
"check_package",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | build_py.exclude_data_files | Filter filenames for package's data files in 'src_dir | capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py | def exclude_data_files(self, package, src_dir, files):
"""Filter filenames for package's data files in 'src_dir'"""
globs = (self.exclude_package_data.get('', [])
+ self.exclude_package_data.get(package, []))
bad = []
for pattern in globs:
bad.extend(
... | def exclude_data_files(self, package, src_dir, files):
"""Filter filenames for package's data files in 'src_dir'"""
globs = (self.exclude_package_data.get('', [])
+ self.exclude_package_data.get(package, []))
bad = []
for pattern in globs:
bad.extend(
... | [
"Filter",
"filenames",
"for",
"package",
"s",
"data",
"files",
"in",
"src_dir"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py#L183-L199 | [
"def",
"exclude_data_files",
"(",
"self",
",",
"package",
",",
"src_dir",
",",
"files",
")",
":",
"globs",
"=",
"(",
"self",
".",
"exclude_package_data",
".",
"get",
"(",
"''",
",",
"[",
"]",
")",
"+",
"self",
".",
"exclude_package_data",
".",
"get",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse_requirements | Parse a requirements file and yield InstallRequirement instances.
:param filename: Path or url of requirements file.
:param finder: Instance of pip.index.PackageFinder.
:param comes_from: Origin description of requirements.
:param options: Global options.
:param session: Instance o... | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py | def parse_requirements(filename, finder=None, comes_from=None, options=None,
session=None, wheel_cache=None):
"""
Parse a requirements file and yield InstallRequirement instances.
:param filename: Path or url of requirements file.
:param finder: Instance of pip.index.Pack... | def parse_requirements(filename, finder=None, comes_from=None, options=None,
session=None, wheel_cache=None):
"""
Parse a requirements file and yield InstallRequirement instances.
:param filename: Path or url of requirements file.
:param finder: Instance of pip.index.Pack... | [
"Parse",
"a",
"requirements",
"file",
"and",
"yield",
"InstallRequirement",
"instances",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py#L56-L87 | [
"def",
"parse_requirements",
"(",
"filename",
",",
"finder",
"=",
"None",
",",
"comes_from",
"=",
"None",
",",
"options",
"=",
"None",
",",
"session",
"=",
"None",
",",
"wheel_cache",
"=",
"None",
")",
":",
"if",
"session",
"is",
"None",
":",
"raise",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | process_line | Process a single requirements line; This can result in creating/yielding
requirements, or updating the finder.
For lines that contain requirements, the only options that have an effect
are from SUPPORTED_OPTIONS_REQ, and they are scoped to the
requirement. Other options from SUPPORTED_OPTIONS may be pr... | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py | def process_line(line, filename, line_number, finder=None, comes_from=None,
options=None, session=None, wheel_cache=None):
"""Process a single requirements line; This can result in creating/yielding
requirements, or updating the finder.
For lines that contain requirements, the only options... | def process_line(line, filename, line_number, finder=None, comes_from=None,
options=None, session=None, wheel_cache=None):
"""Process a single requirements line; This can result in creating/yielding
requirements, or updating the finder.
For lines that contain requirements, the only options... | [
"Process",
"a",
"single",
"requirements",
"line",
";",
"This",
"can",
"result",
"in",
"creating",
"/",
"yielding",
"requirements",
"or",
"updating",
"the",
"finder",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py#L90-L193 | [
"def",
"process_line",
"(",
"line",
",",
"filename",
",",
"line_number",
",",
"finder",
"=",
"None",
",",
"comes_from",
"=",
"None",
",",
"options",
"=",
"None",
",",
"session",
"=",
"None",
",",
"wheel_cache",
"=",
"None",
")",
":",
"parser",
"=",
"bu... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | join_lines | Joins a line ending in '\' with the previous line. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py | def join_lines(iterator):
"""
Joins a line ending in '\' with the previous line.
"""
lines = []
for line in iterator:
if not line.endswith('\\'):
if lines:
lines.append(line)
yield ''.join(lines)
lines = []
else:
... | def join_lines(iterator):
"""
Joins a line ending in '\' with the previous line.
"""
lines = []
for line in iterator:
if not line.endswith('\\'):
if lines:
lines.append(line)
yield ''.join(lines)
lines = []
else:
... | [
"Joins",
"a",
"line",
"ending",
"in",
"\\",
"with",
"the",
"previous",
"line",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py#L233-L247 | [
"def",
"join_lines",
"(",
"iterator",
")",
":",
"lines",
"=",
"[",
"]",
"for",
"line",
"in",
"iterator",
":",
"if",
"not",
"line",
".",
"endswith",
"(",
"'\\\\'",
")",
":",
"if",
"lines",
":",
"lines",
".",
"append",
"(",
"line",
")",
"yield",
"''"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | ignore_comments | Strips and filters empty or commented lines. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py | def ignore_comments(iterator):
"""
Strips and filters empty or commented lines.
"""
for line in iterator:
line = COMMENT_RE.sub('', line)
line = line.strip()
if line:
yield line | def ignore_comments(iterator):
"""
Strips and filters empty or commented lines.
"""
for line in iterator:
line = COMMENT_RE.sub('', line)
line = line.strip()
if line:
yield line | [
"Strips",
"and",
"filters",
"empty",
"or",
"commented",
"lines",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py#L253-L261 | [
"def",
"ignore_comments",
"(",
"iterator",
")",
":",
"for",
"line",
"in",
"iterator",
":",
"line",
"=",
"COMMENT_RE",
".",
"sub",
"(",
"''",
",",
"line",
")",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"line",
":",
"yield",
"line"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | skip_regex | Optionally exclude lines that match '--skip-requirements-regex' | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py | def skip_regex(lines, options):
"""
Optionally exclude lines that match '--skip-requirements-regex'
"""
skip_regex = options.skip_requirements_regex if options else None
if skip_regex:
lines = filterfalse(re.compile(skip_regex).search, lines)
return lines | def skip_regex(lines, options):
"""
Optionally exclude lines that match '--skip-requirements-regex'
"""
skip_regex = options.skip_requirements_regex if options else None
if skip_regex:
lines = filterfalse(re.compile(skip_regex).search, lines)
return lines | [
"Optionally",
"exclude",
"lines",
"that",
"match",
"--",
"skip",
"-",
"requirements",
"-",
"regex"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py#L264-L271 | [
"def",
"skip_regex",
"(",
"lines",
",",
"options",
")",
":",
"skip_regex",
"=",
"options",
".",
"skip_requirements_regex",
"if",
"options",
"else",
"None",
"if",
"skip_regex",
":",
"lines",
"=",
"filterfalse",
"(",
"re",
".",
"compile",
"(",
"skip_regex",
")... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | compile | Return compiled marker as a function accepting an environment dict. | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py | def compile(marker):
"""Return compiled marker as a function accepting an environment dict."""
try:
return _cache[marker]
except KeyError:
pass
if not marker.strip():
def marker_fn(environment=None, override=None):
""""""
return True
else:
comp... | def compile(marker):
"""Return compiled marker as a function accepting an environment dict."""
try:
return _cache[marker]
except KeyError:
pass
if not marker.strip():
def marker_fn(environment=None, override=None):
""""""
return True
else:
comp... | [
"Return",
"compiled",
"marker",
"as",
"a",
"function",
"accepting",
"an",
"environment",
"dict",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py#L94-L116 | [
"def",
"compile",
"(",
"marker",
")",
":",
"try",
":",
"return",
"_cache",
"[",
"marker",
"]",
"except",
"KeyError",
":",
"pass",
"if",
"not",
"marker",
".",
"strip",
"(",
")",
":",
"def",
"marker_fn",
"(",
"environment",
"=",
"None",
",",
"override",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | ASTWhitelist.visit | Ensure statement only contains allowed nodes. | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py | def visit(self, node):
"""Ensure statement only contains allowed nodes."""
if not isinstance(node, self.ALLOWED):
raise SyntaxError('Not allowed in environment markers.\n%s\n%s' %
(self.statement,
(' ' * node.col_offset) + '^'))
... | def visit(self, node):
"""Ensure statement only contains allowed nodes."""
if not isinstance(node, self.ALLOWED):
raise SyntaxError('Not allowed in environment markers.\n%s\n%s' %
(self.statement,
(' ' * node.col_offset) + '^'))
... | [
"Ensure",
"statement",
"only",
"contains",
"allowed",
"nodes",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py#L70-L76 | [
"def",
"visit",
"(",
"self",
",",
"node",
")",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"self",
".",
"ALLOWED",
")",
":",
"raise",
"SyntaxError",
"(",
"'Not allowed in environment markers.\\n%s\\n%s'",
"%",
"(",
"self",
".",
"statement",
",",
"(",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | ASTWhitelist.visit_Attribute | Flatten one level of attribute access. | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py | def visit_Attribute(self, node):
"""Flatten one level of attribute access."""
new_node = ast.Name("%s.%s" % (node.value.id, node.attr), node.ctx)
return ast.copy_location(new_node, node) | def visit_Attribute(self, node):
"""Flatten one level of attribute access."""
new_node = ast.Name("%s.%s" % (node.value.id, node.attr), node.ctx)
return ast.copy_location(new_node, node) | [
"Flatten",
"one",
"level",
"of",
"attribute",
"access",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/_markerlib/markers.py#L78-L81 | [
"def",
"visit_Attribute",
"(",
"self",
",",
"node",
")",
":",
"new_node",
"=",
"ast",
".",
"Name",
"(",
"\"%s.%s\"",
"%",
"(",
"node",
".",
"value",
".",
"id",
",",
"node",
".",
"attr",
")",
",",
"node",
".",
"ctx",
")",
"return",
"ast",
".",
"co... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | coerce | coerce takes a value and attempts to convert it to a float,
or int.
If none of the conversions are successful, the original value is
returned.
>>> coerce('3')
3
>>> coerce('3.0')
3.0
>>> coerce('foo')
'foo'
>>> coerce({})
{}
>>> coerce('{}')
'{}' | jaraco/util/numbers.py | def coerce(value):
"""
coerce takes a value and attempts to convert it to a float,
or int.
If none of the conversions are successful, the original value is
returned.
>>> coerce('3')
3
>>> coerce('3.0')
3.0
>>> coerce('foo')
'foo'
>>> coerce({})
{}
>>> coerce('{}')
'{}'
"""
with contextlib2.suppre... | def coerce(value):
"""
coerce takes a value and attempts to convert it to a float,
or int.
If none of the conversions are successful, the original value is
returned.
>>> coerce('3')
3
>>> coerce('3.0')
3.0
>>> coerce('foo')
'foo'
>>> coerce({})
{}
>>> coerce('{}')
'{}'
"""
with contextlib2.suppre... | [
"coerce",
"takes",
"a",
"value",
"and",
"attempts",
"to",
"convert",
"it",
"to",
"a",
"float",
"or",
"int",
"."
] | jaraco/jaraco.util | python | https://github.com/jaraco/jaraco.util/blob/f21071c64f165a5cf844db15e39356e1a47f4b02/jaraco/util/numbers.py#L10-L37 | [
"def",
"coerce",
"(",
"value",
")",
":",
"with",
"contextlib2",
".",
"suppress",
"(",
"Exception",
")",
":",
"loaded",
"=",
"json",
".",
"loads",
"(",
"value",
")",
"assert",
"isinstance",
"(",
"loaded",
",",
"numbers",
".",
"Number",
")",
"return",
"l... | f21071c64f165a5cf844db15e39356e1a47f4b02 |
test | copy_current_request_context | A helper function that decorates a function to retain the current
request context. This is useful when working with greenlets. The moment
the function is decorated a copy of the request context is created and
then pushed when the function is called.
Example::
import gevent
from flask... | capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py | def copy_current_request_context(f):
"""A helper function that decorates a function to retain the current
request context. This is useful when working with greenlets. The moment
the function is decorated a copy of the request context is created and
then pushed when the function is called.
Example... | def copy_current_request_context(f):
"""A helper function that decorates a function to retain the current
request context. This is useful when working with greenlets. The moment
the function is decorated a copy of the request context is created and
then pushed when the function is called.
Example... | [
"A",
"helper",
"function",
"that",
"decorates",
"a",
"function",
"to",
"retain",
"the",
"current",
"request",
"context",
".",
"This",
"is",
"useful",
"when",
"working",
"with",
"greenlets",
".",
"The",
"moment",
"the",
"function",
"is",
"decorated",
"a",
"co... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L68-L100 | [
"def",
"copy_current_request_context",
"(",
"f",
")",
":",
"top",
"=",
"_request_ctx_stack",
".",
"top",
"if",
"top",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'This decorator can only be used at local scopes '",
"'when a request context is on the stack. For instance... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | AppContext.push | Binds the app context to the current context. | capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py | def push(self):
"""Binds the app context to the current context."""
self._refcnt += 1
_app_ctx_stack.push(self)
appcontext_pushed.send(self.app) | def push(self):
"""Binds the app context to the current context."""
self._refcnt += 1
_app_ctx_stack.push(self)
appcontext_pushed.send(self.app) | [
"Binds",
"the",
"app",
"context",
"to",
"the",
"current",
"context",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L163-L167 | [
"def",
"push",
"(",
"self",
")",
":",
"self",
".",
"_refcnt",
"+=",
"1",
"_app_ctx_stack",
".",
"push",
"(",
"self",
")",
"appcontext_pushed",
".",
"send",
"(",
"self",
".",
"app",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | AppContext.pop | Pops the app context. | capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py | def pop(self, exc=None):
"""Pops the app context."""
self._refcnt -= 1
if self._refcnt <= 0:
if exc is None:
exc = sys.exc_info()[1]
self.app.do_teardown_appcontext(exc)
rv = _app_ctx_stack.pop()
assert rv is self, 'Popped wrong app context... | def pop(self, exc=None):
"""Pops the app context."""
self._refcnt -= 1
if self._refcnt <= 0:
if exc is None:
exc = sys.exc_info()[1]
self.app.do_teardown_appcontext(exc)
rv = _app_ctx_stack.pop()
assert rv is self, 'Popped wrong app context... | [
"Pops",
"the",
"app",
"context",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L169-L179 | [
"def",
"pop",
"(",
"self",
",",
"exc",
"=",
"None",
")",
":",
"self",
".",
"_refcnt",
"-=",
"1",
"if",
"self",
".",
"_refcnt",
"<=",
"0",
":",
"if",
"exc",
"is",
"None",
":",
"exc",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"self"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequestContext.copy | Creates a copy of this request context with the same request object.
This can be used to move a request context to a different greenlet.
Because the actual request object is the same this cannot be used to
move a request context to a different thread unless access to the
request object i... | capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py | def copy(self):
"""Creates a copy of this request context with the same request object.
This can be used to move a request context to a different greenlet.
Because the actual request object is the same this cannot be used to
move a request context to a different thread unless access to t... | def copy(self):
"""Creates a copy of this request context with the same request object.
This can be used to move a request context to a different greenlet.
Because the actual request object is the same this cannot be used to
move a request context to a different thread unless access to t... | [
"Creates",
"a",
"copy",
"of",
"this",
"request",
"context",
"with",
"the",
"same",
"request",
"object",
".",
"This",
"can",
"be",
"used",
"to",
"move",
"a",
"request",
"context",
"to",
"a",
"different",
"greenlet",
".",
"Because",
"the",
"actual",
"request... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L266-L278 | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"app",
",",
"environ",
"=",
"self",
".",
"request",
".",
"environ",
",",
"request",
"=",
"self",
".",
"request",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequestContext.match_request | Can be overridden by a subclass to hook into the matching
of the request. | capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py | def match_request(self):
"""Can be overridden by a subclass to hook into the matching
of the request.
"""
try:
url_rule, self.request.view_args = \
self.url_adapter.match(return_rule=True)
self.request.url_rule = url_rule
except HTTPExcepti... | def match_request(self):
"""Can be overridden by a subclass to hook into the matching
of the request.
"""
try:
url_rule, self.request.view_args = \
self.url_adapter.match(return_rule=True)
self.request.url_rule = url_rule
except HTTPExcepti... | [
"Can",
"be",
"overridden",
"by",
"a",
"subclass",
"to",
"hook",
"into",
"the",
"matching",
"of",
"the",
"request",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L280-L289 | [
"def",
"match_request",
"(",
"self",
")",
":",
"try",
":",
"url_rule",
",",
"self",
".",
"request",
".",
"view_args",
"=",
"self",
".",
"url_adapter",
".",
"match",
"(",
"return_rule",
"=",
"True",
")",
"self",
".",
"request",
".",
"url_rule",
"=",
"ur... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequestContext.push | Binds the request context to the current context. | capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py | def push(self):
"""Binds the request context to the current context."""
# If an exception occurs in debug mode or if context preservation is
# activated under exception situations exactly one context stays
# on the stack. The rationale is that you want to access that
# informati... | def push(self):
"""Binds the request context to the current context."""
# If an exception occurs in debug mode or if context preservation is
# activated under exception situations exactly one context stays
# on the stack. The rationale is that you want to access that
# informati... | [
"Binds",
"the",
"request",
"context",
"to",
"the",
"current",
"context",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L291-L323 | [
"def",
"push",
"(",
"self",
")",
":",
"# If an exception occurs in debug mode or if context preservation is",
"# activated under exception situations exactly one context stays",
"# on the stack. The rationale is that you want to access that",
"# information under debug situations. However if som... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequestContext.pop | Pops the request context and unbinds it by doing that. This will
also trigger the execution of functions registered by the
:meth:`~flask.Flask.teardown_request` decorator.
.. versionchanged:: 0.9
Added the `exc` argument. | capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py | def pop(self, exc=None):
"""Pops the request context and unbinds it by doing that. This will
also trigger the execution of functions registered by the
:meth:`~flask.Flask.teardown_request` decorator.
.. versionchanged:: 0.9
Added the `exc` argument.
"""
app_c... | def pop(self, exc=None):
"""Pops the request context and unbinds it by doing that. This will
also trigger the execution of functions registered by the
:meth:`~flask.Flask.teardown_request` decorator.
.. versionchanged:: 0.9
Added the `exc` argument.
"""
app_c... | [
"Pops",
"the",
"request",
"context",
"and",
"unbinds",
"it",
"by",
"doing",
"that",
".",
"This",
"will",
"also",
"trigger",
"the",
"execution",
"of",
"functions",
"registered",
"by",
"the",
":",
"meth",
":",
"~flask",
".",
"Flask",
".",
"teardown_request",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/ctx.py#L325-L366 | [
"def",
"pop",
"(",
"self",
",",
"exc",
"=",
"None",
")",
":",
"app_ctx",
"=",
"self",
".",
"_implicit_app_ctx_stack",
".",
"pop",
"(",
")",
"clear_request",
"=",
"False",
"if",
"not",
"self",
".",
"_implicit_app_ctx_stack",
":",
"self",
".",
"preserved",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | backup_dir | Figure out the name of a directory to back up the given dir to
(adding .bak, .bak2, etc) | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py | def backup_dir(dir, ext='.bak'):
"""Figure out the name of a directory to back up the given dir to
(adding .bak, .bak2, etc)"""
n = 1
extension = ext
while os.path.exists(dir + extension):
n += 1
extension = ext + str(n)
return dir + extension | def backup_dir(dir, ext='.bak'):
"""Figure out the name of a directory to back up the given dir to
(adding .bak, .bak2, etc)"""
n = 1
extension = ext
while os.path.exists(dir + extension):
n += 1
extension = ext + str(n)
return dir + extension | [
"Figure",
"out",
"the",
"name",
"of",
"a",
"directory",
"to",
"back",
"up",
"the",
"given",
"dir",
"to",
"(",
"adding",
".",
"bak",
".",
"bak2",
"etc",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L119-L127 | [
"def",
"backup_dir",
"(",
"dir",
",",
"ext",
"=",
"'.bak'",
")",
":",
"n",
"=",
"1",
"extension",
"=",
"ext",
"while",
"os",
".",
"path",
".",
"exists",
"(",
"dir",
"+",
"extension",
")",
":",
"n",
"+=",
"1",
"extension",
"=",
"ext",
"+",
"str",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | has_leading_dir | Returns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive) | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py | def has_leading_dir(paths):
"""Returns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive)"""
common_prefix = None
for path in paths:
prefix, rest = split_leading_dir(path)
if not prefix:
return False
elif comm... | def has_leading_dir(paths):
"""Returns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive)"""
common_prefix = None
for path in paths:
prefix, rest = split_leading_dir(path)
if not prefix:
return False
elif comm... | [
"Returns",
"true",
"if",
"all",
"the",
"paths",
"have",
"the",
"same",
"leading",
"path",
"name",
"(",
"i",
".",
"e",
".",
"everything",
"is",
"in",
"one",
"subdirectory",
"in",
"an",
"archive",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L241-L253 | [
"def",
"has_leading_dir",
"(",
"paths",
")",
":",
"common_prefix",
"=",
"None",
"for",
"path",
"in",
"paths",
":",
"prefix",
",",
"rest",
"=",
"split_leading_dir",
"(",
"path",
")",
"if",
"not",
"prefix",
":",
"return",
"False",
"elif",
"common_prefix",
"i... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | make_path_relative | Make a filename relative, where the filename path, and it is
relative to rel_to
>>> make_path_relative('/usr/share/something/a-file.pth',
... '/usr/share/another-place/src/Directory')
'../../../something/a-file.pth'
>>> make_path_relative('/usr/share/something/a-f... | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py | def make_path_relative(path, rel_to):
"""
Make a filename relative, where the filename path, and it is
relative to rel_to
>>> make_path_relative('/usr/share/something/a-file.pth',
... '/usr/share/another-place/src/Directory')
'../../../something/a-file.pth'
... | def make_path_relative(path, rel_to):
"""
Make a filename relative, where the filename path, and it is
relative to rel_to
>>> make_path_relative('/usr/share/something/a-file.pth',
... '/usr/share/another-place/src/Directory')
'../../../something/a-file.pth'
... | [
"Make",
"a",
"filename",
"relative",
"where",
"the",
"filename",
"path",
"and",
"it",
"is",
"relative",
"to",
"rel_to"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L256-L282 | [
"def",
"make_path_relative",
"(",
"path",
",",
"rel_to",
")",
":",
"path_filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"path",
"=",
"os",
".",
"path",
".",
"n... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | dist_in_usersite | Return True if given Distribution is installed in user site. | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py | def dist_in_usersite(dist):
"""
Return True if given Distribution is installed in user site.
"""
norm_path = normalize_path(dist_location(dist))
return norm_path.startswith(normalize_path(user_site)) | def dist_in_usersite(dist):
"""
Return True if given Distribution is installed in user site.
"""
norm_path = normalize_path(dist_location(dist))
return norm_path.startswith(normalize_path(user_site)) | [
"Return",
"True",
"if",
"given",
"Distribution",
"is",
"installed",
"in",
"user",
"site",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L347-L352 | [
"def",
"dist_in_usersite",
"(",
"dist",
")",
":",
"norm_path",
"=",
"normalize_path",
"(",
"dist_location",
"(",
"dist",
")",
")",
"return",
"norm_path",
".",
"startswith",
"(",
"normalize_path",
"(",
"user_site",
")",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | dist_is_editable | Is distribution an editable install? | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py | def dist_is_editable(dist):
"""Is distribution an editable install?"""
# TODO: factor out determining editableness out of FrozenRequirement
from pip import FrozenRequirement
req = FrozenRequirement.from_dist(dist, [])
return req.editable | def dist_is_editable(dist):
"""Is distribution an editable install?"""
# TODO: factor out determining editableness out of FrozenRequirement
from pip import FrozenRequirement
req = FrozenRequirement.from_dist(dist, [])
return req.editable | [
"Is",
"distribution",
"an",
"editable",
"install?"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L365-L370 | [
"def",
"dist_is_editable",
"(",
"dist",
")",
":",
"# TODO: factor out determining editableness out of FrozenRequirement",
"from",
"pip",
"import",
"FrozenRequirement",
"req",
"=",
"FrozenRequirement",
".",
"from_dist",
"(",
"dist",
",",
"[",
"]",
")",
"return",
"req",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | untar_file | Untar the file (with path `filename`) to the destination `location`.
All files are written based on system defaults and umask (i.e. permissions
are not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmod +x" applied after being
written. Note tha... | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py | def untar_file(filename, location):
"""
Untar the file (with path `filename`) to the destination `location`.
All files are written based on system defaults and umask (i.e. permissions
are not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmo... | def untar_file(filename, location):
"""
Untar the file (with path `filename`) to the destination `location`.
All files are written based on system defaults and umask (i.e. permissions
are not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmo... | [
"Untar",
"the",
"file",
"(",
"with",
"path",
"filename",
")",
"to",
"the",
"destination",
"location",
".",
"All",
"files",
"are",
"written",
"based",
"on",
"system",
"defaults",
"and",
"umask",
"(",
"i",
".",
"e",
".",
"permissions",
"are",
"not",
"prese... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/__init__.py#L561-L633 | [
"def",
"untar_file",
"(",
"filename",
",",
"location",
")",
":",
"ensure_dir",
"(",
"location",
")",
"if",
"filename",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.gz'",
")",
"or",
"filename",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.tgz'",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.record | Registers a function that is called when the blueprint is
registered on the application. This function is called with the
state as argument as returned by the :meth:`make_setup_state`
method. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def record(self, func):
"""Registers a function that is called when the blueprint is
registered on the application. This function is called with the
state as argument as returned by the :meth:`make_setup_state`
method.
"""
if self._got_registered_once and self.warn_on_mo... | def record(self, func):
"""Registers a function that is called when the blueprint is
registered on the application. This function is called with the
state as argument as returned by the :meth:`make_setup_state`
method.
"""
if self._got_registered_once and self.warn_on_mo... | [
"Registers",
"a",
"function",
"that",
"is",
"called",
"when",
"the",
"blueprint",
"is",
"registered",
"on",
"the",
"application",
".",
"This",
"function",
"is",
"called",
"with",
"the",
"state",
"as",
"argument",
"as",
"returned",
"by",
"the",
":",
"meth",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L107-L118 | [
"def",
"record",
"(",
"self",
",",
"func",
")",
":",
"if",
"self",
".",
"_got_registered_once",
"and",
"self",
".",
"warn_on_modifications",
":",
"from",
"warnings",
"import",
"warn",
"warn",
"(",
"Warning",
"(",
"'The blueprint was already registered once '",
"'b... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.make_setup_state | Creates an instance of :meth:`~flask.blueprints.BlueprintSetupState`
object that is later passed to the register callback functions.
Subclasses can override this to return a subclass of the setup state. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def make_setup_state(self, app, options, first_registration=False):
"""Creates an instance of :meth:`~flask.blueprints.BlueprintSetupState`
object that is later passed to the register callback functions.
Subclasses can override this to return a subclass of the setup state.
"""
re... | def make_setup_state(self, app, options, first_registration=False):
"""Creates an instance of :meth:`~flask.blueprints.BlueprintSetupState`
object that is later passed to the register callback functions.
Subclasses can override this to return a subclass of the setup state.
"""
re... | [
"Creates",
"an",
"instance",
"of",
":",
"meth",
":",
"~flask",
".",
"blueprints",
".",
"BlueprintSetupState",
"object",
"that",
"is",
"later",
"passed",
"to",
"the",
"register",
"callback",
"functions",
".",
"Subclasses",
"can",
"override",
"this",
"to",
"retu... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L131-L136 | [
"def",
"make_setup_state",
"(",
"self",
",",
"app",
",",
"options",
",",
"first_registration",
"=",
"False",
")",
":",
"return",
"BlueprintSetupState",
"(",
"self",
",",
"app",
",",
"options",
",",
"first_registration",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.endpoint | Like :meth:`Flask.endpoint` but for a blueprint. This does not
prefix the endpoint with the blueprint name, this has to be done
explicitly by the user of this method. If the endpoint is prefixed
with a `.` it will be registered to the current blueprint, otherwise
it's an application in... | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def endpoint(self, endpoint):
"""Like :meth:`Flask.endpoint` but for a blueprint. This does not
prefix the endpoint with the blueprint name, this has to be done
explicitly by the user of this method. If the endpoint is prefixed
with a `.` it will be registered to the current blueprint,... | def endpoint(self, endpoint):
"""Like :meth:`Flask.endpoint` but for a blueprint. This does not
prefix the endpoint with the blueprint name, this has to be done
explicitly by the user of this method. If the endpoint is prefixed
with a `.` it will be registered to the current blueprint,... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"endpoint",
"but",
"for",
"a",
"blueprint",
".",
"This",
"does",
"not",
"prefix",
"the",
"endpoint",
"with",
"the",
"blueprint",
"name",
"this",
"has",
"to",
"be",
"done",
"explicitly",
"by",
"the",
"user",
"of",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L174-L186 | [
"def",
"endpoint",
"(",
"self",
",",
"endpoint",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"def",
"register_endpoint",
"(",
"state",
")",
":",
"state",
".",
"app",
".",
"view_functions",
"[",
"endpoint",
"]",
"=",
"f",
"self",
".",
"record_once... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.app_template_filter | Register a custom template filter, available application wide. Like
:meth:`Flask.template_filter` but for a blueprint.
:param name: the optional name of the filter, otherwise the
function name will be used. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def app_template_filter(self, name=None):
"""Register a custom template filter, available application wide. Like
:meth:`Flask.template_filter` but for a blueprint.
:param name: the optional name of the filter, otherwise the
function name will be used.
"""
d... | def app_template_filter(self, name=None):
"""Register a custom template filter, available application wide. Like
:meth:`Flask.template_filter` but for a blueprint.
:param name: the optional name of the filter, otherwise the
function name will be used.
"""
d... | [
"Register",
"a",
"custom",
"template",
"filter",
"available",
"application",
"wide",
".",
"Like",
":",
"meth",
":",
"Flask",
".",
"template_filter",
"but",
"for",
"a",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L188-L198 | [
"def",
"app_template_filter",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"add_app_template_filter",
"(",
"f",
",",
"name",
"=",
"name",
")",
"return",
"f",
"return",
"decorator"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.add_app_template_filter | Register a custom template filter, available application wide. Like
:meth:`Flask.add_template_filter` but for a blueprint. Works exactly
like the :meth:`app_template_filter` decorator.
:param name: the optional name of the filter, otherwise the
function name will be used. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def add_app_template_filter(self, f, name=None):
"""Register a custom template filter, available application wide. Like
:meth:`Flask.add_template_filter` but for a blueprint. Works exactly
like the :meth:`app_template_filter` decorator.
:param name: the optional name of the filter, ot... | def add_app_template_filter(self, f, name=None):
"""Register a custom template filter, available application wide. Like
:meth:`Flask.add_template_filter` but for a blueprint. Works exactly
like the :meth:`app_template_filter` decorator.
:param name: the optional name of the filter, ot... | [
"Register",
"a",
"custom",
"template",
"filter",
"available",
"application",
"wide",
".",
"Like",
":",
"meth",
":",
"Flask",
".",
"add_template_filter",
"but",
"for",
"a",
"blueprint",
".",
"Works",
"exactly",
"like",
"the",
":",
"meth",
":",
"app_template_fil... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L200-L210 | [
"def",
"add_app_template_filter",
"(",
"self",
",",
"f",
",",
"name",
"=",
"None",
")",
":",
"def",
"register_template",
"(",
"state",
")",
":",
"state",
".",
"app",
".",
"jinja_env",
".",
"filters",
"[",
"name",
"or",
"f",
".",
"__name__",
"]",
"=",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.app_template_global | Register a custom template global, available application wide. Like
:meth:`Flask.template_global` but for a blueprint.
.. versionadded:: 0.10
:param name: the optional name of the global, otherwise the
function name will be used. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def app_template_global(self, name=None):
"""Register a custom template global, available application wide. Like
:meth:`Flask.template_global` but for a blueprint.
.. versionadded:: 0.10
:param name: the optional name of the global, otherwise the
function name wil... | def app_template_global(self, name=None):
"""Register a custom template global, available application wide. Like
:meth:`Flask.template_global` but for a blueprint.
.. versionadded:: 0.10
:param name: the optional name of the global, otherwise the
function name wil... | [
"Register",
"a",
"custom",
"template",
"global",
"available",
"application",
"wide",
".",
"Like",
":",
"meth",
":",
"Flask",
".",
"template_global",
"but",
"for",
"a",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L240-L252 | [
"def",
"app_template_global",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"add_app_template_global",
"(",
"f",
",",
"name",
"=",
"name",
")",
"return",
"f",
"return",
"decorator"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.add_app_template_global | Register a custom template global, available application wide. Like
:meth:`Flask.add_template_global` but for a blueprint. Works exactly
like the :meth:`app_template_global` decorator.
.. versionadded:: 0.10
:param name: the optional name of the global, otherwise the
... | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def add_app_template_global(self, f, name=None):
"""Register a custom template global, available application wide. Like
:meth:`Flask.add_template_global` but for a blueprint. Works exactly
like the :meth:`app_template_global` decorator.
.. versionadded:: 0.10
:param name: the... | def add_app_template_global(self, f, name=None):
"""Register a custom template global, available application wide. Like
:meth:`Flask.add_template_global` but for a blueprint. Works exactly
like the :meth:`app_template_global` decorator.
.. versionadded:: 0.10
:param name: the... | [
"Register",
"a",
"custom",
"template",
"global",
"available",
"application",
"wide",
".",
"Like",
":",
"meth",
":",
"Flask",
".",
"add_template_global",
"but",
"for",
"a",
"blueprint",
".",
"Works",
"exactly",
"like",
"the",
":",
"meth",
":",
"app_template_glo... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L254-L266 | [
"def",
"add_app_template_global",
"(",
"self",
",",
"f",
",",
"name",
"=",
"None",
")",
":",
"def",
"register_template",
"(",
"state",
")",
":",
"state",
".",
"app",
".",
"jinja_env",
".",
"globals",
"[",
"name",
"or",
"f",
".",
"__name__",
"]",
"=",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.before_request | Like :meth:`Flask.before_request` but for a blueprint. This function
is only executed before each request that is handled by a function of
that blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def before_request(self, f):
"""Like :meth:`Flask.before_request` but for a blueprint. This function
is only executed before each request that is handled by a function of
that blueprint.
"""
self.record_once(lambda s: s.app.before_request_funcs
.setdefault(self.name,... | def before_request(self, f):
"""Like :meth:`Flask.before_request` but for a blueprint. This function
is only executed before each request that is handled by a function of
that blueprint.
"""
self.record_once(lambda s: s.app.before_request_funcs
.setdefault(self.name,... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"before_request",
"but",
"for",
"a",
"blueprint",
".",
"This",
"function",
"is",
"only",
"executed",
"before",
"each",
"request",
"that",
"is",
"handled",
"by",
"a",
"function",
"of",
"that",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L268-L275 | [
"def",
"before_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"before_request_funcs",
".",
"setdefault",
"(",
"self",
".",
"name",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.before_app_request | Like :meth:`Flask.before_request`. Such a function is executed
before each request, even if outside of a blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def before_app_request(self, f):
"""Like :meth:`Flask.before_request`. Such a function is executed
before each request, even if outside of a blueprint.
"""
self.record_once(lambda s: s.app.before_request_funcs
.setdefault(None, []).append(f))
return f | def before_app_request(self, f):
"""Like :meth:`Flask.before_request`. Such a function is executed
before each request, even if outside of a blueprint.
"""
self.record_once(lambda s: s.app.before_request_funcs
.setdefault(None, []).append(f))
return f | [
"Like",
":",
"meth",
":",
"Flask",
".",
"before_request",
".",
"Such",
"a",
"function",
"is",
"executed",
"before",
"each",
"request",
"even",
"if",
"outside",
"of",
"a",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L277-L283 | [
"def",
"before_app_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"before_request_funcs",
".",
"setdefault",
"(",
"None",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")",
")",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.before_app_first_request | Like :meth:`Flask.before_first_request`. Such a function is
executed before the first request to the application. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def before_app_first_request(self, f):
"""Like :meth:`Flask.before_first_request`. Such a function is
executed before the first request to the application.
"""
self.record_once(lambda s: s.app.before_first_request_funcs.append(f))
return f | def before_app_first_request(self, f):
"""Like :meth:`Flask.before_first_request`. Such a function is
executed before the first request to the application.
"""
self.record_once(lambda s: s.app.before_first_request_funcs.append(f))
return f | [
"Like",
":",
"meth",
":",
"Flask",
".",
"before_first_request",
".",
"Such",
"a",
"function",
"is",
"executed",
"before",
"the",
"first",
"request",
"to",
"the",
"application",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L285-L290 | [
"def",
"before_app_first_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"before_first_request_funcs",
".",
"append",
"(",
"f",
")",
")",
"return",
"f"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.after_request | Like :meth:`Flask.after_request` but for a blueprint. This function
is only executed after each request that is handled by a function of
that blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def after_request(self, f):
"""Like :meth:`Flask.after_request` but for a blueprint. This function
is only executed after each request that is handled by a function of
that blueprint.
"""
self.record_once(lambda s: s.app.after_request_funcs
.setdefault(self.name, [])... | def after_request(self, f):
"""Like :meth:`Flask.after_request` but for a blueprint. This function
is only executed after each request that is handled by a function of
that blueprint.
"""
self.record_once(lambda s: s.app.after_request_funcs
.setdefault(self.name, [])... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"after_request",
"but",
"for",
"a",
"blueprint",
".",
"This",
"function",
"is",
"only",
"executed",
"after",
"each",
"request",
"that",
"is",
"handled",
"by",
"a",
"function",
"of",
"that",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L292-L299 | [
"def",
"after_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"after_request_funcs",
".",
"setdefault",
"(",
"self",
".",
"name",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.after_app_request | Like :meth:`Flask.after_request` but for a blueprint. Such a function
is executed after each request, even if outside of the blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def after_app_request(self, f):
"""Like :meth:`Flask.after_request` but for a blueprint. Such a function
is executed after each request, even if outside of the blueprint.
"""
self.record_once(lambda s: s.app.after_request_funcs
.setdefault(None, []).append(f))
return... | def after_app_request(self, f):
"""Like :meth:`Flask.after_request` but for a blueprint. Such a function
is executed after each request, even if outside of the blueprint.
"""
self.record_once(lambda s: s.app.after_request_funcs
.setdefault(None, []).append(f))
return... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"after_request",
"but",
"for",
"a",
"blueprint",
".",
"Such",
"a",
"function",
"is",
"executed",
"after",
"each",
"request",
"even",
"if",
"outside",
"of",
"the",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L301-L307 | [
"def",
"after_app_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"after_request_funcs",
".",
"setdefault",
"(",
"None",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")",
")",
"r... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.teardown_request | Like :meth:`Flask.teardown_request` but for a blueprint. This
function is only executed when tearing down requests handled by a
function of that blueprint. Teardown request functions are executed
when the request context is popped, even when no actual request was
performed. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def teardown_request(self, f):
"""Like :meth:`Flask.teardown_request` but for a blueprint. This
function is only executed when tearing down requests handled by a
function of that blueprint. Teardown request functions are executed
when the request context is popped, even when no actual ... | def teardown_request(self, f):
"""Like :meth:`Flask.teardown_request` but for a blueprint. This
function is only executed when tearing down requests handled by a
function of that blueprint. Teardown request functions are executed
when the request context is popped, even when no actual ... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"teardown_request",
"but",
"for",
"a",
"blueprint",
".",
"This",
"function",
"is",
"only",
"executed",
"when",
"tearing",
"down",
"requests",
"handled",
"by",
"a",
"function",
"of",
"that",
"blueprint",
".",
"Teardown"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L309-L318 | [
"def",
"teardown_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"teardown_request_funcs",
".",
"setdefault",
"(",
"self",
".",
"name",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.teardown_app_request | Like :meth:`Flask.teardown_request` but for a blueprint. Such a
function is executed when tearing down each request, even if outside of
the blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def teardown_app_request(self, f):
"""Like :meth:`Flask.teardown_request` but for a blueprint. Such a
function is executed when tearing down each request, even if outside of
the blueprint.
"""
self.record_once(lambda s: s.app.teardown_request_funcs
.setdefault(None, ... | def teardown_app_request(self, f):
"""Like :meth:`Flask.teardown_request` but for a blueprint. Such a
function is executed when tearing down each request, even if outside of
the blueprint.
"""
self.record_once(lambda s: s.app.teardown_request_funcs
.setdefault(None, ... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"teardown_request",
"but",
"for",
"a",
"blueprint",
".",
"Such",
"a",
"function",
"is",
"executed",
"when",
"tearing",
"down",
"each",
"request",
"even",
"if",
"outside",
"of",
"the",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L320-L327 | [
"def",
"teardown_app_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"teardown_request_funcs",
".",
"setdefault",
"(",
"None",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")",
")"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.context_processor | Like :meth:`Flask.context_processor` but for a blueprint. This
function is only executed for requests handled by a blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def context_processor(self, f):
"""Like :meth:`Flask.context_processor` but for a blueprint. This
function is only executed for requests handled by a blueprint.
"""
self.record_once(lambda s: s.app.template_context_processors
.setdefault(self.name, []).append(f))
ret... | def context_processor(self, f):
"""Like :meth:`Flask.context_processor` but for a blueprint. This
function is only executed for requests handled by a blueprint.
"""
self.record_once(lambda s: s.app.template_context_processors
.setdefault(self.name, []).append(f))
ret... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"context_processor",
"but",
"for",
"a",
"blueprint",
".",
"This",
"function",
"is",
"only",
"executed",
"for",
"requests",
"handled",
"by",
"a",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L329-L335 | [
"def",
"context_processor",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"template_context_processors",
".",
"setdefault",
"(",
"self",
".",
"name",
",",
"[",
"]",
")",
".",
"append",
"(",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.app_context_processor | Like :meth:`Flask.context_processor` but for a blueprint. Such a
function is executed each request, even if outside of the blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def app_context_processor(self, f):
"""Like :meth:`Flask.context_processor` but for a blueprint. Such a
function is executed each request, even if outside of the blueprint.
"""
self.record_once(lambda s: s.app.template_context_processors
.setdefault(None, []).append(f))
... | def app_context_processor(self, f):
"""Like :meth:`Flask.context_processor` but for a blueprint. Such a
function is executed each request, even if outside of the blueprint.
"""
self.record_once(lambda s: s.app.template_context_processors
.setdefault(None, []).append(f))
... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"context_processor",
"but",
"for",
"a",
"blueprint",
".",
"Such",
"a",
"function",
"is",
"executed",
"each",
"request",
"even",
"if",
"outside",
"of",
"the",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L337-L343 | [
"def",
"app_context_processor",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"template_context_processors",
".",
"setdefault",
"(",
"None",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.app_errorhandler | Like :meth:`Flask.errorhandler` but for a blueprint. This
handler is used for all requests, even if outside of the blueprint. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def app_errorhandler(self, code):
"""Like :meth:`Flask.errorhandler` but for a blueprint. This
handler is used for all requests, even if outside of the blueprint.
"""
def decorator(f):
self.record_once(lambda s: s.app.errorhandler(code)(f))
return f
retur... | def app_errorhandler(self, code):
"""Like :meth:`Flask.errorhandler` but for a blueprint. This
handler is used for all requests, even if outside of the blueprint.
"""
def decorator(f):
self.record_once(lambda s: s.app.errorhandler(code)(f))
return f
retur... | [
"Like",
":",
"meth",
":",
"Flask",
".",
"errorhandler",
"but",
"for",
"a",
"blueprint",
".",
"This",
"handler",
"is",
"used",
"for",
"all",
"requests",
"even",
"if",
"outside",
"of",
"the",
"blueprint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L345-L352 | [
"def",
"app_errorhandler",
"(",
"self",
",",
"code",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"errorhandler",
"(",
"code",
")",
"(",
"f",
")",
")",
"return",
"f",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.url_value_preprocessor | Registers a function as URL value preprocessor for this
blueprint. It's called before the view functions are called and
can modify the url values provided. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def url_value_preprocessor(self, f):
"""Registers a function as URL value preprocessor for this
blueprint. It's called before the view functions are called and
can modify the url values provided.
"""
self.record_once(lambda s: s.app.url_value_preprocessors
.setdefaul... | def url_value_preprocessor(self, f):
"""Registers a function as URL value preprocessor for this
blueprint. It's called before the view functions are called and
can modify the url values provided.
"""
self.record_once(lambda s: s.app.url_value_preprocessors
.setdefaul... | [
"Registers",
"a",
"function",
"as",
"URL",
"value",
"preprocessor",
"for",
"this",
"blueprint",
".",
"It",
"s",
"called",
"before",
"the",
"view",
"functions",
"are",
"called",
"and",
"can",
"modify",
"the",
"url",
"values",
"provided",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L354-L361 | [
"def",
"url_value_preprocessor",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"url_value_preprocessors",
".",
"setdefault",
"(",
"self",
".",
"name",
",",
"[",
"]",
")",
".",
"append",
"(",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.url_defaults | Callback function for URL defaults for this blueprint. It's called
with the endpoint and values and should update the values passed
in place. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def url_defaults(self, f):
"""Callback function for URL defaults for this blueprint. It's called
with the endpoint and values and should update the values passed
in place.
"""
self.record_once(lambda s: s.app.url_default_functions
.setdefault(self.name, []).append(f)... | def url_defaults(self, f):
"""Callback function for URL defaults for this blueprint. It's called
with the endpoint and values and should update the values passed
in place.
"""
self.record_once(lambda s: s.app.url_default_functions
.setdefault(self.name, []).append(f)... | [
"Callback",
"function",
"for",
"URL",
"defaults",
"for",
"this",
"blueprint",
".",
"It",
"s",
"called",
"with",
"the",
"endpoint",
"and",
"values",
"and",
"should",
"update",
"the",
"values",
"passed",
"in",
"place",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L363-L370 | [
"def",
"url_defaults",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"url_default_functions",
".",
"setdefault",
"(",
"self",
".",
"name",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.app_url_value_preprocessor | Same as :meth:`url_value_preprocessor` but application wide. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def app_url_value_preprocessor(self, f):
"""Same as :meth:`url_value_preprocessor` but application wide.
"""
self.record_once(lambda s: s.app.url_value_preprocessors
.setdefault(None, []).append(f))
return f | def app_url_value_preprocessor(self, f):
"""Same as :meth:`url_value_preprocessor` but application wide.
"""
self.record_once(lambda s: s.app.url_value_preprocessors
.setdefault(None, []).append(f))
return f | [
"Same",
"as",
":",
"meth",
":",
"url_value_preprocessor",
"but",
"application",
"wide",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L372-L377 | [
"def",
"app_url_value_preprocessor",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"url_value_preprocessors",
".",
"setdefault",
"(",
"None",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.app_url_defaults | Same as :meth:`url_defaults` but application wide. | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def app_url_defaults(self, f):
"""Same as :meth:`url_defaults` but application wide.
"""
self.record_once(lambda s: s.app.url_default_functions
.setdefault(None, []).append(f))
return f | def app_url_defaults(self, f):
"""Same as :meth:`url_defaults` but application wide.
"""
self.record_once(lambda s: s.app.url_default_functions
.setdefault(None, []).append(f))
return f | [
"Same",
"as",
":",
"meth",
":",
"url_defaults",
"but",
"application",
"wide",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L379-L384 | [
"def",
"app_url_defaults",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"url_default_functions",
".",
"setdefault",
"(",
"None",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
")",
")",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Blueprint.errorhandler | Registers an error handler that becomes active for this blueprint
only. Please be aware that routing does not happen local to a
blueprint so an error handler for 404 usually is not handled by
a blueprint unless it is caused inside a view function. Another
special case is the 500 intern... | capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py | def errorhandler(self, code_or_exception):
"""Registers an error handler that becomes active for this blueprint
only. Please be aware that routing does not happen local to a
blueprint so an error handler for 404 usually is not handled by
a blueprint unless it is caused inside a view fun... | def errorhandler(self, code_or_exception):
"""Registers an error handler that becomes active for this blueprint
only. Please be aware that routing does not happen local to a
blueprint so an error handler for 404 usually is not handled by
a blueprint unless it is caused inside a view fun... | [
"Registers",
"an",
"error",
"handler",
"that",
"becomes",
"active",
"for",
"this",
"blueprint",
"only",
".",
"Please",
"be",
"aware",
"that",
"routing",
"does",
"not",
"happen",
"local",
"to",
"a",
"blueprint",
"so",
"an",
"error",
"handler",
"for",
"404",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L386-L401 | [
"def",
"errorhandler",
"(",
"self",
",",
"code_or_exception",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"_register_error_handler",
"(",
"self",
".",
"name",
",",
"code_or_... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.