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 | Flask.make_default_options_response | This method is called to create the default `OPTIONS` response.
This can be changed through subclassing to change the default
behavior of `OPTIONS` responses.
.. versionadded:: 0.7 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def make_default_options_response(self):
"""This method is called to create the default `OPTIONS` response.
This can be changed through subclassing to change the default
behavior of `OPTIONS` responses.
.. versionadded:: 0.7
"""
adapter = _request_ctx_stack.top.url_adapt... | def make_default_options_response(self):
"""This method is called to create the default `OPTIONS` response.
This can be changed through subclassing to change the default
behavior of `OPTIONS` responses.
.. versionadded:: 0.7
"""
adapter = _request_ctx_stack.top.url_adapt... | [
"This",
"method",
"is",
"called",
"to",
"create",
"the",
"default",
"OPTIONS",
"response",
".",
"This",
"can",
"be",
"changed",
"through",
"subclassing",
"to",
"change",
"the",
"default",
"behavior",
"of",
"OPTIONS",
"responses",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1499-L1520 | [
"def",
"make_default_options_response",
"(",
"self",
")",
":",
"adapter",
"=",
"_request_ctx_stack",
".",
"top",
".",
"url_adapter",
"if",
"hasattr",
"(",
"adapter",
",",
"'allowed_methods'",
")",
":",
"methods",
"=",
"adapter",
".",
"allowed_methods",
"(",
")",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.make_response | Converts the return value from a view function to a real
response object that is an instance of :attr:`response_class`.
The following types are allowed for `rv`:
.. tabularcolumns:: |p{3.5cm}|p{9.5cm}|
======================= ===========================================
:attr:`... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def make_response(self, rv):
"""Converts the return value from a view function to a real
response object that is an instance of :attr:`response_class`.
The following types are allowed for `rv`:
.. tabularcolumns:: |p{3.5cm}|p{9.5cm}|
======================= ===================... | def make_response(self, rv):
"""Converts the return value from a view function to a real
response object that is an instance of :attr:`response_class`.
The following types are allowed for `rv`:
.. tabularcolumns:: |p{3.5cm}|p{9.5cm}|
======================= ===================... | [
"Converts",
"the",
"return",
"value",
"from",
"a",
"view",
"function",
"to",
"a",
"real",
"response",
"object",
"that",
"is",
"an",
"instance",
"of",
":",
"attr",
":",
"response_class",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1532-L1587 | [
"def",
"make_response",
"(",
"self",
",",
"rv",
")",
":",
"status",
"=",
"headers",
"=",
"None",
"if",
"isinstance",
"(",
"rv",
",",
"tuple",
")",
":",
"rv",
",",
"status",
",",
"headers",
"=",
"rv",
"+",
"(",
"None",
",",
")",
"*",
"(",
"3",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.create_url_adapter | Creates a URL adapter for the given request. The URL adapter
is created at a point where the request context is not yet set up
so the request is passed explicitly.
.. versionadded:: 0.6
.. versionchanged:: 0.9
This can now also be called without a request object when the
... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def create_url_adapter(self, request):
"""Creates a URL adapter for the given request. The URL adapter
is created at a point where the request context is not yet set up
so the request is passed explicitly.
.. versionadded:: 0.6
.. versionchanged:: 0.9
This can now a... | def create_url_adapter(self, request):
"""Creates a URL adapter for the given request. The URL adapter
is created at a point where the request context is not yet set up
so the request is passed explicitly.
.. versionadded:: 0.6
.. versionchanged:: 0.9
This can now a... | [
"Creates",
"a",
"URL",
"adapter",
"for",
"the",
"given",
"request",
".",
"The",
"URL",
"adapter",
"is",
"created",
"at",
"a",
"point",
"where",
"the",
"request",
"context",
"is",
"not",
"yet",
"set",
"up",
"so",
"the",
"request",
"is",
"passed",
"explici... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1589-L1609 | [
"def",
"create_url_adapter",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
"is",
"not",
"None",
":",
"return",
"self",
".",
"url_map",
".",
"bind_to_environ",
"(",
"request",
".",
"environ",
",",
"server_name",
"=",
"self",
".",
"config",
"[",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.inject_url_defaults | Injects the URL defaults for the given endpoint directly into
the values dictionary passed. This is used internally and
automatically called on URL building.
.. versionadded:: 0.7 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def inject_url_defaults(self, endpoint, values):
"""Injects the URL defaults for the given endpoint directly into
the values dictionary passed. This is used internally and
automatically called on URL building.
.. versionadded:: 0.7
"""
funcs = self.url_default_functions... | def inject_url_defaults(self, endpoint, values):
"""Injects the URL defaults for the given endpoint directly into
the values dictionary passed. This is used internally and
automatically called on URL building.
.. versionadded:: 0.7
"""
funcs = self.url_default_functions... | [
"Injects",
"the",
"URL",
"defaults",
"for",
"the",
"given",
"endpoint",
"directly",
"into",
"the",
"values",
"dictionary",
"passed",
".",
"This",
"is",
"used",
"internally",
"and",
"automatically",
"called",
"on",
"URL",
"building",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1611-L1623 | [
"def",
"inject_url_defaults",
"(",
"self",
",",
"endpoint",
",",
"values",
")",
":",
"funcs",
"=",
"self",
".",
"url_default_functions",
".",
"get",
"(",
"None",
",",
"(",
")",
")",
"if",
"'.'",
"in",
"endpoint",
":",
"bp",
"=",
"endpoint",
".",
"rspli... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.handle_url_build_error | Handle :class:`~werkzeug.routing.BuildError` on :meth:`url_for`. | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def handle_url_build_error(self, error, endpoint, values):
"""Handle :class:`~werkzeug.routing.BuildError` on :meth:`url_for`.
"""
exc_type, exc_value, tb = sys.exc_info()
for handler in self.url_build_error_handlers:
try:
rv = handler(error, endpoint, values)... | def handle_url_build_error(self, error, endpoint, values):
"""Handle :class:`~werkzeug.routing.BuildError` on :meth:`url_for`.
"""
exc_type, exc_value, tb = sys.exc_info()
for handler in self.url_build_error_handlers:
try:
rv = handler(error, endpoint, values)... | [
"Handle",
":",
"class",
":",
"~werkzeug",
".",
"routing",
".",
"BuildError",
"on",
":",
"meth",
":",
"url_for",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1625-L1642 | [
"def",
"handle_url_build_error",
"(",
"self",
",",
"error",
",",
"endpoint",
",",
"values",
")",
":",
"exc_type",
",",
"exc_value",
",",
"tb",
"=",
"sys",
".",
"exc_info",
"(",
")",
"for",
"handler",
"in",
"self",
".",
"url_build_error_handlers",
":",
"try... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.preprocess_request | Called before the actual request dispatching and will
call every as :meth:`before_request` decorated function.
If any of these function returns a value it's handled as
if it was the return value from the view and further
request handling is stopped.
This also triggers the :meth:... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def preprocess_request(self):
"""Called before the actual request dispatching and will
call every as :meth:`before_request` decorated function.
If any of these function returns a value it's handled as
if it was the return value from the view and further
request handling is stoppe... | def preprocess_request(self):
"""Called before the actual request dispatching and will
call every as :meth:`before_request` decorated function.
If any of these function returns a value it's handled as
if it was the return value from the view and further
request handling is stoppe... | [
"Called",
"before",
"the",
"actual",
"request",
"dispatching",
"and",
"will",
"call",
"every",
"as",
":",
"meth",
":",
"before_request",
"decorated",
"function",
".",
"If",
"any",
"of",
"these",
"function",
"returns",
"a",
"value",
"it",
"s",
"handled",
"as"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1644-L1668 | [
"def",
"preprocess_request",
"(",
"self",
")",
":",
"bp",
"=",
"_request_ctx_stack",
".",
"top",
".",
"request",
".",
"blueprint",
"funcs",
"=",
"self",
".",
"url_value_preprocessors",
".",
"get",
"(",
"None",
",",
"(",
")",
")",
"if",
"bp",
"is",
"not",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.process_response | Can be overridden in order to modify the response object
before it's sent to the WSGI server. By default this will
call all the :meth:`after_request` decorated functions.
.. versionchanged:: 0.5
As of Flask 0.5 the functions registered for after request
execution are call... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def process_response(self, response):
"""Can be overridden in order to modify the response object
before it's sent to the WSGI server. By default this will
call all the :meth:`after_request` decorated functions.
.. versionchanged:: 0.5
As of Flask 0.5 the functions registere... | def process_response(self, response):
"""Can be overridden in order to modify the response object
before it's sent to the WSGI server. By default this will
call all the :meth:`after_request` decorated functions.
.. versionchanged:: 0.5
As of Flask 0.5 the functions registere... | [
"Can",
"be",
"overridden",
"in",
"order",
"to",
"modify",
"the",
"response",
"object",
"before",
"it",
"s",
"sent",
"to",
"the",
"WSGI",
"server",
".",
"By",
"default",
"this",
"will",
"call",
"all",
"the",
":",
"meth",
":",
"after_request",
"decorated",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1670-L1694 | [
"def",
"process_response",
"(",
"self",
",",
"response",
")",
":",
"ctx",
"=",
"_request_ctx_stack",
".",
"top",
"bp",
"=",
"ctx",
".",
"request",
".",
"blueprint",
"funcs",
"=",
"ctx",
".",
"_after_request_functions",
"if",
"bp",
"is",
"not",
"None",
"and... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.do_teardown_request | Called after the actual request dispatching and will
call every as :meth:`teardown_request` decorated function. This is
not actually called by the :class:`Flask` object itself but is always
triggered when the request context is popped. That way we have a
tighter control over certain re... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def do_teardown_request(self, exc=None):
"""Called after the actual request dispatching and will
call every as :meth:`teardown_request` decorated function. This is
not actually called by the :class:`Flask` object itself but is always
triggered when the request context is popped. That w... | def do_teardown_request(self, exc=None):
"""Called after the actual request dispatching and will
call every as :meth:`teardown_request` decorated function. This is
not actually called by the :class:`Flask` object itself but is always
triggered when the request context is popped. That w... | [
"Called",
"after",
"the",
"actual",
"request",
"dispatching",
"and",
"will",
"call",
"every",
"as",
":",
"meth",
":",
"teardown_request",
"decorated",
"function",
".",
"This",
"is",
"not",
"actually",
"called",
"by",
"the",
":",
"class",
":",
"Flask",
"objec... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1696-L1715 | [
"def",
"do_teardown_request",
"(",
"self",
",",
"exc",
"=",
"None",
")",
":",
"if",
"exc",
"is",
"None",
":",
"exc",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"funcs",
"=",
"reversed",
"(",
"self",
".",
"teardown_request_funcs",
".",
"get... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.do_teardown_appcontext | Called when an application context is popped. This works pretty
much the same as :meth:`do_teardown_request` but for the application
context.
.. versionadded:: 0.9 | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def do_teardown_appcontext(self, exc=None):
"""Called when an application context is popped. This works pretty
much the same as :meth:`do_teardown_request` but for the application
context.
.. versionadded:: 0.9
"""
if exc is None:
exc = sys.exc_info()[1]
... | def do_teardown_appcontext(self, exc=None):
"""Called when an application context is popped. This works pretty
much the same as :meth:`do_teardown_request` but for the application
context.
.. versionadded:: 0.9
"""
if exc is None:
exc = sys.exc_info()[1]
... | [
"Called",
"when",
"an",
"application",
"context",
"is",
"popped",
".",
"This",
"works",
"pretty",
"much",
"the",
"same",
"as",
":",
"meth",
":",
"do_teardown_request",
"but",
"for",
"the",
"application",
"context",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1717-L1728 | [
"def",
"do_teardown_appcontext",
"(",
"self",
",",
"exc",
"=",
"None",
")",
":",
"if",
"exc",
"is",
"None",
":",
"exc",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"for",
"func",
"in",
"reversed",
"(",
"self",
".",
"teardown_appcontext_funcs"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Flask.wsgi_app | The actual WSGI application. This is not implemented in
`__call__` so that middlewares can be applied without losing a
reference to the class. So instead of doing this::
app = MyMiddleware(app)
It's a better idea to do this instead::
app.wsgi_app = MyMiddleware(app.w... | capybara/virtualenv/lib/python2.7/site-packages/flask/app.py | def wsgi_app(self, environ, start_response):
"""The actual WSGI application. This is not implemented in
`__call__` so that middlewares can be applied without losing a
reference to the class. So instead of doing this::
app = MyMiddleware(app)
It's a better idea to do this ... | def wsgi_app(self, environ, start_response):
"""The actual WSGI application. This is not implemented in
`__call__` so that middlewares can be applied without losing a
reference to the class. So instead of doing this::
app = MyMiddleware(app)
It's a better idea to do this ... | [
"The",
"actual",
"WSGI",
"application",
".",
"This",
"is",
"not",
"implemented",
"in",
"__call__",
"so",
"that",
"middlewares",
"can",
"be",
"applied",
"without",
"losing",
"a",
"reference",
"to",
"the",
"class",
".",
"So",
"instead",
"of",
"doing",
"this",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1787-L1825 | [
"def",
"wsgi_app",
"(",
"self",
",",
"environ",
",",
"start_response",
")",
":",
"ctx",
"=",
"self",
".",
"request_context",
"(",
"environ",
")",
"ctx",
".",
"push",
"(",
")",
"error",
"=",
"None",
"try",
":",
"try",
":",
"response",
"=",
"self",
"."... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | unique | Yield unique values in iterable, preserving order. | capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py | def unique(iterable):
"""
Yield unique values in iterable, preserving order.
"""
seen = set()
for value in iterable:
if not value in seen:
seen.add(value)
yield value | def unique(iterable):
"""
Yield unique values in iterable, preserving order.
"""
seen = set()
for value in iterable:
if not value in seen:
seen.add(value)
yield value | [
"Yield",
"unique",
"values",
"in",
"iterable",
"preserving",
"order",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L39-L47 | [
"def",
"unique",
"(",
"iterable",
")",
":",
"seen",
"=",
"set",
"(",
")",
"for",
"value",
"in",
"iterable",
":",
"if",
"not",
"value",
"in",
"seen",
":",
"seen",
".",
"add",
"(",
"value",
")",
"yield",
"value"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | handle_requires | Place the runtime requirements from pkg_info into metadata. | capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py | def handle_requires(metadata, pkg_info, key):
"""
Place the runtime requirements from pkg_info into metadata.
"""
may_requires = defaultdict(list)
for value in pkg_info.get_all(key):
extra_match = EXTRA_RE.search(value)
if extra_match:
groupdict = extra_match.groupdict()
... | def handle_requires(metadata, pkg_info, key):
"""
Place the runtime requirements from pkg_info into metadata.
"""
may_requires = defaultdict(list)
for value in pkg_info.get_all(key):
extra_match = EXTRA_RE.search(value)
if extra_match:
groupdict = extra_match.groupdict()
... | [
"Place",
"the",
"runtime",
"requirements",
"from",
"pkg_info",
"into",
"metadata",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L50-L82 | [
"def",
"handle_requires",
"(",
"metadata",
",",
"pkg_info",
",",
"key",
")",
":",
"may_requires",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"value",
"in",
"pkg_info",
".",
"get_all",
"(",
"key",
")",
":",
"extra_match",
"=",
"EXTRA_RE",
".",
"search",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | pkginfo_to_dict | Convert PKG-INFO to a prototype Metadata 2.0 (PEP 426) dict.
The description is included under the key ['description'] rather than
being written to a separate file.
path: path to PKG-INFO file
distribution: optional distutils Distribution() | capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py | def pkginfo_to_dict(path, distribution=None):
"""
Convert PKG-INFO to a prototype Metadata 2.0 (PEP 426) dict.
The description is included under the key ['description'] rather than
being written to a separate file.
path: path to PKG-INFO file
distribution: optional distutils Distribution()
... | def pkginfo_to_dict(path, distribution=None):
"""
Convert PKG-INFO to a prototype Metadata 2.0 (PEP 426) dict.
The description is included under the key ['description'] rather than
being written to a separate file.
path: path to PKG-INFO file
distribution: optional distutils Distribution()
... | [
"Convert",
"PKG",
"-",
"INFO",
"to",
"a",
"prototype",
"Metadata",
"2",
".",
"0",
"(",
"PEP",
"426",
")",
"dict",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L85-L205 | [
"def",
"pkginfo_to_dict",
"(",
"path",
",",
"distribution",
"=",
"None",
")",
":",
"metadata",
"=",
"defaultdict",
"(",
"lambda",
":",
"defaultdict",
"(",
"lambda",
":",
"defaultdict",
"(",
"dict",
")",
")",
")",
"metadata",
"[",
"\"generator\"",
"]",
"=",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | requires_to_requires_dist | Compose the version predicates for requirement in PEP 345 fashion. | capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py | def requires_to_requires_dist(requirement):
"""Compose the version predicates for requirement in PEP 345 fashion."""
requires_dist = []
for op, ver in requirement.specs:
requires_dist.append(op + ver)
if not requires_dist:
return ''
return " (%s)" % ','.join(requires_dist) | def requires_to_requires_dist(requirement):
"""Compose the version predicates for requirement in PEP 345 fashion."""
requires_dist = []
for op, ver in requirement.specs:
requires_dist.append(op + ver)
if not requires_dist:
return ''
return " (%s)" % ','.join(requires_dist) | [
"Compose",
"the",
"version",
"predicates",
"for",
"requirement",
"in",
"PEP",
"345",
"fashion",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L207-L214 | [
"def",
"requires_to_requires_dist",
"(",
"requirement",
")",
":",
"requires_dist",
"=",
"[",
"]",
"for",
"op",
",",
"ver",
"in",
"requirement",
".",
"specs",
":",
"requires_dist",
".",
"append",
"(",
"op",
"+",
"ver",
")",
"if",
"not",
"requires_dist",
":"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | pkginfo_to_metadata | Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka
old-draft Metadata 2.0 format. | capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py | def pkginfo_to_metadata(egg_info_path, pkginfo_path):
"""
Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka
old-draft Metadata 2.0 format.
"""
pkg_info = read_pkg_info(pkginfo_path)
pkg_info.replace_header('Metadata-Version', '2.0')
requires_path = os.path.join(egg_info_path,... | def pkginfo_to_metadata(egg_info_path, pkginfo_path):
"""
Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka
old-draft Metadata 2.0 format.
"""
pkg_info = read_pkg_info(pkginfo_path)
pkg_info.replace_header('Metadata-Version', '2.0')
requires_path = os.path.join(egg_info_path,... | [
"Convert",
".",
"egg",
"-",
"info",
"directory",
"with",
"PKG",
"-",
"INFO",
"to",
"the",
"Metadata",
"1",
".",
"3",
"aka",
"old",
"-",
"draft",
"Metadata",
"2",
".",
"0",
"format",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/metadata.py#L226-L255 | [
"def",
"pkginfo_to_metadata",
"(",
"egg_info_path",
",",
"pkginfo_path",
")",
":",
"pkg_info",
"=",
"read_pkg_info",
"(",
"pkginfo_path",
")",
"pkg_info",
".",
"replace_header",
"(",
"'Metadata-Version'",
",",
"'2.0'",
")",
"requires_path",
"=",
"os",
".",
"path",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PathGuesser.set_possible | break up a module path to its various parts (prefix, module, class, method)
this uses PEP 8 conventions, so foo.Bar would be foo module with class Bar
return -- list -- a list of possible interpretations of the module path
(eg, foo.bar can be bar module in foo module, or bar method in foo ... | pyt/path.py | def set_possible(self):
'''
break up a module path to its various parts (prefix, module, class, method)
this uses PEP 8 conventions, so foo.Bar would be foo module with class Bar
return -- list -- a list of possible interpretations of the module path
(eg, foo.bar can be bar... | def set_possible(self):
'''
break up a module path to its various parts (prefix, module, class, method)
this uses PEP 8 conventions, so foo.Bar would be foo module with class Bar
return -- list -- a list of possible interpretations of the module path
(eg, foo.bar can be bar... | [
"break",
"up",
"a",
"module",
"path",
"to",
"its",
"various",
"parts",
"(",
"prefix",
"module",
"class",
"method",
")"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L69-L151 | [
"def",
"set_possible",
"(",
"self",
")",
":",
"possible",
"=",
"[",
"]",
"name",
"=",
"self",
".",
"name",
"logger",
".",
"debug",
"(",
"'Guessing test name: {}'",
".",
"format",
"(",
"name",
")",
")",
"name_f",
"=",
"self",
".",
"name",
".",
"lower",
... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder.modules | return modules that match module_name | pyt/path.py | def modules(self):
"""return modules that match module_name"""
# since the module has to be importable we go ahead and put the
# basepath as the very first path to check as that should minimize
# namespace collisions, this is what unittest does also
sys.path.insert(0, self.based... | def modules(self):
"""return modules that match module_name"""
# since the module has to be importable we go ahead and put the
# basepath as the very first path to check as that should minimize
# namespace collisions, this is what unittest does also
sys.path.insert(0, self.based... | [
"return",
"modules",
"that",
"match",
"module_name"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L197-L223 | [
"def",
"modules",
"(",
"self",
")",
":",
"# since the module has to be importable we go ahead and put the",
"# basepath as the very first path to check as that should minimize",
"# namespace collisions, this is what unittest does also",
"sys",
".",
"path",
".",
"insert",
"(",
"0",
",... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder.classes | the partial self.class_name will be used to find actual TestCase classes | pyt/path.py | def classes(self):
"""the partial self.class_name will be used to find actual TestCase classes"""
for module in self.modules():
cs = inspect.getmembers(module, inspect.isclass)
class_name = getattr(self, 'class_name', '')
class_regex = ''
if class_name:
... | def classes(self):
"""the partial self.class_name will be used to find actual TestCase classes"""
for module in self.modules():
cs = inspect.getmembers(module, inspect.isclass)
class_name = getattr(self, 'class_name', '')
class_regex = ''
if class_name:
... | [
"the",
"partial",
"self",
".",
"class_name",
"will",
"be",
"used",
"to",
"find",
"actual",
"TestCase",
"classes"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L225-L247 | [
"def",
"classes",
"(",
"self",
")",
":",
"for",
"module",
"in",
"self",
".",
"modules",
"(",
")",
":",
"cs",
"=",
"inspect",
".",
"getmembers",
"(",
"module",
",",
"inspect",
".",
"isclass",
")",
"class_name",
"=",
"getattr",
"(",
"self",
",",
"'clas... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder.method_names | return the actual test methods that matched self.method_name | pyt/path.py | def method_names(self):
"""return the actual test methods that matched self.method_name"""
for c in self.classes():
#ms = inspect.getmembers(c, inspect.ismethod)
# http://stackoverflow.com/questions/17019949/
ms = inspect.getmembers(c, lambda f: inspect.ismethod(f) or... | def method_names(self):
"""return the actual test methods that matched self.method_name"""
for c in self.classes():
#ms = inspect.getmembers(c, inspect.ismethod)
# http://stackoverflow.com/questions/17019949/
ms = inspect.getmembers(c, lambda f: inspect.ismethod(f) or... | [
"return",
"the",
"actual",
"test",
"methods",
"that",
"matched",
"self",
".",
"method_name"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L249-L284 | [
"def",
"method_names",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
".",
"classes",
"(",
")",
":",
"#ms = inspect.getmembers(c, inspect.ismethod)",
"# http://stackoverflow.com/questions/17019949/",
"ms",
"=",
"inspect",
".",
"getmembers",
"(",
"c",
",",
"lambda"... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder._find_basename | check if name combined with test prefixes or postfixes is found anywhere
in the list of basenames
:param name: string, the name you're searching for
:param basenames: list, a list of basenames to check
:param is_prefix: bool, True if this is a prefix search, which means it will
... | pyt/path.py | def _find_basename(self, name, basenames, is_prefix=False):
"""check if name combined with test prefixes or postfixes is found anywhere
in the list of basenames
:param name: string, the name you're searching for
:param basenames: list, a list of basenames to check
:param is_pref... | def _find_basename(self, name, basenames, is_prefix=False):
"""check if name combined with test prefixes or postfixes is found anywhere
in the list of basenames
:param name: string, the name you're searching for
:param basenames: list, a list of basenames to check
:param is_pref... | [
"check",
"if",
"name",
"combined",
"with",
"test",
"prefixes",
"or",
"postfixes",
"is",
"found",
"anywhere",
"in",
"the",
"list",
"of",
"basenames"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L286-L361 | [
"def",
"_find_basename",
"(",
"self",
",",
"name",
",",
"basenames",
",",
"is_prefix",
"=",
"False",
")",
":",
"ret",
"=",
"\"\"",
"fileroots",
"=",
"[",
"(",
"os",
".",
"path",
".",
"splitext",
"(",
"n",
")",
"[",
"0",
"]",
",",
"n",
")",
"for",... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder._find_prefix_path | Similar to _find_prefix_paths() but only returns the first match | pyt/path.py | def _find_prefix_path(self, basedir, prefix):
"""Similar to _find_prefix_paths() but only returns the first match"""
ret = ""
for ret in self._find_prefix_paths(basedir, prefix):
break
if not ret:
raise IOError("Could not find prefix {} in path {}".format(prefix,... | def _find_prefix_path(self, basedir, prefix):
"""Similar to _find_prefix_paths() but only returns the first match"""
ret = ""
for ret in self._find_prefix_paths(basedir, prefix):
break
if not ret:
raise IOError("Could not find prefix {} in path {}".format(prefix,... | [
"Similar",
"to",
"_find_prefix_paths",
"()",
"but",
"only",
"returns",
"the",
"first",
"match"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L391-L400 | [
"def",
"_find_prefix_path",
"(",
"self",
",",
"basedir",
",",
"prefix",
")",
":",
"ret",
"=",
"\"\"",
"for",
"ret",
"in",
"self",
".",
"_find_prefix_paths",
"(",
"basedir",
",",
"prefix",
")",
":",
"break",
"if",
"not",
"ret",
":",
"raise",
"IOError",
... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder._is_module_path | Returns true if the passed in path is a test module path
:param path: string, the path to check, will need to start or end with the
module test prefixes or postfixes to be considered valid
:returns: boolean, True if a test module path, False otherwise | pyt/path.py | def _is_module_path(self, path):
"""Returns true if the passed in path is a test module path
:param path: string, the path to check, will need to start or end with the
module test prefixes or postfixes to be considered valid
:returns: boolean, True if a test module path, False other... | def _is_module_path(self, path):
"""Returns true if the passed in path is a test module path
:param path: string, the path to check, will need to start or end with the
module test prefixes or postfixes to be considered valid
:returns: boolean, True if a test module path, False other... | [
"Returns",
"true",
"if",
"the",
"passed",
"in",
"path",
"is",
"a",
"test",
"module",
"path"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L450-L470 | [
"def",
"_is_module_path",
"(",
"self",
",",
"path",
")",
":",
"ret",
"=",
"False",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
"fileroot",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"basename",
")",
"[",
"0",
"]",
"for... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder.walk | Walk all the directories of basedir except hidden directories
:param basedir: string, the directory to walk
:returns: generator, same as os.walk | pyt/path.py | def walk(self, basedir):
"""Walk all the directories of basedir except hidden directories
:param basedir: string, the directory to walk
:returns: generator, same as os.walk
"""
system_d = SitePackagesDir()
filter_system_d = system_d and os.path.commonprefix([system_d, ba... | def walk(self, basedir):
"""Walk all the directories of basedir except hidden directories
:param basedir: string, the directory to walk
:returns: generator, same as os.walk
"""
system_d = SitePackagesDir()
filter_system_d = system_d and os.path.commonprefix([system_d, ba... | [
"Walk",
"all",
"the",
"directories",
"of",
"basedir",
"except",
"hidden",
"directories"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L472-L488 | [
"def",
"walk",
"(",
"self",
",",
"basedir",
")",
":",
"system_d",
"=",
"SitePackagesDir",
"(",
")",
"filter_system_d",
"=",
"system_d",
"and",
"os",
".",
"path",
".",
"commonprefix",
"(",
"[",
"system_d",
",",
"basedir",
"]",
")",
"!=",
"system_d",
"for"... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder.paths | given a basedir, yield all test modules paths recursively found in
basedir that are test modules
return -- generator | pyt/path.py | def paths(self):
'''
given a basedir, yield all test modules paths recursively found in
basedir that are test modules
return -- generator
'''
module_name = getattr(self, 'module_name', '')
module_prefix = getattr(self, 'prefix', '')
filepath = getattr(sel... | def paths(self):
'''
given a basedir, yield all test modules paths recursively found in
basedir that are test modules
return -- generator
'''
module_name = getattr(self, 'module_name', '')
module_prefix = getattr(self, 'prefix', '')
filepath = getattr(sel... | [
"given",
"a",
"basedir",
"yield",
"all",
"test",
"modules",
"paths",
"recursively",
"found",
"in",
"basedir",
"that",
"are",
"test",
"modules"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L490-L559 | [
"def",
"paths",
"(",
"self",
")",
":",
"module_name",
"=",
"getattr",
"(",
"self",
",",
"'module_name'",
",",
"''",
")",
"module_prefix",
"=",
"getattr",
"(",
"self",
",",
"'prefix'",
",",
"''",
")",
"filepath",
"=",
"getattr",
"(",
"self",
",",
"'file... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | PathFinder.module_path | given a filepath like /base/path/to/module.py this will convert it to
path.to.module so it can be imported | pyt/path.py | def module_path(self, filepath):
"""given a filepath like /base/path/to/module.py this will convert it to
path.to.module so it can be imported"""
possible_modbits = re.split('[\\/]', filepath.strip('\\/'))
basename = possible_modbits[-1]
prefixes = possible_modbits[0:-1]
... | def module_path(self, filepath):
"""given a filepath like /base/path/to/module.py this will convert it to
path.to.module so it can be imported"""
possible_modbits = re.split('[\\/]', filepath.strip('\\/'))
basename = possible_modbits[-1]
prefixes = possible_modbits[0:-1]
... | [
"given",
"a",
"filepath",
"like",
"/",
"base",
"/",
"path",
"/",
"to",
"/",
"module",
".",
"py",
"this",
"will",
"convert",
"it",
"to",
"path",
".",
"to",
".",
"module",
"so",
"it",
"can",
"be",
"imported"
] | Jaymon/pyt | python | https://github.com/Jaymon/pyt/blob/801581fd0ae238158134bde1c937fa199fa626b2/pyt/path.py#L561-L591 | [
"def",
"module_path",
"(",
"self",
",",
"filepath",
")",
":",
"possible_modbits",
"=",
"re",
".",
"split",
"(",
"'[\\\\/]'",
",",
"filepath",
".",
"strip",
"(",
"'\\\\/'",
")",
")",
"basename",
"=",
"possible_modbits",
"[",
"-",
"1",
"]",
"prefixes",
"="... | 801581fd0ae238158134bde1c937fa199fa626b2 |
test | UninstallPathSet.remove | Remove paths in ``self.paths`` with confirmation (unless
``auto_confirm`` is True). | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_uninstall.py | def remove(self, auto_confirm=False):
"""Remove paths in ``self.paths`` with confirmation (unless
``auto_confirm`` is True)."""
if not self._can_uninstall():
return
if not self.paths:
logger.info(
"Can't uninstall '%s'. No files were found to unins... | def remove(self, auto_confirm=False):
"""Remove paths in ``self.paths`` with confirmation (unless
``auto_confirm`` is True)."""
if not self._can_uninstall():
return
if not self.paths:
logger.info(
"Can't uninstall '%s'. No files were found to unins... | [
"Remove",
"paths",
"in",
"self",
".",
"paths",
"with",
"confirmation",
"(",
"unless",
"auto_confirm",
"is",
"True",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_uninstall.py#L90-L132 | [
"def",
"remove",
"(",
"self",
",",
"auto_confirm",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_can_uninstall",
"(",
")",
":",
"return",
"if",
"not",
"self",
".",
"paths",
":",
"logger",
".",
"info",
"(",
"\"Can't uninstall '%s'. No files were found t... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | UninstallPathSet.rollback | Rollback the changes previously made by remove(). | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_uninstall.py | def rollback(self):
"""Rollback the changes previously made by remove()."""
if self.save_dir is None:
logger.error(
"Can't roll back %s; was not uninstalled",
self.dist.project_name,
)
return False
logger.info('Rolling back unin... | def rollback(self):
"""Rollback the changes previously made by remove()."""
if self.save_dir is None:
logger.error(
"Can't roll back %s; was not uninstalled",
self.dist.project_name,
)
return False
logger.info('Rolling back unin... | [
"Rollback",
"the",
"changes",
"previously",
"made",
"by",
"remove",
"()",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_uninstall.py#L134-L148 | [
"def",
"rollback",
"(",
"self",
")",
":",
"if",
"self",
".",
"save_dir",
"is",
"None",
":",
"logger",
".",
"error",
"(",
"\"Can't roll back %s; was not uninstalled\"",
",",
"self",
".",
"dist",
".",
"project_name",
",",
")",
"return",
"False",
"logger",
".",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | UninstallPathSet.commit | Remove temporary save dir: rollback will no longer be possible. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_uninstall.py | def commit(self):
"""Remove temporary save dir: rollback will no longer be possible."""
if self.save_dir is not None:
rmtree(self.save_dir)
self.save_dir = None
self._moved_paths = [] | def commit(self):
"""Remove temporary save dir: rollback will no longer be possible."""
if self.save_dir is not None:
rmtree(self.save_dir)
self.save_dir = None
self._moved_paths = [] | [
"Remove",
"temporary",
"save",
"dir",
":",
"rollback",
"will",
"no",
"longer",
"be",
"possible",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_uninstall.py#L150-L155 | [
"def",
"commit",
"(",
"self",
")",
":",
"if",
"self",
".",
"save_dir",
"is",
"not",
"None",
":",
"rmtree",
"(",
"self",
".",
"save_dir",
")",
"self",
".",
"save_dir",
"=",
"None",
"self",
".",
"_moved_paths",
"=",
"[",
"]"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _dump_arg_defaults | Inject default arguments for dump functions. | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def _dump_arg_defaults(kwargs):
"""Inject default arguments for dump functions."""
if current_app:
kwargs.setdefault('cls', current_app.json_encoder)
if not current_app.config['JSON_AS_ASCII']:
kwargs.setdefault('ensure_ascii', False)
kwargs.setdefault('sort_keys', current_ap... | def _dump_arg_defaults(kwargs):
"""Inject default arguments for dump functions."""
if current_app:
kwargs.setdefault('cls', current_app.json_encoder)
if not current_app.config['JSON_AS_ASCII']:
kwargs.setdefault('ensure_ascii', False)
kwargs.setdefault('sort_keys', current_ap... | [
"Inject",
"default",
"arguments",
"for",
"dump",
"functions",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L94-L103 | [
"def",
"_dump_arg_defaults",
"(",
"kwargs",
")",
":",
"if",
"current_app",
":",
"kwargs",
".",
"setdefault",
"(",
"'cls'",
",",
"current_app",
".",
"json_encoder",
")",
"if",
"not",
"current_app",
".",
"config",
"[",
"'JSON_AS_ASCII'",
"]",
":",
"kwargs",
".... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _load_arg_defaults | Inject default arguments for load functions. | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def _load_arg_defaults(kwargs):
"""Inject default arguments for load functions."""
if current_app:
kwargs.setdefault('cls', current_app.json_decoder)
else:
kwargs.setdefault('cls', JSONDecoder) | def _load_arg_defaults(kwargs):
"""Inject default arguments for load functions."""
if current_app:
kwargs.setdefault('cls', current_app.json_decoder)
else:
kwargs.setdefault('cls', JSONDecoder) | [
"Inject",
"default",
"arguments",
"for",
"load",
"functions",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L106-L111 | [
"def",
"_load_arg_defaults",
"(",
"kwargs",
")",
":",
"if",
"current_app",
":",
"kwargs",
".",
"setdefault",
"(",
"'cls'",
",",
"current_app",
".",
"json_decoder",
")",
"else",
":",
"kwargs",
".",
"setdefault",
"(",
"'cls'",
",",
"JSONDecoder",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | dumps | Serialize ``obj`` to a JSON formatted ``str`` by using the application's
configured encoder (:attr:`~flask.Flask.json_encoder`) if there is an
application on the stack.
This function can return ``unicode`` strings or ascii-only bytestrings by
default which coerce into unicode strings automatically. Th... | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def dumps(obj, **kwargs):
"""Serialize ``obj`` to a JSON formatted ``str`` by using the application's
configured encoder (:attr:`~flask.Flask.json_encoder`) if there is an
application on the stack.
This function can return ``unicode`` strings or ascii-only bytestrings by
default which coerce into u... | def dumps(obj, **kwargs):
"""Serialize ``obj`` to a JSON formatted ``str`` by using the application's
configured encoder (:attr:`~flask.Flask.json_encoder`) if there is an
application on the stack.
This function can return ``unicode`` strings or ascii-only bytestrings by
default which coerce into u... | [
"Serialize",
"obj",
"to",
"a",
"JSON",
"formatted",
"str",
"by",
"using",
"the",
"application",
"s",
"configured",
"encoder",
"(",
":",
"attr",
":",
"~flask",
".",
"Flask",
".",
"json_encoder",
")",
"if",
"there",
"is",
"an",
"application",
"on",
"the",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L114-L129 | [
"def",
"dumps",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"_dump_arg_defaults",
"(",
"kwargs",
")",
"encoding",
"=",
"kwargs",
".",
"pop",
"(",
"'encoding'",
",",
"None",
")",
"rv",
"=",
"_json",
".",
"dumps",
"(",
"obj",
",",
"*",
"*",
"kwarg... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | dump | Like :func:`dumps` but writes into a file object. | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def dump(obj, fp, **kwargs):
"""Like :func:`dumps` but writes into a file object."""
_dump_arg_defaults(kwargs)
encoding = kwargs.pop('encoding', None)
if encoding is not None:
fp = _wrap_writer_for_text(fp, encoding)
_json.dump(obj, fp, **kwargs) | def dump(obj, fp, **kwargs):
"""Like :func:`dumps` but writes into a file object."""
_dump_arg_defaults(kwargs)
encoding = kwargs.pop('encoding', None)
if encoding is not None:
fp = _wrap_writer_for_text(fp, encoding)
_json.dump(obj, fp, **kwargs) | [
"Like",
":",
"func",
":",
"dumps",
"but",
"writes",
"into",
"a",
"file",
"object",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L132-L138 | [
"def",
"dump",
"(",
"obj",
",",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"_dump_arg_defaults",
"(",
"kwargs",
")",
"encoding",
"=",
"kwargs",
".",
"pop",
"(",
"'encoding'",
",",
"None",
")",
"if",
"encoding",
"is",
"not",
"None",
":",
"fp",
"=",
"_... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | loads | Unserialize a JSON object from a string ``s`` by using the application's
configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
application on the stack. | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def loads(s, **kwargs):
"""Unserialize a JSON object from a string ``s`` by using the application's
configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
application on the stack.
"""
_load_arg_defaults(kwargs)
if isinstance(s, bytes):
s = s.decode(kwargs.pop('encoding', ... | def loads(s, **kwargs):
"""Unserialize a JSON object from a string ``s`` by using the application's
configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
application on the stack.
"""
_load_arg_defaults(kwargs)
if isinstance(s, bytes):
s = s.decode(kwargs.pop('encoding', ... | [
"Unserialize",
"a",
"JSON",
"object",
"from",
"a",
"string",
"s",
"by",
"using",
"the",
"application",
"s",
"configured",
"decoder",
"(",
":",
"attr",
":",
"~flask",
".",
"Flask",
".",
"json_decoder",
")",
"if",
"there",
"is",
"an",
"application",
"on",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L141-L149 | [
"def",
"loads",
"(",
"s",
",",
"*",
"*",
"kwargs",
")",
":",
"_load_arg_defaults",
"(",
"kwargs",
")",
"if",
"isinstance",
"(",
"s",
",",
"bytes",
")",
":",
"s",
"=",
"s",
".",
"decode",
"(",
"kwargs",
".",
"pop",
"(",
"'encoding'",
",",
"None",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | load | Like :func:`loads` but reads from a file object. | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def load(fp, **kwargs):
"""Like :func:`loads` but reads from a file object.
"""
_load_arg_defaults(kwargs)
if not PY2:
fp = _wrap_reader_for_text(fp, kwargs.pop('encoding', None) or 'utf-8')
return _json.load(fp, **kwargs) | def load(fp, **kwargs):
"""Like :func:`loads` but reads from a file object.
"""
_load_arg_defaults(kwargs)
if not PY2:
fp = _wrap_reader_for_text(fp, kwargs.pop('encoding', None) or 'utf-8')
return _json.load(fp, **kwargs) | [
"Like",
":",
"func",
":",
"loads",
"but",
"reads",
"from",
"a",
"file",
"object",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L152-L158 | [
"def",
"load",
"(",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"_load_arg_defaults",
"(",
"kwargs",
")",
"if",
"not",
"PY2",
":",
"fp",
"=",
"_wrap_reader_for_text",
"(",
"fp",
",",
"kwargs",
".",
"pop",
"(",
"'encoding'",
",",
"None",
")",
"or",
"'utf... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | htmlsafe_dumps | Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. Due to how this function escapes certain
characters this... | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def htmlsafe_dumps(obj, **kwargs):
"""Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. Due to how this fu... | def htmlsafe_dumps(obj, **kwargs):
"""Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. Due to how this fu... | [
"Works",
"exactly",
"like",
":",
"func",
":",
"dumps",
"but",
"is",
"safe",
"for",
"use",
"in",
"<script",
">",
"tags",
".",
"It",
"accepts",
"the",
"same",
"arguments",
"and",
"returns",
"a",
"JSON",
"string",
".",
"Note",
"that",
"this",
"is",
"avail... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L161-L193 | [
"def",
"htmlsafe_dumps",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"rv",
"=",
"dumps",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
".",
"replace",
"(",
"u'<'",
",",
"u'\\\\u003c'",
")",
".",
"replace",
"(",
"u'>'",
",",
"u'\\\\u003e'",
")",
".",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | htmlsafe_dump | Like :func:`htmlsafe_dumps` but writes into a file object. | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def htmlsafe_dump(obj, fp, **kwargs):
"""Like :func:`htmlsafe_dumps` but writes into a file object."""
fp.write(unicode(htmlsafe_dumps(obj, **kwargs))) | def htmlsafe_dump(obj, fp, **kwargs):
"""Like :func:`htmlsafe_dumps` but writes into a file object."""
fp.write(unicode(htmlsafe_dumps(obj, **kwargs))) | [
"Like",
":",
"func",
":",
"htmlsafe_dumps",
"but",
"writes",
"into",
"a",
"file",
"object",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L196-L198 | [
"def",
"htmlsafe_dump",
"(",
"obj",
",",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"fp",
".",
"write",
"(",
"unicode",
"(",
"htmlsafe_dumps",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
")",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | jsonify | Creates a :class:`~flask.Response` with the JSON representation of
the given arguments with an `application/json` mimetype. The arguments
to this function are the same as to the :class:`dict` constructor.
Example usage::
from flask import jsonify
@app.route('/_get_current_user')
... | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def jsonify(*args, **kwargs):
"""Creates a :class:`~flask.Response` with the JSON representation of
the given arguments with an `application/json` mimetype. The arguments
to this function are the same as to the :class:`dict` constructor.
Example usage::
from flask import jsonify
@app... | def jsonify(*args, **kwargs):
"""Creates a :class:`~flask.Response` with the JSON representation of
the given arguments with an `application/json` mimetype. The arguments
to this function are the same as to the :class:`dict` constructor.
Example usage::
from flask import jsonify
@app... | [
"Creates",
"a",
":",
"class",
":",
"~flask",
".",
"Response",
"with",
"the",
"JSON",
"representation",
"of",
"the",
"given",
"arguments",
"with",
"an",
"application",
"/",
"json",
"mimetype",
".",
"The",
"arguments",
"to",
"this",
"function",
"are",
"the",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L201-L239 | [
"def",
"jsonify",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"indent",
"=",
"None",
"if",
"current_app",
".",
"config",
"[",
"'JSONIFY_PRETTYPRINT_REGULAR'",
"]",
"and",
"not",
"request",
".",
"is_xhr",
":",
"indent",
"=",
"2",
"return",
"curre... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | JSONEncoder.default | Implement this method in a subclass such that it returns a
serializable object for ``o``, or calls the base implementation (to
raise a ``TypeError``).
For example, to support arbitrary iterators, you could implement
default like this::
def default(self, o):
... | capybara/virtualenv/lib/python2.7/site-packages/flask/json.py | def default(self, o):
"""Implement this method in a subclass such that it returns a
serializable object for ``o``, or calls the base implementation (to
raise a ``TypeError``).
For example, to support arbitrary iterators, you could implement
default like this::
def d... | def default(self, o):
"""Implement this method in a subclass such that it returns a
serializable object for ``o``, or calls the base implementation (to
raise a ``TypeError``).
For example, to support arbitrary iterators, you could implement
default like this::
def d... | [
"Implement",
"this",
"method",
"in",
"a",
"subclass",
"such",
"that",
"it",
"returns",
"a",
"serializable",
"object",
"for",
"o",
"or",
"calls",
"the",
"base",
"implementation",
"(",
"to",
"raise",
"a",
"TypeError",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/json.py#L60-L83 | [
"def",
"default",
"(",
"self",
",",
"o",
")",
":",
"if",
"isinstance",
"(",
"o",
",",
"datetime",
")",
":",
"return",
"http_date",
"(",
"o",
")",
"if",
"isinstance",
"(",
"o",
",",
"uuid",
".",
"UUID",
")",
":",
"return",
"str",
"(",
"o",
")",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | escape | Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string. | capybara/virtualenv/lib/python2.7/site-packages/markupsafe/_native.py | def escape(s):
"""Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string.
"""
if hasattr(s, '__html__'):
return s.__html__()
return Markup(text_type... | def escape(s):
"""Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string.
"""
if hasattr(s, '__html__'):
return s.__html__()
return Markup(text_type... | [
"Convert",
"the",
"characters",
"&",
"<",
">",
"and",
"in",
"string",
"s",
"to",
"HTML",
"-",
"safe",
"sequences",
".",
"Use",
"this",
"if",
"you",
"need",
"to",
"display",
"text",
"that",
"might",
"contain",
"such",
"characters",
"in",
"HTML",
".",
"M... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/markupsafe/_native.py#L15-L28 | [
"def",
"escape",
"(",
"s",
")",
":",
"if",
"hasattr",
"(",
"s",
",",
"'__html__'",
")",
":",
"return",
"s",
".",
"__html__",
"(",
")",
"return",
"Markup",
"(",
"text_type",
"(",
"s",
")",
".",
"replace",
"(",
"'&'",
",",
"'&'",
")",
".",
"rep... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | BaseCache.set_many | Sets multiple keys and values from a mapping.
:param mapping: a mapping with the keys/values to set.
:param timeout: the cache timeout for the key (if not specified,
it uses the default timeout).
:returns: Whether all given keys have been set.
:rtype: boolean | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py | def set_many(self, mapping, timeout=None):
"""Sets multiple keys and values from a mapping.
:param mapping: a mapping with the keys/values to set.
:param timeout: the cache timeout for the key (if not specified,
it uses the default timeout).
:returns: Whether all... | def set_many(self, mapping, timeout=None):
"""Sets multiple keys and values from a mapping.
:param mapping: a mapping with the keys/values to set.
:param timeout: the cache timeout for the key (if not specified,
it uses the default timeout).
:returns: Whether all... | [
"Sets",
"multiple",
"keys",
"and",
"values",
"from",
"a",
"mapping",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py#L173-L186 | [
"def",
"set_many",
"(",
"self",
",",
"mapping",
",",
"timeout",
"=",
"None",
")",
":",
"rv",
"=",
"True",
"for",
"key",
",",
"value",
"in",
"_items",
"(",
"mapping",
")",
":",
"if",
"not",
"self",
".",
"set",
"(",
"key",
",",
"value",
",",
"timeo... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | BaseCache.inc | Increments the value of a key by `delta`. If the key does
not yet exist it is initialized with `delta`.
For supporting caches this is an atomic operation.
:param key: the key to increment.
:param delta: the delta to add.
:returns: The new value or ``None`` for backend errors. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py | def inc(self, key, delta=1):
"""Increments the value of a key by `delta`. If the key does
not yet exist it is initialized with `delta`.
For supporting caches this is an atomic operation.
:param key: the key to increment.
:param delta: the delta to add.
:returns: The ne... | def inc(self, key, delta=1):
"""Increments the value of a key by `delta`. If the key does
not yet exist it is initialized with `delta`.
For supporting caches this is an atomic operation.
:param key: the key to increment.
:param delta: the delta to add.
:returns: The ne... | [
"Increments",
"the",
"value",
"of",
"a",
"key",
"by",
"delta",
".",
"If",
"the",
"key",
"does",
"not",
"yet",
"exist",
"it",
"is",
"initialized",
"with",
"delta",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py#L206-L217 | [
"def",
"inc",
"(",
"self",
",",
"key",
",",
"delta",
"=",
"1",
")",
":",
"value",
"=",
"(",
"self",
".",
"get",
"(",
"key",
")",
"or",
"0",
")",
"+",
"delta",
"return",
"value",
"if",
"self",
".",
"set",
"(",
"key",
",",
"value",
")",
"else",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RedisCache.dump_object | Dumps an object into a string for redis. By default it serializes
integers as regular string and pickle dumps everything else. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py | def dump_object(self, value):
"""Dumps an object into a string for redis. By default it serializes
integers as regular string and pickle dumps everything else.
"""
t = type(value)
if t in integer_types:
return str(value).encode('ascii')
return b'!' + pickle.d... | def dump_object(self, value):
"""Dumps an object into a string for redis. By default it serializes
integers as regular string and pickle dumps everything else.
"""
t = type(value)
if t in integer_types:
return str(value).encode('ascii')
return b'!' + pickle.d... | [
"Dumps",
"an",
"object",
"into",
"a",
"string",
"for",
"redis",
".",
"By",
"default",
"it",
"serializes",
"integers",
"as",
"regular",
"string",
"and",
"pickle",
"dumps",
"everything",
"else",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py#L521-L528 | [
"def",
"dump_object",
"(",
"self",
",",
"value",
")",
":",
"t",
"=",
"type",
"(",
"value",
")",
"if",
"t",
"in",
"integer_types",
":",
"return",
"str",
"(",
"value",
")",
".",
"encode",
"(",
"'ascii'",
")",
"return",
"b'!'",
"+",
"pickle",
".",
"du... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | RedisCache.load_object | The reversal of :meth:`dump_object`. This might be callde with
None. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py | def load_object(self, value):
"""The reversal of :meth:`dump_object`. This might be callde with
None.
"""
if value is None:
return None
if value.startswith(b'!'):
try:
return pickle.loads(value[1:])
except pickle.PickleError:
... | def load_object(self, value):
"""The reversal of :meth:`dump_object`. This might be callde with
None.
"""
if value is None:
return None
if value.startswith(b'!'):
try:
return pickle.loads(value[1:])
except pickle.PickleError:
... | [
"The",
"reversal",
"of",
":",
"meth",
":",
"dump_object",
".",
"This",
"might",
"be",
"callde",
"with",
"None",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/contrib/cache.py#L530-L545 | [
"def",
"load_object",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"value",
".",
"startswith",
"(",
"b'!'",
")",
":",
"try",
":",
"return",
"pickle",
".",
"loads",
"(",
"value",
"[",
"1",
":",
"]",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _strip_postfix | Strip req postfix ( -dev, 0.2, etc ) | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def _strip_postfix(req):
"""
Strip req postfix ( -dev, 0.2, etc )
"""
# FIXME: use package_to_requirement?
match = re.search(r'^(.*?)(?:-dev|-\d.*)$', req)
if match:
# Strip off -dev, -0.2, etc.
req = match.group(1)
return req | def _strip_postfix(req):
"""
Strip req postfix ( -dev, 0.2, etc )
"""
# FIXME: use package_to_requirement?
match = re.search(r'^(.*?)(?:-dev|-\d.*)$', req)
if match:
# Strip off -dev, -0.2, etc.
req = match.group(1)
return req | [
"Strip",
"req",
"postfix",
"(",
"-",
"dev",
"0",
".",
"2",
"etc",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L1018-L1027 | [
"def",
"_strip_postfix",
"(",
"req",
")",
":",
"# FIXME: use package_to_requirement?",
"match",
"=",
"re",
".",
"search",
"(",
"r'^(.*?)(?:-dev|-\\d.*)$'",
",",
"req",
")",
"if",
"match",
":",
"# Strip off -dev, -0.2, etc.",
"req",
"=",
"match",
".",
"group",
"(",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _build_editable_options | This method generates a dictionary of the query string
parameters contained in a given editable URL. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def _build_editable_options(req):
"""
This method generates a dictionary of the query string
parameters contained in a given editable URL.
"""
regexp = re.compile(r"[\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)")
matched = regexp.findall(req)
if matched:
ret = dict()
for... | def _build_editable_options(req):
"""
This method generates a dictionary of the query string
parameters contained in a given editable URL.
"""
regexp = re.compile(r"[\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)")
matched = regexp.findall(req)
if matched:
ret = dict()
for... | [
"This",
"method",
"generates",
"a",
"dictionary",
"of",
"the",
"query",
"string",
"parameters",
"contained",
"in",
"a",
"given",
"editable",
"URL",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L1042-L1059 | [
"def",
"_build_editable_options",
"(",
"req",
")",
":",
"regexp",
"=",
"re",
".",
"compile",
"(",
"r\"[\\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)\"",
")",
"matched",
"=",
"regexp",
".",
"findall",
"(",
"req",
")",
"if",
"matched",
":",
"ret",
"=",
"dict",
"(",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse_editable | Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
.[some_extra] | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def parse_editable(editable_req, default_vcs=None):
"""Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
.[some_extra]
"""
... | def parse_editable(editable_req, default_vcs=None):
"""Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
.[some_extra]
"""
... | [
"Parses",
"an",
"editable",
"requirement",
"into",
":",
"-",
"a",
"requirement",
"name",
"-",
"an",
"URL",
"-",
"extras",
"-",
"editable",
"options",
"Accepted",
"requirements",
":",
"svn",
"+",
"http",
":",
"//",
"blahblah"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L1062-L1146 | [
"def",
"parse_editable",
"(",
"editable_req",
",",
"default_vcs",
"=",
"None",
")",
":",
"url",
"=",
"editable_req",
"extras",
"=",
"None",
"# If a file path is specified with extras, strip off the extras.",
"m",
"=",
"re",
".",
"match",
"(",
"r'^(.+)(\\[[^\\]]+\\])$'",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | InstallRequirement.from_line | Creates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def from_line(
cls, name, comes_from=None, isolated=False, options=None,
wheel_cache=None):
"""Creates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL.
"""
from pip.index import Link
if is... | def from_line(
cls, name, comes_from=None, isolated=False, options=None,
wheel_cache=None):
"""Creates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL.
"""
from pip.index import Link
if is... | [
"Creates",
"an",
"InstallRequirement",
"from",
"a",
"name",
"which",
"might",
"be",
"a",
"requirement",
"directory",
"containing",
"setup",
".",
"py",
"filename",
"or",
"URL",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L133-L213 | [
"def",
"from_line",
"(",
"cls",
",",
"name",
",",
"comes_from",
"=",
"None",
",",
"isolated",
"=",
"False",
",",
"options",
"=",
"None",
",",
"wheel_cache",
"=",
"None",
")",
":",
"from",
"pip",
".",
"index",
"import",
"Link",
"if",
"is_url",
"(",
"n... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | InstallRequirement.populate_link | Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed. | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def populate_link(self, finder, upgrade):
"""Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
"""
if self.link is None:
self.link = finder.find_require... | def populate_link(self, finder, upgrade):
"""Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
"""
if self.link is None:
self.link = finder.find_require... | [
"Ensure",
"that",
"if",
"a",
"link",
"can",
"be",
"found",
"for",
"this",
"that",
"it",
"is",
"found",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L237-L244 | [
"def",
"populate_link",
"(",
"self",
",",
"finder",
",",
"upgrade",
")",
":",
"if",
"self",
".",
"link",
"is",
"None",
":",
"self",
".",
"link",
"=",
"finder",
".",
"find_requirement",
"(",
"self",
",",
"upgrade",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | InstallRequirement._correct_build_location | Move self._temp_build_dir to self._ideal_build_dir/self.req.name
For some requirements (e.g. a path to a directory), the name of the
package is not available until we run egg_info, so the build_location
will return a temporary directory and store the _ideal_build_dir.
This is only call... | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def _correct_build_location(self):
"""Move self._temp_build_dir to self._ideal_build_dir/self.req.name
For some requirements (e.g. a path to a directory), the name of the
package is not available until we run egg_info, so the build_location
will return a temporary directory and store th... | def _correct_build_location(self):
"""Move self._temp_build_dir to self._ideal_build_dir/self.req.name
For some requirements (e.g. a path to a directory), the name of the
package is not available until we run egg_info, so the build_location
will return a temporary directory and store th... | [
"Move",
"self",
".",
"_temp_build_dir",
"to",
"self",
".",
"_ideal_build_dir",
"/",
"self",
".",
"req",
".",
"name"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L297-L327 | [
"def",
"_correct_build_location",
"(",
"self",
")",
":",
"if",
"self",
".",
"source_dir",
"is",
"not",
"None",
":",
"return",
"assert",
"self",
".",
"req",
"is",
"not",
"None",
"assert",
"self",
".",
"_temp_build_dir",
"assert",
"self",
".",
"_ideal_build_di... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | InstallRequirement.ensure_has_source_dir | Ensure that a source_dir is set.
This will create a temporary build dir if the name of the requirement
isn't known yet.
:param parent_dir: The ideal pip parent_dir for the source_dir.
Generally src_dir for editables and build_dir for sdists.
:return: self.source_dir | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def ensure_has_source_dir(self, parent_dir):
"""Ensure that a source_dir is set.
This will create a temporary build dir if the name of the requirement
isn't known yet.
:param parent_dir: The ideal pip parent_dir for the source_dir.
Generally src_dir for editables and build_... | def ensure_has_source_dir(self, parent_dir):
"""Ensure that a source_dir is set.
This will create a temporary build dir if the name of the requirement
isn't known yet.
:param parent_dir: The ideal pip parent_dir for the source_dir.
Generally src_dir for editables and build_... | [
"Ensure",
"that",
"a",
"source_dir",
"is",
"set",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L908-L920 | [
"def",
"ensure_has_source_dir",
"(",
"self",
",",
"parent_dir",
")",
":",
"if",
"self",
".",
"source_dir",
"is",
"None",
":",
"self",
".",
"source_dir",
"=",
"self",
".",
"build_location",
"(",
"parent_dir",
")",
"return",
"self",
".",
"source_dir"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | InstallRequirement.remove_temporary_source | Remove the source files from this requirement, if they are marked
for deletion | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def remove_temporary_source(self):
"""Remove the source files from this requirement, if they are marked
for deletion"""
if self.source_dir and os.path.exists(
os.path.join(self.source_dir, PIP_DELETE_MARKER_FILENAME)):
logger.debug('Removing source in %s', self.source... | def remove_temporary_source(self):
"""Remove the source files from this requirement, if they are marked
for deletion"""
if self.source_dir and os.path.exists(
os.path.join(self.source_dir, PIP_DELETE_MARKER_FILENAME)):
logger.debug('Removing source in %s', self.source... | [
"Remove",
"the",
"source",
"files",
"from",
"this",
"requirement",
"if",
"they",
"are",
"marked",
"for",
"deletion"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L922-L932 | [
"def",
"remove_temporary_source",
"(",
"self",
")",
":",
"if",
"self",
".",
"source_dir",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"source_dir",
",",
"PIP_DELETE_MARKER_FILENAME",
")",
")",
":",
"log... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | InstallRequirement.get_dist | Return a pkg_resources.Distribution built from self.egg_info_path | capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py | def get_dist(self):
"""Return a pkg_resources.Distribution built from self.egg_info_path"""
egg_info = self.egg_info_path('').rstrip('/')
base_dir = os.path.dirname(egg_info)
metadata = pkg_resources.PathMetadata(base_dir, egg_info)
dist_name = os.path.splitext(os.path.basename(e... | def get_dist(self):
"""Return a pkg_resources.Distribution built from self.egg_info_path"""
egg_info = self.egg_info_path('').rstrip('/')
base_dir = os.path.dirname(egg_info)
metadata = pkg_resources.PathMetadata(base_dir, egg_info)
dist_name = os.path.splitext(os.path.basename(e... | [
"Return",
"a",
"pkg_resources",
".",
"Distribution",
"built",
"from",
"self",
".",
"egg_info_path"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_install.py#L1006-L1015 | [
"def",
"get_dist",
"(",
"self",
")",
":",
"egg_info",
"=",
"self",
".",
"egg_info_path",
"(",
"''",
")",
".",
"rstrip",
"(",
"'/'",
")",
"base_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"egg_info",
")",
"metadata",
"=",
"pkg_resources",
".",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse_info | Extract metadata from filenames.
Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
the installer filename and the name of the egg-info directory embedded in
the zipfile (if any).
The egginfo filename has the format::
name-ver(-pyver)(-arch).egg-info
The instal... | capybara/virtualenv/lib/python2.7/site-packages/wheel/wininst2wheel.py | def parse_info(wininfo_name, egginfo_name):
"""Extract metadata from filenames.
Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
the installer filename and the name of the egg-info directory embedded in
the zipfile (if any).
The egginfo filename has the format::
... | def parse_info(wininfo_name, egginfo_name):
"""Extract metadata from filenames.
Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
the installer filename and the name of the egg-info directory embedded in
the zipfile (if any).
The egginfo filename has the format::
... | [
"Extract",
"metadata",
"from",
"filenames",
".",
"Extracts",
"the",
"4",
"metadataitems",
"needed",
"(",
"name",
"version",
"pyversion",
"arch",
")",
"from",
"the",
"installer",
"filename",
"and",
"the",
"name",
"of",
"the",
"egg",
"-",
"info",
"directory",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/wininst2wheel.py#L18-L88 | [
"def",
"parse_info",
"(",
"wininfo_name",
",",
"egginfo_name",
")",
":",
"egginfo",
"=",
"None",
"if",
"egginfo_name",
":",
"egginfo",
"=",
"egg_info_re",
".",
"search",
"(",
"egginfo_name",
")",
"if",
"not",
"egginfo",
":",
"raise",
"ValueError",
"(",
"\"Eg... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | is_internal_attribute | Test if the attribute given is an internal python attribute. For
example this function returns `True` for the `func_code` attribute of
python objects. This is useful if the environment method
:meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
>>> from jinja2.sandbox import is_internal_att... | capybara/virtualenv/lib/python2.7/site-packages/jinja2/sandbox.py | def is_internal_attribute(obj, attr):
"""Test if the attribute given is an internal python attribute. For
example this function returns `True` for the `func_code` attribute of
python objects. This is useful if the environment method
:meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
>... | def is_internal_attribute(obj, attr):
"""Test if the attribute given is an internal python attribute. For
example this function returns `True` for the `func_code` attribute of
python objects. This is useful if the environment method
:meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
>... | [
"Test",
"if",
"the",
"attribute",
"given",
"is",
"an",
"internal",
"python",
"attribute",
".",
"For",
"example",
"this",
"function",
"returns",
"True",
"for",
"the",
"func_code",
"attribute",
"of",
"python",
"objects",
".",
"This",
"is",
"useful",
"if",
"the... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/sandbox.py#L120-L149 | [
"def",
"is_internal_attribute",
"(",
"obj",
",",
"attr",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"function_type",
")",
":",
"if",
"attr",
"in",
"UNSAFE_FUNCTION_ATTRIBUTES",
":",
"return",
"True",
"elif",
"isinstance",
"(",
"obj",
",",
"method_type",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | BaseRequest._get_stream_for_parsing | This is the same as accessing :attr:`stream` with the difference
that if it finds cached data from calling :meth:`get_data` first it
will create a new stream out of the cached data.
.. versionadded:: 0.9.3 | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wrappers.py | def _get_stream_for_parsing(self):
"""This is the same as accessing :attr:`stream` with the difference
that if it finds cached data from calling :meth:`get_data` first it
will create a new stream out of the cached data.
.. versionadded:: 0.9.3
"""
cached_data = getattr(s... | def _get_stream_for_parsing(self):
"""This is the same as accessing :attr:`stream` with the difference
that if it finds cached data from calling :meth:`get_data` first it
will create a new stream out of the cached data.
.. versionadded:: 0.9.3
"""
cached_data = getattr(s... | [
"This",
"is",
"the",
"same",
"as",
"accessing",
":",
"attr",
":",
"stream",
"with",
"the",
"difference",
"that",
"if",
"it",
"finds",
"cached",
"data",
"from",
"calling",
":",
"meth",
":",
"get_data",
"first",
"it",
"will",
"create",
"a",
"new",
"stream"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wrappers.py#L370-L380 | [
"def",
"_get_stream_for_parsing",
"(",
"self",
")",
":",
"cached_data",
"=",
"getattr",
"(",
"self",
",",
"'_cached_data'",
",",
"None",
")",
"if",
"cached_data",
"is",
"not",
"None",
":",
"return",
"BytesIO",
"(",
"cached_data",
")",
"return",
"self",
".",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | BaseRequest.get_data | This reads the buffered incoming data from the client into one
bytestring. By default this is cached but that behavior can be
changed by setting `cache` to `False`.
Usually it's a bad idea to call this method without checking the
content length first as a client could send dozens of me... | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wrappers.py | def get_data(self, cache=True, as_text=False, parse_form_data=False):
"""This reads the buffered incoming data from the client into one
bytestring. By default this is cached but that behavior can be
changed by setting `cache` to `False`.
Usually it's a bad idea to call this method with... | def get_data(self, cache=True, as_text=False, parse_form_data=False):
"""This reads the buffered incoming data from the client into one
bytestring. By default this is cached but that behavior can be
changed by setting `cache` to `False`.
Usually it's a bad idea to call this method with... | [
"This",
"reads",
"the",
"buffered",
"incoming",
"data",
"from",
"the",
"client",
"into",
"one",
"bytestring",
".",
"By",
"default",
"this",
"is",
"cached",
"but",
"that",
"behavior",
"can",
"be",
"changed",
"by",
"setting",
"cache",
"to",
"False",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wrappers.py#L444-L478 | [
"def",
"get_data",
"(",
"self",
",",
"cache",
"=",
"True",
",",
"as_text",
"=",
"False",
",",
"parse_form_data",
"=",
"False",
")",
":",
"rv",
"=",
"getattr",
"(",
"self",
",",
"'_cached_data'",
",",
"None",
")",
"if",
"rv",
"is",
"None",
":",
"if",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | BaseResponse.get_wsgi_headers | This is automatically called right before the response is started
and returns headers modified for the given environment. It returns a
copy of the headers from the response with some modifications applied
if necessary.
For example the location header (if present) is joined with the roo... | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wrappers.py | def get_wsgi_headers(self, environ):
"""This is automatically called right before the response is started
and returns headers modified for the given environment. It returns a
copy of the headers from the response with some modifications applied
if necessary.
For example the loc... | def get_wsgi_headers(self, environ):
"""This is automatically called right before the response is started
and returns headers modified for the given environment. It returns a
copy of the headers from the response with some modifications applied
if necessary.
For example the loc... | [
"This",
"is",
"automatically",
"called",
"right",
"before",
"the",
"response",
"is",
"started",
"and",
"returns",
"headers",
"modified",
"for",
"the",
"given",
"environment",
".",
"It",
"returns",
"a",
"copy",
"of",
"the",
"headers",
"from",
"the",
"response",... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wrappers.py#L1078-L1167 | [
"def",
"get_wsgi_headers",
"(",
"self",
",",
"environ",
")",
":",
"headers",
"=",
"Headers",
"(",
"self",
".",
"headers",
")",
"location",
"=",
"None",
"content_location",
"=",
"None",
"content_length",
"=",
"None",
"status",
"=",
"self",
".",
"status_code",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | url_fix | r"""Sometimes you get an URL by a user that just isn't a real URL because
it contains unsafe characters like ' ' and so on. This function can fix
some of the problems in a similar way browsers handle data entered by the
user:
>>> url_fix(u'http://de.wikipedia.org/wiki/Elf (Begriffskl\xe4rung)')
'ht... | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/urls.py | def url_fix(s, charset='utf-8'):
r"""Sometimes you get an URL by a user that just isn't a real URL because
it contains unsafe characters like ' ' and so on. This function can fix
some of the problems in a similar way browsers handle data entered by the
user:
>>> url_fix(u'http://de.wikipedia.org/wi... | def url_fix(s, charset='utf-8'):
r"""Sometimes you get an URL by a user that just isn't a real URL because
it contains unsafe characters like ' ' and so on. This function can fix
some of the problems in a similar way browsers handle data entered by the
user:
>>> url_fix(u'http://de.wikipedia.org/wi... | [
"r",
"Sometimes",
"you",
"get",
"an",
"URL",
"by",
"a",
"user",
"that",
"just",
"isn",
"t",
"a",
"real",
"URL",
"because",
"it",
"contains",
"unsafe",
"characters",
"like",
"and",
"so",
"on",
".",
"This",
"function",
"can",
"fix",
"some",
"of",
"the",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/urls.py#L548-L576 | [
"def",
"url_fix",
"(",
"s",
",",
"charset",
"=",
"'utf-8'",
")",
":",
"# First step is to switch to unicode processing and to convert",
"# backslashes (which are invalid in URLs anyways) to slashes. This is",
"# consistent with what Chrome does.",
"s",
"=",
"to_unicode",
"(",
"s",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | iri_to_uri | r"""
Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always
uses utf-8 URLs internally because this is what browsers and HTTP do as
well. In some places where it accepts an URL it also accepts a unicode IRI
and converts it into a URI.
Examples for IRI versus URI:
>>> iri_to... | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/urls.py | def iri_to_uri(iri, charset='utf-8', errors='strict', safe_conversion=False):
r"""
Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always
uses utf-8 URLs internally because this is what browsers and HTTP do as
well. In some places where it accepts an URL it also accepts a unicode IRI... | def iri_to_uri(iri, charset='utf-8', errors='strict', safe_conversion=False):
r"""
Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always
uses utf-8 URLs internally because this is what browsers and HTTP do as
well. In some places where it accepts an URL it also accepts a unicode IRI... | [
"r",
"Converts",
"any",
"unicode",
"based",
"IRI",
"to",
"an",
"acceptable",
"ASCII",
"URI",
".",
"Werkzeug",
"always",
"uses",
"utf",
"-",
"8",
"URLs",
"internally",
"because",
"this",
"is",
"what",
"browsers",
"and",
"HTTP",
"do",
"as",
"well",
".",
"I... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/urls.py#L611-L673 | [
"def",
"iri_to_uri",
"(",
"iri",
",",
"charset",
"=",
"'utf-8'",
",",
"errors",
"=",
"'strict'",
",",
"safe_conversion",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"iri",
",",
"tuple",
")",
":",
"iri",
"=",
"url_unparse",
"(",
"iri",
")",
"if",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | user_cache_dir | r"""
Return full path to the user-specific cache dir for this application.
"appname" is the name of application.
Typical user cache directories are:
Mac OS X: ~/Library/Caches/<AppName>
Unix: ~/.cache/<AppName> (XDG default)
Windows: C:\Users\<username>\AppData\Loc... | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py | def user_cache_dir(appname):
r"""
Return full path to the user-specific cache dir for this application.
"appname" is the name of application.
Typical user cache directories are:
Mac OS X: ~/Library/Caches/<AppName>
Unix: ~/.cache/<AppName> (XDG default)
Windows: ... | def user_cache_dir(appname):
r"""
Return full path to the user-specific cache dir for this application.
"appname" is the name of application.
Typical user cache directories are:
Mac OS X: ~/Library/Caches/<AppName>
Unix: ~/.cache/<AppName> (XDG default)
Windows: ... | [
"r",
"Return",
"full",
"path",
"to",
"the",
"user",
"-",
"specific",
"cache",
"dir",
"for",
"this",
"application",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py#L13-L53 | [
"def",
"user_cache_dir",
"(",
"appname",
")",
":",
"if",
"WINDOWS",
":",
"# Get the base path",
"path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"_get_win_folder",
"(",
"\"CSIDL_LOCAL_APPDATA\"",
")",
")",
"# Add our app name and Cache directory to it",
"path",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | user_data_dir | Return full path to the user-specific data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default False) can be set True to use the Windows
roaming appdata directory. That means that for users o... | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py | def user_data_dir(appname, roaming=False):
"""
Return full path to the user-specific data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default False) can be set True to use the Windows
... | def user_data_dir(appname, roaming=False):
"""
Return full path to the user-specific data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default False) can be set True to use the Windows
... | [
"Return",
"full",
"path",
"to",
"the",
"user",
"-",
"specific",
"data",
"dir",
"for",
"this",
"application",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py#L56-L97 | [
"def",
"user_data_dir",
"(",
"appname",
",",
"roaming",
"=",
"False",
")",
":",
"if",
"WINDOWS",
":",
"const",
"=",
"roaming",
"and",
"\"CSIDL_APPDATA\"",
"or",
"\"CSIDL_LOCAL_APPDATA\"",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | user_log_dir | Return full path to the user-specific log dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
Typical user cache directories are:
Mac OS X: ~/Library/Logs/<AppName>
Unix: ~/.cache/<AppName>/log # or under $XDG... | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py | def user_log_dir(appname):
"""
Return full path to the user-specific log dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
Typical user cache directories are:
Mac OS X: ~/Library/Logs/<AppName>
Unix: ... | def user_log_dir(appname):
"""
Return full path to the user-specific log dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
Typical user cache directories are:
Mac OS X: ~/Library/Logs/<AppName>
Unix: ... | [
"Return",
"full",
"path",
"to",
"the",
"user",
"-",
"specific",
"log",
"dir",
"for",
"this",
"application",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py#L100-L129 | [
"def",
"user_log_dir",
"(",
"appname",
")",
":",
"if",
"WINDOWS",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"user_data_dir",
"(",
"appname",
")",
",",
"\"Logs\"",
")",
"elif",
"sys",
".",
"platform",
"==",
"\"darwin\"",
":",
"path",
"=",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | user_config_dir | Return full path to the user-specific config dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default True) can be set False to not use the
Windows roaming appdata directory. That means that for u... | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py | def user_config_dir(appname, roaming=True):
"""Return full path to the user-specific config dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default True) can be set False to not use the
Windo... | def user_config_dir(appname, roaming=True):
"""Return full path to the user-specific config dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default True) can be set False to not use the
Windo... | [
"Return",
"full",
"path",
"to",
"the",
"user",
"-",
"specific",
"config",
"dir",
"for",
"this",
"application",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py#L132-L160 | [
"def",
"user_config_dir",
"(",
"appname",
",",
"roaming",
"=",
"True",
")",
":",
"if",
"WINDOWS",
":",
"path",
"=",
"user_data_dir",
"(",
"appname",
",",
"roaming",
"=",
"roaming",
")",
"elif",
"sys",
".",
"platform",
"==",
"\"darwin\"",
":",
"path",
"="... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | site_config_dirs | Return a list of potential user-shared config dirs for this application.
"appname" is the name of application.
Typical user config directories are:
Mac OS X: /Library/Application Support/<AppName>/
Unix: /etc or $XDG_CONFIG_DIRS[i]/<AppName>/ for each value in
$... | capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py | def site_config_dirs(appname):
"""Return a list of potential user-shared config dirs for this application.
"appname" is the name of application.
Typical user config directories are:
Mac OS X: /Library/Application Support/<AppName>/
Unix: /etc or $XDG_CONFIG_DIRS[i]/<AppName>/ f... | def site_config_dirs(appname):
"""Return a list of potential user-shared config dirs for this application.
"appname" is the name of application.
Typical user config directories are:
Mac OS X: /Library/Application Support/<AppName>/
Unix: /etc or $XDG_CONFIG_DIRS[i]/<AppName>/ f... | [
"Return",
"a",
"list",
"of",
"potential",
"user",
"-",
"shared",
"config",
"dirs",
"for",
"this",
"application",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/appdirs.py#L165-L200 | [
"def",
"site_config_dirs",
"(",
"appname",
")",
":",
"if",
"WINDOWS",
":",
"path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"_get_win_folder",
"(",
"\"CSIDL_COMMON_APPDATA\"",
")",
")",
"pathlist",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"pat... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _iter_module_files | This iterates over all relevant Python files. It goes through all
loaded files from modules, all files in folders of already loaded modules
as well as all files reachable through a package. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/_reloader.py | def _iter_module_files():
"""This iterates over all relevant Python files. It goes through all
loaded files from modules, all files in folders of already loaded modules
as well as all files reachable through a package.
"""
# The list call is necessary on Python 3 in case the module
# dictionary... | def _iter_module_files():
"""This iterates over all relevant Python files. It goes through all
loaded files from modules, all files in folders of already loaded modules
as well as all files reachable through a package.
"""
# The list call is necessary on Python 3 in case the module
# dictionary... | [
"This",
"iterates",
"over",
"all",
"relevant",
"Python",
"files",
".",
"It",
"goes",
"through",
"all",
"loaded",
"files",
"from",
"modules",
"all",
"files",
"in",
"folders",
"of",
"already",
"loaded",
"modules",
"as",
"well",
"as",
"all",
"files",
"reachable... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/_reloader.py#L12-L33 | [
"def",
"_iter_module_files",
"(",
")",
":",
"# The list call is necessary on Python 3 in case the module",
"# dictionary modifies during iteration.",
"for",
"module",
"in",
"list",
"(",
"sys",
".",
"modules",
".",
"values",
"(",
")",
")",
":",
"if",
"module",
"is",
"N... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | ReloaderLoop.restart_with_reloader | Spawn a new Python interpreter with the same arguments as this one,
but running the reloader thread. | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/_reloader.py | def restart_with_reloader(self):
"""Spawn a new Python interpreter with the same arguments as this one,
but running the reloader thread.
"""
while 1:
_log('info', ' * Restarting with %s' % self.name)
args = [sys.executable] + sys.argv
new_environ = os.... | def restart_with_reloader(self):
"""Spawn a new Python interpreter with the same arguments as this one,
but running the reloader thread.
"""
while 1:
_log('info', ' * Restarting with %s' % self.name)
args = [sys.executable] + sys.argv
new_environ = os.... | [
"Spawn",
"a",
"new",
"Python",
"interpreter",
"with",
"the",
"same",
"arguments",
"as",
"this",
"one",
"but",
"running",
"the",
"reloader",
"thread",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/_reloader.py#L86-L106 | [
"def",
"restart_with_reloader",
"(",
"self",
")",
":",
"while",
"1",
":",
"_log",
"(",
"'info'",
",",
"' * Restarting with %s'",
"%",
"self",
".",
"name",
")",
"args",
"=",
"[",
"sys",
".",
"executable",
"]",
"+",
"sys",
".",
"argv",
"new_environ",
"=",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | to_text | Wrapper around six.text_type to convert None to empty string | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/_base.py | def to_text(s, blank_if_none=True):
"""Wrapper around six.text_type to convert None to empty string"""
if s is None:
if blank_if_none:
return ""
else:
return None
elif isinstance(s, text_type):
return s
else:
return text_type(s) | def to_text(s, blank_if_none=True):
"""Wrapper around six.text_type to convert None to empty string"""
if s is None:
if blank_if_none:
return ""
else:
return None
elif isinstance(s, text_type):
return s
else:
return text_type(s) | [
"Wrapper",
"around",
"six",
".",
"text_type",
"to",
"convert",
"None",
"to",
"empty",
"string"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/_base.py#L21-L31 | [
"def",
"to_text",
"(",
"s",
",",
"blank_if_none",
"=",
"True",
")",
":",
"if",
"s",
"is",
"None",
":",
"if",
"blank_if_none",
":",
"return",
"\"\"",
"else",
":",
"return",
"None",
"elif",
"isinstance",
"(",
"s",
",",
"text_type",
")",
":",
"return",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | find_ca_bundle | Return an existing CA bundle path, or None | capybara/virtualenv/lib/python2.7/site-packages/setuptools/ssl_support.py | def find_ca_bundle():
"""Return an existing CA bundle path, or None"""
if os.name=='nt':
return get_win_certfile()
else:
for cert_path in cert_paths:
if os.path.isfile(cert_path):
return cert_path
try:
return pkg_resources.resource_filename('certifi', ... | def find_ca_bundle():
"""Return an existing CA bundle path, or None"""
if os.name=='nt':
return get_win_certfile()
else:
for cert_path in cert_paths:
if os.path.isfile(cert_path):
return cert_path
try:
return pkg_resources.resource_filename('certifi', ... | [
"Return",
"an",
"existing",
"CA",
"bundle",
"path",
"or",
"None"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/ssl_support.py#L230-L241 | [
"def",
"find_ca_bundle",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"return",
"get_win_certfile",
"(",
")",
"else",
":",
"for",
"cert_path",
"in",
"cert_paths",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"cert_path",
")",
":",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse | Parse a string or file-like object into a tree | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py | def parse(doc, treebuilder="etree", encoding=None,
namespaceHTMLElements=True):
"""Parse a string or file-like object into a tree"""
tb = treebuilders.getTreeBuilder(treebuilder)
p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements)
return p.parse(doc, encoding=encoding) | def parse(doc, treebuilder="etree", encoding=None,
namespaceHTMLElements=True):
"""Parse a string or file-like object into a tree"""
tb = treebuilders.getTreeBuilder(treebuilder)
p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements)
return p.parse(doc, encoding=encoding) | [
"Parse",
"a",
"string",
"or",
"file",
"-",
"like",
"object",
"into",
"a",
"tree"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py#L24-L29 | [
"def",
"parse",
"(",
"doc",
",",
"treebuilder",
"=",
"\"etree\"",
",",
"encoding",
"=",
"None",
",",
"namespaceHTMLElements",
"=",
"True",
")",
":",
"tb",
"=",
"treebuilders",
".",
"getTreeBuilder",
"(",
"treebuilder",
")",
"p",
"=",
"HTMLParser",
"(",
"tb... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HTMLParser.parse | Parse a HTML document into a well-formed tree
stream - a filelike object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will be used,
regardless of any BOM or later declaration (such ... | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py | def parse(self, stream, encoding=None, parseMeta=True, useChardet=True):
"""Parse a HTML document into a well-formed tree
stream - a filelike object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, t... | def parse(self, stream, encoding=None, parseMeta=True, useChardet=True):
"""Parse a HTML document into a well-formed tree
stream - a filelike object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, t... | [
"Parse",
"a",
"HTML",
"document",
"into",
"a",
"well",
"-",
"formed",
"tree"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py#L225-L237 | [
"def",
"parse",
"(",
"self",
",",
"stream",
",",
"encoding",
"=",
"None",
",",
"parseMeta",
"=",
"True",
",",
"useChardet",
"=",
"True",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"innerHTML",
"=",
"False",
",",
"encoding",
"=",
"encoding",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HTMLParser.parseFragment | Parse a HTML fragment into a well-formed tree fragment
container - name of the element we're setting the innerHTML property
if set to None, default to 'div'
stream - a filelike object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indi... | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py | def parseFragment(self, stream, container="div", encoding=None,
parseMeta=False, useChardet=True):
"""Parse a HTML fragment into a well-formed tree fragment
container - name of the element we're setting the innerHTML property
if set to None, default to 'div'
strea... | def parseFragment(self, stream, container="div", encoding=None,
parseMeta=False, useChardet=True):
"""Parse a HTML fragment into a well-formed tree fragment
container - name of the element we're setting the innerHTML property
if set to None, default to 'div'
strea... | [
"Parse",
"a",
"HTML",
"fragment",
"into",
"a",
"well",
"-",
"formed",
"tree",
"fragment"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py#L239-L254 | [
"def",
"parseFragment",
"(",
"self",
",",
"stream",
",",
"container",
"=",
"\"div\"",
",",
"encoding",
"=",
"None",
",",
"parseMeta",
"=",
"False",
",",
"useChardet",
"=",
"True",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"True",
",",
"conta... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HTMLParser.parseRCDataRawtext | Generic RCDATA/RAWTEXT Parsing algorithm
contentType - RCDATA or RAWTEXT | capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py | def parseRCDataRawtext(self, token, contentType):
"""Generic RCDATA/RAWTEXT Parsing algorithm
contentType - RCDATA or RAWTEXT
"""
assert contentType in ("RAWTEXT", "RCDATA")
self.tree.insertElement(token)
if contentType == "RAWTEXT":
self.tokenizer.state = s... | def parseRCDataRawtext(self, token, contentType):
"""Generic RCDATA/RAWTEXT Parsing algorithm
contentType - RCDATA or RAWTEXT
"""
assert contentType in ("RAWTEXT", "RCDATA")
self.tree.insertElement(token)
if contentType == "RAWTEXT":
self.tokenizer.state = s... | [
"Generic",
"RCDATA",
"/",
"RAWTEXT",
"Parsing",
"algorithm",
"contentType",
"-",
"RCDATA",
"or",
"RAWTEXT"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/html5lib/html5parser.py#L404-L419 | [
"def",
"parseRCDataRawtext",
"(",
"self",
",",
"token",
",",
"contentType",
")",
":",
"assert",
"contentType",
"in",
"(",
"\"RAWTEXT\"",
",",
"\"RCDATA\"",
")",
"self",
".",
"tree",
".",
"insertElement",
"(",
"token",
")",
"if",
"contentType",
"==",
"\"RAWTE... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Translator.translate | pass in a word string that you
would like to see probable matches for. | pymtranslate/translator.py | def translate(self, word):
"""
pass in a word string that you
would like to see probable matches for.
"""
if (word not in self.transmissions):
raise NoMatchError('no matches found')
else:
trans = self.transmissions[word]
# print out a s... | def translate(self, word):
"""
pass in a word string that you
would like to see probable matches for.
"""
if (word not in self.transmissions):
raise NoMatchError('no matches found')
else:
trans = self.transmissions[word]
# print out a s... | [
"pass",
"in",
"a",
"word",
"string",
"that",
"you",
"would",
"like",
"to",
"see",
"probable",
"matches",
"for",
"."
] | accraze/pymtranslate | python | https://github.com/accraze/pymtranslate/blob/b18f9d7e8ef1583c988e8beb6c3304d362a4d979/pymtranslate/translator.py#L31-L42 | [
"def",
"translate",
"(",
"self",
",",
"word",
")",
":",
"if",
"(",
"word",
"not",
"in",
"self",
".",
"transmissions",
")",
":",
"raise",
"NoMatchError",
"(",
"'no matches found'",
")",
"else",
":",
"trans",
"=",
"self",
".",
"transmissions",
"[",
"word",... | b18f9d7e8ef1583c988e8beb6c3304d362a4d979 |
test | Translator.convertArgsToTokens | this converts the readin lines from
sys to useable format, returns list
of token and dict of tokens | pymtranslate/translator.py | def convertArgsToTokens(self, data):
"""
this converts the readin lines from
sys to useable format, returns list
of token and dict of tokens
"""
tdict = []
tokens = []
d = open(data, 'r')
for line in d.readlines():
tdict.append(line.r... | def convertArgsToTokens(self, data):
"""
this converts the readin lines from
sys to useable format, returns list
of token and dict of tokens
"""
tdict = []
tokens = []
d = open(data, 'r')
for line in d.readlines():
tdict.append(line.r... | [
"this",
"converts",
"the",
"readin",
"lines",
"from",
"sys",
"to",
"useable",
"format",
"returns",
"list",
"of",
"token",
"and",
"dict",
"of",
"tokens"
] | accraze/pymtranslate | python | https://github.com/accraze/pymtranslate/blob/b18f9d7e8ef1583c988e8beb6c3304d362a4d979/pymtranslate/translator.py#L44-L62 | [
"def",
"convertArgsToTokens",
"(",
"self",
",",
"data",
")",
":",
"tdict",
"=",
"[",
"]",
"tokens",
"=",
"[",
"]",
"d",
"=",
"open",
"(",
"data",
",",
"'r'",
")",
"for",
"line",
"in",
"d",
".",
"readlines",
"(",
")",
":",
"tdict",
".",
"append",
... | b18f9d7e8ef1583c988e8beb6c3304d362a4d979 |
test | Translator.initTef | get all probable matches
and then initialize t(f|e) | pymtranslate/translator.py | def initTef(self):
'''
get all probable matches
and then initialize t(f|e)
'''
probs = {}
transmissions = {}
# go through each german word
for word in self.en_words:
word_poss = []
# if word in sentence.. then
for sent... | def initTef(self):
'''
get all probable matches
and then initialize t(f|e)
'''
probs = {}
transmissions = {}
# go through each german word
for word in self.en_words:
word_poss = []
# if word in sentence.. then
for sent... | [
"get",
"all",
"probable",
"matches",
"and",
"then",
"initialize",
"t",
"(",
"f|e",
")"
] | accraze/pymtranslate | python | https://github.com/accraze/pymtranslate/blob/b18f9d7e8ef1583c988e8beb6c3304d362a4d979/pymtranslate/translator.py#L64-L101 | [
"def",
"initTef",
"(",
"self",
")",
":",
"probs",
"=",
"{",
"}",
"transmissions",
"=",
"{",
"}",
"# go through each german word",
"for",
"word",
"in",
"self",
".",
"en_words",
":",
"word_poss",
"=",
"[",
"]",
"# if word in sentence.. then",
"for",
"sent",
"i... | b18f9d7e8ef1583c988e8beb6c3304d362a4d979 |
test | Translator.iterateEM | Iterate through all transmissions of english to
foreign words. keep count of repeated occurences
do until convergence
set count(e|f) to 0 for all e,f
set total(f) to 0 for all f
for all sentence pairs (e_s,f_s)
set total_s(e) = 0 for all e
for ... | pymtranslate/translator.py | def iterateEM(self, count):
'''
Iterate through all transmissions of english to
foreign words. keep count of repeated occurences
do until convergence
set count(e|f) to 0 for all e,f
set total(f) to 0 for all f
for all sentence pairs (e_s,f_s)
... | def iterateEM(self, count):
'''
Iterate through all transmissions of english to
foreign words. keep count of repeated occurences
do until convergence
set count(e|f) to 0 for all e,f
set total(f) to 0 for all f
for all sentence pairs (e_s,f_s)
... | [
"Iterate",
"through",
"all",
"transmissions",
"of",
"english",
"to",
"foreign",
"words",
".",
"keep",
"count",
"of",
"repeated",
"occurences",
"do",
"until",
"convergence",
"set",
"count",
"(",
"e|f",
")",
"to",
"0",
"for",
"all",
"e",
"f",
"set",
"total",... | accraze/pymtranslate | python | https://github.com/accraze/pymtranslate/blob/b18f9d7e8ef1583c988e8beb6c3304d362a4d979/pymtranslate/translator.py#L103-L179 | [
"def",
"iterateEM",
"(",
"self",
",",
"count",
")",
":",
"for",
"iter",
"in",
"range",
"(",
"count",
")",
":",
"countef",
"=",
"{",
"}",
"totalf",
"=",
"{",
"}",
"# set the count of the words to zero",
"for",
"word",
"in",
"self",
".",
"en_words",
":",
... | b18f9d7e8ef1583c988e8beb6c3304d362a4d979 |
test | HTTPServiceProvider.bind | Bind and activate HTTP server. | service_factory/providers/basehttp.py | def bind(self):
"""Bind and activate HTTP server."""
HTTPServer.__init__(self, (self.host, self.port), HTTPRequestHandler)
self.port = self.server_port | def bind(self):
"""Bind and activate HTTP server."""
HTTPServer.__init__(self, (self.host, self.port), HTTPRequestHandler)
self.port = self.server_port | [
"Bind",
"and",
"activate",
"HTTP",
"server",
"."
] | proofit404/service-factory | python | https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/providers/basehttp.py#L68-L72 | [
"def",
"bind",
"(",
"self",
")",
":",
"HTTPServer",
".",
"__init__",
"(",
"self",
",",
"(",
"self",
".",
"host",
",",
"self",
".",
"port",
")",
",",
"HTTPRequestHandler",
")",
"self",
".",
"port",
"=",
"self",
".",
"server_port"
] | a09d4e097e5599244564a2a7f0611e58efb4156a |
test | HTTPServiceProvider.report | Report startup info to stdout. | service_factory/providers/basehttp.py | def report(self):
"""Report startup info to stdout."""
print(
self.report_message.format(
service=self.service,
host=self.host,
port=self.port,
)
)
sys.stdout.flush() | def report(self):
"""Report startup info to stdout."""
print(
self.report_message.format(
service=self.service,
host=self.host,
port=self.port,
)
)
sys.stdout.flush() | [
"Report",
"startup",
"info",
"to",
"stdout",
"."
] | proofit404/service-factory | python | https://github.com/proofit404/service-factory/blob/a09d4e097e5599244564a2a7f0611e58efb4156a/service_factory/providers/basehttp.py#L74-L84 | [
"def",
"report",
"(",
"self",
")",
":",
"print",
"(",
"self",
".",
"report_message",
".",
"format",
"(",
"service",
"=",
"self",
".",
"service",
",",
"host",
"=",
"self",
".",
"host",
",",
"port",
"=",
"self",
".",
"port",
",",
")",
")",
"sys",
"... | a09d4e097e5599244564a2a7f0611e58efb4156a |
test | make_ssl_devcert | Creates an SSL key for development. This should be used instead of
the ``'adhoc'`` key which generates a new cert on each server start.
It accepts a path for where it should store the key and cert and
either a host or CN. If a host is given it will use the CN
``*.host/CN=host``.
For more informat... | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/serving.py | def make_ssl_devcert(base_path, host=None, cn=None):
"""Creates an SSL key for development. This should be used instead of
the ``'adhoc'`` key which generates a new cert on each server start.
It accepts a path for where it should store the key and cert and
either a host or CN. If a host is given it wi... | def make_ssl_devcert(base_path, host=None, cn=None):
"""Creates an SSL key for development. This should be used instead of
the ``'adhoc'`` key which generates a new cert on each server start.
It accepts a path for where it should store the key and cert and
either a host or CN. If a host is given it wi... | [
"Creates",
"an",
"SSL",
"key",
"for",
"development",
".",
"This",
"should",
"be",
"used",
"instead",
"of",
"the",
"adhoc",
"key",
"which",
"generates",
"a",
"new",
"cert",
"on",
"each",
"server",
"start",
".",
"It",
"accepts",
"a",
"path",
"for",
"where"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/serving.py#L303-L334 | [
"def",
"make_ssl_devcert",
"(",
"base_path",
",",
"host",
"=",
"None",
",",
"cn",
"=",
"None",
")",
":",
"from",
"OpenSSL",
"import",
"crypto",
"if",
"host",
"is",
"not",
"None",
":",
"cn",
"=",
"'*.%s/CN=%s'",
"%",
"(",
"host",
",",
"host",
")",
"ce... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Bucket.load_bytecode | Loads bytecode from a file or file like object. | capybara/virtualenv/lib/python2.7/site-packages/jinja2/bccache.py | def load_bytecode(self, f):
"""Loads bytecode from a file or file like object."""
# make sure the magic header is correct
magic = f.read(len(bc_magic))
if magic != bc_magic:
self.reset()
return
# the source code of the file changed, we need to reload
... | def load_bytecode(self, f):
"""Loads bytecode from a file or file like object."""
# make sure the magic header is correct
magic = f.read(len(bc_magic))
if magic != bc_magic:
self.reset()
return
# the source code of the file changed, we need to reload
... | [
"Loads",
"bytecode",
"from",
"a",
"file",
"or",
"file",
"like",
"object",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/bccache.py#L79-L91 | [
"def",
"load_bytecode",
"(",
"self",
",",
"f",
")",
":",
"# make sure the magic header is correct",
"magic",
"=",
"f",
".",
"read",
"(",
"len",
"(",
"bc_magic",
")",
")",
"if",
"magic",
"!=",
"bc_magic",
":",
"self",
".",
"reset",
"(",
")",
"return",
"# ... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | stylesheet_params | Convert keyword args to a dictionary of stylesheet parameters.
XSL stylesheet parameters must be XPath expressions, i.e.:
* string expressions, like "'5'"
* simple (number) expressions, like "5"
* valid XPath expressions, like "/a/b/text()"
This function converts native Python keyword arguments to... | capybara/virtualenv/lib/python2.7/site-packages/lxml/isoschematron/__init__.py | def stylesheet_params(**kwargs):
"""Convert keyword args to a dictionary of stylesheet parameters.
XSL stylesheet parameters must be XPath expressions, i.e.:
* string expressions, like "'5'"
* simple (number) expressions, like "5"
* valid XPath expressions, like "/a/b/text()"
This function con... | def stylesheet_params(**kwargs):
"""Convert keyword args to a dictionary of stylesheet parameters.
XSL stylesheet parameters must be XPath expressions, i.e.:
* string expressions, like "'5'"
* simple (number) expressions, like "5"
* valid XPath expressions, like "/a/b/text()"
This function con... | [
"Convert",
"keyword",
"args",
"to",
"a",
"dictionary",
"of",
"stylesheet",
"parameters",
".",
"XSL",
"stylesheet",
"parameters",
"must",
"be",
"XPath",
"expressions",
"i",
".",
"e",
".",
":"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/isoschematron/__init__.py#L75-L99 | [
"def",
"stylesheet_params",
"(",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"basestring",
")",
":",
"val",
"=",
"_etree",
".",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _stylesheet_param_dict | Return a copy of paramsDict, updated with kwargsDict entries, wrapped as
stylesheet arguments.
kwargsDict entries with a value of None are ignored. | capybara/virtualenv/lib/python2.7/site-packages/lxml/isoschematron/__init__.py | def _stylesheet_param_dict(paramsDict, kwargsDict):
"""Return a copy of paramsDict, updated with kwargsDict entries, wrapped as
stylesheet arguments.
kwargsDict entries with a value of None are ignored.
"""
# beware of changing mutable default arg
paramsDict = dict(paramsDict)
for k, v in kw... | def _stylesheet_param_dict(paramsDict, kwargsDict):
"""Return a copy of paramsDict, updated with kwargsDict entries, wrapped as
stylesheet arguments.
kwargsDict entries with a value of None are ignored.
"""
# beware of changing mutable default arg
paramsDict = dict(paramsDict)
for k, v in kw... | [
"Return",
"a",
"copy",
"of",
"paramsDict",
"updated",
"with",
"kwargsDict",
"entries",
"wrapped",
"as",
"stylesheet",
"arguments",
".",
"kwargsDict",
"entries",
"with",
"a",
"value",
"of",
"None",
"are",
"ignored",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/isoschematron/__init__.py#L103-L114 | [
"def",
"_stylesheet_param_dict",
"(",
"paramsDict",
",",
"kwargsDict",
")",
":",
"# beware of changing mutable default arg",
"paramsDict",
"=",
"dict",
"(",
"paramsDict",
")",
"for",
"k",
",",
"v",
"in",
"kwargsDict",
".",
"items",
"(",
")",
":",
"if",
"v",
"i... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | Schematron._extract | Extract embedded schematron schema from non-schematron host schema.
This method will only be called by __init__ if the given schema document
is not a schematron schema by itself.
Must return a schematron schema document tree or None. | capybara/virtualenv/lib/python2.7/site-packages/lxml/isoschematron/__init__.py | def _extract(self, element):
"""Extract embedded schematron schema from non-schematron host schema.
This method will only be called by __init__ if the given schema document
is not a schematron schema by itself.
Must return a schematron schema document tree or None.
"""
sc... | def _extract(self, element):
"""Extract embedded schematron schema from non-schematron host schema.
This method will only be called by __init__ if the given schema document
is not a schematron schema by itself.
Must return a schematron schema document tree or None.
"""
sc... | [
"Extract",
"embedded",
"schematron",
"schema",
"from",
"non",
"-",
"schematron",
"host",
"schema",
".",
"This",
"method",
"will",
"only",
"be",
"called",
"by",
"__init__",
"if",
"the",
"given",
"schema",
"document",
"is",
"not",
"a",
"schematron",
"schema",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/isoschematron/__init__.py#L193-L205 | [
"def",
"_extract",
"(",
"self",
",",
"element",
")",
":",
"schematron",
"=",
"None",
"if",
"element",
".",
"tag",
"==",
"_xml_schema_root",
":",
"schematron",
"=",
"self",
".",
"_extract_xsd",
"(",
"element",
")",
"elif",
"element",
".",
"nsmap",
"[",
"e... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | VcsSupport.get_backend_name | Return the name of the version control backend if found at given
location, e.g. vcs.get_backend_name('/path/to/vcs/checkout') | capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py | def get_backend_name(self, location):
"""
Return the name of the version control backend if found at given
location, e.g. vcs.get_backend_name('/path/to/vcs/checkout')
"""
for vc_type in self._registry.values():
logger.debug('Checking in %s for %s (%s)...',
... | def get_backend_name(self, location):
"""
Return the name of the version control backend if found at given
location, e.g. vcs.get_backend_name('/path/to/vcs/checkout')
"""
for vc_type in self._registry.values():
logger.debug('Checking in %s for %s (%s)...',
... | [
"Return",
"the",
"name",
"of",
"the",
"version",
"control",
"backend",
"if",
"found",
"at",
"given",
"location",
"e",
".",
"g",
".",
"vcs",
".",
"get_backend_name",
"(",
"/",
"path",
"/",
"to",
"/",
"vcs",
"/",
"checkout",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py#L69-L82 | [
"def",
"get_backend_name",
"(",
"self",
",",
"location",
")",
":",
"for",
"vc_type",
"in",
"self",
".",
"_registry",
".",
"values",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"'Checking in %s for %s (%s)...'",
",",
"location",
",",
"vc_type",
".",
"dirname"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | VersionControl._is_local_repository | posix absolute paths start with os.path.sep,
win32 ones ones start with drive (like c:\\folder) | capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py | def _is_local_repository(self, repo):
"""
posix absolute paths start with os.path.sep,
win32 ones ones start with drive (like c:\\folder)
"""
drive, tail = os.path.splitdrive(repo)
return repo.startswith(os.path.sep) or drive | def _is_local_repository(self, repo):
"""
posix absolute paths start with os.path.sep,
win32 ones ones start with drive (like c:\\folder)
"""
drive, tail = os.path.splitdrive(repo)
return repo.startswith(os.path.sep) or drive | [
"posix",
"absolute",
"paths",
"start",
"with",
"os",
".",
"path",
".",
"sep",
"win32",
"ones",
"ones",
"start",
"with",
"drive",
"(",
"like",
"c",
":",
"\\\\",
"folder",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py#L109-L115 | [
"def",
"_is_local_repository",
"(",
"self",
",",
"repo",
")",
":",
"drive",
",",
"tail",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"repo",
")",
"return",
"repo",
".",
"startswith",
"(",
"os",
".",
"path",
".",
"sep",
")",
"or",
"drive"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | VersionControl.get_info | Returns (url, revision), where both are strings | capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py | def get_info(self, location):
"""
Returns (url, revision), where both are strings
"""
assert not location.rstrip('/').endswith(self.dirname), \
'Bad directory: %s' % location
return self.get_url(location), self.get_revision(location) | def get_info(self, location):
"""
Returns (url, revision), where both are strings
"""
assert not location.rstrip('/').endswith(self.dirname), \
'Bad directory: %s' % location
return self.get_url(location), self.get_revision(location) | [
"Returns",
"(",
"url",
"revision",
")",
"where",
"both",
"are",
"strings"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py#L149-L155 | [
"def",
"get_info",
"(",
"self",
",",
"location",
")",
":",
"assert",
"not",
"location",
".",
"rstrip",
"(",
"'/'",
")",
".",
"endswith",
"(",
"self",
".",
"dirname",
")",
",",
"'Bad directory: %s'",
"%",
"location",
"return",
"self",
".",
"get_url",
"(",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | VersionControl.unpack | Clean up current location and download the url repository
(and vcs infos) into location | capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py | def unpack(self, location):
"""
Clean up current location and download the url repository
(and vcs infos) into location
"""
if os.path.exists(location):
rmtree(location)
self.obtain(location) | def unpack(self, location):
"""
Clean up current location and download the url repository
(and vcs infos) into location
"""
if os.path.exists(location):
rmtree(location)
self.obtain(location) | [
"Clean",
"up",
"current",
"location",
"and",
"download",
"the",
"url",
"repository",
"(",
"and",
"vcs",
"infos",
")",
"into",
"location"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py#L268-L275 | [
"def",
"unpack",
"(",
"self",
",",
"location",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"location",
")",
":",
"rmtree",
"(",
"location",
")",
"self",
".",
"obtain",
"(",
"location",
")"
] | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | VersionControl.run_command | Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the VCS
command name, and checks that the VCS is available | capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py | def run_command(self, cmd, show_stdout=True, cwd=None,
raise_on_returncode=True,
command_level=logging.DEBUG, command_desc=None,
extra_environ=None):
"""
Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the... | def run_command(self, cmd, show_stdout=True, cwd=None,
raise_on_returncode=True,
command_level=logging.DEBUG, command_desc=None,
extra_environ=None):
"""
Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the... | [
"Run",
"a",
"VCS",
"subcommand",
"This",
"is",
"simply",
"a",
"wrapper",
"around",
"call_subprocess",
"that",
"adds",
"the",
"VCS",
"command",
"name",
"and",
"checks",
"that",
"the",
"VCS",
"is",
"available"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/__init__.py#L301-L321 | [
"def",
"run_command",
"(",
"self",
",",
"cmd",
",",
"show_stdout",
"=",
"True",
",",
"cwd",
"=",
"None",
",",
"raise_on_returncode",
"=",
"True",
",",
"command_level",
"=",
"logging",
".",
"DEBUG",
",",
"command_desc",
"=",
"None",
",",
"extra_environ",
"=... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | get_impl_ver | Return implementation version. | capybara/virtualenv/lib/python2.7/site-packages/wheel/pep425tags.py | def get_impl_ver():
"""Return implementation version."""
impl_ver = sysconfig.get_config_var("py_version_nodot")
if not impl_ver:
impl_ver = ''.join(map(str, sys.version_info[:2]))
return impl_ver | def get_impl_ver():
"""Return implementation version."""
impl_ver = sysconfig.get_config_var("py_version_nodot")
if not impl_ver:
impl_ver = ''.join(map(str, sys.version_info[:2]))
return impl_ver | [
"Return",
"implementation",
"version",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/pep425tags.py#L26-L31 | [
"def",
"get_impl_ver",
"(",
")",
":",
"impl_ver",
"=",
"sysconfig",
".",
"get_config_var",
"(",
"\"py_version_nodot\"",
")",
"if",
"not",
"impl_ver",
":",
"impl_ver",
"=",
"''",
".",
"join",
"(",
"map",
"(",
"str",
",",
"sys",
".",
"version_info",
"[",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | get_supported | Return a list of supported tags for each version specified in
`versions`.
:param versions: a list of string versions, of the form ["33", "32"],
or None. The first version will be assumed to support our ABI. | capybara/virtualenv/lib/python2.7/site-packages/wheel/pep425tags.py | def get_supported(versions=None):
"""Return a list of supported tags for each version specified in
`versions`.
:param versions: a list of string versions, of the form ["33", "32"],
or None. The first version will be assumed to support our ABI.
"""
supported = []
# Versions must be... | def get_supported(versions=None):
"""Return a list of supported tags for each version specified in
`versions`.
:param versions: a list of string versions, of the form ["33", "32"],
or None. The first version will be assumed to support our ABI.
"""
supported = []
# Versions must be... | [
"Return",
"a",
"list",
"of",
"supported",
"tags",
"for",
"each",
"version",
"specified",
"in",
"versions",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/wheel/pep425tags.py#L40-L95 | [
"def",
"get_supported",
"(",
"versions",
"=",
"None",
")",
":",
"supported",
"=",
"[",
"]",
"# Versions must be given with respect to the preference",
"if",
"versions",
"is",
"None",
":",
"versions",
"=",
"[",
"]",
"major",
"=",
"sys",
".",
"version_info",
"[",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | get_host | Return the real host for the given WSGI environment. This first checks
the `X-Forwarded-Host` header, then the normal `Host` header, and finally
the `SERVER_NAME` environment variable (using the first one it finds).
Optionally it verifies that the host is in a list of trusted hosts.
If the host is not... | capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wsgi.py | def get_host(environ, trusted_hosts=None):
"""Return the real host for the given WSGI environment. This first checks
the `X-Forwarded-Host` header, then the normal `Host` header, and finally
the `SERVER_NAME` environment variable (using the first one it finds).
Optionally it verifies that the host is ... | def get_host(environ, trusted_hosts=None):
"""Return the real host for the given WSGI environment. This first checks
the `X-Forwarded-Host` header, then the normal `Host` header, and finally
the `SERVER_NAME` environment variable (using the first one it finds).
Optionally it verifies that the host is ... | [
"Return",
"the",
"real",
"host",
"for",
"the",
"given",
"WSGI",
"environment",
".",
"This",
"first",
"checks",
"the",
"X",
"-",
"Forwarded",
"-",
"Host",
"header",
"then",
"the",
"normal",
"Host",
"header",
"and",
"finally",
"the",
"SERVER_NAME",
"environmen... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/werkzeug/wsgi.py#L131-L157 | [
"def",
"get_host",
"(",
"environ",
",",
"trusted_hosts",
"=",
"None",
")",
":",
"if",
"'HTTP_X_FORWARDED_HOST'",
"in",
"environ",
":",
"rv",
"=",
"environ",
"[",
"'HTTP_X_FORWARDED_HOST'",
"]",
".",
"split",
"(",
"','",
",",
"1",
")",
"[",
"0",
"]",
".",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | distros_for_location | Yield egg or source distribution objects based on basename | capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py | def distros_for_location(location, basename, metadata=None):
"""Yield egg or source distribution objects based on basename"""
if basename.endswith('.egg.zip'):
basename = basename[:-4] # strip the .zip
if basename.endswith('.egg') and '-' in basename:
# only one, unambiguous interpretatio... | def distros_for_location(location, basename, metadata=None):
"""Yield egg or source distribution objects based on basename"""
if basename.endswith('.egg.zip'):
basename = basename[:-4] # strip the .zip
if basename.endswith('.egg') and '-' in basename:
# only one, unambiguous interpretatio... | [
"Yield",
"egg",
"or",
"source",
"distribution",
"objects",
"based",
"on",
"basename"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L90-L109 | [
"def",
"distros_for_location",
"(",
"location",
",",
"basename",
",",
"metadata",
"=",
"None",
")",
":",
"if",
"basename",
".",
"endswith",
"(",
"'.egg.zip'",
")",
":",
"basename",
"=",
"basename",
"[",
":",
"-",
"4",
"]",
"# strip the .zip",
"if",
"basena... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | find_external_links | Find rel="homepage" and rel="download" links in `page`, yielding URLs | capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py | def find_external_links(url, page):
"""Find rel="homepage" and rel="download" links in `page`, yielding URLs"""
for match in REL.finditer(page):
tag, rel = match.groups()
rels = set(map(str.strip, rel.lower().split(',')))
if 'homepage' in rels or 'download' in rels:
for matc... | def find_external_links(url, page):
"""Find rel="homepage" and rel="download" links in `page`, yielding URLs"""
for match in REL.finditer(page):
tag, rel = match.groups()
rels = set(map(str.strip, rel.lower().split(',')))
if 'homepage' in rels or 'download' in rels:
for matc... | [
"Find",
"rel",
"=",
"homepage",
"and",
"rel",
"=",
"download",
"links",
"in",
"page",
"yielding",
"URLs"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L184-L199 | [
"def",
"find_external_links",
"(",
"url",
",",
"page",
")",
":",
"for",
"match",
"in",
"REL",
".",
"finditer",
"(",
"page",
")",
":",
"tag",
",",
"rel",
"=",
"match",
".",
"groups",
"(",
")",
"rels",
"=",
"set",
"(",
"map",
"(",
"str",
".",
"stri... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _encode_auth | A function compatible with Python 2.3-3.3 that will encode
auth from a URL suitable for an HTTP header.
>>> str(_encode_auth('username%3Apassword'))
'dXNlcm5hbWU6cGFzc3dvcmQ='
Long auth strings should not cause a newline to be inserted.
>>> long_auth = 'username:' + 'password'*10
>>> chr(10) in... | capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py | def _encode_auth(auth):
"""
A function compatible with Python 2.3-3.3 that will encode
auth from a URL suitable for an HTTP header.
>>> str(_encode_auth('username%3Apassword'))
'dXNlcm5hbWU6cGFzc3dvcmQ='
Long auth strings should not cause a newline to be inserted.
>>> long_auth = 'username:... | def _encode_auth(auth):
"""
A function compatible with Python 2.3-3.3 that will encode
auth from a URL suitable for an HTTP header.
>>> str(_encode_auth('username%3Apassword'))
'dXNlcm5hbWU6cGFzc3dvcmQ='
Long auth strings should not cause a newline to be inserted.
>>> long_auth = 'username:... | [
"A",
"function",
"compatible",
"with",
"Python",
"2",
".",
"3",
"-",
"3",
".",
"3",
"that",
"will",
"encode",
"auth",
"from",
"a",
"URL",
"suitable",
"for",
"an",
"HTTP",
"header",
".",
">>>",
"str",
"(",
"_encode_auth",
"(",
"username%3Apassword",
"))",... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L900-L920 | [
"def",
"_encode_auth",
"(",
"auth",
")",
":",
"auth_s",
"=",
"unquote",
"(",
"auth",
")",
"# convert to bytes",
"auth_bytes",
"=",
"auth_s",
".",
"encode",
"(",
")",
"# use the legacy interface for Python 2.3 support",
"encoded_bytes",
"=",
"base64",
".",
"encodestr... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | local_open | Read a local path, with special support for directories | capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py | def local_open(url):
"""Read a local path, with special support for directories"""
scheme, server, path, param, query, frag = urlparse(url)
filename = url2pathname(path)
if os.path.isfile(filename):
return urllib2.urlopen(url)
elif path.endswith('/') and os.path.isdir(filename):
file... | def local_open(url):
"""Read a local path, with special support for directories"""
scheme, server, path, param, query, frag = urlparse(url)
filename = url2pathname(path)
if os.path.isfile(filename):
return urllib2.urlopen(url)
elif path.endswith('/') and os.path.isdir(filename):
file... | [
"Read",
"a",
"local",
"path",
"with",
"special",
"support",
"for",
"directories"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L1025-L1049 | [
"def",
"local_open",
"(",
"url",
")",
":",
"scheme",
",",
"server",
",",
"path",
",",
"param",
",",
"query",
",",
"frag",
"=",
"urlparse",
"(",
"url",
")",
"filename",
"=",
"url2pathname",
"(",
"path",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HashChecker.from_url | Construct a (possibly null) ContentChecker from a URL | capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py | def from_url(cls, url):
"Construct a (possibly null) ContentChecker from a URL"
fragment = urlparse(url)[-1]
if not fragment:
return ContentChecker()
match = cls.pattern.search(fragment)
if not match:
return ContentChecker()
return cls(**match.grou... | def from_url(cls, url):
"Construct a (possibly null) ContentChecker from a URL"
fragment = urlparse(url)[-1]
if not fragment:
return ContentChecker()
match = cls.pattern.search(fragment)
if not match:
return ContentChecker()
return cls(**match.grou... | [
"Construct",
"a",
"(",
"possibly",
"null",
")",
"ContentChecker",
"from",
"a",
"URL"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L240-L248 | [
"def",
"from_url",
"(",
"cls",
",",
"url",
")",
":",
"fragment",
"=",
"urlparse",
"(",
"url",
")",
"[",
"-",
"1",
"]",
"if",
"not",
"fragment",
":",
"return",
"ContentChecker",
"(",
")",
"match",
"=",
"cls",
".",
"pattern",
".",
"search",
"(",
"fra... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | PackageIndex.process_url | Evaluate a URL as a possible download, and maybe retrieve it | capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py | def process_url(self, url, retrieve=False):
"""Evaluate a URL as a possible download, and maybe retrieve it"""
if url in self.scanned_urls and not retrieve:
return
self.scanned_urls[url] = True
if not URL_SCHEME(url):
self.process_filename(url)
return
... | def process_url(self, url, retrieve=False):
"""Evaluate a URL as a possible download, and maybe retrieve it"""
if url in self.scanned_urls and not retrieve:
return
self.scanned_urls[url] = True
if not URL_SCHEME(url):
self.process_filename(url)
return
... | [
"Evaluate",
"a",
"URL",
"as",
"a",
"possible",
"download",
"and",
"maybe",
"retrieve",
"it"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L279-L325 | [
"def",
"process_url",
"(",
"self",
",",
"url",
",",
"retrieve",
"=",
"False",
")",
":",
"if",
"url",
"in",
"self",
".",
"scanned_urls",
"and",
"not",
"retrieve",
":",
"return",
"self",
".",
"scanned_urls",
"[",
"url",
"]",
"=",
"True",
"if",
"not",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | get_supported | Return a list of supported tags for each version specified in
`versions`.
:param versions: a list of string versions, of the form ["33", "32"],
or None. The first version will be assumed to support our ABI. | capybara/virtualenv/lib/python2.7/site-packages/pip/pep425tags.py | def get_supported(versions=None, noarch=False):
"""Return a list of supported tags for each version specified in
`versions`.
:param versions: a list of string versions, of the form ["33", "32"],
or None. The first version will be assumed to support our ABI.
"""
supported = []
# Version... | def get_supported(versions=None, noarch=False):
"""Return a list of supported tags for each version specified in
`versions`.
:param versions: a list of string versions, of the form ["33", "32"],
or None. The first version will be assumed to support our ABI.
"""
supported = []
# Version... | [
"Return",
"a",
"list",
"of",
"supported",
"tags",
"for",
"each",
"version",
"specified",
"in",
"versions",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/pep425tags.py#L42-L133 | [
"def",
"get_supported",
"(",
"versions",
"=",
"None",
",",
"noarch",
"=",
"False",
")",
":",
"supported",
"=",
"[",
"]",
"# Versions must be given with respect to the preference",
"if",
"versions",
"is",
"None",
":",
"versions",
"=",
"[",
"]",
"major",
"=",
"s... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | removeduppaths | Remove duplicate entries from sys.path along with making them
absolute | capybara/virtualenv/lib/python2.7/site.py | def removeduppaths():
""" Remove duplicate entries from sys.path along with making them
absolute"""
# This ensures that the initial path provided by the interpreter contains
# only absolute pathnames, even if we're running from the build directory.
L = []
known_paths = set()
for dir in sys.p... | def removeduppaths():
""" Remove duplicate entries from sys.path along with making them
absolute"""
# This ensures that the initial path provided by the interpreter contains
# only absolute pathnames, even if we're running from the build directory.
L = []
known_paths = set()
for dir in sys.p... | [
"Remove",
"duplicate",
"entries",
"from",
"sys",
".",
"path",
"along",
"with",
"making",
"them",
"absolute"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site.py#L113-L129 | [
"def",
"removeduppaths",
"(",
")",
":",
"# This ensures that the initial path provided by the interpreter contains",
"# only absolute pathnames, even if we're running from the build directory.",
"L",
"=",
"[",
"]",
"known_paths",
"=",
"set",
"(",
")",
"for",
"dir",
"in",
"sys",... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | addbuilddir | Append ./build/lib.<platform> in case we're running in the build dir
(especially for Guido :-) | capybara/virtualenv/lib/python2.7/site.py | def addbuilddir():
"""Append ./build/lib.<platform> in case we're running in the build dir
(especially for Guido :-)"""
from distutils.util import get_platform
s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
if hasattr(sys, 'gettotalrefcount'):
s += '-pydebug'
s = os.path.join(os... | def addbuilddir():
"""Append ./build/lib.<platform> in case we're running in the build dir
(especially for Guido :-)"""
from distutils.util import get_platform
s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
if hasattr(sys, 'gettotalrefcount'):
s += '-pydebug'
s = os.path.join(os... | [
"Append",
".",
"/",
"build",
"/",
"lib",
".",
"<platform",
">",
"in",
"case",
"we",
"re",
"running",
"in",
"the",
"build",
"dir",
"(",
"especially",
"for",
"Guido",
":",
"-",
")"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site.py#L133-L141 | [
"def",
"addbuilddir",
"(",
")",
":",
"from",
"distutils",
".",
"util",
"import",
"get_platform",
"s",
"=",
"\"build/lib.%s-%.3s\"",
"%",
"(",
"get_platform",
"(",
")",
",",
"sys",
".",
"version",
")",
"if",
"hasattr",
"(",
"sys",
",",
"'gettotalrefcount'",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.