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 | price_converter | Ensures that string prices are converted into Price objects. | pricing/fields.py | def price_converter(obj):
"""Ensures that string prices are converted into Price objects."""
if isinstance(obj, str):
obj = PriceClass.parse(obj)
return obj | def price_converter(obj):
"""Ensures that string prices are converted into Price objects."""
if isinstance(obj, str):
obj = PriceClass.parse(obj)
return obj | [
"Ensures",
"that",
"string",
"prices",
"are",
"converted",
"into",
"Price",
"objects",
"."
] | joeblackwaslike/pricing | python | https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/fields.py#L24-L28 | [
"def",
"price_converter",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"str",
")",
":",
"obj",
"=",
"PriceClass",
".",
"parse",
"(",
"obj",
")",
"return",
"obj"
] | be988b0851b4313af81f1db475bc33248700e39c |
test | price | Price field for attrs.
See `help(attr.ib)` for full signature.
Usage:
>>> from pricing import fields
... @attr.s
... class Test:
... price: Price = fields.price(default='USD 5.00')
...
... Test()
Test(price=USD 5.00) | pricing/fields.py | def price(*args, **kwargs):
"""Price field for attrs.
See `help(attr.ib)` for full signature.
Usage:
>>> from pricing import fields
... @attr.s
... class Test:
... price: Price = fields.price(default='USD 5.00')
...
... Test()
Test(price=USD 5.0... | def price(*args, **kwargs):
"""Price field for attrs.
See `help(attr.ib)` for full signature.
Usage:
>>> from pricing import fields
... @attr.s
... class Test:
... price: Price = fields.price(default='USD 5.00')
...
... Test()
Test(price=USD 5.0... | [
"Price",
"field",
"for",
"attrs",
"."
] | joeblackwaslike/pricing | python | https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/fields.py#L58-L84 | [
"def",
"price",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'default'",
",",
"'USD 0.00'",
")",
"kwargs",
".",
"setdefault",
"(",
"'converter'",
",",
"price_converter",
")",
"if",
"'validator'",
"in",
"kwargs",
... | be988b0851b4313af81f1db475bc33248700e39c |
test | Service.validate | Validate JSON-RPC request.
:param request: RPC request object
:type request: dict | service_factory/service.py | def validate(self, request):
"""Validate JSON-RPC request.
:param request: RPC request object
:type request: dict
"""
try:
validate_version(request)
validate_method(request)
validate_params(request)
validate_id(request)
e... | def validate(self, request):
"""Validate JSON-RPC request.
:param request: RPC request object
:type request: dict
"""
try:
validate_version(request)
validate_method(request)
validate_params(request)
validate_id(request)
e... | [
"Validate",
"JSON",
"-",
"RPC",
"request",
"."
] | proofit404/service-factory | python | https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/service.py#L69-L83 | [
"def",
"validate",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"validate_version",
"(",
"request",
")",
"validate_method",
"(",
"request",
")",
"validate_params",
"(",
"request",
")",
"validate_id",
"(",
"request",
")",
"except",
"(",
"AssertionError",
... | a09d4e097e5599244564a2a7f0611e58efb4156a |
test | Service.get_method | Get request method for service application. | service_factory/service.py | def get_method(self, args):
"""Get request method for service application."""
try:
method = self.app[args['method']]
except KeyError:
method_not_found(args['id'])
else:
return method | def get_method(self, args):
"""Get request method for service application."""
try:
method = self.app[args['method']]
except KeyError:
method_not_found(args['id'])
else:
return method | [
"Get",
"request",
"method",
"for",
"service",
"application",
"."
] | proofit404/service-factory | python | https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/service.py#L85-L93 | [
"def",
"get_method",
"(",
"self",
",",
"args",
")",
":",
"try",
":",
"method",
"=",
"self",
".",
"app",
"[",
"args",
"[",
"'method'",
"]",
"]",
"except",
"KeyError",
":",
"method_not_found",
"(",
"args",
"[",
"'id'",
"]",
")",
"else",
":",
"return",
... | a09d4e097e5599244564a2a7f0611e58efb4156a |
test | Service.apply | Apply application method. | service_factory/service.py | def apply(self, method, args):
"""Apply application method."""
try:
params = args['params']
if isinstance(params, dict):
result = method(**params)
else:
result = method(*params)
except Exception as error:
server_err... | def apply(self, method, args):
"""Apply application method."""
try:
params = args['params']
if isinstance(params, dict):
result = method(**params)
else:
result = method(*params)
except Exception as error:
server_err... | [
"Apply",
"application",
"method",
"."
] | proofit404/service-factory | python | https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/service.py#L95-L107 | [
"def",
"apply",
"(",
"self",
",",
"method",
",",
"args",
")",
":",
"try",
":",
"params",
"=",
"args",
"[",
"'params'",
"]",
"if",
"isinstance",
"(",
"params",
",",
"dict",
")",
":",
"result",
"=",
"method",
"(",
"*",
"*",
"params",
")",
"else",
"... | a09d4e097e5599244564a2a7f0611e58efb4156a |
test | Request.module | The name of the current module if the request was dispatched
to an actual module. This is deprecated functionality, use blueprints
instead. | capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py | def module(self):
"""The name of the current module if the request was dispatched
to an actual module. This is deprecated functionality, use blueprints
instead.
"""
from warnings import warn
warn(DeprecationWarning('modules were deprecated in favor of '
... | def module(self):
"""The name of the current module if the request was dispatched
to an actual module. This is deprecated functionality, use blueprints
instead.
"""
from warnings import warn
warn(DeprecationWarning('modules were deprecated in favor of '
... | [
"The",
"name",
"of",
"the",
"current",
"module",
"if",
"the",
"request",
"was",
"dispatched",
"to",
"an",
"actual",
"module",
".",
"This",
"is",
"deprecated",
"functionality",
"use",
"blueprints",
"instead",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py#L82-L92 | [
"def",
"module",
"(",
"self",
")",
":",
"from",
"warnings",
"import",
"warn",
"warn",
"(",
"DeprecationWarning",
"(",
"'modules were deprecated in favor of '",
"'blueprints. Use request.blueprint '",
"'instead.'",
")",
",",
"stacklevel",
"=",
"2",
")",
"if",
"self",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Request.blueprint | The name of the current blueprint | capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py | def blueprint(self):
"""The name of the current blueprint"""
if self.url_rule and '.' in self.url_rule.endpoint:
return self.url_rule.endpoint.rsplit('.', 1)[0] | def blueprint(self):
"""The name of the current blueprint"""
if self.url_rule and '.' in self.url_rule.endpoint:
return self.url_rule.endpoint.rsplit('.', 1)[0] | [
"The",
"name",
"of",
"the",
"current",
"blueprint"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py#L95-L98 | [
"def",
"blueprint",
"(",
"self",
")",
":",
"if",
"self",
".",
"url_rule",
"and",
"'.'",
"in",
"self",
".",
"url_rule",
".",
"endpoint",
":",
"return",
"self",
".",
"url_rule",
".",
"endpoint",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"[",
"0",
"]"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Request.get_json | Parses the incoming JSON request data and returns it. If
parsing fails the :meth:`on_json_loading_failed` method on the
request object will be invoked. By default this function will
only load the json data if the mimetype is ``application/json``
but this can be overriden by the `force`... | capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py | def get_json(self, force=False, silent=False, cache=True):
"""Parses the incoming JSON request data and returns it. If
parsing fails the :meth:`on_json_loading_failed` method on the
request object will be invoked. By default this function will
only load the json data if the mimetype is... | def get_json(self, force=False, silent=False, cache=True):
"""Parses the incoming JSON request data and returns it. If
parsing fails the :meth:`on_json_loading_failed` method on the
request object will be invoked. By default this function will
only load the json data if the mimetype is... | [
"Parses",
"the",
"incoming",
"JSON",
"request",
"data",
"and",
"returns",
"it",
".",
"If",
"parsing",
"fails",
"the",
":",
"meth",
":",
"on_json_loading_failed",
"method",
"on",
"the",
"request",
"object",
"will",
"be",
"invoked",
".",
"By",
"default",
"this... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/wrappers.py#L110-L148 | [
"def",
"get_json",
"(",
"self",
",",
"force",
"=",
"False",
",",
"silent",
"=",
"False",
",",
"cache",
"=",
"True",
")",
":",
"rv",
"=",
"getattr",
"(",
"self",
",",
"'_cached_json'",
",",
"_missing",
")",
"if",
"rv",
"is",
"not",
"_missing",
":",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | attach_enctype_error_multidict | Since Flask 0.8 we're monkeypatching the files object in case a
request is detected that does not use multipart form data but the files
object is accessed. | capybara/virtualenv/lib/python2.7/site-packages/flask/debughelpers.py | def attach_enctype_error_multidict(request):
"""Since Flask 0.8 we're monkeypatching the files object in case a
request is detected that does not use multipart form data but the files
object is accessed.
"""
oldcls = request.files.__class__
class newcls(oldcls):
def __getitem__(self, key... | def attach_enctype_error_multidict(request):
"""Since Flask 0.8 we're monkeypatching the files object in case a
request is detected that does not use multipart form data but the files
object is accessed.
"""
oldcls = request.files.__class__
class newcls(oldcls):
def __getitem__(self, key... | [
"Since",
"Flask",
"0",
".",
"8",
"we",
"re",
"monkeypatching",
"the",
"files",
"object",
"in",
"case",
"a",
"request",
"is",
"detected",
"that",
"does",
"not",
"use",
"multipart",
"form",
"data",
"but",
"the",
"files",
"object",
"is",
"accessed",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/debughelpers.py#L71-L87 | [
"def",
"attach_enctype_error_multidict",
"(",
"request",
")",
":",
"oldcls",
"=",
"request",
".",
"files",
".",
"__class__",
"class",
"newcls",
"(",
"oldcls",
")",
":",
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"return",
"oldcls"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | make_abstract_dist | Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def make_abstract_dist(req_to_install):
"""Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction.
"""
if req_to_install.editable:
re... | def make_abstract_dist(req_to_install):
"""Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction.
"""
if req_to_install.editable:
re... | [
"Factory",
"to",
"make",
"an",
"abstract",
"dist",
"object",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L84-L97 | [
"def",
"make_abstract_dist",
"(",
"req_to_install",
")",
":",
"if",
"req_to_install",
".",
"editable",
":",
"return",
"IsSDist",
"(",
"req_to_install",
")",
"elif",
"req_to_install",
".",
"link",
"and",
"req_to_install",
".",
"link",
".",
"is_wheel",
":",
"retur... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet.add_requirement | Add install_req as a requirement to install.
:param parent_req_name: The name of the requirement that needed this
added. The name is used because when multiple unnamed requirements
resolve to the same name, we could otherwise end up with dependency
links that point outside t... | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def add_requirement(self, install_req, parent_req_name=None):
"""Add install_req as a requirement to install.
:param parent_req_name: The name of the requirement that needed this
added. The name is used because when multiple unnamed requirements
resolve to the same name, we coul... | def add_requirement(self, install_req, parent_req_name=None):
"""Add install_req as a requirement to install.
:param parent_req_name: The name of the requirement that needed this
added. The name is used because when multiple unnamed requirements
resolve to the same name, we coul... | [
"Add",
"install_req",
"as",
"a",
"requirement",
"to",
"install",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L205-L253 | [
"def",
"add_requirement",
"(",
"self",
",",
"install_req",
",",
"parent_req_name",
"=",
"None",
")",
":",
"name",
"=",
"install_req",
".",
"name",
"if",
"not",
"install_req",
".",
"match_markers",
"(",
")",
":",
"logger",
".",
"warning",
"(",
"\"Ignoring %s:... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet._walk_req_to_install | Call handler for all pending reqs.
:param handler: Handle a single requirement. Should take a requirement
to install. Can optionally return an iterable of additional
InstallRequirements to cover. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def _walk_req_to_install(self, handler):
"""Call handler for all pending reqs.
:param handler: Handle a single requirement. Should take a requirement
to install. Can optionally return an iterable of additional
InstallRequirements to cover.
"""
# The list() here i... | def _walk_req_to_install(self, handler):
"""Call handler for all pending reqs.
:param handler: Handle a single requirement. Should take a requirement
to install. Can optionally return an iterable of additional
InstallRequirements to cover.
"""
# The list() here i... | [
"Call",
"handler",
"for",
"all",
"pending",
"reqs",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L291-L306 | [
"def",
"_walk_req_to_install",
"(",
"self",
",",
"handler",
")",
":",
"# The list() here is to avoid potential mutate-while-iterating bugs.",
"discovered_reqs",
"=",
"[",
"]",
"reqs",
"=",
"itertools",
".",
"chain",
"(",
"list",
"(",
"self",
".",
"unnamed_requirements",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet.prepare_files | Prepare process. Create temp directories, download and/or unpack files. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def prepare_files(self, finder):
"""
Prepare process. Create temp directories, download and/or unpack files.
"""
# make the wheelhouse
if self.wheel_download_dir:
ensure_dir(self.wheel_download_dir)
self._walk_req_to_install(
functools.partial(sel... | def prepare_files(self, finder):
"""
Prepare process. Create temp directories, download and/or unpack files.
"""
# make the wheelhouse
if self.wheel_download_dir:
ensure_dir(self.wheel_download_dir)
self._walk_req_to_install(
functools.partial(sel... | [
"Prepare",
"process",
".",
"Create",
"temp",
"directories",
"download",
"and",
"/",
"or",
"unpack",
"files",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L308-L317 | [
"def",
"prepare_files",
"(",
"self",
",",
"finder",
")",
":",
"# make the wheelhouse",
"if",
"self",
".",
"wheel_download_dir",
":",
"ensure_dir",
"(",
"self",
".",
"wheel_download_dir",
")",
"self",
".",
"_walk_req_to_install",
"(",
"functools",
".",
"partial",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet._check_skip_installed | Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only have satisfied_by set to
None if the req_to_install is to be... | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def _check_skip_installed(self, req_to_install, finder):
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only ... | def _check_skip_installed(self, req_to_install, finder):
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only ... | [
"Check",
"if",
"req_to_install",
"should",
"be",
"skipped",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L319-L369 | [
"def",
"_check_skip_installed",
"(",
"self",
",",
"req_to_install",
",",
"finder",
")",
":",
"# Check whether to upgrade/reinstall this req or not.",
"req_to_install",
".",
"check_if_exists",
"(",
")",
"if",
"req_to_install",
".",
"satisfied_by",
":",
"skip_reason",
"=",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet._prepare_file | Prepare a single requirements files.
:return: A list of addition InstallRequirements to also install. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def _prepare_file(self, finder, req_to_install):
"""Prepare a single requirements files.
:return: A list of addition InstallRequirements to also install.
"""
# Tell user what we are doing for this requirement:
# obtain (editable), skipping, processing (local url), collecting
... | def _prepare_file(self, finder, req_to_install):
"""Prepare a single requirements files.
:return: A list of addition InstallRequirements to also install.
"""
# Tell user what we are doing for this requirement:
# obtain (editable), skipping, processing (local url), collecting
... | [
"Prepare",
"a",
"single",
"requirements",
"files",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L371-L562 | [
"def",
"_prepare_file",
"(",
"self",
",",
"finder",
",",
"req_to_install",
")",
":",
"# Tell user what we are doing for this requirement:",
"# obtain (editable), skipping, processing (local url), collecting",
"# (remote url or package name)",
"if",
"req_to_install",
".",
"editable",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet.cleanup_files | Clean up files, remove builds. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def cleanup_files(self):
"""Clean up files, remove builds."""
logger.debug('Cleaning up...')
with indent_log():
for req in self.reqs_to_cleanup:
req.remove_temporary_source() | def cleanup_files(self):
"""Clean up files, remove builds."""
logger.debug('Cleaning up...')
with indent_log():
for req in self.reqs_to_cleanup:
req.remove_temporary_source() | [
"Clean",
"up",
"files",
"remove",
"builds",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L564-L569 | [
"def",
"cleanup_files",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Cleaning up...'",
")",
"with",
"indent_log",
"(",
")",
":",
"for",
"req",
"in",
"self",
".",
"reqs_to_cleanup",
":",
"req",
".",
"remove_temporary_source",
"(",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet._to_install | Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def _to_install(self):
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees.
"""
# The current implementation, which we may cha... | def _to_install(self):
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees.
"""
# The current implementation, which we may cha... | [
"Create",
"the",
"installation",
"order",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L571-L593 | [
"def",
"_to_install",
"(",
"self",
")",
":",
"# The current implementation, which we may change at any point",
"# installs the user specified things in the order given, except when",
"# dependencies must come earlier to achieve topological order.",
"order",
"=",
"[",
"]",
"ordered_reqs",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RequirementSet.install | Install everything in this set (after having downloaded and unpacked
the packages) | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py | def install(self, install_options, global_options=(), *args, **kwargs):
"""
Install everything in this set (after having downloaded and unpacked
the packages)
"""
to_install = self._to_install()
if to_install:
logger.info(
'Installing collecte... | def install(self, install_options, global_options=(), *args, **kwargs):
"""
Install everything in this set (after having downloaded and unpacked
the packages)
"""
to_install = self._to_install()
if to_install:
logger.info(
'Installing collecte... | [
"Install",
"everything",
"in",
"this",
"set",
"(",
"after",
"having",
"downloaded",
"and",
"unpacked",
"the",
"packages",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_set.py#L595-L636 | [
"def",
"install",
"(",
"self",
",",
"install_options",
",",
"global_options",
"=",
"(",
")",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"to_install",
"=",
"self",
".",
"_to_install",
"(",
")",
"if",
"to_install",
":",
"logger",
".",
"info",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | install_egg_info._get_all_ns_packages | Return sorted list of all package namespaces | capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/install_egg_info.py | def _get_all_ns_packages(self):
"""Return sorted list of all package namespaces"""
nsp = set()
for pkg in self.distribution.namespace_packages or []:
pkg = pkg.split('.')
while pkg:
nsp.add('.'.join(pkg))
pkg.pop()
return sorted(nsp... | def _get_all_ns_packages(self):
"""Return sorted list of all package namespaces"""
nsp = set()
for pkg in self.distribution.namespace_packages or []:
pkg = pkg.split('.')
while pkg:
nsp.add('.'.join(pkg))
pkg.pop()
return sorted(nsp... | [
"Return",
"sorted",
"list",
"of",
"all",
"package",
"namespaces"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/install_egg_info.py#L108-L116 | [
"def",
"_get_all_ns_packages",
"(",
"self",
")",
":",
"nsp",
"=",
"set",
"(",
")",
"for",
"pkg",
"in",
"self",
".",
"distribution",
".",
"namespace_packages",
"or",
"[",
"]",
":",
"pkg",
"=",
"pkg",
".",
"split",
"(",
"'.'",
")",
"while",
"pkg",
":",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | JsonResponseEncoder.default | Convert QuerySet objects to their list counter-parts | django_api/json_helpers.py | def default(self, obj):
"""
Convert QuerySet objects to their list counter-parts
"""
if isinstance(obj, models.Model):
return self.encode(model_to_dict(obj))
elif isinstance(obj, models.query.QuerySet):
return serializers.serialize('json', obj)
els... | def default(self, obj):
"""
Convert QuerySet objects to their list counter-parts
"""
if isinstance(obj, models.Model):
return self.encode(model_to_dict(obj))
elif isinstance(obj, models.query.QuerySet):
return serializers.serialize('json', obj)
els... | [
"Convert",
"QuerySet",
"objects",
"to",
"their",
"list",
"counter",
"-",
"parts"
] | bipsandbytes/django-api | python | https://github.com/bipsandbytes/django-api/blob/df99f4ccbb0c5128bd06da83f60881a85f6dbfe1/django_api/json_helpers.py#L11-L20 | [
"def",
"default",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"models",
".",
"Model",
")",
":",
"return",
"self",
".",
"encode",
"(",
"model_to_dict",
"(",
"obj",
")",
")",
"elif",
"isinstance",
"(",
"obj",
",",
"models",
... | df99f4ccbb0c5128bd06da83f60881a85f6dbfe1 |
test | html_annotate | doclist should be ordered from oldest to newest, like::
>>> version1 = 'Hello World'
>>> version2 = 'Goodbye World'
>>> print(html_annotate([(version1, 'version 1'),
... (version2, 'version 2')]))
<span title="version 2">Goodbye</span> <span title="version 1... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def html_annotate(doclist, markup=default_markup):
"""
doclist should be ordered from oldest to newest, like::
>>> version1 = 'Hello World'
>>> version2 = 'Goodbye World'
>>> print(html_annotate([(version1, 'version 1'),
... (version2, 'version 2')]))
... | def html_annotate(doclist, markup=default_markup):
"""
doclist should be ordered from oldest to newest, like::
>>> version1 = 'Hello World'
>>> version2 = 'Goodbye World'
>>> print(html_annotate([(version1, 'version 1'),
... (version2, 'version 2')]))
... | [
"doclist",
"should",
"be",
"ordered",
"from",
"oldest",
"to",
"newest",
"like",
"::"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L31-L69 | [
"def",
"html_annotate",
"(",
"doclist",
",",
"markup",
"=",
"default_markup",
")",
":",
"# The basic strategy we have is to split the documents up into",
"# logical tokens (which are words with attached markup). We then",
"# do diffs of each of the versions to track when a token first",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | tokenize_annotated | Tokenize a document and add an annotation attribute to each token | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def tokenize_annotated(doc, annotation):
"""Tokenize a document and add an annotation attribute to each token
"""
tokens = tokenize(doc, include_hrefs=False)
for tok in tokens:
tok.annotation = annotation
return tokens | def tokenize_annotated(doc, annotation):
"""Tokenize a document and add an annotation attribute to each token
"""
tokens = tokenize(doc, include_hrefs=False)
for tok in tokens:
tok.annotation = annotation
return tokens | [
"Tokenize",
"a",
"document",
"and",
"add",
"an",
"annotation",
"attribute",
"to",
"each",
"token"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L71-L77 | [
"def",
"tokenize_annotated",
"(",
"doc",
",",
"annotation",
")",
":",
"tokens",
"=",
"tokenize",
"(",
"doc",
",",
"include_hrefs",
"=",
"False",
")",
"for",
"tok",
"in",
"tokens",
":",
"tok",
".",
"annotation",
"=",
"annotation",
"return",
"tokens"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | html_annotate_merge_annotations | Merge the annotations from tokens_old into tokens_new, when the
tokens in the new document already existed in the old document. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def html_annotate_merge_annotations(tokens_old, tokens_new):
"""Merge the annotations from tokens_old into tokens_new, when the
tokens in the new document already existed in the old document.
"""
s = InsensitiveSequenceMatcher(a=tokens_old, b=tokens_new)
commands = s.get_opcodes()
for command,... | def html_annotate_merge_annotations(tokens_old, tokens_new):
"""Merge the annotations from tokens_old into tokens_new, when the
tokens in the new document already existed in the old document.
"""
s = InsensitiveSequenceMatcher(a=tokens_old, b=tokens_new)
commands = s.get_opcodes()
for command,... | [
"Merge",
"the",
"annotations",
"from",
"tokens_old",
"into",
"tokens_new",
"when",
"the",
"tokens",
"in",
"the",
"new",
"document",
"already",
"existed",
"in",
"the",
"old",
"document",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L79-L90 | [
"def",
"html_annotate_merge_annotations",
"(",
"tokens_old",
",",
"tokens_new",
")",
":",
"s",
"=",
"InsensitiveSequenceMatcher",
"(",
"a",
"=",
"tokens_old",
",",
"b",
"=",
"tokens_new",
")",
"commands",
"=",
"s",
".",
"get_opcodes",
"(",
")",
"for",
"command... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | copy_annotations | Copy annotations from the tokens listed in src to the tokens in dest | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def copy_annotations(src, dest):
"""
Copy annotations from the tokens listed in src to the tokens in dest
"""
assert len(src) == len(dest)
for src_tok, dest_tok in zip(src, dest):
dest_tok.annotation = src_tok.annotation | def copy_annotations(src, dest):
"""
Copy annotations from the tokens listed in src to the tokens in dest
"""
assert len(src) == len(dest)
for src_tok, dest_tok in zip(src, dest):
dest_tok.annotation = src_tok.annotation | [
"Copy",
"annotations",
"from",
"the",
"tokens",
"listed",
"in",
"src",
"to",
"the",
"tokens",
"in",
"dest"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L92-L98 | [
"def",
"copy_annotations",
"(",
"src",
",",
"dest",
")",
":",
"assert",
"len",
"(",
"src",
")",
"==",
"len",
"(",
"dest",
")",
"for",
"src_tok",
",",
"dest_tok",
"in",
"zip",
"(",
"src",
",",
"dest",
")",
":",
"dest_tok",
".",
"annotation",
"=",
"s... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | compress_tokens | Combine adjacent tokens when there is no HTML between the tokens,
and they share an annotation | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def compress_tokens(tokens):
"""
Combine adjacent tokens when there is no HTML between the tokens,
and they share an annotation
"""
result = [tokens[0]]
for tok in tokens[1:]:
if (not result[-1].post_tags and
not tok.pre_tags and
result[-1].annotation == tok.... | def compress_tokens(tokens):
"""
Combine adjacent tokens when there is no HTML between the tokens,
and they share an annotation
"""
result = [tokens[0]]
for tok in tokens[1:]:
if (not result[-1].post_tags and
not tok.pre_tags and
result[-1].annotation == tok.... | [
"Combine",
"adjacent",
"tokens",
"when",
"there",
"is",
"no",
"HTML",
"between",
"the",
"tokens",
"and",
"they",
"share",
"an",
"annotation"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L100-L113 | [
"def",
"compress_tokens",
"(",
"tokens",
")",
":",
"result",
"=",
"[",
"tokens",
"[",
"0",
"]",
"]",
"for",
"tok",
"in",
"tokens",
"[",
"1",
":",
"]",
":",
"if",
"(",
"not",
"result",
"[",
"-",
"1",
"]",
".",
"post_tags",
"and",
"not",
"tok",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | compress_merge_back | Merge tok into the last element of tokens (modifying the list of
tokens in-place). | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def compress_merge_back(tokens, tok):
""" Merge tok into the last element of tokens (modifying the list of
tokens in-place). """
last = tokens[-1]
if type(last) is not token or type(tok) is not token:
tokens.append(tok)
else:
text = _unicode(last)
if last.trailing_whitespa... | def compress_merge_back(tokens, tok):
""" Merge tok into the last element of tokens (modifying the list of
tokens in-place). """
last = tokens[-1]
if type(last) is not token or type(tok) is not token:
tokens.append(tok)
else:
text = _unicode(last)
if last.trailing_whitespa... | [
"Merge",
"tok",
"into",
"the",
"last",
"element",
"of",
"tokens",
"(",
"modifying",
"the",
"list",
"of",
"tokens",
"in",
"-",
"place",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L115-L131 | [
"def",
"compress_merge_back",
"(",
"tokens",
",",
"tok",
")",
":",
"last",
"=",
"tokens",
"[",
"-",
"1",
"]",
"if",
"type",
"(",
"last",
")",
"is",
"not",
"token",
"or",
"type",
"(",
"tok",
")",
"is",
"not",
"token",
":",
"tokens",
".",
"append",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | markup_serialize_tokens | Serialize the list of tokens into a list of text chunks, calling
markup_func around text to add annotations. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def markup_serialize_tokens(tokens, markup_func):
"""
Serialize the list of tokens into a list of text chunks, calling
markup_func around text to add annotations.
"""
for token in tokens:
for pre in token.pre_tags:
yield pre
html = token.html()
html = markup_func(... | def markup_serialize_tokens(tokens, markup_func):
"""
Serialize the list of tokens into a list of text chunks, calling
markup_func around text to add annotations.
"""
for token in tokens:
for pre in token.pre_tags:
yield pre
html = token.html()
html = markup_func(... | [
"Serialize",
"the",
"list",
"of",
"tokens",
"into",
"a",
"list",
"of",
"text",
"chunks",
"calling",
"markup_func",
"around",
"text",
"to",
"add",
"annotations",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L133-L147 | [
"def",
"markup_serialize_tokens",
"(",
"tokens",
",",
"markup_func",
")",
":",
"for",
"token",
"in",
"tokens",
":",
"for",
"pre",
"in",
"token",
".",
"pre_tags",
":",
"yield",
"pre",
"html",
"=",
"token",
".",
"html",
"(",
")",
"html",
"=",
"markup_func"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | htmldiff | Do a diff of the old and new document. The documents are HTML
*fragments* (str/UTF8 or unicode), they are not complete documents
(i.e., no <html> tag).
Returns HTML with <ins> and <del> tags added around the
appropriate text.
Markup is generally ignored, with the markup from new_html
preser... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def htmldiff(old_html, new_html):
## FIXME: this should take parsed documents too, and use their body
## or other content.
""" Do a diff of the old and new document. The documents are HTML
*fragments* (str/UTF8 or unicode), they are not complete documents
(i.e., no <html> tag).
Returns HTML wi... | def htmldiff(old_html, new_html):
## FIXME: this should take parsed documents too, and use their body
## or other content.
""" Do a diff of the old and new document. The documents are HTML
*fragments* (str/UTF8 or unicode), they are not complete documents
(i.e., no <html> tag).
Returns HTML wi... | [
"Do",
"a",
"diff",
"of",
"the",
"old",
"and",
"new",
"document",
".",
"The",
"documents",
"are",
"HTML",
"*",
"fragments",
"*",
"(",
"str",
"/",
"UTF8",
"or",
"unicode",
")",
"they",
"are",
"not",
"complete",
"documents",
"(",
"i",
".",
"e",
".",
"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L154-L175 | [
"def",
"htmldiff",
"(",
"old_html",
",",
"new_html",
")",
":",
"## FIXME: this should take parsed documents too, and use their body",
"## or other content.",
"old_html_tokens",
"=",
"tokenize",
"(",
"old_html",
")",
"new_html_tokens",
"=",
"tokenize",
"(",
"new_html",
")",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | htmldiff_tokens | Does a diff on the tokens themselves, returning a list of text
chunks (not tokens). | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def htmldiff_tokens(html1_tokens, html2_tokens):
""" Does a diff on the tokens themselves, returning a list of text
chunks (not tokens).
"""
# There are several passes as we do the differences. The tokens
# isolate the portion of the content we care to diff; difflib does
# all the actual hard w... | def htmldiff_tokens(html1_tokens, html2_tokens):
""" Does a diff on the tokens themselves, returning a list of text
chunks (not tokens).
"""
# There are several passes as we do the differences. The tokens
# isolate the portion of the content we care to diff; difflib does
# all the actual hard w... | [
"Does",
"a",
"diff",
"on",
"the",
"tokens",
"themselves",
"returning",
"a",
"list",
"of",
"text",
"chunks",
"(",
"not",
"tokens",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L177-L213 | [
"def",
"htmldiff_tokens",
"(",
"html1_tokens",
",",
"html2_tokens",
")",
":",
"# There are several passes as we do the differences. The tokens",
"# isolate the portion of the content we care to diff; difflib does",
"# all the actual hard work at that point. ",
"#",
"# Then we must create a... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | expand_tokens | Given a list of tokens, return a generator of the chunks of
text for the data in the tokens. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def expand_tokens(tokens, equal=False):
"""Given a list of tokens, return a generator of the chunks of
text for the data in the tokens.
"""
for token in tokens:
for pre in token.pre_tags:
yield pre
if not equal or not token.hide_when_equal:
if token.trailing_white... | def expand_tokens(tokens, equal=False):
"""Given a list of tokens, return a generator of the chunks of
text for the data in the tokens.
"""
for token in tokens:
for pre in token.pre_tags:
yield pre
if not equal or not token.hide_when_equal:
if token.trailing_white... | [
"Given",
"a",
"list",
"of",
"tokens",
"return",
"a",
"generator",
"of",
"the",
"chunks",
"of",
"text",
"for",
"the",
"data",
"in",
"the",
"tokens",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L215-L228 | [
"def",
"expand_tokens",
"(",
"tokens",
",",
"equal",
"=",
"False",
")",
":",
"for",
"token",
"in",
"tokens",
":",
"for",
"pre",
"in",
"token",
".",
"pre_tags",
":",
"yield",
"pre",
"if",
"not",
"equal",
"or",
"not",
"token",
".",
"hide_when_equal",
":"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | merge_insert | doc is the already-handled document (as a list of text chunks);
here we add <ins>ins_chunks</ins> to the end of that. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def merge_insert(ins_chunks, doc):
""" doc is the already-handled document (as a list of text chunks);
here we add <ins>ins_chunks</ins> to the end of that. """
# Though we don't throw away unbalanced_start or unbalanced_end
# (we assume there is accompanying markup later or earlier in the
# docume... | def merge_insert(ins_chunks, doc):
""" doc is the already-handled document (as a list of text chunks);
here we add <ins>ins_chunks</ins> to the end of that. """
# Though we don't throw away unbalanced_start or unbalanced_end
# (we assume there is accompanying markup later or earlier in the
# docume... | [
"doc",
"is",
"the",
"already",
"-",
"handled",
"document",
"(",
"as",
"a",
"list",
"of",
"text",
"chunks",
")",
";",
"here",
"we",
"add",
"<ins",
">",
"ins_chunks<",
"/",
"ins",
">",
"to",
"the",
"end",
"of",
"that",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L230-L248 | [
"def",
"merge_insert",
"(",
"ins_chunks",
",",
"doc",
")",
":",
"# Though we don't throw away unbalanced_start or unbalanced_end",
"# (we assume there is accompanying markup later or earlier in the",
"# document), we only put <ins> around the balanced portion.",
"unbalanced_start",
",",
"b... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | merge_delete | Adds the text chunks in del_chunks to the document doc (another
list of text chunks) with marker to show it is a delete.
cleanup_delete later resolves these markers into <del> tags. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def merge_delete(del_chunks, doc):
""" Adds the text chunks in del_chunks to the document doc (another
list of text chunks) with marker to show it is a delete.
cleanup_delete later resolves these markers into <del> tags."""
doc.append(DEL_START)
doc.extend(del_chunks)
doc.append(DEL_END) | def merge_delete(del_chunks, doc):
""" Adds the text chunks in del_chunks to the document doc (another
list of text chunks) with marker to show it is a delete.
cleanup_delete later resolves these markers into <del> tags."""
doc.append(DEL_START)
doc.extend(del_chunks)
doc.append(DEL_END) | [
"Adds",
"the",
"text",
"chunks",
"in",
"del_chunks",
"to",
"the",
"document",
"doc",
"(",
"another",
"list",
"of",
"text",
"chunks",
")",
"with",
"marker",
"to",
"show",
"it",
"is",
"a",
"delete",
".",
"cleanup_delete",
"later",
"resolves",
"these",
"marke... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L262-L268 | [
"def",
"merge_delete",
"(",
"del_chunks",
",",
"doc",
")",
":",
"doc",
".",
"append",
"(",
"DEL_START",
")",
"doc",
".",
"extend",
"(",
"del_chunks",
")",
"doc",
".",
"append",
"(",
"DEL_END",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | cleanup_delete | Cleans up any DEL_START/DEL_END markers in the document, replacing
them with <del></del>. To do this while keeping the document
valid, it may need to drop some tags (either start or end tags).
It may also move the del into adjacent tags to try to move it to a
similar location where it was originally l... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def cleanup_delete(chunks):
""" Cleans up any DEL_START/DEL_END markers in the document, replacing
them with <del></del>. To do this while keeping the document
valid, it may need to drop some tags (either start or end tags).
It may also move the del into adjacent tags to try to move it to a
simila... | def cleanup_delete(chunks):
""" Cleans up any DEL_START/DEL_END markers in the document, replacing
them with <del></del>. To do this while keeping the document
valid, it may need to drop some tags (either start or end tags).
It may also move the del into adjacent tags to try to move it to a
simila... | [
"Cleans",
"up",
"any",
"DEL_START",
"/",
"DEL_END",
"markers",
"in",
"the",
"document",
"replacing",
"them",
"with",
"<del",
">",
"<",
"/",
"del",
">",
".",
"To",
"do",
"this",
"while",
"keeping",
"the",
"document",
"valid",
"it",
"may",
"need",
"to",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L270-L307 | [
"def",
"cleanup_delete",
"(",
"chunks",
")",
":",
"while",
"1",
":",
"# Find a pending DEL_START/DEL_END, splitting the document",
"# into stuff-preceding-DEL_START, stuff-inside, and",
"# stuff-following-DEL_END",
"try",
":",
"pre_delete",
",",
"delete",
",",
"post_delete",
"=... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | split_unbalanced | Return (unbalanced_start, balanced, unbalanced_end), where each is
a list of text and tag chunks.
unbalanced_start is a list of all the tags that are opened, but
not closed in this span. Similarly, unbalanced_end is a list of
tags that are closed but were not opened. Extracting these might
mean s... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def split_unbalanced(chunks):
"""Return (unbalanced_start, balanced, unbalanced_end), where each is
a list of text and tag chunks.
unbalanced_start is a list of all the tags that are opened, but
not closed in this span. Similarly, unbalanced_end is a list of
tags that are closed but were not opene... | def split_unbalanced(chunks):
"""Return (unbalanced_start, balanced, unbalanced_end), where each is
a list of text and tag chunks.
unbalanced_start is a list of all the tags that are opened, but
not closed in this span. Similarly, unbalanced_end is a list of
tags that are closed but were not opene... | [
"Return",
"(",
"unbalanced_start",
"balanced",
"unbalanced_end",
")",
"where",
"each",
"is",
"a",
"list",
"of",
"text",
"and",
"tag",
"chunks",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L309-L347 | [
"def",
"split_unbalanced",
"(",
"chunks",
")",
":",
"start",
"=",
"[",
"]",
"end",
"=",
"[",
"]",
"tag_stack",
"=",
"[",
"]",
"balanced",
"=",
"[",
"]",
"for",
"chunk",
"in",
"chunks",
":",
"if",
"not",
"chunk",
".",
"startswith",
"(",
"'<'",
")",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | split_delete | Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,
stuff_after_DEL_END). Returns the first case found (there may be
more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if
there's no DEL_START found. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def split_delete(chunks):
""" Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,
stuff_after_DEL_END). Returns the first case found (there may be
more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if
there's no DEL_START found. """
try:
pos = chunks.index(DEL_START)
ex... | def split_delete(chunks):
""" Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,
stuff_after_DEL_END). Returns the first case found (there may be
more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if
there's no DEL_START found. """
try:
pos = chunks.index(DEL_START)
ex... | [
"Returns",
"(",
"stuff_before_DEL_START",
"stuff_inside_DEL_START_END",
"stuff_after_DEL_END",
")",
".",
"Returns",
"the",
"first",
"case",
"found",
"(",
"there",
"may",
"be",
"more",
"DEL_STARTs",
"in",
"stuff_after_DEL_END",
")",
".",
"Raises",
"NoDeletes",
"if",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L349-L359 | [
"def",
"split_delete",
"(",
"chunks",
")",
":",
"try",
":",
"pos",
"=",
"chunks",
".",
"index",
"(",
"DEL_START",
")",
"except",
"ValueError",
":",
"raise",
"NoDeletes",
"pos2",
"=",
"chunks",
".",
"index",
"(",
"DEL_END",
")",
"return",
"chunks",
"[",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | locate_unbalanced_start | pre_delete and post_delete implicitly point to a place in the
document (where the two were split). This moves that point (by
popping items from one and pushing them onto the other). It moves
the point to try to find a place where unbalanced_start applies.
As an example::
>>> unbalanced_start... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete):
""" pre_delete and post_delete implicitly point to a place in the
document (where the two were split). This moves that point (by
popping items from one and pushing them onto the other). It moves
the point to try to find a place wh... | def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete):
""" pre_delete and post_delete implicitly point to a place in the
document (where the two were split). This moves that point (by
popping items from one and pushing them onto the other). It moves
the point to try to find a place wh... | [
"pre_delete",
"and",
"post_delete",
"implicitly",
"point",
"to",
"a",
"place",
"in",
"the",
"document",
"(",
"where",
"the",
"two",
"were",
"split",
")",
".",
"This",
"moves",
"that",
"point",
"(",
"by",
"popping",
"items",
"from",
"one",
"and",
"pushing",... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L361-L409 | [
"def",
"locate_unbalanced_start",
"(",
"unbalanced_start",
",",
"pre_delete",
",",
"post_delete",
")",
":",
"while",
"1",
":",
"if",
"not",
"unbalanced_start",
":",
"# We have totally succeded in finding the position",
"break",
"finding",
"=",
"unbalanced_start",
"[",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | locate_unbalanced_end | like locate_unbalanced_start, except handling end tags and
possibly moving the point earlier in the document. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete):
""" like locate_unbalanced_start, except handling end tags and
possibly moving the point earlier in the document. """
while 1:
if not unbalanced_end:
# Success
break
finding = unbalanced_end[-1]
... | def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete):
""" like locate_unbalanced_start, except handling end tags and
possibly moving the point earlier in the document. """
while 1:
if not unbalanced_end:
# Success
break
finding = unbalanced_end[-1]
... | [
"like",
"locate_unbalanced_start",
"except",
"handling",
"end",
"tags",
"and",
"possibly",
"moving",
"the",
"point",
"earlier",
"in",
"the",
"document",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L411-L435 | [
"def",
"locate_unbalanced_end",
"(",
"unbalanced_end",
",",
"pre_delete",
",",
"post_delete",
")",
":",
"while",
"1",
":",
"if",
"not",
"unbalanced_end",
":",
"# Success",
"break",
"finding",
"=",
"unbalanced_end",
"[",
"-",
"1",
"]",
"finding_name",
"=",
"fin... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | tokenize | Parse the given HTML and returns token objects (words with attached tags).
This parses only the content of a page; anything in the head is
ignored, and the <head> and <body> elements are themselves
optional. The content is then parsed by lxml, which ensures the
validity of the resulting parsed documen... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def tokenize(html, include_hrefs=True):
"""
Parse the given HTML and returns token objects (words with attached tags).
This parses only the content of a page; anything in the head is
ignored, and the <head> and <body> elements are themselves
optional. The content is then parsed by lxml, which ensu... | def tokenize(html, include_hrefs=True):
"""
Parse the given HTML and returns token objects (words with attached tags).
This parses only the content of a page; anything in the head is
ignored, and the <head> and <body> elements are themselves
optional. The content is then parsed by lxml, which ensu... | [
"Parse",
"the",
"given",
"HTML",
"and",
"returns",
"token",
"objects",
"(",
"words",
"with",
"attached",
"tags",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L516-L538 | [
"def",
"tokenize",
"(",
"html",
",",
"include_hrefs",
"=",
"True",
")",
":",
"if",
"etree",
".",
"iselement",
"(",
"html",
")",
":",
"body_el",
"=",
"html",
"else",
":",
"body_el",
"=",
"parse_html",
"(",
"html",
",",
"cleanup",
"=",
"True",
")",
"# ... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse_html | Parses an HTML fragment, returning an lxml element. Note that the HTML will be
wrapped in a <div> tag that was not in the original document.
If cleanup is true, make sure there's no <head> or <body>, and get
rid of any <ins> and <del> tags. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def parse_html(html, cleanup=True):
"""
Parses an HTML fragment, returning an lxml element. Note that the HTML will be
wrapped in a <div> tag that was not in the original document.
If cleanup is true, make sure there's no <head> or <body>, and get
rid of any <ins> and <del> tags.
"""
if cl... | def parse_html(html, cleanup=True):
"""
Parses an HTML fragment, returning an lxml element. Note that the HTML will be
wrapped in a <div> tag that was not in the original document.
If cleanup is true, make sure there's no <head> or <body>, and get
rid of any <ins> and <del> tags.
"""
if cl... | [
"Parses",
"an",
"HTML",
"fragment",
"returning",
"an",
"lxml",
"element",
".",
"Note",
"that",
"the",
"HTML",
"will",
"be",
"wrapped",
"in",
"a",
"<div",
">",
"tag",
"that",
"was",
"not",
"in",
"the",
"original",
"document",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L540-L551 | [
"def",
"parse_html",
"(",
"html",
",",
"cleanup",
"=",
"True",
")",
":",
"if",
"cleanup",
":",
"# This removes any extra markup or structure like <head>:",
"html",
"=",
"cleanup_html",
"(",
"html",
")",
"return",
"fragment_fromstring",
"(",
"html",
",",
"create_pare... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | cleanup_html | This 'cleans' the HTML, meaning that any page structure is removed
(only the contents of <body> are used, if there is any <body).
Also <ins> and <del> tags are removed. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def cleanup_html(html):
""" This 'cleans' the HTML, meaning that any page structure is removed
(only the contents of <body> are used, if there is any <body).
Also <ins> and <del> tags are removed. """
match = _body_re.search(html)
if match:
html = html[match.end():]
match = _end_body_re... | def cleanup_html(html):
""" This 'cleans' the HTML, meaning that any page structure is removed
(only the contents of <body> are used, if there is any <body).
Also <ins> and <del> tags are removed. """
match = _body_re.search(html)
if match:
html = html[match.end():]
match = _end_body_re... | [
"This",
"cleans",
"the",
"HTML",
"meaning",
"that",
"any",
"page",
"structure",
"is",
"removed",
"(",
"only",
"the",
"contents",
"of",
"<body",
">",
"are",
"used",
"if",
"there",
"is",
"any",
"<body",
")",
".",
"Also",
"<ins",
">",
"and",
"<del",
">",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L557-L568 | [
"def",
"cleanup_html",
"(",
"html",
")",
":",
"match",
"=",
"_body_re",
".",
"search",
"(",
"html",
")",
"if",
"match",
":",
"html",
"=",
"html",
"[",
"match",
".",
"end",
"(",
")",
":",
"]",
"match",
"=",
"_end_body_re",
".",
"search",
"(",
"html"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | split_trailing_whitespace | This function takes a word, such as 'test\n\n' and returns ('test','\n\n') | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def split_trailing_whitespace(word):
"""
This function takes a word, such as 'test\n\n' and returns ('test','\n\n')
"""
stripped_length = len(word.rstrip())
return word[0:stripped_length], word[stripped_length:] | def split_trailing_whitespace(word):
"""
This function takes a word, such as 'test\n\n' and returns ('test','\n\n')
"""
stripped_length = len(word.rstrip())
return word[0:stripped_length], word[stripped_length:] | [
"This",
"function",
"takes",
"a",
"word",
"such",
"as",
"test",
"\\",
"n",
"\\",
"n",
"and",
"returns",
"(",
"test",
"\\",
"n",
"\\",
"n",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L573-L578 | [
"def",
"split_trailing_whitespace",
"(",
"word",
")",
":",
"stripped_length",
"=",
"len",
"(",
"word",
".",
"rstrip",
"(",
")",
")",
"return",
"word",
"[",
"0",
":",
"stripped_length",
"]",
",",
"word",
"[",
"stripped_length",
":",
"]"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fixup_chunks | This function takes a list of chunks and produces a list of tokens. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def fixup_chunks(chunks):
"""
This function takes a list of chunks and produces a list of tokens.
"""
tag_accum = []
cur_word = None
result = []
for chunk in chunks:
if isinstance(chunk, tuple):
if chunk[0] == 'img':
src = chunk[1]
tag, tra... | def fixup_chunks(chunks):
"""
This function takes a list of chunks and produces a list of tokens.
"""
tag_accum = []
cur_word = None
result = []
for chunk in chunks:
if isinstance(chunk, tuple):
if chunk[0] == 'img':
src = chunk[1]
tag, tra... | [
"This",
"function",
"takes",
"a",
"list",
"of",
"chunks",
"and",
"produces",
"a",
"list",
"of",
"tokens",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L581-L631 | [
"def",
"fixup_chunks",
"(",
"chunks",
")",
":",
"tag_accum",
"=",
"[",
"]",
"cur_word",
"=",
"None",
"result",
"=",
"[",
"]",
"for",
"chunk",
"in",
"chunks",
":",
"if",
"isinstance",
"(",
"chunk",
",",
"tuple",
")",
":",
"if",
"chunk",
"[",
"0",
"]... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | flatten_el | Takes an lxml element el, and generates all the text chunks for
that tag. Each start tag is a chunk, each word is a chunk, and each
end tag is a chunk.
If skip_tag is true, then the outermost container tag is
not returned (just its contents). | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def flatten_el(el, include_hrefs, skip_tag=False):
""" Takes an lxml element el, and generates all the text chunks for
that tag. Each start tag is a chunk, each word is a chunk, and each
end tag is a chunk.
If skip_tag is true, then the outermost container tag is
not returned (just its contents)."... | def flatten_el(el, include_hrefs, skip_tag=False):
""" Takes an lxml element el, and generates all the text chunks for
that tag. Each start tag is a chunk, each word is a chunk, and each
end tag is a chunk.
If skip_tag is true, then the outermost container tag is
not returned (just its contents)."... | [
"Takes",
"an",
"lxml",
"element",
"el",
"and",
"generates",
"all",
"the",
"text",
"chunks",
"for",
"that",
"tag",
".",
"Each",
"start",
"tag",
"is",
"a",
"chunk",
"each",
"word",
"is",
"a",
"chunk",
"and",
"each",
"end",
"tag",
"is",
"a",
"chunk",
".... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L680-L706 | [
"def",
"flatten_el",
"(",
"el",
",",
"include_hrefs",
",",
"skip_tag",
"=",
"False",
")",
":",
"if",
"not",
"skip_tag",
":",
"if",
"el",
".",
"tag",
"==",
"'img'",
":",
"yield",
"(",
"'img'",
",",
"el",
".",
"get",
"(",
"'src'",
")",
",",
"start_ta... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | split_words | Splits some text into words. Includes trailing whitespace
on each word when appropriate. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def split_words(text):
""" Splits some text into words. Includes trailing whitespace
on each word when appropriate. """
if not text or not text.strip():
return []
words = split_words_re.findall(text)
return words | def split_words(text):
""" Splits some text into words. Includes trailing whitespace
on each word when appropriate. """
if not text or not text.strip():
return []
words = split_words_re.findall(text)
return words | [
"Splits",
"some",
"text",
"into",
"words",
".",
"Includes",
"trailing",
"whitespace",
"on",
"each",
"word",
"when",
"appropriate",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L710-L717 | [
"def",
"split_words",
"(",
"text",
")",
":",
"if",
"not",
"text",
"or",
"not",
"text",
".",
"strip",
"(",
")",
":",
"return",
"[",
"]",
"words",
"=",
"split_words_re",
".",
"findall",
"(",
"text",
")",
"return",
"words"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | start_tag | The text representation of the start tag for a tag. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def start_tag(el):
"""
The text representation of the start tag for a tag.
"""
return '<%s%s>' % (
el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True))
for name, value in el.attrib.items()])) | def start_tag(el):
"""
The text representation of the start tag for a tag.
"""
return '<%s%s>' % (
el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True))
for name, value in el.attrib.items()])) | [
"The",
"text",
"representation",
"of",
"the",
"start",
"tag",
"for",
"a",
"tag",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L721-L727 | [
"def",
"start_tag",
"(",
"el",
")",
":",
"return",
"'<%s%s>'",
"%",
"(",
"el",
".",
"tag",
",",
"''",
".",
"join",
"(",
"[",
"' %s=\"%s\"'",
"%",
"(",
"name",
",",
"html_escape",
"(",
"value",
",",
"True",
")",
")",
"for",
"name",
",",
"value",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | end_tag | The text representation of an end tag for a tag. Includes
trailing whitespace when appropriate. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def end_tag(el):
""" The text representation of an end tag for a tag. Includes
trailing whitespace when appropriate. """
if el.tail and start_whitespace_re.search(el.tail):
extra = ' '
else:
extra = ''
return '</%s>%s' % (el.tag, extra) | def end_tag(el):
""" The text representation of an end tag for a tag. Includes
trailing whitespace when appropriate. """
if el.tail and start_whitespace_re.search(el.tail):
extra = ' '
else:
extra = ''
return '</%s>%s' % (el.tag, extra) | [
"The",
"text",
"representation",
"of",
"an",
"end",
"tag",
"for",
"a",
"tag",
".",
"Includes",
"trailing",
"whitespace",
"when",
"appropriate",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L729-L736 | [
"def",
"end_tag",
"(",
"el",
")",
":",
"if",
"el",
".",
"tail",
"and",
"start_whitespace_re",
".",
"search",
"(",
"el",
".",
"tail",
")",
":",
"extra",
"=",
"' '",
"else",
":",
"extra",
"=",
"''",
"return",
"'</%s>%s'",
"%",
"(",
"el",
".",
"tag",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fixup_ins_del_tags | Given an html string, move any <ins> or <del> tags inside of any
block-level elements, e.g. transform <ins><p>word</p></ins> to
<p><ins>word</ins></p> | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def fixup_ins_del_tags(html):
""" Given an html string, move any <ins> or <del> tags inside of any
block-level elements, e.g. transform <ins><p>word</p></ins> to
<p><ins>word</ins></p> """
doc = parse_html(html, cleanup=False)
_fixup_ins_del_tags(doc)
html = serialize_html_fragment(doc, skip_out... | def fixup_ins_del_tags(html):
""" Given an html string, move any <ins> or <del> tags inside of any
block-level elements, e.g. transform <ins><p>word</p></ins> to
<p><ins>word</ins></p> """
doc = parse_html(html, cleanup=False)
_fixup_ins_del_tags(doc)
html = serialize_html_fragment(doc, skip_out... | [
"Given",
"an",
"html",
"string",
"move",
"any",
"<ins",
">",
"or",
"<del",
">",
"tags",
"inside",
"of",
"any",
"block",
"-",
"level",
"elements",
"e",
".",
"g",
".",
"transform",
"<ins",
">",
"<p",
">",
"word<",
"/",
"p",
">",
"<",
"/",
"ins",
">... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L747-L754 | [
"def",
"fixup_ins_del_tags",
"(",
"html",
")",
":",
"doc",
"=",
"parse_html",
"(",
"html",
",",
"cleanup",
"=",
"False",
")",
"_fixup_ins_del_tags",
"(",
"doc",
")",
"html",
"=",
"serialize_html_fragment",
"(",
"doc",
",",
"skip_outer",
"=",
"True",
")",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | serialize_html_fragment | Serialize a single lxml element as HTML. The serialized form
includes the elements tail.
If skip_outer is true, then don't serialize the outermost tag | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def serialize_html_fragment(el, skip_outer=False):
""" Serialize a single lxml element as HTML. The serialized form
includes the elements tail.
If skip_outer is true, then don't serialize the outermost tag
"""
assert not isinstance(el, basestring), (
"You should pass in an element, not a... | def serialize_html_fragment(el, skip_outer=False):
""" Serialize a single lxml element as HTML. The serialized form
includes the elements tail.
If skip_outer is true, then don't serialize the outermost tag
"""
assert not isinstance(el, basestring), (
"You should pass in an element, not a... | [
"Serialize",
"a",
"single",
"lxml",
"element",
"as",
"HTML",
".",
"The",
"serialized",
"form",
"includes",
"the",
"elements",
"tail",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L756-L772 | [
"def",
"serialize_html_fragment",
"(",
"el",
",",
"skip_outer",
"=",
"False",
")",
":",
"assert",
"not",
"isinstance",
"(",
"el",
",",
"basestring",
")",
",",
"(",
"\"You should pass in an element, not a string like %r\"",
"%",
"el",
")",
"html",
"=",
"etree",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _fixup_ins_del_tags | fixup_ins_del_tags that works on an lxml document in-place | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def _fixup_ins_del_tags(doc):
"""fixup_ins_del_tags that works on an lxml document in-place
"""
for tag in ['ins', 'del']:
for el in doc.xpath('descendant-or-self::%s' % tag):
if not _contains_block_level_tag(el):
continue
_move_el_inside_block(el, tag=tag)
... | def _fixup_ins_del_tags(doc):
"""fixup_ins_del_tags that works on an lxml document in-place
"""
for tag in ['ins', 'del']:
for el in doc.xpath('descendant-or-self::%s' % tag):
if not _contains_block_level_tag(el):
continue
_move_el_inside_block(el, tag=tag)
... | [
"fixup_ins_del_tags",
"that",
"works",
"on",
"an",
"lxml",
"document",
"in",
"-",
"place"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L774-L782 | [
"def",
"_fixup_ins_del_tags",
"(",
"doc",
")",
":",
"for",
"tag",
"in",
"[",
"'ins'",
",",
"'del'",
"]",
":",
"for",
"el",
"in",
"doc",
".",
"xpath",
"(",
"'descendant-or-self::%s'",
"%",
"tag",
")",
":",
"if",
"not",
"_contains_block_level_tag",
"(",
"e... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _contains_block_level_tag | True if the element contains any block-level elements, like <p>, <td>, etc. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def _contains_block_level_tag(el):
"""True if the element contains any block-level elements, like <p>, <td>, etc.
"""
if el.tag in block_level_tags or el.tag in block_level_container_tags:
return True
for child in el:
if _contains_block_level_tag(child):
return True
retur... | def _contains_block_level_tag(el):
"""True if the element contains any block-level elements, like <p>, <td>, etc.
"""
if el.tag in block_level_tags or el.tag in block_level_container_tags:
return True
for child in el:
if _contains_block_level_tag(child):
return True
retur... | [
"True",
"if",
"the",
"element",
"contains",
"any",
"block",
"-",
"level",
"elements",
"like",
"<p",
">",
"<td",
">",
"etc",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L785-L793 | [
"def",
"_contains_block_level_tag",
"(",
"el",
")",
":",
"if",
"el",
".",
"tag",
"in",
"block_level_tags",
"or",
"el",
".",
"tag",
"in",
"block_level_container_tags",
":",
"return",
"True",
"for",
"child",
"in",
"el",
":",
"if",
"_contains_block_level_tag",
"(... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _move_el_inside_block | helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
and moves them inside any block-level tags. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def _move_el_inside_block(el, tag):
""" helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
and moves them inside any block-level tags. """
for child in el:
if _contains_block_level_tag(child):
break
else:
import sys
# No block-level tags in any child
... | def _move_el_inside_block(el, tag):
""" helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
and moves them inside any block-level tags. """
for child in el:
if _contains_block_level_tag(child):
break
else:
import sys
# No block-level tags in any child
... | [
"helper",
"for",
"_fixup_ins_del_tags",
";",
"actually",
"takes",
"the",
"<ins",
">",
"etc",
"tags",
"and",
"moves",
"them",
"inside",
"any",
"block",
"-",
"level",
"tags",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L795-L826 | [
"def",
"_move_el_inside_block",
"(",
"el",
",",
"tag",
")",
":",
"for",
"child",
"in",
"el",
":",
"if",
"_contains_block_level_tag",
"(",
"child",
")",
":",
"break",
"else",
":",
"import",
"sys",
"# No block-level tags in any child",
"children_tag",
"=",
"etree"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _merge_element_contents | Removes an element, but merges its contents into its place, e.g.,
given <p>Hi <i>there!</i></p>, if you remove the <i> element you get
<p>Hi there!</p> | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py | def _merge_element_contents(el):
"""
Removes an element, but merges its contents into its place, e.g.,
given <p>Hi <i>there!</i></p>, if you remove the <i> element you get
<p>Hi there!</p>
"""
parent = el.getparent()
text = el.text or ''
if el.tail:
if not len(el):
te... | def _merge_element_contents(el):
"""
Removes an element, but merges its contents into its place, e.g.,
given <p>Hi <i>there!</i></p>, if you remove the <i> element you get
<p>Hi there!</p>
"""
parent = el.getparent()
text = el.text or ''
if el.tail:
if not len(el):
te... | [
"Removes",
"an",
"element",
"but",
"merges",
"its",
"contents",
"into",
"its",
"place",
"e",
".",
"g",
".",
"given",
"<p",
">",
"Hi",
"<i",
">",
"there!<",
"/",
"i",
">",
"<",
"/",
"p",
">",
"if",
"you",
"remove",
"the",
"<i",
">",
"element",
"yo... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/diff.py#L828-L860 | [
"def",
"_merge_element_contents",
"(",
"el",
")",
":",
"parent",
"=",
"el",
".",
"getparent",
"(",
")",
"text",
"=",
"el",
".",
"text",
"or",
"''",
"if",
"el",
".",
"tail",
":",
"if",
"not",
"len",
"(",
"el",
")",
":",
"text",
"+=",
"el",
".",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _iter_code | Yield '(op,arg)' pair for each operation in code object 'code | capybara/virtualenv/lib/python2.7/site-packages/setuptools/depends.py | def _iter_code(code):
"""Yield '(op,arg)' pair for each operation in code object 'code'"""
from array import array
from dis import HAVE_ARGUMENT, EXTENDED_ARG
bytes = array('b',code.co_code)
eof = len(code.co_code)
ptr = 0
extended_arg = 0
while ptr<eof:
op = bytes[ptr]
... | def _iter_code(code):
"""Yield '(op,arg)' pair for each operation in code object 'code'"""
from array import array
from dis import HAVE_ARGUMENT, EXTENDED_ARG
bytes = array('b',code.co_code)
eof = len(code.co_code)
ptr = 0
extended_arg = 0
while ptr<eof:
op = bytes[ptr]
... | [
"Yield",
"(",
"op",
"arg",
")",
"pair",
"for",
"each",
"operation",
"in",
"code",
"object",
"code"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/depends.py#L79-L109 | [
"def",
"_iter_code",
"(",
"code",
")",
":",
"from",
"array",
"import",
"array",
"from",
"dis",
"import",
"HAVE_ARGUMENT",
",",
"EXTENDED_ARG",
"bytes",
"=",
"array",
"(",
"'b'",
",",
"code",
".",
"co_code",
")",
"eof",
"=",
"len",
"(",
"code",
".",
"co... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | extract_constant | Extract the constant value of 'symbol' from 'code'
If the name 'symbol' is bound to a constant value by the Python code
object 'code', return that value. If 'symbol' is bound to an expression,
return 'default'. Otherwise, return 'None'.
Return value is based on the first assignment to 'symbol'. 'sy... | capybara/virtualenv/lib/python2.7/site-packages/setuptools/depends.py | def extract_constant(code, symbol, default=-1):
"""Extract the constant value of 'symbol' from 'code'
If the name 'symbol' is bound to a constant value by the Python code
object 'code', return that value. If 'symbol' is bound to an expression,
return 'default'. Otherwise, return 'None'.
Return v... | def extract_constant(code, symbol, default=-1):
"""Extract the constant value of 'symbol' from 'code'
If the name 'symbol' is bound to a constant value by the Python code
object 'code', return that value. If 'symbol' is bound to an expression,
return 'default'. Otherwise, return 'None'.
Return v... | [
"Extract",
"the",
"constant",
"value",
"of",
"symbol",
"from",
"code"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/depends.py#L166-L198 | [
"def",
"extract_constant",
"(",
"code",
",",
"symbol",
",",
"default",
"=",
"-",
"1",
")",
":",
"if",
"symbol",
"not",
"in",
"code",
".",
"co_names",
":",
"# name's not there, can't possibly be an assigment",
"return",
"None",
"name_idx",
"=",
"list",
"(",
"co... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | AmazonCall.cache_url | A simplified URL to be used for caching the given query. | capybara/virtualenv/lib/python2.7/site-packages/bottlenose/api.py | def cache_url(self, **kwargs):
"""A simplified URL to be used for caching the given query."""
query = {
'Operation': self.Operation,
'Service': "AWSECommerceService",
'Version': self.Version,
}
query.update(kwargs)
service_domain = SERVICE_DOM... | def cache_url(self, **kwargs):
"""A simplified URL to be used for caching the given query."""
query = {
'Operation': self.Operation,
'Service': "AWSECommerceService",
'Version': self.Version,
}
query.update(kwargs)
service_domain = SERVICE_DOM... | [
"A",
"simplified",
"URL",
"to",
"be",
"used",
"for",
"caching",
"the",
"given",
"query",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/bottlenose/api.py#L168-L179 | [
"def",
"cache_url",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"query",
"=",
"{",
"'Operation'",
":",
"self",
".",
"Operation",
",",
"'Service'",
":",
"\"AWSECommerceService\"",
",",
"'Version'",
":",
"self",
".",
"Version",
",",
"}",
"query",
".",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | autolink | Turn any URLs into links.
It will search for links identified by the given regular
expressions (by default mailto and http(s) links).
It won't link text in an element in avoid_elements, or an element
with a class in avoid_classes. It won't link to anything with a
host that matches one of the regu... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py | def autolink(el, link_regexes=_link_regexes,
avoid_elements=_avoid_elements,
avoid_hosts=_avoid_hosts,
avoid_classes=_avoid_classes):
"""
Turn any URLs into links.
It will search for links identified by the given regular
expressions (by default mailto and http(s) ... | def autolink(el, link_regexes=_link_regexes,
avoid_elements=_avoid_elements,
avoid_hosts=_avoid_hosts,
avoid_classes=_avoid_classes):
"""
Turn any URLs into links.
It will search for links identified by the given regular
expressions (by default mailto and http(s) ... | [
"Turn",
"any",
"URLs",
"into",
"links",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py#L530-L573 | [
"def",
"autolink",
"(",
"el",
",",
"link_regexes",
"=",
"_link_regexes",
",",
"avoid_elements",
"=",
"_avoid_elements",
",",
"avoid_hosts",
"=",
"_avoid_hosts",
",",
"avoid_classes",
"=",
"_avoid_classes",
")",
":",
"if",
"el",
".",
"tag",
"in",
"avoid_elements"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | word_break | Breaks any long words found in the body of the text (not attributes).
Doesn't effect any of the tags in avoid_elements, by default
``<textarea>`` and ``<pre>``
Breaks words by inserting ​, which is a unicode character
for Zero Width Space character. This generally takes up no space
in rende... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py | def word_break(el, max_width=40,
avoid_elements=_avoid_word_break_elements,
avoid_classes=_avoid_word_break_classes,
break_character=unichr(0x200b)):
"""
Breaks any long words found in the body of the text (not attributes).
Doesn't effect any of the tags in avoi... | def word_break(el, max_width=40,
avoid_elements=_avoid_word_break_elements,
avoid_classes=_avoid_word_break_classes,
break_character=unichr(0x200b)):
"""
Breaks any long words found in the body of the text (not attributes).
Doesn't effect any of the tags in avoi... | [
"Breaks",
"any",
"long",
"words",
"found",
"in",
"the",
"body",
"of",
"the",
"text",
"(",
"not",
"attributes",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py#L651-L690 | [
"def",
"word_break",
"(",
"el",
",",
"max_width",
"=",
"40",
",",
"avoid_elements",
"=",
"_avoid_word_break_elements",
",",
"avoid_classes",
"=",
"_avoid_word_break_classes",
",",
"break_character",
"=",
"unichr",
"(",
"0x200b",
")",
")",
":",
"# Character suggestio... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Cleaner.kill_conditional_comments | IE conditional comments basically embed HTML that the parser
doesn't normally see. We can't allow anything like that, so
we'll kill any comments that could be conditional. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py | def kill_conditional_comments(self, doc):
"""
IE conditional comments basically embed HTML that the parser
doesn't normally see. We can't allow anything like that, so
we'll kill any comments that could be conditional.
"""
bad = []
self._kill_elements(
... | def kill_conditional_comments(self, doc):
"""
IE conditional comments basically embed HTML that the parser
doesn't normally see. We can't allow anything like that, so
we'll kill any comments that could be conditional.
"""
bad = []
self._kill_elements(
... | [
"IE",
"conditional",
"comments",
"basically",
"embed",
"HTML",
"that",
"the",
"parser",
"doesn",
"t",
"normally",
"see",
".",
"We",
"can",
"t",
"allow",
"anything",
"like",
"that",
"so",
"we",
"ll",
"kill",
"any",
"comments",
"that",
"could",
"be",
"condit... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py#L448-L457 | [
"def",
"kill_conditional_comments",
"(",
"self",
",",
"doc",
")",
":",
"bad",
"=",
"[",
"]",
"self",
".",
"_kill_elements",
"(",
"doc",
",",
"lambda",
"el",
":",
"_conditional_comment_re",
".",
"search",
"(",
"el",
".",
"text",
")",
",",
"etree",
".",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Cleaner._has_sneaky_javascript | Depending on the browser, stuff like ``e x p r e s s i o n(...)``
can get interpreted, or ``expre/* stuff */ssion(...)``. This
checks for attempt to do stuff like this.
Typically the response will be to kill the entire style; if you
have just a bit of Javascript in the style another ru... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py | def _has_sneaky_javascript(self, style):
"""
Depending on the browser, stuff like ``e x p r e s s i o n(...)``
can get interpreted, or ``expre/* stuff */ssion(...)``. This
checks for attempt to do stuff like this.
Typically the response will be to kill the entire style; if you
... | def _has_sneaky_javascript(self, style):
"""
Depending on the browser, stuff like ``e x p r e s s i o n(...)``
can get interpreted, or ``expre/* stuff */ssion(...)``. This
checks for attempt to do stuff like this.
Typically the response will be to kill the entire style; if you
... | [
"Depending",
"on",
"the",
"browser",
"stuff",
"like",
"e",
"x",
"p",
"r",
"e",
"s",
"s",
"i",
"o",
"n",
"(",
"...",
")",
"can",
"get",
"interpreted",
"or",
"expre",
"/",
"*",
"stuff",
"*",
"/",
"ssion",
"(",
"...",
")",
".",
"This",
"checks",
"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/clean.py#L477-L496 | [
"def",
"_has_sneaky_javascript",
"(",
"self",
",",
"style",
")",
":",
"style",
"=",
"self",
".",
"_substitute_comments",
"(",
"''",
",",
"style",
")",
"style",
"=",
"style",
".",
"replace",
"(",
"'\\\\'",
",",
"''",
")",
"style",
"=",
"_substitute_whitespa... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | document_fromstring | Parse a whole document into a string. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py | def document_fromstring(html, guess_charset=True, parser=None):
"""Parse a whole document into a string."""
if not isinstance(html, _strings):
raise TypeError('string required')
if parser is None:
parser = html_parser
return parser.parse(html, useChardet=guess_charset).getroot() | def document_fromstring(html, guess_charset=True, parser=None):
"""Parse a whole document into a string."""
if not isinstance(html, _strings):
raise TypeError('string required')
if parser is None:
parser = html_parser
return parser.parse(html, useChardet=guess_charset).getroot() | [
"Parse",
"a",
"whole",
"document",
"into",
"a",
"string",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py#L56-L64 | [
"def",
"document_fromstring",
"(",
"html",
",",
"guess_charset",
"=",
"True",
",",
"parser",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"html",
",",
"_strings",
")",
":",
"raise",
"TypeError",
"(",
"'string required'",
")",
"if",
"parser",
"is"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fragments_fromstring | Parses several HTML elements, returning a list of elements.
The first item in the list may be a string. If no_leading_text is true,
then it will be an error if there is leading text, and it will always be
a list of only elements.
If `guess_charset` is `True` and the text was not unicode but a
byt... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py | def fragments_fromstring(html, no_leading_text=False,
guess_charset=False, parser=None):
"""Parses several HTML elements, returning a list of elements.
The first item in the list may be a string. If no_leading_text is true,
then it will be an error if there is leading text, and it... | def fragments_fromstring(html, no_leading_text=False,
guess_charset=False, parser=None):
"""Parses several HTML elements, returning a list of elements.
The first item in the list may be a string. If no_leading_text is true,
then it will be an error if there is leading text, and it... | [
"Parses",
"several",
"HTML",
"elements",
"returning",
"a",
"list",
"of",
"elements",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py#L67-L92 | [
"def",
"fragments_fromstring",
"(",
"html",
",",
"no_leading_text",
"=",
"False",
",",
"guess_charset",
"=",
"False",
",",
"parser",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"html",
",",
"_strings",
")",
":",
"raise",
"TypeError",
"(",
"'stri... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fragment_fromstring | Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.
If create_parent is true (or is a tag name) then a parent node
will be created to encapsulate the HTML in a single element. In
this case, leading or traili... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py | def fragment_fromstring(html, create_parent=False,
guess_charset=False, parser=None):
"""Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.
If create_parent is true (or is a tag name) the... | def fragment_fromstring(html, create_parent=False,
guess_charset=False, parser=None):
"""Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.
If create_parent is true (or is a tag name) the... | [
"Parses",
"a",
"single",
"HTML",
"element",
";",
"it",
"is",
"an",
"error",
"if",
"there",
"is",
"more",
"than",
"one",
"element",
"or",
"if",
"anything",
"but",
"whitespace",
"precedes",
"or",
"follows",
"the",
"element",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py#L95-L133 | [
"def",
"fragment_fromstring",
"(",
"html",
",",
"create_parent",
"=",
"False",
",",
"guess_charset",
"=",
"False",
",",
"parser",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"html",
",",
"_strings",
")",
":",
"raise",
"TypeError",
"(",
"'string ... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fromstring | Parse the html, returning a single element/document.
This tries to minimally parse the chunk of text, without knowing if it
is a fragment or a document.
base_url will set the document's base_url attribute (and the tree's docinfo.URL) | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py | def fromstring(html, guess_charset=True, parser=None):
"""Parse the html, returning a single element/document.
This tries to minimally parse the chunk of text, without knowing if it
is a fragment or a document.
base_url will set the document's base_url attribute (and the tree's docinfo.URL)
"""
... | def fromstring(html, guess_charset=True, parser=None):
"""Parse the html, returning a single element/document.
This tries to minimally parse the chunk of text, without knowing if it
is a fragment or a document.
base_url will set the document's base_url attribute (and the tree's docinfo.URL)
"""
... | [
"Parse",
"the",
"html",
"returning",
"a",
"single",
"element",
"/",
"document",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py#L136-L175 | [
"def",
"fromstring",
"(",
"html",
",",
"guess_charset",
"=",
"True",
",",
"parser",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"html",
",",
"_strings",
")",
":",
"raise",
"TypeError",
"(",
"'string required'",
")",
"doc",
"=",
"document_fromstr... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse | Parse a filename, URL, or file-like object into an HTML document
tree. Note: this returns a tree, not an element. Use
``parse(...).getroot()`` to get the document root. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py | def parse(filename_url_or_file, guess_charset=True, parser=None):
"""Parse a filename, URL, or file-like object into an HTML document
tree. Note: this returns a tree, not an element. Use
``parse(...).getroot()`` to get the document root.
"""
if parser is None:
parser = html_parser
if n... | def parse(filename_url_or_file, guess_charset=True, parser=None):
"""Parse a filename, URL, or file-like object into an HTML document
tree. Note: this returns a tree, not an element. Use
``parse(...).getroot()`` to get the document root.
"""
if parser is None:
parser = html_parser
if n... | [
"Parse",
"a",
"filename",
"URL",
"or",
"file",
"-",
"like",
"object",
"into",
"an",
"HTML",
"document",
"tree",
".",
"Note",
":",
"this",
"returns",
"a",
"tree",
"not",
"an",
"element",
".",
"Use",
"parse",
"(",
"...",
")",
".",
"getroot",
"()",
"to"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py#L178-L191 | [
"def",
"parse",
"(",
"filename_url_or_file",
",",
"guess_charset",
"=",
"True",
",",
"parser",
"=",
"None",
")",
":",
"if",
"parser",
"is",
"None",
":",
"parser",
"=",
"html_parser",
"if",
"not",
"isinstance",
"(",
"filename_url_or_file",
",",
"_strings",
")... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | api_accepts | Define the accept schema of an API (GET or POST).
'fields' is a dict of Django form fields keyed by field name that specifies
the form-urlencoded fields that the API accepts*.
The view function is then called with GET/POST data that has been cleaned
by the Django form.
In debug and test modes, fa... | django_api/decorators.py | def api_accepts(fields):
"""
Define the accept schema of an API (GET or POST).
'fields' is a dict of Django form fields keyed by field name that specifies
the form-urlencoded fields that the API accepts*.
The view function is then called with GET/POST data that has been cleaned
by the Django f... | def api_accepts(fields):
"""
Define the accept schema of an API (GET or POST).
'fields' is a dict of Django form fields keyed by field name that specifies
the form-urlencoded fields that the API accepts*.
The view function is then called with GET/POST data that has been cleaned
by the Django f... | [
"Define",
"the",
"accept",
"schema",
"of",
"an",
"API",
"(",
"GET",
"or",
"POST",
")",
"."
] | bipsandbytes/django-api | python | https://github.com/bipsandbytes/django-api/blob/df99f4ccbb0c5128bd06da83f60881a85f6dbfe1/django_api/decorators.py#L35-L119 | [
"def",
"api_accepts",
"(",
"fields",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapped_func",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"request",
".",
"method",
"n... | df99f4ccbb0c5128bd06da83f60881a85f6dbfe1 |
test | api_returns | Define the return schema of an API.
'return_values' is a dictionary mapping
HTTP return code => documentation
In addition to validating that the status code of the response belongs to
one of the accepted status codes, it also validates that the returned
object is JSON (derived from JsonResponse)
... | django_api/decorators.py | def api_returns(return_values):
"""
Define the return schema of an API.
'return_values' is a dictionary mapping
HTTP return code => documentation
In addition to validating that the status code of the response belongs to
one of the accepted status codes, it also validates that the returned
o... | def api_returns(return_values):
"""
Define the return schema of an API.
'return_values' is a dictionary mapping
HTTP return code => documentation
In addition to validating that the status code of the response belongs to
one of the accepted status codes, it also validates that the returned
o... | [
"Define",
"the",
"return",
"schema",
"of",
"an",
"API",
"."
] | bipsandbytes/django-api | python | https://github.com/bipsandbytes/django-api/blob/df99f4ccbb0c5128bd06da83f60881a85f6dbfe1/django_api/decorators.py#L122-L182 | [
"def",
"api_returns",
"(",
"return_values",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapped_func",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return_value",
"=",
"func",
... | df99f4ccbb0c5128bd06da83f60881a85f6dbfe1 |
test | api | Wrapper that calls @api_accepts and @api_returns in sequence.
For example:
@api({
'accepts': {
'x': forms.IntegerField(min_value=0),
'y': forms.IntegerField(min_value=0),
},
'returns': [
200: 'Operation successful',
403: 'User does not hav... | django_api/decorators.py | def api(accept_return_dict):
"""
Wrapper that calls @api_accepts and @api_returns in sequence.
For example:
@api({
'accepts': {
'x': forms.IntegerField(min_value=0),
'y': forms.IntegerField(min_value=0),
},
'returns': [
200: 'Operation success... | def api(accept_return_dict):
"""
Wrapper that calls @api_accepts and @api_returns in sequence.
For example:
@api({
'accepts': {
'x': forms.IntegerField(min_value=0),
'y': forms.IntegerField(min_value=0),
},
'returns': [
200: 'Operation success... | [
"Wrapper",
"that",
"calls",
"@api_accepts",
"and",
"@api_returns",
"in",
"sequence",
".",
"For",
"example",
":"
] | bipsandbytes/django-api | python | https://github.com/bipsandbytes/django-api/blob/df99f4ccbb0c5128bd06da83f60881a85f6dbfe1/django_api/decorators.py#L185-L218 | [
"def",
"api",
"(",
"accept_return_dict",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapped_func",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"@",
"api_accepts",
"(",
"accept... | df99f4ccbb0c5128bd06da83f60881a85f6dbfe1 |
test | validate_json_request | Return a decorator that ensures that the request passed to the view
function/method has a valid JSON request body with the given required
fields. The dict parsed from the JSON is then passed as the second
argument to the decorated function/method. For example:
@json_request({'name', 'date'})
def ... | django_api/decorators.py | def validate_json_request(required_fields):
"""
Return a decorator that ensures that the request passed to the view
function/method has a valid JSON request body with the given required
fields. The dict parsed from the JSON is then passed as the second
argument to the decorated function/method. Fo... | def validate_json_request(required_fields):
"""
Return a decorator that ensures that the request passed to the view
function/method has a valid JSON request body with the given required
fields. The dict parsed from the JSON is then passed as the second
argument to the decorated function/method. Fo... | [
"Return",
"a",
"decorator",
"that",
"ensures",
"that",
"the",
"request",
"passed",
"to",
"the",
"view",
"function",
"/",
"method",
"has",
"a",
"valid",
"JSON",
"request",
"body",
"with",
"the",
"given",
"required",
"fields",
".",
"The",
"dict",
"parsed",
"... | bipsandbytes/django-api | python | https://github.com/bipsandbytes/django-api/blob/df99f4ccbb0c5128bd06da83f60881a85f6dbfe1/django_api/decorators.py#L221-L247 | [
"def",
"validate_json_request",
"(",
"required_fields",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapped_func",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"reques... | df99f4ccbb0c5128bd06da83f60881a85f6dbfe1 |
test | getTreeWalker | Get a TreeWalker class for various types of tree with built-in support
treeType - the name of the tree type required (case-insensitive). Supported
values are:
"dom" - The xml.dom.minidom DOM implementation
"pulldom" - The xml.dom.pulldom event stream
... | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py | def getTreeWalker(treeType, implementation=None, **kwargs):
"""Get a TreeWalker class for various types of tree with built-in support
treeType - the name of the tree type required (case-insensitive). Supported
values are:
"dom" - The xml.dom.minidom DOM implementation
... | def getTreeWalker(treeType, implementation=None, **kwargs):
"""Get a TreeWalker class for various types of tree with built-in support
treeType - the name of the tree type required (case-insensitive). Supported
values are:
"dom" - The xml.dom.minidom DOM implementation
... | [
"Get",
"a",
"TreeWalker",
"class",
"for",
"various",
"types",
"of",
"tree",
"with",
"built",
"-",
"in",
"support"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py#L24-L61 | [
"def",
"getTreeWalker",
"(",
"treeType",
",",
"implementation",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"treeType",
"=",
"treeType",
".",
"lower",
"(",
")",
"if",
"treeType",
"not",
"in",
"treeWalkerCache",
":",
"if",
"treeType",
"in",
"(",
"\"do... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | get_include | Returns a list of header include paths (for lxml itself, libxml2
and libxslt) needed to compile C code against lxml if it was built
with statically linked libraries. | capybara/virtualenv/lib/python2.7/site-packages/lxml/__init__.py | def get_include():
"""
Returns a list of header include paths (for lxml itself, libxml2
and libxslt) needed to compile C code against lxml if it was built
with statically linked libraries.
"""
import os
lxml_path = __path__[0]
include_path = os.path.join(lxml_path, 'includes')
includ... | def get_include():
"""
Returns a list of header include paths (for lxml itself, libxml2
and libxslt) needed to compile C code against lxml if it was built
with statically linked libraries.
"""
import os
lxml_path = __path__[0]
include_path = os.path.join(lxml_path, 'includes')
includ... | [
"Returns",
"a",
"list",
"of",
"header",
"include",
"paths",
"(",
"for",
"lxml",
"itself",
"libxml2",
"and",
"libxslt",
")",
"needed",
"to",
"compile",
"C",
"code",
"against",
"lxml",
"if",
"it",
"was",
"built",
"with",
"statically",
"linked",
"libraries",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/__init__.py#L3-L19 | [
"def",
"get_include",
"(",
")",
":",
"import",
"os",
"lxml_path",
"=",
"__path__",
"[",
"0",
"]",
"include_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"lxml_path",
",",
"'includes'",
")",
"includes",
"=",
"[",
"include_path",
",",
"lxml_path",
"]",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Subversion.export | Export the svn repository at the url to the destination location | capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/subversion.py | def export(self, location):
"""Export the svn repository at the url to the destination location"""
url, rev = self.get_url_rev()
rev_options = get_rev_options(url, rev)
logger.info('Exporting svn repository %s to %s', url, location)
with indent_log():
if os.path.exist... | def export(self, location):
"""Export the svn repository at the url to the destination location"""
url, rev = self.get_url_rev()
rev_options = get_rev_options(url, rev)
logger.info('Exporting svn repository %s to %s', url, location)
with indent_log():
if os.path.exist... | [
"Export",
"the",
"svn",
"repository",
"at",
"the",
"url",
"to",
"the",
"destination",
"location"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/subversion.py#L59-L71 | [
"def",
"export",
"(",
"self",
",",
"location",
")",
":",
"url",
",",
"rev",
"=",
"self",
".",
"get_url_rev",
"(",
")",
"rev_options",
"=",
"get_rev_options",
"(",
"url",
",",
"rev",
")",
"logger",
".",
"info",
"(",
"'Exporting svn repository %s to %s'",
",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Subversion.get_revision | Return the maximum revision for all files under a given location | capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/subversion.py | def get_revision(self, location):
"""
Return the maximum revision for all files under a given location
"""
# Note: taken from setuptools.command.egg_info
revision = 0
for base, dirs, files in os.walk(location):
if self.dirname not in dirs:
dir... | def get_revision(self, location):
"""
Return the maximum revision for all files under a given location
"""
# Note: taken from setuptools.command.egg_info
revision = 0
for base, dirs, files in os.walk(location):
if self.dirname not in dirs:
dir... | [
"Return",
"the",
"maximum",
"revision",
"for",
"all",
"files",
"under",
"a",
"given",
"location"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/subversion.py#L109-L134 | [
"def",
"get_revision",
"(",
"self",
",",
"location",
")",
":",
"# Note: taken from setuptools.command.egg_info",
"revision",
"=",
"0",
"for",
"base",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"location",
")",
":",
"if",
"self",
".",
"dirname",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | setupmethod | Wraps a method so that it performs a check in debug mode if the
first request was already handled. | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def setupmethod(f):
"""Wraps a method so that it performs a check in debug mode if the
first request was already handled.
"""
def wrapper_func(self, *args, **kwargs):
if self.debug and self._got_first_request:
raise AssertionError('A setup function was called after the '
... | def setupmethod(f):
"""Wraps a method so that it performs a check in debug mode if the
first request was already handled.
"""
def wrapper_func(self, *args, **kwargs):
if self.debug and self._got_first_request:
raise AssertionError('A setup function was called after the '
... | [
"Wraps",
"a",
"method",
"so",
"that",
"it",
"performs",
"a",
"check",
"in",
"debug",
"mode",
"if",
"the",
"first",
"request",
"was",
"already",
"handled",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L49-L63 | [
"def",
"setupmethod",
"(",
"f",
")",
":",
"def",
"wrapper_func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"debug",
"and",
"self",
".",
"_got_first_request",
":",
"raise",
"AssertionError",
"(",
"'A setup functi... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.name | The name of the application. This is usually the import name
with the difference that it's guessed from the run file if the
import name is main. This name is used as a display name when
Flask needs the name of the application. It can be set and overridden
to change the value.
... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def name(self):
"""The name of the application. This is usually the import name
with the difference that it's guessed from the run file if the
import name is main. This name is used as a display name when
Flask needs the name of the application. It can be set and overridden
to... | def name(self):
"""The name of the application. This is usually the import name
with the difference that it's guessed from the run file if the
import name is main. This name is used as a display name when
Flask needs the name of the application. It can be set and overridden
to... | [
"The",
"name",
"of",
"the",
"application",
".",
"This",
"is",
"usually",
"the",
"import",
"name",
"with",
"the",
"difference",
"that",
"it",
"s",
"guessed",
"from",
"the",
"run",
"file",
"if",
"the",
"import",
"name",
"is",
"main",
".",
"This",
"name",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L523-L537 | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"import_name",
"==",
"'__main__'",
":",
"fn",
"=",
"getattr",
"(",
"sys",
".",
"modules",
"[",
"'__main__'",
"]",
",",
"'__file__'",
",",
"None",
")",
"if",
"fn",
"is",
"None",
":",
"return",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.propagate_exceptions | Returns the value of the `PROPAGATE_EXCEPTIONS` configuration
value in case it's set, otherwise a sensible default is returned.
.. versionadded:: 0.7 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def propagate_exceptions(self):
"""Returns the value of the `PROPAGATE_EXCEPTIONS` configuration
value in case it's set, otherwise a sensible default is returned.
.. versionadded:: 0.7
"""
rv = self.config['PROPAGATE_EXCEPTIONS']
if rv is not None:
return rv
... | def propagate_exceptions(self):
"""Returns the value of the `PROPAGATE_EXCEPTIONS` configuration
value in case it's set, otherwise a sensible default is returned.
.. versionadded:: 0.7
"""
rv = self.config['PROPAGATE_EXCEPTIONS']
if rv is not None:
return rv
... | [
"Returns",
"the",
"value",
"of",
"the",
"PROPAGATE_EXCEPTIONS",
"configuration",
"value",
"in",
"case",
"it",
"s",
"set",
"otherwise",
"a",
"sensible",
"default",
"is",
"returned",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L540-L549 | [
"def",
"propagate_exceptions",
"(",
"self",
")",
":",
"rv",
"=",
"self",
".",
"config",
"[",
"'PROPAGATE_EXCEPTIONS'",
"]",
"if",
"rv",
"is",
"not",
"None",
":",
"return",
"rv",
"return",
"self",
".",
"testing",
"or",
"self",
".",
"debug"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.logger | A :class:`logging.Logger` object for this application. The
default configuration is to log to stderr if the application is
in debug mode. This logger can be used to (surprise) log messages.
Here some examples::
app.logger.debug('A value for debugging')
app.logger.warni... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def logger(self):
"""A :class:`logging.Logger` object for this application. The
default configuration is to log to stderr if the application is
in debug mode. This logger can be used to (surprise) log messages.
Here some examples::
app.logger.debug('A value for debugging')... | def logger(self):
"""A :class:`logging.Logger` object for this application. The
default configuration is to log to stderr if the application is
in debug mode. This logger can be used to (surprise) log messages.
Here some examples::
app.logger.debug('A value for debugging')... | [
"A",
":",
"class",
":",
"logging",
".",
"Logger",
"object",
"for",
"this",
"application",
".",
"The",
"default",
"configuration",
"is",
"to",
"log",
"to",
"stderr",
"if",
"the",
"application",
"is",
"in",
"debug",
"mode",
".",
"This",
"logger",
"can",
"b... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L565-L584 | [
"def",
"logger",
"(",
"self",
")",
":",
"if",
"self",
".",
"_logger",
"and",
"self",
".",
"_logger",
".",
"name",
"==",
"self",
".",
"logger_name",
":",
"return",
"self",
".",
"_logger",
"with",
"_logger_lock",
":",
"if",
"self",
".",
"_logger",
"and",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.make_config | Used to create the config attribute by the Flask constructor.
The `instance_relative` parameter is passed in from the constructor
of Flask (there named `instance_relative_config`) and indicates if
the config should be relative to the instance path or the root path
of the application.
... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def make_config(self, instance_relative=False):
"""Used to create the config attribute by the Flask constructor.
The `instance_relative` parameter is passed in from the constructor
of Flask (there named `instance_relative_config`) and indicates if
the config should be relative to the ins... | def make_config(self, instance_relative=False):
"""Used to create the config attribute by the Flask constructor.
The `instance_relative` parameter is passed in from the constructor
of Flask (there named `instance_relative_config`) and indicates if
the config should be relative to the ins... | [
"Used",
"to",
"create",
"the",
"config",
"attribute",
"by",
"the",
"Flask",
"constructor",
".",
"The",
"instance_relative",
"parameter",
"is",
"passed",
"in",
"from",
"the",
"constructor",
"of",
"Flask",
"(",
"there",
"named",
"instance_relative_config",
")",
"a... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L600-L612 | [
"def",
"make_config",
"(",
"self",
",",
"instance_relative",
"=",
"False",
")",
":",
"root_path",
"=",
"self",
".",
"root_path",
"if",
"instance_relative",
":",
"root_path",
"=",
"self",
".",
"instance_path",
"return",
"Config",
"(",
"root_path",
",",
"self",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.auto_find_instance_path | Tries to locate the instance path if it was not provided to the
constructor of the application class. It will basically calculate
the path to a folder named ``instance`` next to your main file or
the package.
.. versionadded:: 0.8 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def auto_find_instance_path(self):
"""Tries to locate the instance path if it was not provided to the
constructor of the application class. It will basically calculate
the path to a folder named ``instance`` next to your main file or
the package.
.. versionadded:: 0.8
"... | def auto_find_instance_path(self):
"""Tries to locate the instance path if it was not provided to the
constructor of the application class. It will basically calculate
the path to a folder named ``instance`` next to your main file or
the package.
.. versionadded:: 0.8
"... | [
"Tries",
"to",
"locate",
"the",
"instance",
"path",
"if",
"it",
"was",
"not",
"provided",
"to",
"the",
"constructor",
"of",
"the",
"application",
"class",
".",
"It",
"will",
"basically",
"calculate",
"the",
"path",
"to",
"a",
"folder",
"named",
"instance",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L614-L625 | [
"def",
"auto_find_instance_path",
"(",
"self",
")",
":",
"prefix",
",",
"package_path",
"=",
"find_package",
"(",
"self",
".",
"import_name",
")",
"if",
"prefix",
"is",
"None",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"package_path",
",",
"'inst... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.open_instance_resource | Opens a resource from the application's instance folder
(:attr:`instance_path`). Otherwise works like
:meth:`open_resource`. Instance resources can also be opened for
writing.
:param resource: the name of the resource. To access resources within
subfolders us... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def open_instance_resource(self, resource, mode='rb'):
"""Opens a resource from the application's instance folder
(:attr:`instance_path`). Otherwise works like
:meth:`open_resource`. Instance resources can also be opened for
writing.
:param resource: the name of the resource. ... | def open_instance_resource(self, resource, mode='rb'):
"""Opens a resource from the application's instance folder
(:attr:`instance_path`). Otherwise works like
:meth:`open_resource`. Instance resources can also be opened for
writing.
:param resource: the name of the resource. ... | [
"Opens",
"a",
"resource",
"from",
"the",
"application",
"s",
"instance",
"folder",
"(",
":",
"attr",
":",
"instance_path",
")",
".",
"Otherwise",
"works",
"like",
":",
"meth",
":",
"open_resource",
".",
"Instance",
"resources",
"can",
"also",
"be",
"opened",... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L627-L637 | [
"def",
"open_instance_resource",
"(",
"self",
",",
"resource",
",",
"mode",
"=",
"'rb'",
")",
":",
"return",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"instance_path",
",",
"resource",
")",
",",
"mode",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.create_jinja_environment | Creates the Jinja2 environment based on :attr:`jinja_options`
and :meth:`select_jinja_autoescape`. Since 0.7 this also adds
the Jinja2 globals and filters after initialization. Override
this function to customize the behavior.
.. versionadded:: 0.5 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def create_jinja_environment(self):
"""Creates the Jinja2 environment based on :attr:`jinja_options`
and :meth:`select_jinja_autoescape`. Since 0.7 this also adds
the Jinja2 globals and filters after initialization. Override
this function to customize the behavior.
.. versiona... | def create_jinja_environment(self):
"""Creates the Jinja2 environment based on :attr:`jinja_options`
and :meth:`select_jinja_autoescape`. Since 0.7 this also adds
the Jinja2 globals and filters after initialization. Override
this function to customize the behavior.
.. versiona... | [
"Creates",
"the",
"Jinja2",
"environment",
"based",
"on",
":",
"attr",
":",
"jinja_options",
"and",
":",
"meth",
":",
"select_jinja_autoescape",
".",
"Since",
"0",
".",
"7",
"this",
"also",
"adds",
"the",
"Jinja2",
"globals",
"and",
"filters",
"after",
"init... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L639-L663 | [
"def",
"create_jinja_environment",
"(",
"self",
")",
":",
"options",
"=",
"dict",
"(",
"self",
".",
"jinja_options",
")",
"if",
"'autoescape'",
"not",
"in",
"options",
":",
"options",
"[",
"'autoescape'",
"]",
"=",
"self",
".",
"select_jinja_autoescape",
"rv",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.update_template_context | Update the template context with some commonly used variables.
This injects request, session, config and g into the template
context as well as everything template context processors want
to inject. Note that the as of Flask 0.6, the original values
in the context will not be overridden... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def update_template_context(self, context):
"""Update the template context with some commonly used variables.
This injects request, session, config and g into the template
context as well as everything template context processors want
to inject. Note that the as of Flask 0.6, the origin... | def update_template_context(self, context):
"""Update the template context with some commonly used variables.
This injects request, session, config and g into the template
context as well as everything template context processors want
to inject. Note that the as of Flask 0.6, the origin... | [
"Update",
"the",
"template",
"context",
"with",
"some",
"commonly",
"used",
"variables",
".",
"This",
"injects",
"request",
"session",
"config",
"and",
"g",
"into",
"the",
"template",
"context",
"as",
"well",
"as",
"everything",
"template",
"context",
"processor... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L697-L720 | [
"def",
"update_template_context",
"(",
"self",
",",
"context",
")",
":",
"funcs",
"=",
"self",
".",
"template_context_processors",
"[",
"None",
"]",
"reqctx",
"=",
"_request_ctx_stack",
".",
"top",
"if",
"reqctx",
"is",
"not",
"None",
":",
"bp",
"=",
"reqctx... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.run | Runs the application on a local development server. If the
:attr:`debug` flag is set the server will automatically reload
for code changes and show a debugger in case an exception happened.
If you want to run the application in debug mode, but disable the
code execution on the interact... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def run(self, host=None, port=None, debug=None, **options):
"""Runs the application on a local development server. If the
:attr:`debug` flag is set the server will automatically reload
for code changes and show a debugger in case an exception happened.
If you want to run the applicatio... | def run(self, host=None, port=None, debug=None, **options):
"""Runs the application on a local development server. If the
:attr:`debug` flag is set the server will automatically reload
for code changes and show a debugger in case an exception happened.
If you want to run the applicatio... | [
"Runs",
"the",
"application",
"on",
"a",
"local",
"development",
"server",
".",
"If",
"the",
":",
"attr",
":",
"debug",
"flag",
"is",
"set",
"the",
"server",
"will",
"automatically",
"reload",
"for",
"code",
"changes",
"and",
"show",
"a",
"debugger",
"in",... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L722-L777 | [
"def",
"run",
"(",
"self",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"debug",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"from",
"werkzeug",
".",
"serving",
"import",
"run_simple",
"if",
"host",
"is",
"None",
":",
"host",
"=",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.save_session | Saves the session if it needs updates. For the default
implementation, check :meth:`open_session`. Instead of overriding this
method we recommend replacing the :class:`session_interface`.
:param session: the session to be saved (a
:class:`~werkzeug.contrib.securecookie... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def save_session(self, session, response):
"""Saves the session if it needs updates. For the default
implementation, check :meth:`open_session`. Instead of overriding this
method we recommend replacing the :class:`session_interface`.
:param session: the session to be saved (a
... | def save_session(self, session, response):
"""Saves the session if it needs updates. For the default
implementation, check :meth:`open_session`. Instead of overriding this
method we recommend replacing the :class:`session_interface`.
:param session: the session to be saved (a
... | [
"Saves",
"the",
"session",
"if",
"it",
"needs",
"updates",
".",
"For",
"the",
"default",
"implementation",
"check",
":",
"meth",
":",
"open_session",
".",
"Instead",
"of",
"overriding",
"this",
"method",
"we",
"recommend",
"replacing",
"the",
":",
"class",
"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L827-L837 | [
"def",
"save_session",
"(",
"self",
",",
"session",
",",
"response",
")",
":",
"return",
"self",
".",
"session_interface",
".",
"save_session",
"(",
"self",
",",
"session",
",",
"response",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.register_module | Registers a module with this application. The keyword argument
of this function are the same as the ones for the constructor of the
:class:`Module` class and will override the values of the module if
provided.
.. versionchanged:: 0.7
The module system was deprecated in favor... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def register_module(self, module, **options):
"""Registers a module with this application. The keyword argument
of this function are the same as the ones for the constructor of the
:class:`Module` class and will override the values of the module if
provided.
.. versionchanged::... | def register_module(self, module, **options):
"""Registers a module with this application. The keyword argument
of this function are the same as the ones for the constructor of the
:class:`Module` class and will override the values of the module if
provided.
.. versionchanged::... | [
"Registers",
"a",
"module",
"with",
"this",
"application",
".",
"The",
"keyword",
"argument",
"of",
"this",
"function",
"are",
"the",
"same",
"as",
"the",
"ones",
"for",
"the",
"constructor",
"of",
"the",
":",
"class",
":",
"Module",
"class",
"and",
"will"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L847-L871 | [
"def",
"register_module",
"(",
"self",
",",
"module",
",",
"*",
"*",
"options",
")",
":",
"assert",
"blueprint_is_module",
"(",
"module",
")",
",",
"'register_module requires '",
"'actual module objects. Please upgrade to blueprints though.'",
"if",
"not",
"self",
".",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.add_url_rule | Connects a URL rule. Works exactly like the :meth:`route`
decorator. If a view_func is provided it will be registered with the
endpoint.
Basically this example::
@app.route('/')
def index():
pass
Is equivalent to the following::
d... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
"""Connects a URL rule. Works exactly like the :meth:`route`
decorator. If a view_func is provided it will be registered with the
endpoint.
Basically this example::
@app.route('/')
def ind... | def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
"""Connects a URL rule. Works exactly like the :meth:`route`
decorator. If a view_func is provided it will be registered with the
endpoint.
Basically this example::
@app.route('/')
def ind... | [
"Connects",
"a",
"URL",
"rule",
".",
"Works",
"exactly",
"like",
"the",
":",
"meth",
":",
"route",
"decorator",
".",
"If",
"a",
"view_func",
"is",
"provided",
"it",
"will",
"be",
"registered",
"with",
"the",
"endpoint",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L892-L985 | [
"def",
"add_url_rule",
"(",
"self",
",",
"rule",
",",
"endpoint",
"=",
"None",
",",
"view_func",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"if",
"endpoint",
"is",
"None",
":",
"endpoint",
"=",
"_endpoint_from_view_func",
"(",
"view_func",
")",
"op... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.endpoint | A decorator to register a function as an endpoint.
Example::
@app.endpoint('example.endpoint')
def example():
return "example"
:param endpoint: the name of the endpoint | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def endpoint(self, endpoint):
"""A decorator to register a function as an endpoint.
Example::
@app.endpoint('example.endpoint')
def example():
return "example"
:param endpoint: the name of the endpoint
"""
def decorator(f):
se... | def endpoint(self, endpoint):
"""A decorator to register a function as an endpoint.
Example::
@app.endpoint('example.endpoint')
def example():
return "example"
:param endpoint: the name of the endpoint
"""
def decorator(f):
se... | [
"A",
"decorator",
"to",
"register",
"a",
"function",
"as",
"an",
"endpoint",
".",
"Example",
"::"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1018-L1031 | [
"def",
"endpoint",
"(",
"self",
",",
"endpoint",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"view_functions",
"[",
"endpoint",
"]",
"=",
"f",
"return",
"f",
"return",
"decorator"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.errorhandler | A decorator that is used to register a function give a given
error code. Example::
@app.errorhandler(404)
def page_not_found(error):
return 'This page does not exist', 404
You can also register handlers for arbitrary exceptions::
@app.errorhandler(... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def errorhandler(self, code_or_exception):
"""A decorator that is used to register a function give a given
error code. Example::
@app.errorhandler(404)
def page_not_found(error):
return 'This page does not exist', 404
You can also register handlers for ... | def errorhandler(self, code_or_exception):
"""A decorator that is used to register a function give a given
error code. Example::
@app.errorhandler(404)
def page_not_found(error):
return 'This page does not exist', 404
You can also register handlers for ... | [
"A",
"decorator",
"that",
"is",
"used",
"to",
"register",
"a",
"function",
"give",
"a",
"given",
"error",
"code",
".",
"Example",
"::"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1034-L1073 | [
"def",
"errorhandler",
"(",
"self",
",",
"code_or_exception",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"_register_error_handler",
"(",
"None",
",",
"code_or_exception",
",",
"f",
")",
"return",
"f",
"return",
"decorator"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.template_filter | A decorator that is used to register custom template filter.
You can specify a name for the filter, otherwise the function
name will be used. Example::
@app.template_filter()
def reverse(s):
return s[::-1]
:param name: the optional name of the filter, otherwis... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def template_filter(self, name=None):
"""A decorator that is used to register custom template filter.
You can specify a name for the filter, otherwise the function
name will be used. Example::
@app.template_filter()
def reverse(s):
return s[::-1]
:para... | def template_filter(self, name=None):
"""A decorator that is used to register custom template filter.
You can specify a name for the filter, otherwise the function
name will be used. Example::
@app.template_filter()
def reverse(s):
return s[::-1]
:para... | [
"A",
"decorator",
"that",
"is",
"used",
"to",
"register",
"custom",
"template",
"filter",
".",
"You",
"can",
"specify",
"a",
"name",
"for",
"the",
"filter",
"otherwise",
"the",
"function",
"name",
"will",
"be",
"used",
".",
"Example",
"::"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1098-L1113 | [
"def",
"template_filter",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"add_template_filter",
"(",
"f",
",",
"name",
"=",
"name",
")",
"return",
"f",
"return",
"decorator"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.add_template_filter | Register a custom template filter. Works exactly like the
:meth:`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/app.py | def add_template_filter(self, f, name=None):
"""Register a custom template filter. Works exactly like the
:meth:`template_filter` decorator.
:param name: the optional name of the filter, otherwise the
function name will be used.
"""
self.jinja_env.filters[n... | def add_template_filter(self, f, name=None):
"""Register a custom template filter. Works exactly like the
:meth:`template_filter` decorator.
:param name: the optional name of the filter, otherwise the
function name will be used.
"""
self.jinja_env.filters[n... | [
"Register",
"a",
"custom",
"template",
"filter",
".",
"Works",
"exactly",
"like",
"the",
":",
"meth",
":",
"template_filter",
"decorator",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1116-L1123 | [
"def",
"add_template_filter",
"(",
"self",
",",
"f",
",",
"name",
"=",
"None",
")",
":",
"self",
".",
"jinja_env",
".",
"filters",
"[",
"name",
"or",
"f",
".",
"__name__",
"]",
"=",
"f"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.template_global | A decorator that is used to register a custom template global function.
You can specify a name for the global function, otherwise the function
name will be used. Example::
@app.template_global()
def double(n):
return 2 * n
.. versionadded:: 0.10
... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def template_global(self, name=None):
"""A decorator that is used to register a custom template global function.
You can specify a name for the global function, otherwise the function
name will be used. Example::
@app.template_global()
def double(n):
retu... | def template_global(self, name=None):
"""A decorator that is used to register a custom template global function.
You can specify a name for the global function, otherwise the function
name will be used. Example::
@app.template_global()
def double(n):
retu... | [
"A",
"decorator",
"that",
"is",
"used",
"to",
"register",
"a",
"custom",
"template",
"global",
"function",
".",
"You",
"can",
"specify",
"a",
"name",
"for",
"the",
"global",
"function",
"otherwise",
"the",
"function",
"name",
"will",
"be",
"used",
".",
"Ex... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1164-L1181 | [
"def",
"template_global",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"add_template_global",
"(",
"f",
",",
"name",
"=",
"name",
")",
"return",
"f",
"return",
"decorator"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.add_template_global | Register a custom template global function. Works exactly like the
:meth:`template_global` decorator.
.. versionadded:: 0.10
:param name: the optional name of the global function, otherwise the
function name will be used. | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def add_template_global(self, f, name=None):
"""Register a custom template global function. Works exactly like the
:meth:`template_global` decorator.
.. versionadded:: 0.10
:param name: the optional name of the global function, otherwise the
function name will be u... | def add_template_global(self, f, name=None):
"""Register a custom template global function. Works exactly like the
:meth:`template_global` decorator.
.. versionadded:: 0.10
:param name: the optional name of the global function, otherwise the
function name will be u... | [
"Register",
"a",
"custom",
"template",
"global",
"function",
".",
"Works",
"exactly",
"like",
"the",
":",
"meth",
":",
"template_global",
"decorator",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1184-L1193 | [
"def",
"add_template_global",
"(",
"self",
",",
"f",
",",
"name",
"=",
"None",
")",
":",
"self",
".",
"jinja_env",
".",
"globals",
"[",
"name",
"or",
"f",
".",
"__name__",
"]",
"=",
"f"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.handle_http_exception | Handles an HTTP exception. By default this will invoke the
registered error handlers and fall back to returning the
exception as response.
.. versionadded:: 0.3 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def handle_http_exception(self, e):
"""Handles an HTTP exception. By default this will invoke the
registered error handlers and fall back to returning the
exception as response.
.. versionadded:: 0.3
"""
handlers = self.error_handler_spec.get(request.blueprint)
... | def handle_http_exception(self, e):
"""Handles an HTTP exception. By default this will invoke the
registered error handlers and fall back to returning the
exception as response.
.. versionadded:: 0.3
"""
handlers = self.error_handler_spec.get(request.blueprint)
... | [
"Handles",
"an",
"HTTP",
"exception",
".",
"By",
"default",
"this",
"will",
"invoke",
"the",
"registered",
"error",
"handlers",
"and",
"fall",
"back",
"to",
"returning",
"the",
"exception",
"as",
"response",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1312-L1330 | [
"def",
"handle_http_exception",
"(",
"self",
",",
"e",
")",
":",
"handlers",
"=",
"self",
".",
"error_handler_spec",
".",
"get",
"(",
"request",
".",
"blueprint",
")",
"# Proxy exceptions don't have error codes. We want to always return",
"# those unchanged as errors",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.trap_http_exception | Checks if an HTTP exception should be trapped or not. By default
this will return `False` for all exceptions except for a bad request
key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to `True`. It
also returns `True` if ``TRAP_HTTP_EXCEPTIONS`` is set to `True`.
This is called for all ... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def trap_http_exception(self, e):
"""Checks if an HTTP exception should be trapped or not. By default
this will return `False` for all exceptions except for a bad request
key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to `True`. It
also returns `True` if ``TRAP_HTTP_EXCEPTIONS`` is se... | def trap_http_exception(self, e):
"""Checks if an HTTP exception should be trapped or not. By default
this will return `False` for all exceptions except for a bad request
key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to `True`. It
also returns `True` if ``TRAP_HTTP_EXCEPTIONS`` is se... | [
"Checks",
"if",
"an",
"HTTP",
"exception",
"should",
"be",
"trapped",
"or",
"not",
".",
"By",
"default",
"this",
"will",
"return",
"False",
"for",
"all",
"exceptions",
"except",
"for",
"a",
"bad",
"request",
"key",
"error",
"if",
"TRAP_BAD_REQUEST_ERRORS",
"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1332-L1350 | [
"def",
"trap_http_exception",
"(",
"self",
",",
"e",
")",
":",
"if",
"self",
".",
"config",
"[",
"'TRAP_HTTP_EXCEPTIONS'",
"]",
":",
"return",
"True",
"if",
"self",
".",
"config",
"[",
"'TRAP_BAD_REQUEST_ERRORS'",
"]",
":",
"return",
"isinstance",
"(",
"e",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.handle_user_exception | This method is called whenever an exception occurs that should be
handled. A special case are
:class:`~werkzeug.exception.HTTPException`\s which are forwarded by
this function to the :meth:`handle_http_exception` method. This
function will either return a response value or reraise the
... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def handle_user_exception(self, e):
"""This method is called whenever an exception occurs that should be
handled. A special case are
:class:`~werkzeug.exception.HTTPException`\s which are forwarded by
this function to the :meth:`handle_http_exception` method. This
function will... | def handle_user_exception(self, e):
"""This method is called whenever an exception occurs that should be
handled. A special case are
:class:`~werkzeug.exception.HTTPException`\s which are forwarded by
this function to the :meth:`handle_http_exception` method. This
function will... | [
"This",
"method",
"is",
"called",
"whenever",
"an",
"exception",
"occurs",
"that",
"should",
"be",
"handled",
".",
"A",
"special",
"case",
"are",
":",
"class",
":",
"~werkzeug",
".",
"exception",
".",
"HTTPException",
"\\",
"s",
"which",
"are",
"forwarded",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1352-L1381 | [
"def",
"handle_user_exception",
"(",
"self",
",",
"e",
")",
":",
"exc_type",
",",
"exc_value",
",",
"tb",
"=",
"sys",
".",
"exc_info",
"(",
")",
"assert",
"exc_value",
"is",
"e",
"# ensure not to trash sys.exc_info() at that point in case someone",
"# wants the traceb... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.handle_exception | Default exception handling that kicks in when an exception
occurs that is not caught. In debug mode the exception will
be re-raised immediately, otherwise it is logged and the handler
for a 500 internal server error is used. If no such handler
exists, a default 500 internal server erro... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def handle_exception(self, e):
"""Default exception handling that kicks in when an exception
occurs that is not caught. In debug mode the exception will
be re-raised immediately, otherwise it is logged and the handler
for a 500 internal server error is used. If no such handler
... | def handle_exception(self, e):
"""Default exception handling that kicks in when an exception
occurs that is not caught. In debug mode the exception will
be re-raised immediately, otherwise it is logged and the handler
for a 500 internal server error is used. If no such handler
... | [
"Default",
"exception",
"handling",
"that",
"kicks",
"in",
"when",
"an",
"exception",
"occurs",
"that",
"is",
"not",
"caught",
".",
"In",
"debug",
"mode",
"the",
"exception",
"will",
"be",
"re",
"-",
"raised",
"immediately",
"otherwise",
"it",
"is",
"logged"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1383-L1410 | [
"def",
"handle_exception",
"(",
"self",
",",
"e",
")",
":",
"exc_type",
",",
"exc_value",
",",
"tb",
"=",
"sys",
".",
"exc_info",
"(",
")",
"got_request_exception",
".",
"send",
"(",
"self",
",",
"exception",
"=",
"e",
")",
"handler",
"=",
"self",
".",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.log_exception | Logs an exception. This is called by :meth:`handle_exception`
if debugging is disabled and right before the handler is called.
The default implementation logs the exception as error on the
:attr:`logger`.
.. versionadded:: 0.8 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def log_exception(self, exc_info):
"""Logs an exception. This is called by :meth:`handle_exception`
if debugging is disabled and right before the handler is called.
The default implementation logs the exception as error on the
:attr:`logger`.
.. versionadded:: 0.8
"""
... | def log_exception(self, exc_info):
"""Logs an exception. This is called by :meth:`handle_exception`
if debugging is disabled and right before the handler is called.
The default implementation logs the exception as error on the
:attr:`logger`.
.. versionadded:: 0.8
"""
... | [
"Logs",
"an",
"exception",
".",
"This",
"is",
"called",
"by",
":",
"meth",
":",
"handle_exception",
"if",
"debugging",
"is",
"disabled",
"and",
"right",
"before",
"the",
"handler",
"is",
"called",
".",
"The",
"default",
"implementation",
"logs",
"the",
"exce... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1412-L1423 | [
"def",
"log_exception",
"(",
"self",
",",
"exc_info",
")",
":",
"self",
".",
"logger",
".",
"error",
"(",
"'Exception on %s [%s]'",
"%",
"(",
"request",
".",
"path",
",",
"request",
".",
"method",
")",
",",
"exc_info",
"=",
"exc_info",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.raise_routing_exception | Exceptions that are recording during routing are reraised with
this method. During debug we are not reraising redirect requests
for non ``GET``, ``HEAD``, or ``OPTIONS`` requests and we're raising
a different error instead to help debug situations.
:internal: | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def raise_routing_exception(self, request):
"""Exceptions that are recording during routing are reraised with
this method. During debug we are not reraising redirect requests
for non ``GET``, ``HEAD``, or ``OPTIONS`` requests and we're raising
a different error instead to help debug sit... | def raise_routing_exception(self, request):
"""Exceptions that are recording during routing are reraised with
this method. During debug we are not reraising redirect requests
for non ``GET``, ``HEAD``, or ``OPTIONS`` requests and we're raising
a different error instead to help debug sit... | [
"Exceptions",
"that",
"are",
"recording",
"during",
"routing",
"are",
"reraised",
"with",
"this",
"method",
".",
"During",
"debug",
"we",
"are",
"not",
"reraising",
"redirect",
"requests",
"for",
"non",
"GET",
"HEAD",
"or",
"OPTIONS",
"requests",
"and",
"we",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1425-L1439 | [
"def",
"raise_routing_exception",
"(",
"self",
",",
"request",
")",
":",
"if",
"not",
"self",
".",
"debug",
"or",
"not",
"isinstance",
"(",
"request",
".",
"routing_exception",
",",
"RequestRedirect",
")",
"or",
"request",
".",
"method",
"in",
"(",
"'GET'",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.dispatch_request | Does the request dispatching. Matches the URL and returns the
return value of the view or error handler. This does not have to
be a response object. In order to convert the return value to a
proper response object, call :func:`make_response`.
.. versionchanged:: 0.7
This n... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def dispatch_request(self):
"""Does the request dispatching. Matches the URL and returns the
return value of the view or error handler. This does not have to
be a response object. In order to convert the return value to a
proper response object, call :func:`make_response`.
..... | def dispatch_request(self):
"""Does the request dispatching. Matches the URL and returns the
return value of the view or error handler. This does not have to
be a response object. In order to convert the return value to a
proper response object, call :func:`make_response`.
..... | [
"Does",
"the",
"request",
"dispatching",
".",
"Matches",
"the",
"URL",
"and",
"returns",
"the",
"return",
"value",
"of",
"the",
"view",
"or",
"error",
"handler",
".",
"This",
"does",
"not",
"have",
"to",
"be",
"a",
"response",
"object",
".",
"In",
"order... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1441-L1461 | [
"def",
"dispatch_request",
"(",
"self",
")",
":",
"req",
"=",
"_request_ctx_stack",
".",
"top",
".",
"request",
"if",
"req",
".",
"routing_exception",
"is",
"not",
"None",
":",
"self",
".",
"raise_routing_exception",
"(",
"req",
")",
"rule",
"=",
"req",
".... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.full_dispatch_request | Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
.. versionadded:: 0.7 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def full_dispatch_request(self):
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
.. versionadded:: 0.7
"""
self.try_trigger_before_first_request_functions()
try:
... | def full_dispatch_request(self):
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
.. versionadded:: 0.7
"""
self.try_trigger_before_first_request_functions()
try:
... | [
"Dispatches",
"the",
"request",
"and",
"on",
"top",
"of",
"that",
"performs",
"request",
"pre",
"and",
"postprocessing",
"as",
"well",
"as",
"HTTP",
"exception",
"catching",
"and",
"error",
"handling",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1463-L1481 | [
"def",
"full_dispatch_request",
"(",
"self",
")",
":",
"self",
".",
"try_trigger_before_first_request_functions",
"(",
")",
"try",
":",
"request_started",
".",
"send",
"(",
"self",
")",
"rv",
"=",
"self",
".",
"preprocess_request",
"(",
")",
"if",
"rv",
"is",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.try_trigger_before_first_request_functions | Called before each request and will ensure that it triggers
the :attr:`before_first_request_funcs` and only exactly once per
application instance (which means process usually).
:internal: | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def try_trigger_before_first_request_functions(self):
"""Called before each request and will ensure that it triggers
the :attr:`before_first_request_funcs` and only exactly once per
application instance (which means process usually).
:internal:
"""
if self._got_first_req... | def try_trigger_before_first_request_functions(self):
"""Called before each request and will ensure that it triggers
the :attr:`before_first_request_funcs` and only exactly once per
application instance (which means process usually).
:internal:
"""
if self._got_first_req... | [
"Called",
"before",
"each",
"request",
"and",
"will",
"ensure",
"that",
"it",
"triggers",
"the",
":",
"attr",
":",
"before_first_request_funcs",
"and",
"only",
"exactly",
"once",
"per",
"application",
"instance",
"(",
"which",
"means",
"process",
"usually",
")",... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1483-L1497 | [
"def",
"try_trigger_before_first_request_functions",
"(",
"self",
")",
":",
"if",
"self",
".",
"_got_first_request",
":",
"return",
"with",
"self",
".",
"_before_request_lock",
":",
"if",
"self",
".",
"_got_first_request",
":",
"return",
"self",
".",
"_got_first_req... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.