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
stream_with_context
Request contexts disappear when the response is started on the server. This is done for efficiency reasons and to make it less likely to encounter memory leaks with badly written WSGI middlewares. The downside is that if you are using streamed responses, the generator cannot access request bound inform...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def stream_with_context(generator_or_function): """Request contexts disappear when the response is started on the server. This is done for efficiency reasons and to make it less likely to encounter memory leaks with badly written WSGI middlewares. The downside is that if you are using streamed response...
def stream_with_context(generator_or_function): """Request contexts disappear when the response is started on the server. This is done for efficiency reasons and to make it less likely to encounter memory leaks with badly written WSGI middlewares. The downside is that if you are using streamed response...
[ "Request", "contexts", "disappear", "when", "the", "response", "is", "started", "on", "the", "server", ".", "This", "is", "done", "for", "efficiency", "reasons", "and", "to", "make", "it", "less", "likely", "to", "encounter", "memory", "leaks", "with", "badl...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L65-L134
[ "def", "stream_with_context", "(", "generator_or_function", ")", ":", "try", ":", "gen", "=", "iter", "(", "generator_or_function", ")", "except", "TypeError", ":", "def", "decorator", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "gen", "=", "gener...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
make_response
Sometimes it is necessary to set additional headers in a view. Because views do not have to return response objects but can return a value that is converted into a response object by Flask itself, it becomes tricky to add headers to it. This function can be called instead of using a return and you wil...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def make_response(*args): """Sometimes it is necessary to set additional headers in a view. Because views do not have to return response objects but can return a value that is converted into a response object by Flask itself, it becomes tricky to add headers to it. This function can be called instead ...
def make_response(*args): """Sometimes it is necessary to set additional headers in a view. Because views do not have to return response objects but can return a value that is converted into a response object by Flask itself, it becomes tricky to add headers to it. This function can be called instead ...
[ "Sometimes", "it", "is", "necessary", "to", "set", "additional", "headers", "in", "a", "view", ".", "Because", "views", "do", "not", "have", "to", "return", "response", "objects", "but", "can", "return", "a", "value", "that", "is", "converted", "into", "a"...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L137-L183
[ "def", "make_response", "(", "*", "args", ")", ":", "if", "not", "args", ":", "return", "current_app", ".", "response_class", "(", ")", "if", "len", "(", "args", ")", "==", "1", ":", "args", "=", "args", "[", "0", "]", "return", "current_app", ".", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
url_for
Generates a URL to the given endpoint with the method provided. Variable arguments that are unknown to the target endpoint are appended to the generated URL as query arguments. If the value of a query argument is `None`, the whole pair is skipped. In case blueprints are active you can shortcut refere...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def url_for(endpoint, **values): """Generates a URL to the given endpoint with the method provided. Variable arguments that are unknown to the target endpoint are appended to the generated URL as query arguments. If the value of a query argument is `None`, the whole pair is skipped. In case blueprint...
def url_for(endpoint, **values): """Generates a URL to the given endpoint with the method provided. Variable arguments that are unknown to the target endpoint are appended to the generated URL as query arguments. If the value of a query argument is `None`, the whole pair is skipped. In case blueprint...
[ "Generates", "a", "URL", "to", "the", "given", "endpoint", "with", "the", "method", "provided", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L186-L316
[ "def", "url_for", "(", "endpoint", ",", "*", "*", "values", ")", ":", "appctx", "=", "_app_ctx_stack", ".", "top", "reqctx", "=", "_request_ctx_stack", ".", "top", "if", "appctx", "is", "None", ":", "raise", "RuntimeError", "(", "'Attempted to generate a URL w...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
get_template_attribute
Loads a macro (or variable) a template exports. This can be used to invoke a macro from within Python code. If you for example have a template named `_cider.html` with the following contents: .. sourcecode:: html+jinja {% macro hello(name) %}Hello {{ name }}!{% endmacro %} You can access thi...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def get_template_attribute(template_name, attribute): """Loads a macro (or variable) a template exports. This can be used to invoke a macro from within Python code. If you for example have a template named `_cider.html` with the following contents: .. sourcecode:: html+jinja {% macro hello(na...
def get_template_attribute(template_name, attribute): """Loads a macro (or variable) a template exports. This can be used to invoke a macro from within Python code. If you for example have a template named `_cider.html` with the following contents: .. sourcecode:: html+jinja {% macro hello(na...
[ "Loads", "a", "macro", "(", "or", "variable", ")", "a", "template", "exports", ".", "This", "can", "be", "used", "to", "invoke", "a", "macro", "from", "within", "Python", "code", ".", "If", "you", "for", "example", "have", "a", "template", "named", "_c...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L319-L339
[ "def", "get_template_attribute", "(", "template_name", ",", "attribute", ")", ":", "return", "getattr", "(", "current_app", ".", "jinja_env", ".", "get_template", "(", "template_name", ")", ".", "module", ",", "attribute", ")" ]
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
flash
Flashes a message to the next request. In order to remove the flashed message from the session and to display it to the user, the template has to call :func:`get_flashed_messages`. .. versionchanged:: 0.3 `category` parameter added. :param message: the message to be flashed. :param categor...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def flash(message, category='message'): """Flashes a message to the next request. In order to remove the flashed message from the session and to display it to the user, the template has to call :func:`get_flashed_messages`. .. versionchanged:: 0.3 `category` parameter added. :param message...
def flash(message, category='message'): """Flashes a message to the next request. In order to remove the flashed message from the session and to display it to the user, the template has to call :func:`get_flashed_messages`. .. versionchanged:: 0.3 `category` parameter added. :param message...
[ "Flashes", "a", "message", "to", "the", "next", "request", ".", "In", "order", "to", "remove", "the", "flashed", "message", "from", "the", "session", "and", "to", "display", "it", "to", "the", "user", "the", "template", "has", "to", "call", ":", "func", ...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L342-L368
[ "def", "flash", "(", "message", ",", "category", "=", "'message'", ")", ":", "# Original implementation:", "#", "# session.setdefault('_flashes', []).append((category, message))", "#", "# This assumed that changes made to mutable structures in the session are", "# are always in syn...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
get_flashed_messages
Pulls all flashed messages from the session and returns them. Further calls in the same request to the function will return the same messages. By default just the messages are returned, but when `with_categories` is set to `True`, the return value will be a list of tuples in the form ``(category, messa...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def get_flashed_messages(with_categories=False, category_filter=[]): """Pulls all flashed messages from the session and returns them. Further calls in the same request to the function will return the same messages. By default just the messages are returned, but when `with_categories` is set to `True`, ...
def get_flashed_messages(with_categories=False, category_filter=[]): """Pulls all flashed messages from the session and returns them. Further calls in the same request to the function will return the same messages. By default just the messages are returned, but when `with_categories` is set to `True`, ...
[ "Pulls", "all", "flashed", "messages", "from", "the", "session", "and", "returns", "them", ".", "Further", "calls", "in", "the", "same", "request", "to", "the", "function", "will", "return", "the", "same", "messages", ".", "By", "default", "just", "the", "...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L371-L407
[ "def", "get_flashed_messages", "(", "with_categories", "=", "False", ",", "category_filter", "=", "[", "]", ")", ":", "flashes", "=", "_request_ctx_stack", ".", "top", ".", "flashes", "if", "flashes", "is", "None", ":", "_request_ctx_stack", ".", "top", ".", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
send_file
Sends the contents of a file to the client. This will use the most efficient method available and configured. By default it will try to use the WSGI server's file_wrapper support. Alternatively you can set the application's :attr:`~Flask.use_x_sendfile` attribute to ``True`` to directly emit an `X-Se...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def send_file(filename_or_fp, mimetype=None, as_attachment=False, attachment_filename=None, add_etags=True, cache_timeout=None, conditional=False): """Sends the contents of a file to the client. This will use the most efficient method available and configured. By default it will ...
def send_file(filename_or_fp, mimetype=None, as_attachment=False, attachment_filename=None, add_etags=True, cache_timeout=None, conditional=False): """Sends the contents of a file to the client. This will use the most efficient method available and configured. By default it will ...
[ "Sends", "the", "contents", "of", "a", "file", "to", "the", "client", ".", "This", "will", "use", "the", "most", "efficient", "method", "available", "and", "configured", ".", "By", "default", "it", "will", "try", "to", "use", "the", "WSGI", "server", "s"...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L410-L555
[ "def", "send_file", "(", "filename_or_fp", ",", "mimetype", "=", "None", ",", "as_attachment", "=", "False", ",", "attachment_filename", "=", "None", ",", "add_etags", "=", "True", ",", "cache_timeout", "=", "None", ",", "conditional", "=", "False", ")", ":"...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
safe_join
Safely join `directory` and `filename`. Example usage:: @app.route('/wiki/<path:filename>') def wiki_page(filename): filename = safe_join(app.config['WIKI_FOLDER'], filename) with open(filename, 'rb') as fd: content = fd.read() # Read and process the file co...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def safe_join(directory, filename): """Safely join `directory` and `filename`. Example usage:: @app.route('/wiki/<path:filename>') def wiki_page(filename): filename = safe_join(app.config['WIKI_FOLDER'], filename) with open(filename, 'rb') as fd: content...
def safe_join(directory, filename): """Safely join `directory` and `filename`. Example usage:: @app.route('/wiki/<path:filename>') def wiki_page(filename): filename = safe_join(app.config['WIKI_FOLDER'], filename) with open(filename, 'rb') as fd: content...
[ "Safely", "join", "directory", "and", "filename", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L558-L582
[ "def", "safe_join", "(", "directory", ",", "filename", ")", ":", "filename", "=", "posixpath", ".", "normpath", "(", "filename", ")", "for", "sep", "in", "_os_alt_seps", ":", "if", "sep", "in", "filename", ":", "raise", "NotFound", "(", ")", "if", "os", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
send_from_directory
Send a file from a given directory with :func:`send_file`. This is a secure way to quickly expose static files from an upload folder or something similar. Example usage:: @app.route('/uploads/<path:filename>') def download_file(filename): return send_from_directory(app.config[...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def send_from_directory(directory, filename, **options): """Send a file from a given directory with :func:`send_file`. This is a secure way to quickly expose static files from an upload folder or something similar. Example usage:: @app.route('/uploads/<path:filename>') def download_fi...
def send_from_directory(directory, filename, **options): """Send a file from a given directory with :func:`send_file`. This is a secure way to quickly expose static files from an upload folder or something similar. Example usage:: @app.route('/uploads/<path:filename>') def download_fi...
[ "Send", "a", "file", "from", "a", "given", "directory", "with", ":", "func", ":", "send_file", ".", "This", "is", "a", "secure", "way", "to", "quickly", "expose", "static", "files", "from", "an", "upload", "folder", "or", "something", "similar", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L585-L616
[ "def", "send_from_directory", "(", "directory", ",", "filename", ",", "*", "*", "options", ")", ":", "filename", "=", "safe_join", "(", "directory", ",", "filename", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "raise", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
get_root_path
Returns the path to a package or cwd if that cannot be found. This returns the path of a package or the folder that contains a module. Not to be confused with the package path returned by :func:`find_package`.
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def get_root_path(import_name): """Returns the path to a package or cwd if that cannot be found. This returns the path of a package or the folder that contains a module. Not to be confused with the package path returned by :func:`find_package`. """ # Module already imported and has a file attribut...
def get_root_path(import_name): """Returns the path to a package or cwd if that cannot be found. This returns the path of a package or the folder that contains a module. Not to be confused with the package path returned by :func:`find_package`. """ # Module already imported and has a file attribut...
[ "Returns", "the", "path", "to", "a", "package", "or", "cwd", "if", "that", "cannot", "be", "found", ".", "This", "returns", "the", "path", "of", "a", "package", "or", "the", "folder", "that", "contains", "a", "module", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L619-L649
[ "def", "get_root_path", "(", "import_name", ")", ":", "# Module already imported and has a file attribute. Use that first.", "mod", "=", "sys", ".", "modules", ".", "get", "(", "import_name", ")", "if", "mod", "is", "not", "None", "and", "hasattr", "(", "mod", ",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
find_package
Finds a package and returns the prefix (or None if the package is not installed) as well as the folder that contains the package or module as a tuple. The package path returned is the module that would have to be added to the pythonpath in order to make it possible to import the module. The prefix is ...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def find_package(import_name): """Finds a package and returns the prefix (or None if the package is not installed) as well as the folder that contains the package or module as a tuple. The package path returned is the module that would have to be added to the pythonpath in order to make it possible to ...
def find_package(import_name): """Finds a package and returns the prefix (or None if the package is not installed) as well as the folder that contains the package or module as a tuple. The package path returned is the module that would have to be added to the pythonpath in order to make it possible to ...
[ "Finds", "a", "package", "and", "returns", "the", "prefix", "(", "or", "None", "if", "the", "package", "is", "not", "installed", ")", "as", "well", "as", "the", "folder", "that", "contains", "the", "package", "or", "module", "as", "a", "tuple", ".", "T...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L652-L700
[ "def", "find_package", "(", "import_name", ")", ":", "root_mod_name", "=", "import_name", ".", "split", "(", "'.'", ")", "[", "0", "]", "loader", "=", "pkgutil", ".", "get_loader", "(", "root_mod_name", ")", "if", "loader", "is", "None", "or", "import_name...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_PackageBoundObject.jinja_loader
The Jinja loader for this package bound object. .. versionadded:: 0.5
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def jinja_loader(self): """The Jinja loader for this package bound object. .. versionadded:: 0.5 """ if self.template_folder is not None: return FileSystemLoader(os.path.join(self.root_path, self.template_folder))
def jinja_loader(self): """The Jinja loader for this package bound object. .. versionadded:: 0.5 """ if self.template_folder is not None: return FileSystemLoader(os.path.join(self.root_path, self.template_folder))
[ "The", "Jinja", "loader", "for", "this", "package", "bound", "object", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L775-L782
[ "def", "jinja_loader", "(", "self", ")", ":", "if", "self", ".", "template_folder", "is", "not", "None", ":", "return", "FileSystemLoader", "(", "os", ".", "path", ".", "join", "(", "self", ".", "root_path", ",", "self", ".", "template_folder", ")", ")" ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_PackageBoundObject.open_resource
Opens a resource from the application's resource folder. To see how this works, consider the following folder structure:: /myapplication.py /schema.sql /static /style.css /templates /layout.html /index.html ...
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
def open_resource(self, resource, mode='rb'): """Opens a resource from the application's resource folder. To see how this works, consider the following folder structure:: /myapplication.py /schema.sql /static /style.css /templates ...
def open_resource(self, resource, mode='rb'): """Opens a resource from the application's resource folder. To see how this works, consider the following folder structure:: /myapplication.py /schema.sql /static /style.css /templates ...
[ "Opens", "a", "resource", "from", "the", "application", "s", "resource", "folder", ".", "To", "see", "how", "this", "works", "consider", "the", "following", "folder", "structure", "::" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L824-L849
[ "def", "open_resource", "(", "self", ",", "resource", ",", "mode", "=", "'rb'", ")", ":", "if", "mode", "not", "in", "(", "'r'", ",", "'rb'", ")", ":", "raise", "ValueError", "(", "'Resources can only be opened for reading'", ")", "return", "open", "(", "o...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
CompletionCommand.run
Prints the completion code of the given shell
capybara/virtualenv/lib/python2.7/site-packages/pip/commands/completion.py
def run(self, options, args): """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() shell_options = ['--' + shell for shell in sorted(shells)] if options.shell in shells: script = COMPLETION_SCRIPTS.get(options.shell, '') print(BAS...
def run(self, options, args): """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() shell_options = ['--' + shell for shell in sorted(shells)] if options.shell in shells: script = COMPLETION_SCRIPTS.get(options.shell, '') print(BAS...
[ "Prints", "the", "completion", "code", "of", "the", "given", "shell" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/commands/completion.py#L58-L68
[ "def", "run", "(", "self", ",", "options", ",", "args", ")", ":", "shells", "=", "COMPLETION_SCRIPTS", ".", "keys", "(", ")", "shell_options", "=", "[", "'--'", "+", "shell", "for", "shell", "in", "sorted", "(", "shells", ")", "]", "if", "options", "...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
SessionInterface.get_cookie_domain
Helpful helper method that returns the cookie domain that should be used for the session cookie if session cookies are used.
capybara/virtualenv/lib/python2.7/site-packages/flask/sessions.py
def get_cookie_domain(self, app): """Helpful helper method that returns the cookie domain that should be used for the session cookie if session cookies are used. """ if app.config['SESSION_COOKIE_DOMAIN'] is not None: return app.config['SESSION_COOKIE_DOMAIN'] if app....
def get_cookie_domain(self, app): """Helpful helper method that returns the cookie domain that should be used for the session cookie if session cookies are used. """ if app.config['SESSION_COOKIE_DOMAIN'] is not None: return app.config['SESSION_COOKIE_DOMAIN'] if app....
[ "Helpful", "helper", "method", "that", "returns", "the", "cookie", "domain", "that", "should", "be", "used", "for", "the", "session", "cookie", "if", "session", "cookies", "are", "used", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/sessions.py#L198-L222
[ "def", "get_cookie_domain", "(", "self", ",", "app", ")", ":", "if", "app", ".", "config", "[", "'SESSION_COOKIE_DOMAIN'", "]", "is", "not", "None", ":", "return", "app", ".", "config", "[", "'SESSION_COOKIE_DOMAIN'", "]", "if", "app", ".", "config", "[", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_cache_for_link
Return a directory to store cached wheels in for link. Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only insert things into the cache if they have plausible version numbers, so that we don't co...
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def _cache_for_link(cache_dir, link): """ Return a directory to store cached wheels in for link. Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only insert things into the cache if they have ...
def _cache_for_link(cache_dir, link): """ Return a directory to store cached wheels in for link. Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only insert things into the cache if they have ...
[ "Return", "a", "directory", "to", "store", "cached", "wheels", "in", "for", "link", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L66-L104
[ "def", "_cache_for_link", "(", "cache_dir", ",", "link", ")", ":", "# We want to generate an url to use as our cache key, we don't want to just", "# re-use the URL because it might have other items in the fragment and we", "# don't care about those.", "key_parts", "=", "[", "link", "."...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
rehash
Return (hash, length) for path using hashlib.new(algo)
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def rehash(path, algo='sha256', blocksize=1 << 20): """Return (hash, length) for path using hashlib.new(algo)""" h = hashlib.new(algo) length = 0 with open(path, 'rb') as f: block = f.read(blocksize) while block: length += len(block) h.update(block) bl...
def rehash(path, algo='sha256', blocksize=1 << 20): """Return (hash, length) for path using hashlib.new(algo)""" h = hashlib.new(algo) length = 0 with open(path, 'rb') as f: block = f.read(blocksize) while block: length += len(block) h.update(block) bl...
[ "Return", "(", "hash", "length", ")", "for", "path", "using", "hashlib", ".", "new", "(", "algo", ")" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L146-L159
[ "def", "rehash", "(", "path", ",", "algo", "=", "'sha256'", ",", "blocksize", "=", "1", "<<", "20", ")", ":", "h", "=", "hashlib", ".", "new", "(", "algo", ")", "length", "=", "0", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
fix_script
Replace #!python with #!/path/to/python Return True if file was changed.
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def fix_script(path): """Replace #!python with #!/path/to/python Return True if file was changed.""" # XXX RECORD hashes will need to be updated if os.path.isfile(path): with open(path, 'rb') as script: firstline = script.readline() if not firstline.startswith(b'#!python'...
def fix_script(path): """Replace #!python with #!/path/to/python Return True if file was changed.""" # XXX RECORD hashes will need to be updated if os.path.isfile(path): with open(path, 'rb') as script: firstline = script.readline() if not firstline.startswith(b'#!python'...
[ "Replace", "#!python", "with", "#!", "/", "path", "/", "to", "/", "python", "Return", "True", "if", "file", "was", "changed", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L172-L187
[ "def", "fix_script", "(", "path", ")", ":", "# XXX RECORD hashes will need to be updated", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "script", ":", "firstline", "=", "script", ".", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
root_is_purelib
Return True if the extracted wheel in wheeldir should go into purelib.
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def root_is_purelib(name, wheeldir): """ Return True if the extracted wheel in wheeldir should go into purelib. """ name_folded = name.replace("-", "_") for item in os.listdir(wheeldir): match = dist_info_re.match(item) if match and match.group('name') == name_folded: wit...
def root_is_purelib(name, wheeldir): """ Return True if the extracted wheel in wheeldir should go into purelib. """ name_folded = name.replace("-", "_") for item in os.listdir(wheeldir): match = dist_info_re.match(item) if match and match.group('name') == name_folded: wit...
[ "Return", "True", "if", "the", "extracted", "wheel", "in", "wheeldir", "should", "go", "into", "purelib", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L193-L206
[ "def", "root_is_purelib", "(", "name", ",", "wheeldir", ")", ":", "name_folded", "=", "name", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "for", "item", "in", "os", ".", "listdir", "(", "wheeldir", ")", ":", "match", "=", "dist_info_re", ".", "mat...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
uninstallation_paths
Yield all the uninstallation paths for dist based on RECORD-without-.pyc Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc in the same directory. UninstallPathSet.add() takes care of the __pycache__ .pyc.
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def uninstallation_paths(dist): """ Yield all the uninstallation paths for dist based on RECORD-without-.pyc Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc in the same directory. UninstallPathSet.add() takes care of the __pycache__ .pyc. """ from pip.util...
def uninstallation_paths(dist): """ Yield all the uninstallation paths for dist based on RECORD-without-.pyc Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc in the same directory. UninstallPathSet.add() takes care of the __pycache__ .pyc. """ from pip.util...
[ "Yield", "all", "the", "uninstallation", "paths", "for", "dist", "based", "on", "RECORD", "-", "without", "-", ".", "pyc" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L521-L539
[ "def", "uninstallation_paths", "(", "dist", ")", ":", "from", "pip", ".", "utils", "import", "FakeFile", "# circular import", "r", "=", "csv", ".", "reader", "(", "FakeFile", "(", "dist", ".", "get_metadata_lines", "(", "'RECORD'", ")", ")", ")", "for", "r...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
check_compatibility
Raises errors or warns if called with an incompatible Wheel-Version. Pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Whe...
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def check_compatibility(version, name): """ Raises errors or warns if called with an incompatible Wheel-Version. Pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1....
def check_compatibility(version, name): """ Raises errors or warns if called with an incompatible Wheel-Version. Pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1....
[ "Raises", "errors", "or", "warns", "if", "called", "with", "an", "incompatible", "Wheel", "-", "Version", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L561-L587
[ "def", "check_compatibility", "(", "version", ",", "name", ")", ":", "if", "not", "version", ":", "raise", "UnsupportedWheel", "(", "\"%s is in an unsupported or invalid wheel\"", "%", "name", ")", "if", "version", "[", "0", "]", ">", "VERSION_COMPATIBLE", "[", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
WheelBuilder._build_one
Build one wheel. :return: The filename of the built wheel, or None if the build failed.
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def _build_one(self, req, output_dir): """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ tempd = tempfile.mkdtemp('pip-wheel-') try: if self.__build_one(req, tempd): try: wheel_name = os...
def _build_one(self, req, output_dir): """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ tempd = tempfile.mkdtemp('pip-wheel-') try: if self.__build_one(req, tempd): try: wheel_name = os...
[ "Build", "one", "wheel", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L657-L675
[ "def", "_build_one", "(", "self", ",", "req", ",", "output_dir", ")", ":", "tempd", "=", "tempfile", ".", "mkdtemp", "(", "'pip-wheel-'", ")", "try", ":", "if", "self", ".", "__build_one", "(", "req", ",", "tempd", ")", ":", "try", ":", "wheel_name", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
WheelBuilder.build
Build wheels. :param unpack: If True, replace the sdist we built from the with the newly built wheel, in preparation for installation. :return: True if all the wheels built correctly.
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
def build(self, autobuilding=False): """Build wheels. :param unpack: If True, replace the sdist we built from the with the newly built wheel, in preparation for installation. :return: True if all the wheels built correctly. """ assert self._wheel_dir or (autobuilding...
def build(self, autobuilding=False): """Build wheels. :param unpack: If True, replace the sdist we built from the with the newly built wheel, in preparation for installation. :return: True if all the wheels built correctly. """ assert self._wheel_dir or (autobuilding...
[ "Build", "wheels", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L696-L799
[ "def", "build", "(", "self", ",", "autobuilding", "=", "False", ")", ":", "assert", "self", ".", "_wheel_dir", "or", "(", "autobuilding", "and", "self", ".", "_cache_root", ")", "# unpack sdists and constructs req set", "self", ".", "requirement_set", ".", "prep...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
iter_symbols
Yield names and strings used by `code` and its nested code objects
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/bdist_egg.py
def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in code.co_consts: if isinstance(const, basestring): yield const elif isinstance(const, CodeType): for name in iter...
def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in code.co_consts: if isinstance(const, basestring): yield const elif isinstance(const, CodeType): for name in iter...
[ "Yield", "names", "and", "strings", "used", "by", "code", "and", "its", "nested", "code", "objects" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/bdist_egg.py#L411-L420
[ "def", "iter_symbols", "(", "code", ")", ":", "for", "name", "in", "code", ".", "co_names", ":", "yield", "name", "for", "const", "in", "code", ".", "co_consts", ":", "if", "isinstance", "(", "const", ",", "basestring", ")", ":", "yield", "const", "eli...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
ensure_fresh_rates
Decorator for Backend that ensures rates are fresh within last 5 mins
pricing/exchange.py
def ensure_fresh_rates(func): """Decorator for Backend that ensures rates are fresh within last 5 mins""" def wrapper(self, *args, **kwargs): if self.last_updated + timedelta(minutes=5) < zulu.now(): self.refresh() return func(self, *args, **kwargs) return wrapper
def ensure_fresh_rates(func): """Decorator for Backend that ensures rates are fresh within last 5 mins""" def wrapper(self, *args, **kwargs): if self.last_updated + timedelta(minutes=5) < zulu.now(): self.refresh() return func(self, *args, **kwargs) return wrapper
[ "Decorator", "for", "Backend", "that", "ensures", "rates", "are", "fresh", "within", "last", "5", "mins" ]
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/exchange.py#L29-L35
[ "def", "ensure_fresh_rates", "(", "func", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "last_updated", "+", "timedelta", "(", "minutes", "=", "5", ")", "<", "zulu", ".", "now", "("...
be988b0851b4313af81f1db475bc33248700e39c
test
BackendBase.quotation
Return quotation between two currencies (origin, target)
pricing/exchange.py
def quotation(self, origin, target): """Return quotation between two currencies (origin, target)""" a = self.rate(origin) b = self.rate(target) if a and b: return Decimal(b) / Decimal(a) return None
def quotation(self, origin, target): """Return quotation between two currencies (origin, target)""" a = self.rate(origin) b = self.rate(target) if a and b: return Decimal(b) / Decimal(a) return None
[ "Return", "quotation", "between", "two", "currencies", "(", "origin", "target", ")" ]
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/exchange.py#L41-L47
[ "def", "quotation", "(", "self", ",", "origin", ",", "target", ")", ":", "a", "=", "self", ".", "rate", "(", "origin", ")", "b", "=", "self", ".", "rate", "(", "target", ")", "if", "a", "and", "b", ":", "return", "Decimal", "(", "b", ")", "/", ...
be988b0851b4313af81f1db475bc33248700e39c
test
manifest_maker._add_egg_info
Add paths for egg-info files for an external egg-base. The egg-info files are written to egg-base. If egg-base is outside the current working directory, this method searchs the egg-base directory for files to include in the manifest. Uses distutils.filelist.findall (which is rea...
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/egg_info.py
def _add_egg_info(self, cmd): """ Add paths for egg-info files for an external egg-base. The egg-info files are written to egg-base. If egg-base is outside the current working directory, this method searchs the egg-base directory for files to include in the manifest. Use...
def _add_egg_info(self, cmd): """ Add paths for egg-info files for an external egg-base. The egg-info files are written to egg-base. If egg-base is outside the current working directory, this method searchs the egg-base directory for files to include in the manifest. Use...
[ "Add", "paths", "for", "egg", "-", "info", "files", "for", "an", "external", "egg", "-", "base", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/egg_info.py#L332-L354
[ "def", "_add_egg_info", "(", "self", ",", "cmd", ")", ":", "if", "cmd", ".", "egg_base", "==", "os", ".", "curdir", ":", "# egg-info files were already added by something else", "return", "discovered", "=", "distutils", ".", "filelist", ".", "findall", "(", "cmd...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
write_delete_marker_file
Write the pip delete marker file into this directory.
capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py
def write_delete_marker_file(directory): """ Write the pip delete marker file into this directory. """ filepath = os.path.join(directory, PIP_DELETE_MARKER_FILENAME) with open(filepath, 'w') as marker_fp: marker_fp.write(DELETE_MARKER_MESSAGE)
def write_delete_marker_file(directory): """ Write the pip delete marker file into this directory. """ filepath = os.path.join(directory, PIP_DELETE_MARKER_FILENAME) with open(filepath, 'w') as marker_fp: marker_fp.write(DELETE_MARKER_MESSAGE)
[ "Write", "the", "pip", "delete", "marker", "file", "into", "this", "directory", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py#L63-L69
[ "def", "write_delete_marker_file", "(", "directory", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "PIP_DELETE_MARKER_FILENAME", ")", "with", "open", "(", "filepath", ",", "'w'", ")", "as", "marker_fp", ":", "marker_fp", "...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
running_under_virtualenv
Return True if we're running inside a virtualenv, False otherwise.
capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py
def running_under_virtualenv(): """ Return True if we're running inside a virtualenv, False otherwise. """ if hasattr(sys, 'real_prefix'): return True elif sys.prefix != getattr(sys, "base_prefix", sys.prefix): return True return False
def running_under_virtualenv(): """ Return True if we're running inside a virtualenv, False otherwise. """ if hasattr(sys, 'real_prefix'): return True elif sys.prefix != getattr(sys, "base_prefix", sys.prefix): return True return False
[ "Return", "True", "if", "we", "re", "running", "inside", "a", "virtualenv", "False", "otherwise", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py#L72-L82
[ "def", "running_under_virtualenv", "(", ")", ":", "if", "hasattr", "(", "sys", ",", "'real_prefix'", ")", ":", "return", "True", "elif", "sys", ".", "prefix", "!=", "getattr", "(", "sys", ",", "\"base_prefix\"", ",", "sys", ".", "prefix", ")", ":", "retu...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
__get_username
Returns the effective username of the current process.
capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py
def __get_username(): """ Returns the effective username of the current process. """ if WINDOWS: return getpass.getuser() import pwd return pwd.getpwuid(os.geteuid()).pw_name
def __get_username(): """ Returns the effective username of the current process. """ if WINDOWS: return getpass.getuser() import pwd return pwd.getpwuid(os.geteuid()).pw_name
[ "Returns", "the", "effective", "username", "of", "the", "current", "process", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py#L97-L102
[ "def", "__get_username", "(", ")", ":", "if", "WINDOWS", ":", "return", "getpass", ".", "getuser", "(", ")", "import", "pwd", "return", "pwd", ".", "getpwuid", "(", "os", ".", "geteuid", "(", ")", ")", ".", "pw_name" ]
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
distutils_scheme
Return a distutils install scheme
capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py
def distutils_scheme(dist_name, user=False, home=None, root=None, isolated=False): """ Return a distutils install scheme """ from distutils.dist import Distribution scheme = {} if isolated: extra_dist_args = {"script_args": ["--no-user-cfg"]} else: extr...
def distutils_scheme(dist_name, user=False, home=None, root=None, isolated=False): """ Return a distutils install scheme """ from distutils.dist import Distribution scheme = {} if isolated: extra_dist_args = {"script_args": ["--no-user-cfg"]} else: extr...
[ "Return", "a", "distutils", "install", "scheme" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/locations.py#L165-L213
[ "def", "distutils_scheme", "(", "dist_name", ",", "user", "=", "False", ",", "home", "=", "None", ",", "root", "=", "None", ",", "isolated", "=", "False", ")", ":", "from", "distutils", ".", "dist", "import", "Distribution", "scheme", "=", "{", "}", "i...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
CacheController.parse_cache_control
Parse the cache control headers returning a dictionary with values for the different directives.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py
def parse_cache_control(self, headers): """ Parse the cache control headers returning a dictionary with values for the different directives. """ retval = {} cc_header = 'cache-control' if 'Cache-Control' in headers: cc_header = 'Cache-Control' ...
def parse_cache_control(self, headers): """ Parse the cache control headers returning a dictionary with values for the different directives. """ retval = {} cc_header = 'cache-control' if 'Cache-Control' in headers: cc_header = 'Cache-Control' ...
[ "Parse", "the", "cache", "control", "headers", "returning", "a", "dictionary", "with", "values", "for", "the", "different", "directives", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py#L59-L81
[ "def", "parse_cache_control", "(", "self", ",", "headers", ")", ":", "retval", "=", "{", "}", "cc_header", "=", "'cache-control'", "if", "'Cache-Control'", "in", "headers", ":", "cc_header", "=", "'Cache-Control'", "if", "cc_header", "in", "headers", ":", "par...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
CacheController.cached_request
Return a cached response if it exists in the cache, otherwise return False.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py
def cached_request(self, request): """ Return a cached response if it exists in the cache, otherwise return False. """ cache_url = self.cache_url(request.url) cc = self.parse_cache_control(request.headers) # non-caching states no_cache = True if 'no-cache...
def cached_request(self, request): """ Return a cached response if it exists in the cache, otherwise return False. """ cache_url = self.cache_url(request.url) cc = self.parse_cache_control(request.headers) # non-caching states no_cache = True if 'no-cache...
[ "Return", "a", "cached", "response", "if", "it", "exists", "in", "the", "cache", "otherwise", "return", "False", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py#L83-L179
[ "def", "cached_request", "(", "self", ",", "request", ")", ":", "cache_url", "=", "self", ".", "cache_url", "(", "request", ".", "url", ")", "cc", "=", "self", ".", "parse_cache_control", "(", "request", ".", "headers", ")", "# non-caching states", "no_cache...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
CacheController.cache_response
Algorithm for caching requests. This assumes a requests Response object.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py
def cache_response(self, request, response, body=None): """ Algorithm for caching requests. This assumes a requests Response object. """ # From httplib2: Don't cache 206's since we aren't going to # handle byte range requests if response.status not...
def cache_response(self, request, response, body=None): """ Algorithm for caching requests. This assumes a requests Response object. """ # From httplib2: Don't cache 206's since we aren't going to # handle byte range requests if response.status not...
[ "Algorithm", "for", "caching", "requests", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py#L197-L254
[ "def", "cache_response", "(", "self", ",", "request", ",", "response", ",", "body", "=", "None", ")", ":", "# From httplib2: Don't cache 206's since we aren't going to", "# handle byte range requests", "if", "response", ".", "status", "not", "in", "[", "2...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_update_zipimporter_cache
Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry key and the original entry (after already removing the entry from the cache),...
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def _update_zipimporter_cache(normalized_path, cache, updater=None): """ Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry ...
def _update_zipimporter_cache(normalized_path, cache, updater=None): """ Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry ...
[ "Update", "zipimporter", "cache", "data", "for", "a", "given", "normalized", "path", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L1716-L1745
[ "def", "_update_zipimporter_cache", "(", "normalized_path", ",", "cache", ",", "updater", "=", "None", ")", ":", "for", "p", "in", "_collect_zipimporter_cache_entries", "(", "normalized_path", ",", "cache", ")", ":", "# N.B. pypy's custom zipimport._zip_directory_cache im...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
get_win_launcher
Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def get_win_launcher(type): """ Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. """ launcher_fn = '%s.exe' % type if platform.machine().lower() == 'arm': launcher_fn = launcher_f...
def get_win_launcher(type): """ Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. """ launcher_fn = '%s.exe' % type if platform.machine().lower() == 'arm': launcher_fn = launcher_f...
[ "Load", "the", "Windows", "launcher", "(", "executable", ")", "suitable", "for", "launching", "a", "script", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L2158-L2173
[ "def", "get_win_launcher", "(", "type", ")", ":", "launcher_fn", "=", "'%s.exe'", "%", "type", "if", "platform", ".", "machine", "(", ")", ".", "lower", "(", ")", "==", "'arm'", ":", "launcher_fn", "=", "launcher_fn", ".", "replace", "(", "\".\"", ",", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
easy_install.pseudo_tempname
Return a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def pseudo_tempname(self): """Return a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo. """ try: pid = os.getpid() except: pid = r...
def pseudo_tempname(self): """Return a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo. """ try: pid = os.getpid() except: pid = r...
[ "Return", "a", "pseudo", "-", "tempname", "base", "in", "the", "install", "directory", ".", "This", "code", "is", "intentionally", "naive", ";", "if", "a", "malicious", "party", "can", "write", "to", "the", "target", "directory", "you", "re", "already", "i...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L398-L407
[ "def", "pseudo_tempname", "(", "self", ")", ":", "try", ":", "pid", "=", "os", ".", "getpid", "(", ")", "except", ":", "pid", "=", "random", ".", "randint", "(", "0", ",", "maxsize", ")", "return", "os", ".", "path", ".", "join", "(", "self", "."...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
easy_install.install_script
Generate a legacy script wrapper and install it
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def install_script(self, dist, script_name, script_text, dev_path=None): """Generate a legacy script wrapper and install it""" spec = str(dist.as_requirement()) is_script = is_python_script(script_text, script_name) if is_script: script_text = (ScriptWriter.get_header(script...
def install_script(self, dist, script_name, script_text, dev_path=None): """Generate a legacy script wrapper and install it""" spec = str(dist.as_requirement()) is_script = is_python_script(script_text, script_name) if is_script: script_text = (ScriptWriter.get_header(script...
[ "Generate", "a", "legacy", "script", "wrapper", "and", "install", "it" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L758-L766
[ "def", "install_script", "(", "self", ",", "dist", ",", "script_name", ",", "script_text", ",", "dev_path", "=", "None", ")", ":", "spec", "=", "str", "(", "dist", ".", "as_requirement", "(", ")", ")", "is_script", "=", "is_python_script", "(", "script_tex...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
easy_install._load_template
There are a couple of template scripts in the package. This function loads one of them and prepares it for use.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def _load_template(dev_path): """ There are a couple of template scripts in the package. This function loads one of them and prepares it for use. """ # See https://bitbucket.org/pypa/setuptools/issue/134 for info # on script file naming and downstream issues with SVR4 ...
def _load_template(dev_path): """ There are a couple of template scripts in the package. This function loads one of them and prepares it for use. """ # See https://bitbucket.org/pypa/setuptools/issue/134 for info # on script file naming and downstream issues with SVR4 ...
[ "There", "are", "a", "couple", "of", "template", "scripts", "in", "the", "package", ".", "This", "function", "loads", "one", "of", "them", "and", "prepares", "it", "for", "use", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L769-L781
[ "def", "_load_template", "(", "dev_path", ")", ":", "# See https://bitbucket.org/pypa/setuptools/issue/134 for info", "# on script file naming and downstream issues with SVR4", "name", "=", "'script.tmpl'", "if", "dev_path", ":", "name", "=", "name", ".", "replace", "(", "'.t...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
easy_install.install_site_py
Make sure there's a site.py in the target dir, if needed
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def install_site_py(self): """Make sure there's a site.py in the target dir, if needed""" if self.sitepy_installed: return # already did it, or don't need to sitepy = os.path.join(self.install_dir, "site.py") source = resource_string("setuptools", "site-patch.py") ...
def install_site_py(self): """Make sure there's a site.py in the target dir, if needed""" if self.sitepy_installed: return # already did it, or don't need to sitepy = os.path.join(self.install_dir, "site.py") source = resource_string("setuptools", "site-patch.py") ...
[ "Make", "sure", "there", "s", "a", "site", ".", "py", "in", "the", "target", "dir", "if", "needed" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L1223-L1257
[ "def", "install_site_py", "(", "self", ")", ":", "if", "self", ".", "sitepy_installed", ":", "return", "# already did it, or don't need to", "sitepy", "=", "os", ".", "path", ".", "join", "(", "self", ".", "install_dir", ",", "\"site.py\"", ")", "source", "=",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
PthDistributions.save
Write changed .pth file back to disk
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def save(self): """Write changed .pth file back to disk""" if not self.dirty: return data = '\n'.join(map(self.make_relative, self.paths)) if data: log.debug("Saving %s", self.filename) data = ( "import sys; sys.__plen = len(sys.path)\...
def save(self): """Write changed .pth file back to disk""" if not self.dirty: return data = '\n'.join(map(self.make_relative, self.paths)) if data: log.debug("Saving %s", self.filename) data = ( "import sys; sys.__plen = len(sys.path)\...
[ "Write", "changed", ".", "pth", "file", "back", "to", "disk" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L1528-L1555
[ "def", "save", "(", "self", ")", ":", "if", "not", "self", ".", "dirty", ":", "return", "data", "=", "'\\n'", ".", "join", "(", "map", "(", "self", ".", "make_relative", ",", "self", ".", "paths", ")", ")", "if", "data", ":", "log", ".", "debug",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
JythonCommandSpec.as_header
Workaround Jython's sys.executable being a .sh (an invalid shebang line interpreter)
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def as_header(self): """ Workaround Jython's sys.executable being a .sh (an invalid shebang line interpreter) """ if not is_sh(self[0]): return super(JythonCommandSpec, self).as_header() if self.options: # Can't apply the workaround, leave it brok...
def as_header(self): """ Workaround Jython's sys.executable being a .sh (an invalid shebang line interpreter) """ if not is_sh(self[0]): return super(JythonCommandSpec, self).as_header() if self.options: # Can't apply the workaround, leave it brok...
[ "Workaround", "Jython", "s", "sys", ".", "executable", "being", "a", ".", "sh", "(", "an", "invalid", "shebang", "line", "interpreter", ")" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L1956-L1974
[ "def", "as_header", "(", "self", ")", ":", "if", "not", "is_sh", "(", "self", "[", "0", "]", ")", ":", "return", "super", "(", "JythonCommandSpec", ",", "self", ")", ".", "as_header", "(", ")", "if", "self", ".", "options", ":", "# Can't apply the work...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
WindowsScriptWriter._adjust_header
Make sure 'pythonw' is used for gui and and 'python' is used for console (regardless of what sys.executable is).
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
def _adjust_header(type_, orig_header): """ Make sure 'pythonw' is used for gui and and 'python' is used for console (regardless of what sys.executable is). """ pattern = 'pythonw.exe' repl = 'python.exe' if type_ == 'gui': pattern, repl = repl, patter...
def _adjust_header(type_, orig_header): """ Make sure 'pythonw' is used for gui and and 'python' is used for console (regardless of what sys.executable is). """ pattern = 'pythonw.exe' repl = 'python.exe' if type_ == 'gui': pattern, repl = repl, patter...
[ "Make", "sure", "pythonw", "is", "used", "for", "gui", "and", "and", "python", "is", "used", "for", "console", "(", "regardless", "of", "what", "sys", ".", "executable", "is", ")", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L2104-L2119
[ "def", "_adjust_header", "(", "type_", ",", "orig_header", ")", ":", "pattern", "=", "'pythonw.exe'", "repl", "=", "'python.exe'", "if", "type_", "==", "'gui'", ":", "pattern", ",", "repl", "=", "repl", ",", "pattern", "pattern_ob", "=", "re", ".", "compil...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
BaseConfigurator.convert
Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do.
capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py
def convert(self, value): """ Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. """ if not isinstance(value, ConvertingDic...
def convert(self, value): """ Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. """ if not isinstance(value, ConvertingDic...
[ "Convert", "values", "to", "an", "appropriate", "type", ".", "dicts", "lists", "and", "tuples", "are", "replaced", "by", "their", "converting", "alternatives", ".", "Strings", "are", "checked", "to", "see", "if", "they", "have", "a", "conversion", "format", ...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L228-L254
[ "def", "convert", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "ConvertingDict", ")", "and", "isinstance", "(", "value", ",", "dict", ")", ":", "value", "=", "ConvertingDict", "(", "value", ")", "value", ".", "conf...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
DictConfigurator.add_filters
Add filters to a filterer from a list of names.
capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py
def add_filters(self, filterer, filters): """Add filters to a filterer from a list of names.""" for f in filters: try: filterer.addFilter(self.config['filters'][f]) except StandardError as e: raise ValueError('Unable to add filter %r: %s' % (f, e))
def add_filters(self, filterer, filters): """Add filters to a filterer from a list of names.""" for f in filters: try: filterer.addFilter(self.config['filters'][f]) except StandardError as e: raise ValueError('Unable to add filter %r: %s' % (f, e))
[ "Add", "filters", "to", "a", "filterer", "from", "a", "list", "of", "names", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L460-L466
[ "def", "add_filters", "(", "self", ",", "filterer", ",", "filters", ")", ":", "for", "f", "in", "filters", ":", "try", ":", "filterer", ".", "addFilter", "(", "self", ".", "config", "[", "'filters'", "]", "[", "f", "]", ")", "except", "StandardError", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
DictConfigurator.configure_handler
Configure a handler from a dictionary.
capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py
def configure_handler(self, config): """Configure a handler from a dictionary.""" formatter = config.pop('formatter', None) if formatter: try: formatter = self.config['formatters'][formatter] except StandardError as e: raise ValueError('Una...
def configure_handler(self, config): """Configure a handler from a dictionary.""" formatter = config.pop('formatter', None) if formatter: try: formatter = self.config['formatters'][formatter] except StandardError as e: raise ValueError('Una...
[ "Configure", "a", "handler", "from", "a", "dictionary", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L468-L519
[ "def", "configure_handler", "(", "self", ",", "config", ")", ":", "formatter", "=", "config", ".", "pop", "(", "'formatter'", ",", "None", ")", "if", "formatter", ":", "try", ":", "formatter", "=", "self", ".", "config", "[", "'formatters'", "]", "[", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
DictConfigurator.add_handlers
Add handlers to a logger from a list of names.
capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py
def add_handlers(self, logger, handlers): """Add handlers to a logger from a list of names.""" for h in handlers: try: logger.addHandler(self.config['handlers'][h]) except StandardError as e: raise ValueError('Unable to add handler %r: %s' % (h, e)...
def add_handlers(self, logger, handlers): """Add handlers to a logger from a list of names.""" for h in handlers: try: logger.addHandler(self.config['handlers'][h]) except StandardError as e: raise ValueError('Unable to add handler %r: %s' % (h, e)...
[ "Add", "handlers", "to", "a", "logger", "from", "a", "list", "of", "names", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L521-L527
[ "def", "add_handlers", "(", "self", ",", "logger", ",", "handlers", ")", ":", "for", "h", "in", "handlers", ":", "try", ":", "logger", ".", "addHandler", "(", "self", ".", "config", "[", "'handlers'", "]", "[", "h", "]", ")", "except", "StandardError",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
DictConfigurator.common_logger_config
Perform configuration which is common to root and non-root loggers.
capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py
def common_logger_config(self, logger, config, incremental=False): """ Perform configuration which is common to root and non-root loggers. """ level = config.get('level', None) if level is not None: logger.setLevel(_checkLevel(level)) if not incremental: ...
def common_logger_config(self, logger, config, incremental=False): """ Perform configuration which is common to root and non-root loggers. """ level = config.get('level', None) if level is not None: logger.setLevel(_checkLevel(level)) if not incremental: ...
[ "Perform", "configuration", "which", "is", "common", "to", "root", "and", "non", "-", "root", "loggers", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/compat/dictconfig.py#L529-L545
[ "def", "common_logger_config", "(", "self", ",", "logger", ",", "config", ",", "incremental", "=", "False", ")", ":", "level", "=", "config", ".", "get", "(", "'level'", ",", "None", ")", "if", "level", "is", "not", "None", ":", "logger", ".", "setLeve...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Config.from_envvar
Loads a configuration from an environment variable pointing to a configuration file. This is basically just a shortcut with nicer error messages for this line of code:: app.config.from_pyfile(os.environ['YOURAPPLICATION_SETTINGS']) :param variable_name: name of the environment var...
capybara/virtualenv/lib/python2.7/site-packages/flask/config.py
def from_envvar(self, variable_name, silent=False): """Loads a configuration from an environment variable pointing to a configuration file. This is basically just a shortcut with nicer error messages for this line of code:: app.config.from_pyfile(os.environ['YOURAPPLICATION_SETTING...
def from_envvar(self, variable_name, silent=False): """Loads a configuration from an environment variable pointing to a configuration file. This is basically just a shortcut with nicer error messages for this line of code:: app.config.from_pyfile(os.environ['YOURAPPLICATION_SETTING...
[ "Loads", "a", "configuration", "from", "an", "environment", "variable", "pointing", "to", "a", "configuration", "file", ".", "This", "is", "basically", "just", "a", "shortcut", "with", "nicer", "error", "messages", "for", "this", "line", "of", "code", "::" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/config.py#L87-L108
[ "def", "from_envvar", "(", "self", ",", "variable_name", ",", "silent", "=", "False", ")", ":", "rv", "=", "os", ".", "environ", ".", "get", "(", "variable_name", ")", "if", "not", "rv", ":", "if", "silent", ":", "return", "False", "raise", "RuntimeErr...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Config.from_pyfile
Updates the values in the config from a Python file. This function behaves as if the file was imported as module with the :meth:`from_object` function. :param filename: the filename of the config. This can either be an absolute filename or a filename relative to the ...
capybara/virtualenv/lib/python2.7/site-packages/flask/config.py
def from_pyfile(self, filename, silent=False): """Updates the values in the config from a Python file. This function behaves as if the file was imported as module with the :meth:`from_object` function. :param filename: the filename of the config. This can either be an ...
def from_pyfile(self, filename, silent=False): """Updates the values in the config from a Python file. This function behaves as if the file was imported as module with the :meth:`from_object` function. :param filename: the filename of the config. This can either be an ...
[ "Updates", "the", "values", "in", "the", "config", "from", "a", "Python", "file", ".", "This", "function", "behaves", "as", "if", "the", "file", "was", "imported", "as", "module", "with", "the", ":", "meth", ":", "from_object", "function", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/config.py#L110-L136
[ "def", "from_pyfile", "(", "self", ",", "filename", ",", "silent", "=", "False", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "root_path", ",", "filename", ")", "d", "=", "imp", ".", "new_module", "(", "'config'", ")",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Config.from_object
Updates the values from the given object. An object can be of one of the following two types: - a string: in this case the object with that name will be imported - an actual object reference: that object is used directly Objects are usually either modules or classes. Just...
capybara/virtualenv/lib/python2.7/site-packages/flask/config.py
def from_object(self, obj): """Updates the values from the given object. An object can be of one of the following two types: - a string: in this case the object with that name will be imported - an actual object reference: that object is used directly Objects are usually e...
def from_object(self, obj): """Updates the values from the given object. An object can be of one of the following two types: - a string: in this case the object with that name will be imported - an actual object reference: that object is used directly Objects are usually e...
[ "Updates", "the", "values", "from", "the", "given", "object", ".", "An", "object", "can", "be", "of", "one", "of", "the", "following", "two", "types", ":" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/config.py#L138-L165
[ "def", "from_object", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "string_types", ")", ":", "obj", "=", "import_string", "(", "obj", ")", "for", "key", "in", "dir", "(", "obj", ")", ":", "if", "key", ".", "isupper", "(",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_execfile
Python 3 implementation of execfile.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py
def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() # compile() function in Python 2.6 and 3.1 requires LF line endings. if sys.version_info[:2] < (2, 7) or sys.version_inf...
def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() # compile() function in Python 2.6 and 3.1 requires LF line endings. if sys.version_info[:2] < (2, 7) or sys.version_inf...
[ "Python", "3", "implementation", "of", "execfile", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py#L32-L46
[ "def", "_execfile", "(", "filename", ",", "globals", ",", "locals", "=", "None", ")", ":", "mode", "=", "'rb'", "with", "open", "(", "filename", ",", "mode", ")", "as", "stream", ":", "script", "=", "stream", ".", "read", "(", ")", "# compile() functio...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
override_temp
Monkey-patch tempfile.tempdir with replacement, ensuring it exists
capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py
def override_temp(replacement): """ Monkey-patch tempfile.tempdir with replacement, ensuring it exists """ if not os.path.isdir(replacement): os.makedirs(replacement) saved = tempfile.tempdir tempfile.tempdir = replacement try: yield finally: tempfile.tempdir =...
def override_temp(replacement): """ Monkey-patch tempfile.tempdir with replacement, ensuring it exists """ if not os.path.isdir(replacement): os.makedirs(replacement) saved = tempfile.tempdir tempfile.tempdir = replacement try: yield finally: tempfile.tempdir =...
[ "Monkey", "-", "patch", "tempfile", ".", "tempdir", "with", "replacement", "ensuring", "it", "exists" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py#L70-L84
[ "def", "override_temp", "(", "replacement", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "replacement", ")", ":", "os", ".", "makedirs", "(", "replacement", ")", "saved", "=", "tempfile", ".", "tempdir", "tempfile", ".", "tempdir", "=", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
run_setup
Run a distutils setup script, sandboxed in its directory
capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py
def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script]+list(args) sys.path.insert(0, setup_dir) #...
def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script]+list(args) sys.path.insert(0, setup_dir) #...
[ "Run", "a", "distutils", "setup", "script", "sandboxed", "in", "its", "directory" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py#L224-L240
[ "def", "run_setup", "(", "setup_script", ",", "args", ")", ":", "setup_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "setup_script", ")", ")", "with", "setup_context", "(", "setup_dir", ")", ":", "try", ":",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
UnpickleableException.dump
Always return a dumped (pickled) type and exc. If exc can't be pickled, wrap it in UnpickleableException first.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py
def dump(cls, type, exc): """ Always return a dumped (pickled) type and exc. If exc can't be pickled, wrap it in UnpickleableException first. """ try: return pickle.dumps(type), pickle.dumps(exc) except Exception: return cls.dump(cls, cls(repr(exc)...
def dump(cls, type, exc): """ Always return a dumped (pickled) type and exc. If exc can't be pickled, wrap it in UnpickleableException first. """ try: return pickle.dumps(type), pickle.dumps(exc) except Exception: return cls.dump(cls, cls(repr(exc)...
[ "Always", "return", "a", "dumped", "(", "pickled", ")", "type", "and", "exc", ".", "If", "exc", "can", "t", "be", "pickled", "wrap", "it", "in", "UnpickleableException", "first", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py#L102-L110
[ "def", "dump", "(", "cls", ",", "type", ",", "exc", ")", ":", "try", ":", "return", "pickle", ".", "dumps", "(", "type", ")", ",", "pickle", ".", "dumps", "(", "exc", ")", "except", "Exception", ":", "return", "cls", ".", "dump", "(", "cls", ",",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Git.check_rev_options
Check the revision options before checkout to compensate that tags and branches may need origin/ as a prefix. Returns the SHA1 of the branch or tag if found.
capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/git.py
def check_rev_options(self, rev, dest, rev_options): """Check the revision options before checkout to compensate that tags and branches may need origin/ as a prefix. Returns the SHA1 of the branch or tag if found. """ revisions = self.get_refs(dest) origin_rev = 'origin/...
def check_rev_options(self, rev, dest, rev_options): """Check the revision options before checkout to compensate that tags and branches may need origin/ as a prefix. Returns the SHA1 of the branch or tag if found. """ revisions = self.get_refs(dest) origin_rev = 'origin/...
[ "Check", "the", "revision", "options", "before", "checkout", "to", "compensate", "that", "tags", "and", "branches", "may", "need", "origin", "/", "as", "a", "prefix", ".", "Returns", "the", "SHA1", "of", "the", "branch", "or", "tag", "if", "found", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/git.py#L63-L81
[ "def", "check_rev_options", "(", "self", ",", "rev", ",", "dest", ",", "rev_options", ")", ":", "revisions", "=", "self", ".", "get_refs", "(", "dest", ")", "origin_rev", "=", "'origin/%s'", "%", "rev", "if", "origin_rev", "in", "revisions", ":", "# remote...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Git.get_url_rev
Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes doesn't work with a ssh:// scheme (e.g. Github). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub.
capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/git.py
def get_url_rev(self): """ Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes doesn't work with a ssh:// scheme (e.g. Github). But we need a scheme for parsing. Hence we remove it again afterwards and ...
def get_url_rev(self): """ Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes doesn't work with a ssh:// scheme (e.g. Github). But we need a scheme for parsing. Hence we remove it again afterwards and ...
[ "Prefixes", "stub", "URLs", "like", "user" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/vcs/git.py#L184-L199
[ "def", "get_url_rev", "(", "self", ")", ":", "if", "'://'", "not", "in", "self", ".", "url", ":", "assert", "'file:'", "not", "in", "self", ".", "url", "self", ".", "url", "=", "self", ".", "url", ".", "replace", "(", "'git+'", ",", "'git+ssh://'", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
ExtensionImporter.is_important_traceback
Walks a traceback's frames and checks if any of the frames originated in the given important module. If that is the case then we were able to import the module itself but apparently something went wrong when the module was imported. (Eg: import of an import failed).
capybara/virtualenv/lib/python2.7/site-packages/flask/exthook.py
def is_important_traceback(self, important_module, tb): """Walks a traceback's frames and checks if any of the frames originated in the given important module. If that is the case then we were able to import the module itself but apparently something went wrong when the module was impor...
def is_important_traceback(self, important_module, tb): """Walks a traceback's frames and checks if any of the frames originated in the given important module. If that is the case then we were able to import the module itself but apparently something went wrong when the module was impor...
[ "Walks", "a", "traceback", "s", "frames", "and", "checks", "if", "any", "of", "the", "frames", "originated", "in", "the", "given", "important", "module", ".", "If", "that", "is", "the", "case", "then", "we", "were", "able", "to", "import", "the", "module...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/exthook.py#L89-L99
[ "def", "is_important_traceback", "(", "self", ",", "important_module", ",", "tb", ")", ":", "while", "tb", "is", "not", "None", ":", "if", "self", ".", "is_important_frame", "(", "important_module", ",", "tb", ")", ":", "return", "True", "tb", "=", "tb", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Environment.getitem
Get an item or attribute of an object but prefer the item.
capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py
def getitem(self, obj, argument): """Get an item or attribute of an object but prefer the item.""" try: return obj[argument] except (TypeError, LookupError): if isinstance(argument, string_types): try: attr = str(argument) ...
def getitem(self, obj, argument): """Get an item or attribute of an object but prefer the item.""" try: return obj[argument] except (TypeError, LookupError): if isinstance(argument, string_types): try: attr = str(argument) ...
[ "Get", "an", "item", "or", "attribute", "of", "an", "object", "but", "prefer", "the", "item", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py#L375-L390
[ "def", "getitem", "(", "self", ",", "obj", ",", "argument", ")", ":", "try", ":", "return", "obj", "[", "argument", "]", "except", "(", "TypeError", ",", "LookupError", ")", ":", "if", "isinstance", "(", "argument", ",", "string_types", ")", ":", "try"...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Environment._generate
Internal hook that can be overridden to hook a different generate method in. .. versionadded:: 2.5
capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py
def _generate(self, source, name, filename, defer_init=False): """Internal hook that can be overridden to hook a different generate method in. .. versionadded:: 2.5 """ return generate(source, self, name, filename, defer_init=defer_init)
def _generate(self, source, name, filename, defer_init=False): """Internal hook that can be overridden to hook a different generate method in. .. versionadded:: 2.5 """ return generate(source, self, name, filename, defer_init=defer_init)
[ "Internal", "hook", "that", "can", "be", "overridden", "to", "hook", "a", "different", "generate", "method", "in", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py#L498-L504
[ "def", "_generate", "(", "self", ",", "source", ",", "name", ",", "filename", ",", "defer_init", "=", "False", ")", ":", "return", "generate", "(", "source", ",", "self", ",", "name", ",", "filename", ",", "defer_init", "=", "defer_init", ")" ]
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Environment.compile_templates
Finds all the templates the loader can find, compiles them and stores them in `target`. If `zip` is `None`, instead of in a zipfile, the templates will be will be stored in a directory. By default a deflate zip algorithm is used, to switch to the stored algorithm, `zip` can be set to ``...
capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py
def compile_templates(self, target, extensions=None, filter_func=None, zip='deflated', log_function=None, ignore_errors=True, py_compile=False): """Finds all the templates the loader can find, compiles them and stores them in `target`. If `zip` is `No...
def compile_templates(self, target, extensions=None, filter_func=None, zip='deflated', log_function=None, ignore_errors=True, py_compile=False): """Finds all the templates the loader can find, compiles them and stores them in `target`. If `zip` is `No...
[ "Finds", "all", "the", "templates", "the", "loader", "can", "find", "compiles", "them", "and", "stores", "them", "in", "target", ".", "If", "zip", "is", "None", "instead", "of", "in", "a", "zipfile", "the", "templates", "will", "be", "will", "be", "store...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py#L601-L693
[ "def", "compile_templates", "(", "self", ",", "target", ",", "extensions", "=", "None", ",", "filter_func", "=", "None", ",", "zip", "=", "'deflated'", ",", "log_function", "=", "None", ",", "ignore_errors", "=", "True", ",", "py_compile", "=", "False", ")...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Environment.list_templates
Returns a list of templates for this environment. This requires that the loader supports the loader's :meth:`~BaseLoader.list_templates` method. If there are other files in the template folder besides the actual templates, the returned list can be filtered. There are two ways:...
capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py
def list_templates(self, extensions=None, filter_func=None): """Returns a list of templates for this environment. This requires that the loader supports the loader's :meth:`~BaseLoader.list_templates` method. If there are other files in the template folder besides the actual te...
def list_templates(self, extensions=None, filter_func=None): """Returns a list of templates for this environment. This requires that the loader supports the loader's :meth:`~BaseLoader.list_templates` method. If there are other files in the template folder besides the actual te...
[ "Returns", "a", "list", "of", "templates", "for", "this", "environment", ".", "This", "requires", "that", "the", "loader", "supports", "the", "loader", "s", ":", "meth", ":", "~BaseLoader", ".", "list_templates", "method", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py#L695-L720
[ "def", "list_templates", "(", "self", ",", "extensions", "=", "None", ",", "filter_func", "=", "None", ")", ":", "x", "=", "self", ".", "loader", ".", "list_templates", "(", ")", "if", "extensions", "is", "not", "None", ":", "if", "filter_func", "is", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
get_default_cache
Determine the default cache location This returns the ``PYTHON_EGG_CACHE`` environment variable, if set. Otherwise, on Windows, it returns a "Python-Eggs" subdirectory of the "Application Data" directory. On all other systems, it's "~/.python-eggs".
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def get_default_cache(): """Determine the default cache location This returns the ``PYTHON_EGG_CACHE`` environment variable, if set. Otherwise, on Windows, it returns a "Python-Eggs" subdirectory of the "Application Data" directory. On all other systems, it's "~/.python-eggs". """ try: ...
def get_default_cache(): """Determine the default cache location This returns the ``PYTHON_EGG_CACHE`` environment variable, if set. Otherwise, on Windows, it returns a "Python-Eggs" subdirectory of the "Application Data" directory. On all other systems, it's "~/.python-eggs". """ try: ...
[ "Determine", "the", "default", "cache", "location" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1299-L1341
[ "def", "get_default_cache", "(", ")", ":", "try", ":", "return", "os", ".", "environ", "[", "'PYTHON_EGG_CACHE'", "]", "except", "KeyError", ":", "pass", "if", "os", ".", "name", "!=", "'nt'", ":", "return", "os", ".", "path", ".", "expanduser", "(", "...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
find_eggs_in_zip
Find eggs in zip files; possibly multiple nested eggs.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def find_eggs_in_zip(importer, path_item, only=False): """ Find eggs in zip files; possibly multiple nested eggs. """ if importer.archive.endswith('.whl'): # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return meta...
def find_eggs_in_zip(importer, path_item, only=False): """ Find eggs in zip files; possibly multiple nested eggs. """ if importer.archive.endswith('.whl'): # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return meta...
[ "Find", "eggs", "in", "zip", "files", ";", "possibly", "multiple", "nested", "eggs", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2050-L2068
[ "def", "find_eggs_in_zip", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "if", "importer", ".", "archive", ".", "endswith", "(", "'.whl'", ")", ":", "# wheels are not supported with this finder", "# they don't have PKG-INFO metadata, and won't ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
find_on_path
Yield distributions accessible on a sys.path directory
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if os.path.isdir(path_item) and os.access(path_item, os.R_OK): if path_item.lower().endswith('.egg'): # unpacked egg yield...
def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if os.path.isdir(path_item) and os.access(path_item, os.R_OK): if path_item.lower().endswith('.egg'): # unpacked egg yield...
[ "Yield", "distributions", "accessible", "on", "a", "sys", ".", "path", "directory" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2076-L2116
[ "def", "find_on_path", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "path_item", "=", "_normalize_cached", "(", "path_item", ")", "if", "os", ".", "path", ".", "isdir", "(", "path_item", ")", "and", "os", ".", "access", "(", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
declare_namespace
Declare that package 'packageName' is a namespace package
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" imp.acquire_lock() try: if packageName in _namespace_packages: return path, parent = sys.path, None if '.' in packageName: parent = '.'.join(packageName.split...
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" imp.acquire_lock() try: if packageName in _namespace_packages: return path, parent = sys.path, None if '.' in packageName: parent = '.'.join(packageName.split...
[ "Declare", "that", "package", "packageName", "is", "a", "namespace", "package" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2170-L2200
[ "def", "declare_namespace", "(", "packageName", ")", ":", "imp", ".", "acquire_lock", "(", ")", "try", ":", "if", "packageName", "in", "_namespace_packages", ":", "return", "path", ",", "parent", "=", "sys", ".", "path", ",", "None", "if", "'.'", "in", "...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
yield_lines
Yield non-empty/non-comment lines of a string or sequence
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def yield_lines(strs): """Yield non-empty/non-comment lines of a string or sequence""" if isinstance(strs, string_types): for s in strs.splitlines(): s = s.strip() # skip blank lines/comments if s and not s.startswith('#'): yield s else: fo...
def yield_lines(strs): """Yield non-empty/non-comment lines of a string or sequence""" if isinstance(strs, string_types): for s in strs.splitlines(): s = s.strip() # skip blank lines/comments if s and not s.startswith('#'): yield s else: fo...
[ "Yield", "non", "-", "empty", "/", "non", "-", "comment", "lines", "of", "a", "string", "or", "sequence" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2257-L2268
[ "def", "yield_lines", "(", "strs", ")", ":", "if", "isinstance", "(", "strs", ",", "string_types", ")", ":", "for", "s", "in", "strs", ".", "splitlines", "(", ")", ":", "s", "=", "s", ".", "strip", "(", ")", "# skip blank lines/comments", "if", "s", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_get_mro
Get an mro for a type or classic class
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def _get_mro(cls): """Get an mro for a type or classic class""" if not isinstance(cls, type): class cls(cls, object): pass return cls.__mro__[1:] return cls.__mro__
def _get_mro(cls): """Get an mro for a type or classic class""" if not isinstance(cls, type): class cls(cls, object): pass return cls.__mro__[1:] return cls.__mro__
[ "Get", "an", "mro", "for", "a", "type", "or", "classic", "class" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2968-L2973
[ "def", "_get_mro", "(", "cls", ")", ":", "if", "not", "isinstance", "(", "cls", ",", "type", ")", ":", "class", "cls", "(", "cls", ",", "object", ")", ":", "pass", "return", "cls", ".", "__mro__", "[", "1", ":", "]", "return", "cls", ".", "__mro_...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_find_adapter
Return an adapter factory for `ob` from `registry`
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def _find_adapter(registry, ob): """Return an adapter factory for `ob` from `registry`""" for t in _get_mro(getattr(ob, '__class__', type(ob))): if t in registry: return registry[t]
def _find_adapter(registry, ob): """Return an adapter factory for `ob` from `registry`""" for t in _get_mro(getattr(ob, '__class__', type(ob))): if t in registry: return registry[t]
[ "Return", "an", "adapter", "factory", "for", "ob", "from", "registry" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2975-L2979
[ "def", "_find_adapter", "(", "registry", ",", "ob", ")", ":", "for", "t", "in", "_get_mro", "(", "getattr", "(", "ob", ",", "'__class__'", ",", "type", "(", "ob", ")", ")", ")", ":", "if", "t", "in", "registry", ":", "return", "registry", "[", "t",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
ensure_directory
Ensure that the parent directory of `path` exists
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname)
def ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname)
[ "Ensure", "that", "the", "parent", "directory", "of", "path", "exists" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2982-L2986
[ "def", "ensure_directory", "(", "path", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "dirname", ")", ":", "os", ".", "makedirs", "(", "dirname", ")" ]
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
WorkingSet.iter_entry_points
Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution order).
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def iter_entry_points(self, group, name=None): """Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution ord...
def iter_entry_points(self, group, name=None): """Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution ord...
[ "Yield", "entry", "point", "objects", "from", "group", "matching", "name" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L696-L709
[ "def", "iter_entry_points", "(", "self", ",", "group", ",", "name", "=", "None", ")", ":", "for", "dist", "in", "self", ":", "entries", "=", "dist", ".", "get_entry_map", "(", "group", ")", "if", "name", "is", "None", ":", "for", "ep", "in", "entries...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
WorkingSet.subscribe
Invoke `callback` for all distributions (including existing ones)
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def subscribe(self, callback): """Invoke `callback` for all distributions (including existing ones)""" if callback in self.callbacks: return self.callbacks.append(callback) for dist in self: callback(dist)
def subscribe(self, callback): """Invoke `callback` for all distributions (including existing ones)""" if callback in self.callbacks: return self.callbacks.append(callback) for dist in self: callback(dist)
[ "Invoke", "callback", "for", "all", "distributions", "(", "including", "existing", "ones", ")" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L941-L947
[ "def", "subscribe", "(", "self", ",", "callback", ")", ":", "if", "callback", "in", "self", ".", "callbacks", ":", "return", "self", ".", "callbacks", ".", "append", "(", "callback", ")", "for", "dist", "in", "self", ":", "callback", "(", "dist", ")" ]
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Environment.can_add
Is distribution `dist` acceptable for this environment? The distribution must match the platform and python version requirements specified when this environment was created, or False is returned.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def can_add(self, dist): """Is distribution `dist` acceptable for this environment? The distribution must match the platform and python version requirements specified when this environment was created, or False is returned. """ return (self.python is None or dist.py_vers...
def can_add(self, dist): """Is distribution `dist` acceptable for this environment? The distribution must match the platform and python version requirements specified when this environment was created, or False is returned. """ return (self.python is None or dist.py_vers...
[ "Is", "distribution", "dist", "acceptable", "for", "this", "environment?" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L993-L1002
[ "def", "can_add", "(", "self", ",", "dist", ")", ":", "return", "(", "self", ".", "python", "is", "None", "or", "dist", ".", "py_version", "is", "None", "or", "dist", ".", "py_version", "==", "self", ".", "python", ")", "and", "compatible_platforms", "...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Environment.best_match
Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitable version of the project is already active in the specified...
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def best_match(self, req, working_set, installer=None): """Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitabl...
def best_match(self, req, working_set, installer=None): """Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitabl...
[ "Find", "distribution", "best", "matching", "req", "and", "usable", "on", "working_set" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1043-L1063
[ "def", "best_match", "(", "self", ",", "req", ",", "working_set", ",", "installer", "=", "None", ")", ":", "dist", "=", "working_set", ".", "find", "(", "req", ")", "if", "dist", "is", "not", "None", ":", "return", "dist", "for", "dist", "in", "self"...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
ResourceManager.extraction_error
Give an error message for problems extracting file(s)
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def extraction_error(self): """Give an error message for problems extracting file(s)""" old_exc = sys.exc_info()[1] cache_path = self.extraction_path or get_default_cache() err = ExtractionError("""Can't extract file(s) to egg cache The following error occurred while trying to extract...
def extraction_error(self): """Give an error message for problems extracting file(s)""" old_exc = sys.exc_info()[1] cache_path = self.extraction_path or get_default_cache() err = ExtractionError("""Can't extract file(s) to egg cache The following error occurred while trying to extract...
[ "Give", "an", "error", "message", "for", "problems", "extracting", "file", "(", "s", ")" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1164-L1189
[ "def", "extraction_error", "(", "self", ")", ":", "old_exc", "=", "sys", ".", "exc_info", "(", ")", "[", "1", "]", "cache_path", "=", "self", ".", "extraction_path", "or", "get_default_cache", "(", ")", "err", "=", "ExtractionError", "(", "\"\"\"Can't extrac...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
MarkerEvaluation.is_invalid_marker
Validate text as a PEP 426 environment marker; return an exception if invalid or False otherwise.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def is_invalid_marker(cls, text): """ Validate text as a PEP 426 environment marker; return an exception if invalid or False otherwise. """ try: cls.evaluate_marker(text) except SyntaxError as e: return cls.normalize_exception(e) return Fal...
def is_invalid_marker(cls, text): """ Validate text as a PEP 426 environment marker; return an exception if invalid or False otherwise. """ try: cls.evaluate_marker(text) except SyntaxError as e: return cls.normalize_exception(e) return Fal...
[ "Validate", "text", "as", "a", "PEP", "426", "environment", "marker", ";", "return", "an", "exception", "if", "invalid", "or", "False", "otherwise", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1392-L1401
[ "def", "is_invalid_marker", "(", "cls", ",", "text", ")", ":", "try", ":", "cls", ".", "evaluate_marker", "(", "text", ")", "except", "SyntaxError", "as", "e", ":", "return", "cls", ".", "normalize_exception", "(", "e", ")", "return", "False" ]
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
MarkerEvaluation.normalize_exception
Given a SyntaxError from a marker evaluation, normalize the error message: - Remove indications of filename and line number. - Replace platform-specific error messages with standard error messages.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def normalize_exception(exc): """ Given a SyntaxError from a marker evaluation, normalize the error message: - Remove indications of filename and line number. - Replace platform-specific error messages with standard error messages. """ subs = { ...
def normalize_exception(exc): """ Given a SyntaxError from a marker evaluation, normalize the error message: - Remove indications of filename and line number. - Replace platform-specific error messages with standard error messages. """ subs = { ...
[ "Given", "a", "SyntaxError", "from", "a", "marker", "evaluation", "normalize", "the", "error", "message", ":", "-", "Remove", "indications", "of", "filename", "and", "line", "number", ".", "-", "Replace", "platform", "-", "specific", "error", "messages", "with...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1404-L1419
[ "def", "normalize_exception", "(", "exc", ")", ":", "subs", "=", "{", "'unexpected EOF while parsing'", ":", "'invalid syntax'", ",", "'parenthesis is never closed'", ":", "'invalid syntax'", ",", "}", "exc", ".", "filename", "=", "None", "exc", ".", "lineno", "="...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
MarkerEvaluation.evaluate_marker
Evaluate a PEP 426 environment marker on CPython 2.4+. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'parser' module, which is not implemented on Jython and has been superseded by the 'ast'...
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def evaluate_marker(cls, text, extra=None): """ Evaluate a PEP 426 environment marker on CPython 2.4+. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'parser' module, which is not implemente...
def evaluate_marker(cls, text, extra=None): """ Evaluate a PEP 426 environment marker on CPython 2.4+. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'parser' module, which is not implemente...
[ "Evaluate", "a", "PEP", "426", "environment", "marker", "on", "CPython", "2", ".", "4", "+", ".", "Return", "a", "boolean", "indicating", "the", "marker", "result", "in", "this", "environment", ".", "Raise", "SyntaxError", "if", "marker", "is", "invalid", ...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1486-L1497
[ "def", "evaluate_marker", "(", "cls", ",", "text", ",", "extra", "=", "None", ")", ":", "return", "cls", ".", "interpret", "(", "parser", ".", "expr", "(", "text", ")", ".", "totuple", "(", "1", ")", "[", "1", "]", ")" ]
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
MarkerEvaluation._markerlib_evaluate
Evaluate a PEP 426 environment marker using markerlib. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def _markerlib_evaluate(cls, text): """ Evaluate a PEP 426 environment marker using markerlib. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. """ from pip._vendor import _markerlib # markerlib implements ...
def _markerlib_evaluate(cls, text): """ Evaluate a PEP 426 environment marker using markerlib. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. """ from pip._vendor import _markerlib # markerlib implements ...
[ "Evaluate", "a", "PEP", "426", "environment", "marker", "using", "markerlib", ".", "Return", "a", "boolean", "indicating", "the", "marker", "result", "in", "this", "environment", ".", "Raise", "SyntaxError", "if", "marker", "is", "invalid", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1500-L1517
[ "def", "_markerlib_evaluate", "(", "cls", ",", "text", ")", ":", "from", "pip", ".", "_vendor", "import", "_markerlib", "# markerlib implements Metadata 1.2 (PEP 345) environment markers.", "# Translate the variables to Metadata 2.0 (PEP 426).", "env", "=", "_markerlib", ".", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Distribution.insert_on
Insert self.location in path before its nearest parent directory
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def insert_on(self, path, loc = None): """Insert self.location in path before its nearest parent directory""" loc = loc or self.location if not loc: return nloc = _normalize_cached(loc) bdir = os.path.dirname(nloc) npath= [(p and _normalize_cached(p) or p) f...
def insert_on(self, path, loc = None): """Insert self.location in path before its nearest parent directory""" loc = loc or self.location if not loc: return nloc = _normalize_cached(loc) bdir = os.path.dirname(nloc) npath= [(p and _normalize_cached(p) or p) f...
[ "Insert", "self", ".", "location", "in", "path", "before", "its", "nearest", "parent", "directory" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2678-L2716
[ "def", "insert_on", "(", "self", ",", "path", ",", "loc", "=", "None", ")", ":", "loc", "=", "loc", "or", "self", ".", "location", "if", "not", "loc", ":", "return", "nloc", "=", "_normalize_cached", "(", "loc", ")", "bdir", "=", "os", ".", "path",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
DistInfoDistribution._preparse_requirement
Convert 'Foobar (1); baz' to ('Foobar ==1', 'baz') Split environment marker, add == prefix to version specifiers as necessary, and remove parenthesis.
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
def _preparse_requirement(self, requires_dist): """Convert 'Foobar (1); baz' to ('Foobar ==1', 'baz') Split environment marker, add == prefix to version specifiers as necessary, and remove parenthesis. """ parts = requires_dist.split(';', 1) + [''] distvers = parts[0].str...
def _preparse_requirement(self, requires_dist): """Convert 'Foobar (1); baz' to ('Foobar ==1', 'baz') Split environment marker, add == prefix to version specifiers as necessary, and remove parenthesis. """ parts = requires_dist.split(';', 1) + [''] distvers = parts[0].str...
[ "Convert", "Foobar", "(", "1", ")", ";", "baz", "to", "(", "Foobar", "==", "1", "baz", ")", "Split", "environment", "marker", "add", "==", "prefix", "to", "version", "specifiers", "as", "necessary", "and", "remove", "parenthesis", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2784-L2794
[ "def", "_preparse_requirement", "(", "self", ",", "requires_dist", ")", ":", "parts", "=", "requires_dist", ".", "split", "(", "';'", ",", "1", ")", "+", "[", "''", "]", "distvers", "=", "parts", "[", "0", "]", ".", "strip", "(", ")", "mark", "=", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
IndentingFormatter.format
Calls the standard formatter, but will indent all of the log messages by our current indentation level.
capybara/virtualenv/lib/python2.7/site-packages/pip/utils/logging.py
def format(self, record): """ Calls the standard formatter, but will indent all of the log messages by our current indentation level. """ formatted = logging.Formatter.format(self, record) formatted = "".join([ (" " * get_indentation()) + line for ...
def format(self, record): """ Calls the standard formatter, but will indent all of the log messages by our current indentation level. """ formatted = logging.Formatter.format(self, record) formatted = "".join([ (" " * get_indentation()) + line for ...
[ "Calls", "the", "standard", "formatter", "but", "will", "indent", "all", "of", "the", "log", "messages", "by", "our", "current", "indentation", "level", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/utils/logging.py#L47-L57
[ "def", "format", "(", "self", ",", "record", ")", ":", "formatted", "=", "logging", ".", "Formatter", ".", "format", "(", "self", ",", "record", ")", "formatted", "=", "\"\"", ".", "join", "(", "[", "(", "\" \"", "*", "get_indentation", "(", ")", ")"...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
format_currency
Return formatted currency value. >>> format_currency(1099.98, 'USD', locale='en_US') u'$1,099.98' >>> format_currency(1099.98, 'USD', locale='es_CO') u'US$\\xa01.099,98' >>> format_currency(1099.98, 'EUR', locale='de_DE') u'1.099,98\\xa0\\u20ac' The format can also be specified explicitly....
pricing/babel_numbers.py
def format_currency(number, currency, format=None, locale=LC_NUMERIC, currency_digits=True, format_type='standard', decimal_quantization=True): """Return formatted currency value. >>> format_currency(1099.98, 'USD', locale='en_US') u'$1,099.98' >>> format_curren...
def format_currency(number, currency, format=None, locale=LC_NUMERIC, currency_digits=True, format_type='standard', decimal_quantization=True): """Return formatted currency value. >>> format_currency(1099.98, 'USD', locale='en_US') u'$1,099.98' >>> format_curren...
[ "Return", "formatted", "currency", "value", "." ]
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/babel_numbers.py#L22-L112
[ "def", "format_currency", "(", "number", ",", "currency", ",", "format", "=", "None", ",", "locale", "=", "LC_NUMERIC", ",", "currency_digits", "=", "True", ",", "format_type", "=", "'standard'", ",", "decimal_quantization", "=", "True", ")", ":", "locale", ...
be988b0851b4313af81f1db475bc33248700e39c
test
parse_pattern
Parse number format patterns
pricing/babel_numbers.py
def parse_pattern(pattern): """Parse number format patterns""" if isinstance(pattern, NumberPattern): return pattern def _match_number(pattern): rv = number_re.search(pattern) if rv is None: raise ValueError('Invalid number pattern %r' % pattern) return rv.groups...
def parse_pattern(pattern): """Parse number format patterns""" if isinstance(pattern, NumberPattern): return pattern def _match_number(pattern): rv = number_re.search(pattern) if rv is None: raise ValueError('Invalid number pattern %r' % pattern) return rv.groups...
[ "Parse", "number", "format", "patterns" ]
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/babel_numbers.py#L115-L179
[ "def", "parse_pattern", "(", "pattern", ")", ":", "if", "isinstance", "(", "pattern", ",", "NumberPattern", ")", ":", "return", "pattern", "def", "_match_number", "(", "pattern", ")", ":", "rv", "=", "number_re", ".", "search", "(", "pattern", ")", "if", ...
be988b0851b4313af81f1db475bc33248700e39c
test
get_decimal_quantum
Return minimal quantum of a number, as defined by precision.
pricing/babel_numbers.py
def get_decimal_quantum(precision): """Return minimal quantum of a number, as defined by precision.""" assert isinstance(precision, (int, decimal.Decimal)) return decimal.Decimal(10) ** (-precision)
def get_decimal_quantum(precision): """Return minimal quantum of a number, as defined by precision.""" assert isinstance(precision, (int, decimal.Decimal)) return decimal.Decimal(10) ** (-precision)
[ "Return", "minimal", "quantum", "of", "a", "number", "as", "defined", "by", "precision", "." ]
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/babel_numbers.py#L297-L300
[ "def", "get_decimal_quantum", "(", "precision", ")", ":", "assert", "isinstance", "(", "precision", ",", "(", "int", ",", "decimal", ".", "Decimal", ")", ")", "return", "decimal", ".", "Decimal", "(", "10", ")", "**", "(", "-", "precision", ")" ]
be988b0851b4313af81f1db475bc33248700e39c
test
get_decimal_precision
Return maximum precision of a decimal instance's fractional part. Precision is extracted from the fractional part only.
pricing/babel_numbers.py
def get_decimal_precision(number): """Return maximum precision of a decimal instance's fractional part. Precision is extracted from the fractional part only. """ # Copied from: https://github.com/mahmoud/boltons/pull/59 assert isinstance(number, decimal.Decimal) decimal_tuple = number.normalize(...
def get_decimal_precision(number): """Return maximum precision of a decimal instance's fractional part. Precision is extracted from the fractional part only. """ # Copied from: https://github.com/mahmoud/boltons/pull/59 assert isinstance(number, decimal.Decimal) decimal_tuple = number.normalize(...
[ "Return", "maximum", "precision", "of", "a", "decimal", "instance", "s", "fractional", "part", ".", "Precision", "is", "extracted", "from", "the", "fractional", "part", "only", "." ]
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/babel_numbers.py#L303-L312
[ "def", "get_decimal_precision", "(", "number", ")", ":", "# Copied from: https://github.com/mahmoud/boltons/pull/59", "assert", "isinstance", "(", "number", ",", "decimal", ".", "Decimal", ")", "decimal_tuple", "=", "number", ".", "normalize", "(", ")", ".", "as_tuple...
be988b0851b4313af81f1db475bc33248700e39c
test
NumberPattern.apply
Renders into a string a number following the defined pattern. Forced decimal quantization is active by default so we'll produce a number string that is strictly following CLDR pattern definitions.
pricing/babel_numbers.py
def apply( self, value, locale, currency=None, currency_digits=True, decimal_quantization=True): """Renders into a string a number following the defined pattern. Forced decimal quantization is active by default so we'll produce a number string that is strictly following C...
def apply( self, value, locale, currency=None, currency_digits=True, decimal_quantization=True): """Renders into a string a number following the defined pattern. Forced decimal quantization is active by default so we'll produce a number string that is strictly following C...
[ "Renders", "into", "a", "string", "a", "number", "following", "the", "defined", "pattern", ".", "Forced", "decimal", "quantization", "is", "active", "by", "default", "so", "we", "ll", "produce", "a", "number", "string", "that", "is", "strictly", "following", ...
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/babel_numbers.py#L185-L259
[ "def", "apply", "(", "self", ",", "value", ",", "locale", ",", "currency", "=", "None", ",", "currency_digits", "=", "True", ",", "decimal_quantization", "=", "True", ")", ":", "if", "not", "isinstance", "(", "value", ",", "decimal", ".", "Decimal", ")",...
be988b0851b4313af81f1db475bc33248700e39c
test
NumberPattern.scientific_notation_elements
Returns normalized scientific notation components of a value.
pricing/babel_numbers.py
def scientific_notation_elements(self, value, locale): """ Returns normalized scientific notation components of a value.""" # Normalize value to only have one lead digit. exp = value.adjusted() value = value * get_decimal_quantum(exp) assert value.adjusted() == 0 # Shift...
def scientific_notation_elements(self, value, locale): """ Returns normalized scientific notation components of a value.""" # Normalize value to only have one lead digit. exp = value.adjusted() value = value * get_decimal_quantum(exp) assert value.adjusted() == 0 # Shift...
[ "Returns", "normalized", "scientific", "notation", "components", "of", "a", "value", "." ]
joeblackwaslike/pricing
python
https://github.com/joeblackwaslike/pricing/blob/be988b0851b4313af81f1db475bc33248700e39c/pricing/babel_numbers.py#L270-L294
[ "def", "scientific_notation_elements", "(", "self", ",", "value", ",", "locale", ")", ":", "# Normalize value to only have one lead digit.", "exp", "=", "value", ".", "adjusted", "(", ")", "value", "=", "value", "*", "get_decimal_quantum", "(", "exp", ")", "assert...
be988b0851b4313af81f1db475bc33248700e39c
test
patch_for_specialized_compiler
Patch functions in distutils.msvc9compiler to use the standalone compiler build for Python (Windows only). Fall back to original behavior when the standalone compiler is not available.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/msvc9_support.py
def patch_for_specialized_compiler(): """ Patch functions in distutils.msvc9compiler to use the standalone compiler build for Python (Windows only). Fall back to original behavior when the standalone compiler is not available. """ if 'distutils' not in globals(): # The module isn't avail...
def patch_for_specialized_compiler(): """ Patch functions in distutils.msvc9compiler to use the standalone compiler build for Python (Windows only). Fall back to original behavior when the standalone compiler is not available. """ if 'distutils' not in globals(): # The module isn't avail...
[ "Patch", "functions", "in", "distutils", ".", "msvc9compiler", "to", "use", "the", "standalone", "compiler", "build", "for", "Python", "(", "Windows", "only", ")", ".", "Fall", "back", "to", "original", "behavior", "when", "the", "standalone", "compiler", "is"...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/msvc9_support.py#L8-L25
[ "def", "patch_for_specialized_compiler", "(", ")", ":", "if", "'distutils'", "not", "in", "globals", "(", ")", ":", "# The module isn't available to be patched", "return", "if", "unpatched", ":", "# Already patched", "return", "unpatched", ".", "update", "(", "vars", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
total_seconds
Python 2.6 compatability
capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py
def total_seconds(td): """Python 2.6 compatability""" if hasattr(td, 'total_seconds'): return td.total_seconds() ms = td.microseconds secs = (td.seconds + td.days * 24 * 3600) return (ms + secs * 10**6) / 10**6
def total_seconds(td): """Python 2.6 compatability""" if hasattr(td, 'total_seconds'): return td.total_seconds() ms = td.microseconds secs = (td.seconds + td.days * 24 * 3600) return (ms + secs * 10**6) / 10**6
[ "Python", "2", ".", "6", "compatability" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py#L6-L13
[ "def", "total_seconds", "(", "td", ")", ":", "if", "hasattr", "(", "td", ",", "'total_seconds'", ")", ":", "return", "td", ".", "total_seconds", "(", ")", "ms", "=", "td", ".", "microseconds", "secs", "=", "(", "td", ".", "seconds", "+", "td", ".", ...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
parse_requirements
Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof.
capybara/virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py
def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) def scan_list(ITEM, TERMINATOR, ...
def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) def scan_list(ITEM, TERMINATOR, ...
[ "Yield", "Requirement", "objects", "for", "each", "specification", "in", "strs" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py#L2861-L2922
[ "def", "parse_requirements", "(", "strs", ")", ":", "# create a steppable iterator, so we can handle \\-continuations", "lines", "=", "iter", "(", "yield_lines", "(", "strs", ")", ")", "def", "scan_list", "(", "ITEM", ",", "TERMINATOR", ",", "line", ",", "p", ",",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_initialize
Set up global resource manager (deliberately not state-saved)
capybara/virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py
def _initialize(g=globals()): "Set up global resource manager (deliberately not state-saved)" manager = ResourceManager() g['_manager'] = manager for name in dir(manager): if not name.startswith('_'): g[name] = getattr(manager, name)
def _initialize(g=globals()): "Set up global resource manager (deliberately not state-saved)" manager = ResourceManager() g['_manager'] = manager for name in dir(manager): if not name.startswith('_'): g[name] = getattr(manager, name)
[ "Set", "up", "global", "resource", "manager", "(", "deliberately", "not", "state", "-", "saved", ")" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py#L3065-L3071
[ "def", "_initialize", "(", "g", "=", "globals", "(", ")", ")", ":", "manager", "=", "ResourceManager", "(", ")", "g", "[", "'_manager'", "]", "=", "manager", "for", "name", "in", "dir", "(", "manager", ")", ":", "if", "not", "name", ".", "startswith"...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_initialize_master_working_set
Prepare the master working set and make the ``require()`` API available. This function has explicit effects on the global state of pkg_resources. It is intended to be invoked once at the initialization of this module. Invocation by other packages is unsupported and done at their own risk.
capybara/virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py
def _initialize_master_working_set(): """ Prepare the master working set and make the ``require()`` API available. This function has explicit effects on the global state of pkg_resources. It is intended to be invoked once at the initialization of this module. Invocation by other packages i...
def _initialize_master_working_set(): """ Prepare the master working set and make the ``require()`` API available. This function has explicit effects on the global state of pkg_resources. It is intended to be invoked once at the initialization of this module. Invocation by other packages i...
[ "Prepare", "the", "master", "working", "set", "and", "make", "the", "require", "()", "API", "available", "." ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py#L3075-L3103
[ "def", "_initialize_master_working_set", "(", ")", ":", "working_set", "=", "WorkingSet", ".", "_build_master", "(", ")", "_declare_state", "(", "'object'", ",", "working_set", "=", "working_set", ")", "require", "=", "working_set", ".", "require", "iter_entry_point...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_get_unpatched
Protect against re-patching the distutils if reloaded Also ensures that no other distutils extension monkeypatched the distutils first.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py
def _get_unpatched(cls): """Protect against re-patching the distutils if reloaded Also ensures that no other distutils extension monkeypatched the distutils first. """ while cls.__module__.startswith('setuptools'): cls, = cls.__bases__ if not cls.__module__.startswith('distutils'): ...
def _get_unpatched(cls): """Protect against re-patching the distutils if reloaded Also ensures that no other distutils extension monkeypatched the distutils first. """ while cls.__module__.startswith('setuptools'): cls, = cls.__bases__ if not cls.__module__.startswith('distutils'): ...
[ "Protect", "against", "re", "-", "patching", "the", "distutils", "if", "reloaded" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L24-L36
[ "def", "_get_unpatched", "(", "cls", ")", ":", "while", "cls", ".", "__module__", ".", "startswith", "(", "'setuptools'", ")", ":", "cls", ",", "=", "cls", ".", "__bases__", "if", "not", "cls", ".", "__module__", ".", "startswith", "(", "'distutils'", ")...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
_patch_distribution_metadata_write_pkg_info
Workaround issue #197 - Python 3 prior to 3.2.2 uses an environment-local encoding to save the pkg_info. Monkey-patch its write_pkg_info method to correct this undesirable behavior.
capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py
def _patch_distribution_metadata_write_pkg_info(): """ Workaround issue #197 - Python 3 prior to 3.2.2 uses an environment-local encoding to save the pkg_info. Monkey-patch its write_pkg_info method to correct this undesirable behavior. """ environment_local = (3,) <= sys.version_info[:3] < (3, ...
def _patch_distribution_metadata_write_pkg_info(): """ Workaround issue #197 - Python 3 prior to 3.2.2 uses an environment-local encoding to save the pkg_info. Monkey-patch its write_pkg_info method to correct this undesirable behavior. """ environment_local = (3,) <= sys.version_info[:3] < (3, ...
[ "Workaround", "issue", "#197", "-", "Python", "3", "prior", "to", "3", ".", "2", ".", "2", "uses", "an", "environment", "-", "local", "encoding", "to", "save", "the", "pkg_info", ".", "Monkey", "-", "patch", "its", "write_pkg_info", "method", "to", "corr...
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L40-L58
[ "def", "_patch_distribution_metadata_write_pkg_info", "(", ")", ":", "environment_local", "=", "(", "3", ",", ")", "<=", "sys", ".", "version_info", "[", ":", "3", "]", "<", "(", "3", ",", "2", ",", "2", ")", "if", "not", "environment_local", ":", "retur...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
check_extras
Verify that extras_require mapping is valid
capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py
def check_extras(dist, attr, value): """Verify that extras_require mapping is valid""" try: for k,v in value.items(): if ':' in k: k,m = k.split(':',1) if pkg_resources.invalid_marker(m): raise DistutilsSetupError("Invalid environment marke...
def check_extras(dist, attr, value): """Verify that extras_require mapping is valid""" try: for k,v in value.items(): if ':' in k: k,m = k.split(':',1) if pkg_resources.invalid_marker(m): raise DistutilsSetupError("Invalid environment marke...
[ "Verify", "that", "extras_require", "mapping", "is", "valid" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L99-L113
[ "def", "check_extras", "(", "dist", ",", "attr", ",", "value", ")", ":", "try", ":", "for", "k", ",", "v", "in", "value", ".", "items", "(", ")", ":", "if", "':'", "in", "k", ":", "k", ",", "m", "=", "k", ".", "split", "(", "':'", ",", "1",...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
check_requirements
Verify that install_requires is a valid requirements list
capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py
def check_requirements(dist, attr, value): """Verify that install_requires is a valid requirements list""" try: list(pkg_resources.parse_requirements(value)) except (TypeError, ValueError) as error: tmpl = ( "{attr!r} must be a string or list of strings " "containing ...
def check_requirements(dist, attr, value): """Verify that install_requires is a valid requirements list""" try: list(pkg_resources.parse_requirements(value)) except (TypeError, ValueError) as error: tmpl = ( "{attr!r} must be a string or list of strings " "containing ...
[ "Verify", "that", "install_requires", "is", "a", "valid", "requirements", "list" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L122-L131
[ "def", "check_requirements", "(", "dist", ",", "attr", ",", "value", ")", ":", "try", ":", "list", "(", "pkg_resources", ".", "parse_requirements", "(", "value", ")", ")", "except", "(", "TypeError", ",", "ValueError", ")", "as", "error", ":", "tmpl", "=...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Distribution.fetch_build_egg
Fetch an egg needed for building
capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py
def fetch_build_egg(self, req): """Fetch an egg needed for building""" try: cmd = self._egg_fetcher cmd.package_index.to_scan = [] except AttributeError: from setuptools.command.easy_install import easy_install dist = self.__class__({'script_args'...
def fetch_build_egg(self, req): """Fetch an egg needed for building""" try: cmd = self._egg_fetcher cmd.package_index.to_scan = [] except AttributeError: from setuptools.command.easy_install import easy_install dist = self.__class__({'script_args'...
[ "Fetch", "an", "egg", "needed", "for", "building" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L349-L380
[ "def", "fetch_build_egg", "(", "self", ",", "req", ")", ":", "try", ":", "cmd", "=", "self", ".", "_egg_fetcher", "cmd", ".", "package_index", ".", "to_scan", "=", "[", "]", "except", "AttributeError", ":", "from", "setuptools", ".", "command", ".", "eas...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
Distribution._include_misc
Handle 'include()' for list/tuple attrs without a special handler
capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py
def _include_misc(self,name,value): """Handle 'include()' for list/tuple attrs without a special handler""" if not isinstance(value,sequence): raise DistutilsSetupError( "%s: setting must be a list (%r)" % (name, value) ) try: old = getattr(se...
def _include_misc(self,name,value): """Handle 'include()' for list/tuple attrs without a special handler""" if not isinstance(value,sequence): raise DistutilsSetupError( "%s: setting must be a list (%r)" % (name, value) ) try: old = getattr(se...
[ "Handle", "include", "()", "for", "list", "/", "tuple", "attrs", "without", "a", "special", "handler" ]
AkihikoITOH/capybara
python
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/dist.py#L534-L554
[ "def", "_include_misc", "(", "self", ",", "name", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "sequence", ")", ":", "raise", "DistutilsSetupError", "(", "\"%s: setting must be a list (%r)\"", "%", "(", "name", ",", "value", ")", ")"...
e86c2173ea386654f4ae061148e8fbe3f25e715c
test
do_dice_roll
Roll n-sided dice and return each result and the total
jaraco/util/dice.py
def do_dice_roll(): """ Roll n-sided dice and return each result and the total """ options = get_options() dice = Dice(options.sides) rolls = [dice.roll() for n in range(options.number)] for roll in rolls: print('rolled', roll) if options.number > 1: print('total', sum(rolls))
def do_dice_roll(): """ Roll n-sided dice and return each result and the total """ options = get_options() dice = Dice(options.sides) rolls = [dice.roll() for n in range(options.number)] for roll in rolls: print('rolled', roll) if options.number > 1: print('total', sum(rolls))
[ "Roll", "n", "-", "sided", "dice", "and", "return", "each", "result", "and", "the", "total" ]
jaraco/jaraco.util
python
https://github.com/jaraco/jaraco.util/blob/f21071c64f165a5cf844db15e39356e1a47f4b02/jaraco/util/dice.py#L32-L42
[ "def", "do_dice_roll", "(", ")", ":", "options", "=", "get_options", "(", ")", "dice", "=", "Dice", "(", "options", ".", "sides", ")", "rolls", "=", "[", "dice", ".", "roll", "(", ")", "for", "n", "in", "range", "(", "options", ".", "number", ")", ...
f21071c64f165a5cf844db15e39356e1a47f4b02