repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
pypa/pipenv
pipenv/vendor/cerberus/errors.py
ErrorTree.fetch_errors_from
def fetch_errors_from(self, path): """ Returns all errors for a particular path. :param path: :class:`tuple` of :term:`hashable` s. :rtype: :class:`~cerberus.errors.ErrorList` """ node = self.fetch_node_from(path) if node is not None: return node.errors ...
python
def fetch_errors_from(self, path): """ Returns all errors for a particular path. :param path: :class:`tuple` of :term:`hashable` s. :rtype: :class:`~cerberus.errors.ErrorList` """ node = self.fetch_node_from(path) if node is not None: return node.errors ...
[ "def", "fetch_errors_from", "(", "self", ",", "path", ")", ":", "node", "=", "self", ".", "fetch_node_from", "(", "path", ")", "if", "node", "is", "not", "None", ":", "return", "node", ".", "errors", "else", ":", "return", "ErrorList", "(", ")" ]
Returns all errors for a particular path. :param path: :class:`tuple` of :term:`hashable` s. :rtype: :class:`~cerberus.errors.ErrorList`
[ "Returns", "all", "errors", "for", "a", "particular", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L297-L307
train
pypa/pipenv
pipenv/vendor/cerberus/errors.py
ErrorTree.fetch_node_from
def fetch_node_from(self, path): """ Returns a node for a path. :param path: Tuple of :term:`hashable` s. :rtype: :class:`~cerberus.errors.ErrorTreeNode` or :obj:`None` """ context = self for key in path: context = context[key] if context is None:...
python
def fetch_node_from(self, path): """ Returns a node for a path. :param path: Tuple of :term:`hashable` s. :rtype: :class:`~cerberus.errors.ErrorTreeNode` or :obj:`None` """ context = self for key in path: context = context[key] if context is None:...
[ "def", "fetch_node_from", "(", "self", ",", "path", ")", ":", "context", "=", "self", "for", "key", "in", "path", ":", "context", "=", "context", "[", "key", "]", "if", "context", "is", "None", ":", "break", "return", "context" ]
Returns a node for a path. :param path: Tuple of :term:`hashable` s. :rtype: :class:`~cerberus.errors.ErrorTreeNode` or :obj:`None`
[ "Returns", "a", "node", "for", "a", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L309-L320
train
pypa/pipenv
pipenv/vendor/cerberus/errors.py
BasicErrorHandler._insert_error
def _insert_error(self, path, node): """ Adds an error or sub-tree to :attr:tree. :param path: Path to the error. :type path: Tuple of strings and integers. :param node: An error message or a sub-tree. :type node: String or dictionary. """ field = path[0] ...
python
def _insert_error(self, path, node): """ Adds an error or sub-tree to :attr:tree. :param path: Path to the error. :type path: Tuple of strings and integers. :param node: An error message or a sub-tree. :type node: String or dictionary. """ field = path[0] ...
[ "def", "_insert_error", "(", "self", ",", "path", ",", "node", ")", ":", "field", "=", "path", "[", "0", "]", "if", "len", "(", "path", ")", "==", "1", ":", "if", "field", "in", "self", ".", "tree", ":", "subtree", "=", "self", ".", "tree", "["...
Adds an error or sub-tree to :attr:tree. :param path: Path to the error. :type path: Tuple of strings and integers. :param node: An error message or a sub-tree. :type node: String or dictionary.
[ "Adds", "an", "error", "or", "sub", "-", "tree", "to", ":", "attr", ":", "tree", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L528-L553
train
pypa/pipenv
pipenv/vendor/cerberus/errors.py
BasicErrorHandler._rewrite_error_path
def _rewrite_error_path(self, error, offset=0): """ Recursively rewrites the error path to correctly represent logic errors """ if error.is_logic_error: self._rewrite_logic_error_path(error, offset) elif error.is_group_error: self._rewrite_group_error_path...
python
def _rewrite_error_path(self, error, offset=0): """ Recursively rewrites the error path to correctly represent logic errors """ if error.is_logic_error: self._rewrite_logic_error_path(error, offset) elif error.is_group_error: self._rewrite_group_error_path...
[ "def", "_rewrite_error_path", "(", "self", ",", "error", ",", "offset", "=", "0", ")", ":", "if", "error", ".", "is_logic_error", ":", "self", ".", "_rewrite_logic_error_path", "(", "error", ",", "offset", ")", "elif", "error", ".", "is_group_error", ":", ...
Recursively rewrites the error path to correctly represent logic errors
[ "Recursively", "rewrites", "the", "error", "path", "to", "correctly", "represent", "logic", "errors" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L589-L596
train
pypa/pipenv
pipenv/vendor/requests/hooks.py
dispatch_hook
def dispatch_hook(key, hooks, hook_data, **kwargs): """Dispatches a hook dictionary on a given piece of data.""" hooks = hooks or {} hooks = hooks.get(key) if hooks: if hasattr(hooks, '__call__'): hooks = [hooks] for hook in hooks: _hook_data = hook(hook_data, **k...
python
def dispatch_hook(key, hooks, hook_data, **kwargs): """Dispatches a hook dictionary on a given piece of data.""" hooks = hooks or {} hooks = hooks.get(key) if hooks: if hasattr(hooks, '__call__'): hooks = [hooks] for hook in hooks: _hook_data = hook(hook_data, **k...
[ "def", "dispatch_hook", "(", "key", ",", "hooks", ",", "hook_data", ",", "*", "*", "kwargs", ")", ":", "hooks", "=", "hooks", "or", "{", "}", "hooks", "=", "hooks", ".", "get", "(", "key", ")", "if", "hooks", ":", "if", "hasattr", "(", "hooks", "...
Dispatches a hook dictionary on a given piece of data.
[ "Dispatches", "a", "hook", "dictionary", "on", "a", "given", "piece", "of", "data", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/hooks.py#L23-L34
train
pypa/pipenv
pipenv/vendor/dotenv/cli.py
cli
def cli(ctx, file, quote): '''This script is used to set, get or unset values from a .env file.''' ctx.obj = {} ctx.obj['FILE'] = file ctx.obj['QUOTE'] = quote
python
def cli(ctx, file, quote): '''This script is used to set, get or unset values from a .env file.''' ctx.obj = {} ctx.obj['FILE'] = file ctx.obj['QUOTE'] = quote
[ "def", "cli", "(", "ctx", ",", "file", ",", "quote", ")", ":", "ctx", ".", "obj", "=", "{", "}", "ctx", ".", "obj", "[", "'FILE'", "]", "=", "file", "ctx", ".", "obj", "[", "'QUOTE'", "]", "=", "quote" ]
This script is used to set, get or unset values from a .env file.
[ "This", "script", "is", "used", "to", "set", "get", "or", "unset", "values", "from", "a", ".", "env", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L24-L28
train
pypa/pipenv
pipenv/vendor/dotenv/cli.py
list
def list(ctx): '''Display all the stored key/value.''' file = ctx.obj['FILE'] dotenv_as_dict = dotenv_values(file) for k, v in dotenv_as_dict.items(): click.echo('%s=%s' % (k, v))
python
def list(ctx): '''Display all the stored key/value.''' file = ctx.obj['FILE'] dotenv_as_dict = dotenv_values(file) for k, v in dotenv_as_dict.items(): click.echo('%s=%s' % (k, v))
[ "def", "list", "(", "ctx", ")", ":", "file", "=", "ctx", ".", "obj", "[", "'FILE'", "]", "dotenv_as_dict", "=", "dotenv_values", "(", "file", ")", "for", "k", ",", "v", "in", "dotenv_as_dict", ".", "items", "(", ")", ":", "click", ".", "echo", "(",...
Display all the stored key/value.
[ "Display", "all", "the", "stored", "key", "/", "value", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L33-L38
train
pypa/pipenv
pipenv/vendor/dotenv/cli.py
set
def set(ctx, key, value): '''Store the given key/value.''' file = ctx.obj['FILE'] quote = ctx.obj['QUOTE'] success, key, value = set_key(file, key, value, quote) if success: click.echo('%s=%s' % (key, value)) else: exit(1)
python
def set(ctx, key, value): '''Store the given key/value.''' file = ctx.obj['FILE'] quote = ctx.obj['QUOTE'] success, key, value = set_key(file, key, value, quote) if success: click.echo('%s=%s' % (key, value)) else: exit(1)
[ "def", "set", "(", "ctx", ",", "key", ",", "value", ")", ":", "file", "=", "ctx", ".", "obj", "[", "'FILE'", "]", "quote", "=", "ctx", ".", "obj", "[", "'QUOTE'", "]", "success", ",", "key", ",", "value", "=", "set_key", "(", "file", ",", "key"...
Store the given key/value.
[ "Store", "the", "given", "key", "/", "value", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L45-L53
train
pypa/pipenv
pipenv/vendor/dotenv/cli.py
get
def get(ctx, key): '''Retrieve the value for the given key.''' file = ctx.obj['FILE'] stored_value = get_key(file, key) if stored_value: click.echo('%s=%s' % (key, stored_value)) else: exit(1)
python
def get(ctx, key): '''Retrieve the value for the given key.''' file = ctx.obj['FILE'] stored_value = get_key(file, key) if stored_value: click.echo('%s=%s' % (key, stored_value)) else: exit(1)
[ "def", "get", "(", "ctx", ",", "key", ")", ":", "file", "=", "ctx", ".", "obj", "[", "'FILE'", "]", "stored_value", "=", "get_key", "(", "file", ",", "key", ")", "if", "stored_value", ":", "click", ".", "echo", "(", "'%s=%s'", "%", "(", "key", ",...
Retrieve the value for the given key.
[ "Retrieve", "the", "value", "for", "the", "given", "key", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L59-L66
train
pypa/pipenv
pipenv/vendor/dotenv/cli.py
unset
def unset(ctx, key): '''Removes the given key.''' file = ctx.obj['FILE'] quote = ctx.obj['QUOTE'] success, key = unset_key(file, key, quote) if success: click.echo("Successfully removed %s" % key) else: exit(1)
python
def unset(ctx, key): '''Removes the given key.''' file = ctx.obj['FILE'] quote = ctx.obj['QUOTE'] success, key = unset_key(file, key, quote) if success: click.echo("Successfully removed %s" % key) else: exit(1)
[ "def", "unset", "(", "ctx", ",", "key", ")", ":", "file", "=", "ctx", ".", "obj", "[", "'FILE'", "]", "quote", "=", "ctx", ".", "obj", "[", "'QUOTE'", "]", "success", ",", "key", "=", "unset_key", "(", "file", ",", "key", ",", "quote", ")", "if...
Removes the given key.
[ "Removes", "the", "given", "key", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L72-L80
train
pypa/pipenv
pipenv/vendor/dotenv/cli.py
run
def run(ctx, commandline): """Run command with environment variables present.""" file = ctx.obj['FILE'] dotenv_as_dict = dotenv_values(file) if not commandline: click.echo('No command given.') exit(1) ret = run_command(commandline, dotenv_as_dict) exit(ret)
python
def run(ctx, commandline): """Run command with environment variables present.""" file = ctx.obj['FILE'] dotenv_as_dict = dotenv_values(file) if not commandline: click.echo('No command given.') exit(1) ret = run_command(commandline, dotenv_as_dict) exit(ret)
[ "def", "run", "(", "ctx", ",", "commandline", ")", ":", "file", "=", "ctx", ".", "obj", "[", "'FILE'", "]", "dotenv_as_dict", "=", "dotenv_values", "(", "file", ")", "if", "not", "commandline", ":", "click", ".", "echo", "(", "'No command given.'", ")", ...
Run command with environment variables present.
[ "Run", "command", "with", "environment", "variables", "present", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L86-L94
train
pypa/pipenv
pipenv/vendor/passa/models/synchronizers.py
_is_installation_local
def _is_installation_local(name): """Check whether the distribution is in the current Python installation. This is used to distinguish packages seen by a virtual environment. A venv may be able to see global packages, but we don't want to mess with them. """ loc = os.path.normcase(pkg_resources.wor...
python
def _is_installation_local(name): """Check whether the distribution is in the current Python installation. This is used to distinguish packages seen by a virtual environment. A venv may be able to see global packages, but we don't want to mess with them. """ loc = os.path.normcase(pkg_resources.wor...
[ "def", "_is_installation_local", "(", "name", ")", ":", "loc", "=", "os", ".", "path", ".", "normcase", "(", "pkg_resources", ".", "working_set", ".", "by_key", "[", "name", "]", ".", "location", ")", "pre", "=", "os", ".", "path", ".", "normcase", "("...
Check whether the distribution is in the current Python installation. This is used to distinguish packages seen by a virtual environment. A venv may be able to see global packages, but we don't want to mess with them.
[ "Check", "whether", "the", "distribution", "is", "in", "the", "current", "Python", "installation", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/synchronizers.py#L20-L28
train
pypa/pipenv
pipenv/vendor/passa/models/synchronizers.py
_group_installed_names
def _group_installed_names(packages): """Group locally installed packages based on given specifications. `packages` is a name-package mapping that are used as baseline to determine how the installed package should be grouped. Returns a 3-tuple of disjoint sets, all containing names of installed pa...
python
def _group_installed_names(packages): """Group locally installed packages based on given specifications. `packages` is a name-package mapping that are used as baseline to determine how the installed package should be grouped. Returns a 3-tuple of disjoint sets, all containing names of installed pa...
[ "def", "_group_installed_names", "(", "packages", ")", ":", "groupcoll", "=", "GroupCollection", "(", "set", "(", ")", ",", "set", "(", ")", ",", "set", "(", ")", ",", "set", "(", ")", ")", "for", "distro", "in", "pkg_resources", ".", "working_set", ":...
Group locally installed packages based on given specifications. `packages` is a name-package mapping that are used as baseline to determine how the installed package should be grouped. Returns a 3-tuple of disjoint sets, all containing names of installed packages: * `uptodate`: These match the sp...
[ "Group", "locally", "installed", "packages", "based", "on", "given", "specifications", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/synchronizers.py#L41-L74
train
pypa/pipenv
pipenv/vendor/passa/models/synchronizers.py
_build_paths
def _build_paths(): """Prepare paths for distlib.wheel.Wheel to install into. """ paths = sysconfig.get_paths() return { "prefix": sys.prefix, "data": paths["data"], "scripts": paths["scripts"], "headers": paths["include"], "purelib": paths["purelib"], "pl...
python
def _build_paths(): """Prepare paths for distlib.wheel.Wheel to install into. """ paths = sysconfig.get_paths() return { "prefix": sys.prefix, "data": paths["data"], "scripts": paths["scripts"], "headers": paths["include"], "purelib": paths["purelib"], "pl...
[ "def", "_build_paths", "(", ")", ":", "paths", "=", "sysconfig", ".", "get_paths", "(", ")", "return", "{", "\"prefix\"", ":", "sys", ".", "prefix", ",", "\"data\"", ":", "paths", "[", "\"data\"", "]", ",", "\"scripts\"", ":", "paths", "[", "\"scripts\""...
Prepare paths for distlib.wheel.Wheel to install into.
[ "Prepare", "paths", "for", "distlib", ".", "wheel", ".", "Wheel", "to", "install", "into", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/synchronizers.py#L98-L109
train
pypa/pipenv
pipenv/vendor/tomlkit/api.py
dumps
def dumps(data): # type: (_TOMLDocument) -> str """ Dumps a TOMLDocument into a string. """ if not isinstance(data, _TOMLDocument) and isinstance(data, dict): data = item(data) return data.as_string()
python
def dumps(data): # type: (_TOMLDocument) -> str """ Dumps a TOMLDocument into a string. """ if not isinstance(data, _TOMLDocument) and isinstance(data, dict): data = item(data) return data.as_string()
[ "def", "dumps", "(", "data", ")", ":", "# type: (_TOMLDocument) -> str", "if", "not", "isinstance", "(", "data", ",", "_TOMLDocument", ")", "and", "isinstance", "(", "data", ",", "dict", ")", ":", "data", "=", "item", "(", "data", ")", "return", "data", ...
Dumps a TOMLDocument into a string.
[ "Dumps", "a", "TOMLDocument", "into", "a", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/api.py#L35-L42
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest.findall
def findall(self): """Find all files under the base and set ``allfiles`` to the absolute pathnames of files found. """ from stat import S_ISREG, S_ISDIR, S_ISLNK self.allfiles = allfiles = [] root = self.base stack = [root] pop = stack.pop push = ...
python
def findall(self): """Find all files under the base and set ``allfiles`` to the absolute pathnames of files found. """ from stat import S_ISREG, S_ISDIR, S_ISLNK self.allfiles = allfiles = [] root = self.base stack = [root] pop = stack.pop push = ...
[ "def", "findall", "(", "self", ")", ":", "from", "stat", "import", "S_ISREG", ",", "S_ISDIR", ",", "S_ISLNK", "self", ".", "allfiles", "=", "allfiles", "=", "[", "]", "root", "=", "self", ".", "base", "stack", "=", "[", "root", "]", "pop", "=", "st...
Find all files under the base and set ``allfiles`` to the absolute pathnames of files found.
[ "Find", "all", "files", "under", "the", "base", "and", "set", "allfiles", "to", "the", "absolute", "pathnames", "of", "files", "found", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L57-L82
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest.add
def add(self, item): """ Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. """ if not item.startswith(self.prefix): item = os.path.join(self.base, item) self.files.add(os.path.normpath(item))
python
def add(self, item): """ Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. """ if not item.startswith(self.prefix): item = os.path.join(self.base, item) self.files.add(os.path.normpath(item))
[ "def", "add", "(", "self", ",", "item", ")", ":", "if", "not", "item", ".", "startswith", "(", "self", ".", "prefix", ")", ":", "item", "=", "os", ".", "path", ".", "join", "(", "self", ".", "base", ",", "item", ")", "self", ".", "files", ".", ...
Add a file to the manifest. :param item: The pathname to add. This can be relative to the base.
[ "Add", "a", "file", "to", "the", "manifest", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L84-L92
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest.sorted
def sorted(self, wantdirs=False): """ Return sorted files in directory order """ def add_dir(dirs, d): dirs.add(d) logger.debug('add_dir added %s', d) if d != self.base: parent, _ = os.path.split(d) assert parent not in...
python
def sorted(self, wantdirs=False): """ Return sorted files in directory order """ def add_dir(dirs, d): dirs.add(d) logger.debug('add_dir added %s', d) if d != self.base: parent, _ = os.path.split(d) assert parent not in...
[ "def", "sorted", "(", "self", ",", "wantdirs", "=", "False", ")", ":", "def", "add_dir", "(", "dirs", ",", "d", ")", ":", "dirs", ".", "add", "(", "d", ")", "logger", ".", "debug", "(", "'add_dir added %s'", ",", "d", ")", "if", "d", "!=", "self"...
Return sorted files in directory order
[ "Return", "sorted", "files", "in", "directory", "order" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L103-L123
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest.process_directive
def process_directive(self, directive): """ Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANI...
python
def process_directive(self, directive): """ Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANI...
[ "def", "process_directive", "(", "self", ",", "directive", ")", ":", "# Parse the line: split it up, make sure the right number of words", "# is there, and return the relevant words. 'action' is always", "# defined: it's the first word of the line. Which of the other", "# three are defined d...
Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.or...
[ "Process", "a", "directive", "which", "either", "adds", "some", "files", "from", "allfiles", "to", "files", "or", "removes", "some", "files", "from", "files", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L130-L203
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest._parse_directive
def _parse_directive(self, directive): """ Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns """ words = directive.split() if len(words) == 1 and words[0] not in ('include', 'exclude', ...
python
def _parse_directive(self, directive): """ Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns """ words = directive.split() if len(words) == 1 and words[0] not in ('include', 'exclude', ...
[ "def", "_parse_directive", "(", "self", ",", "directive", ")", ":", "words", "=", "directive", ".", "split", "(", ")", "if", "len", "(", "words", ")", "==", "1", "and", "words", "[", "0", "]", "not", "in", "(", "'include'", ",", "'exclude'", ",", "...
Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns
[ "Validate", "a", "directive", ".", ":", "param", "directive", ":", "The", "directive", "to", "validate", ".", ":", "return", ":", "A", "tuple", "of", "action", "patterns", "thedir", "dir_patterns" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L209-L254
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest._include_pattern
def _include_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' ...
python
def _include_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' ...
[ "def", "_include_pattern", "(", "self", ",", "pattern", ",", "anchor", "=", "True", ",", "prefix", "=", "None", ",", "is_regex", "=", "False", ")", ":", "# XXX docstring lying about what the special chars are?", "found", "=", "False", "pattern_re", "=", "self", ...
Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; co...
[ "Select", "strings", "(", "presumably", "filenames", ")", "from", "self", ".", "files", "that", "match", "pattern", "a", "Unix", "-", "style", "wildcard", "(", "glob", ")", "pattern", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L256-L295
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest._exclude_pattern
def _exclude_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place...
python
def _exclude_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place...
[ "def", "_exclude_pattern", "(", "self", ",", "pattern", ",", "anchor", "=", "True", ",", "prefix", "=", "None", ",", "is_regex", "=", "False", ")", ":", "found", "=", "False", "pattern_re", "=", "self", ".", "_translate_pattern", "(", "pattern", ",", "an...
Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. ...
[ "Remove", "strings", "(", "presumably", "filenames", ")", "from", "files", "that", "match", "pattern", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L297-L315
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest._translate_pattern
def _translate_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Translate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it'...
python
def _translate_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Translate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it'...
[ "def", "_translate_pattern", "(", "self", ",", "pattern", ",", "anchor", "=", "True", ",", "prefix", "=", "None", ",", "is_regex", "=", "False", ")", ":", "if", "is_regex", ":", "if", "isinstance", "(", "pattern", ",", "str", ")", ":", "return", "re", ...
Translate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object).
[ "Translate", "a", "shell", "-", "like", "wildcard", "pattern", "to", "a", "compiled", "regular", "expression", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L317-L370
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
Manifest._glob_to_re
def _glob_to_re(self, pattern): """Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). """ pattern_re = fnmat...
python
def _glob_to_re(self, pattern): """Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). """ pattern_re = fnmat...
[ "def", "_glob_to_re", "(", "self", ",", "pattern", ")", ":", "pattern_re", "=", "fnmatch", ".", "translate", "(", "pattern", ")", "# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which", "# IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,", "#...
Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific).
[ "Translate", "a", "shell", "-", "like", "glob", "pattern", "to", "a", "regular", "expression", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L372-L393
train
pypa/pipenv
pipenv/vendor/pexpect/expect.py
Expecter.expect_loop
def expect_loop(self, timeout=-1): """Blocking expect""" spawn = self.spawn if timeout is not None: end_time = time.time() + timeout try: incoming = spawn.buffer spawn._buffer = spawn.buffer_type() spawn._before = spawn.buffer_type() ...
python
def expect_loop(self, timeout=-1): """Blocking expect""" spawn = self.spawn if timeout is not None: end_time = time.time() + timeout try: incoming = spawn.buffer spawn._buffer = spawn.buffer_type() spawn._before = spawn.buffer_type() ...
[ "def", "expect_loop", "(", "self", ",", "timeout", "=", "-", "1", ")", ":", "spawn", "=", "self", ".", "spawn", "if", "timeout", "is", "not", "None", ":", "end_time", "=", "time", ".", "time", "(", ")", "+", "timeout", "try", ":", "incoming", "=", ...
Blocking expect
[ "Blocking", "expect" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/expect.py#L91-L122
train
pypa/pipenv
pipenv/vendor/urllib3/_collections.py
HTTPHeaderDict.add
def add(self, key, val): """Adds a (name, value) pair, doesn't overwrite the value if it already exists. >>> headers = HTTPHeaderDict(foo='bar') >>> headers.add('Foo', 'baz') >>> headers['foo'] 'bar, baz' """ key_lower = key.lower() new_vals = [ke...
python
def add(self, key, val): """Adds a (name, value) pair, doesn't overwrite the value if it already exists. >>> headers = HTTPHeaderDict(foo='bar') >>> headers.add('Foo', 'baz') >>> headers['foo'] 'bar, baz' """ key_lower = key.lower() new_vals = [ke...
[ "def", "add", "(", "self", ",", "key", ",", "val", ")", ":", "key_lower", "=", "key", ".", "lower", "(", ")", "new_vals", "=", "[", "key", ",", "val", "]", "# Keep the common case aka no item present as fast as possible", "vals", "=", "self", ".", "_containe...
Adds a (name, value) pair, doesn't overwrite the value if it already exists. >>> headers = HTTPHeaderDict(foo='bar') >>> headers.add('Foo', 'baz') >>> headers['foo'] 'bar, baz'
[ "Adds", "a", "(", "name", "value", ")", "pair", "doesn", "t", "overwrite", "the", "value", "if", "it", "already", "exists", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/_collections.py#L209-L223
train
pypa/pipenv
pipenv/vendor/urllib3/_collections.py
HTTPHeaderDict.extend
def extend(self, *args, **kwargs): """Generic import function for any type of header-like object. Adapted version of MutableMapping.update in order to insert items with self.add instead of self.__setitem__ """ if len(args) > 1: raise TypeError("extend() takes at most ...
python
def extend(self, *args, **kwargs): """Generic import function for any type of header-like object. Adapted version of MutableMapping.update in order to insert items with self.add instead of self.__setitem__ """ if len(args) > 1: raise TypeError("extend() takes at most ...
[ "def", "extend", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", ">", "1", ":", "raise", "TypeError", "(", "\"extend() takes at most 1 positional \"", "\"arguments ({0} given)\"", ".", "format", "(", "len", ...
Generic import function for any type of header-like object. Adapted version of MutableMapping.update in order to insert items with self.add instead of self.__setitem__
[ "Generic", "import", "function", "for", "any", "type", "of", "header", "-", "like", "object", ".", "Adapted", "version", "of", "MutableMapping", ".", "update", "in", "order", "to", "insert", "items", "with", "self", ".", "add", "instead", "of", "self", "."...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/_collections.py#L225-L249
train
pypa/pipenv
pipenv/vendor/urllib3/_collections.py
HTTPHeaderDict.getlist
def getlist(self, key, default=__marker): """Returns a list of all the values for the named field. Returns an empty list if the key doesn't exist.""" try: vals = self._container[key.lower()] except KeyError: if default is self.__marker: return [] ...
python
def getlist(self, key, default=__marker): """Returns a list of all the values for the named field. Returns an empty list if the key doesn't exist.""" try: vals = self._container[key.lower()] except KeyError: if default is self.__marker: return [] ...
[ "def", "getlist", "(", "self", ",", "key", ",", "default", "=", "__marker", ")", ":", "try", ":", "vals", "=", "self", ".", "_container", "[", "key", ".", "lower", "(", ")", "]", "except", "KeyError", ":", "if", "default", "is", "self", ".", "__mar...
Returns a list of all the values for the named field. Returns an empty list if the key doesn't exist.
[ "Returns", "a", "list", "of", "all", "the", "values", "for", "the", "named", "field", ".", "Returns", "an", "empty", "list", "if", "the", "key", "doesn", "t", "exist", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/_collections.py#L251-L261
train
pypa/pipenv
pipenv/vendor/urllib3/_collections.py
HTTPHeaderDict.iteritems
def iteritems(self): """Iterate over all header lines, including duplicate ones.""" for key in self: vals = self._container[key.lower()] for val in vals[1:]: yield vals[0], val
python
def iteritems(self): """Iterate over all header lines, including duplicate ones.""" for key in self: vals = self._container[key.lower()] for val in vals[1:]: yield vals[0], val
[ "def", "iteritems", "(", "self", ")", ":", "for", "key", "in", "self", ":", "vals", "=", "self", ".", "_container", "[", "key", ".", "lower", "(", ")", "]", "for", "val", "in", "vals", "[", "1", ":", "]", ":", "yield", "vals", "[", "0", "]", ...
Iterate over all header lines, including duplicate ones.
[ "Iterate", "over", "all", "header", "lines", "including", "duplicate", "ones", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/_collections.py#L287-L292
train
pypa/pipenv
pipenv/vendor/urllib3/_collections.py
HTTPHeaderDict.itermerged
def itermerged(self): """Iterate over all headers, merging duplicate ones together.""" for key in self: val = self._container[key.lower()] yield val[0], ', '.join(val[1:])
python
def itermerged(self): """Iterate over all headers, merging duplicate ones together.""" for key in self: val = self._container[key.lower()] yield val[0], ', '.join(val[1:])
[ "def", "itermerged", "(", "self", ")", ":", "for", "key", "in", "self", ":", "val", "=", "self", ".", "_container", "[", "key", ".", "lower", "(", ")", "]", "yield", "val", "[", "0", "]", ",", "', '", ".", "join", "(", "val", "[", "1", ":", "...
Iterate over all headers, merging duplicate ones together.
[ "Iterate", "over", "all", "headers", "merging", "duplicate", "ones", "together", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/_collections.py#L294-L298
train
pypa/pipenv
pipenv/vendor/urllib3/_collections.py
HTTPHeaderDict.from_httplib
def from_httplib(cls, message): # Python 2 """Read headers from a Python 2 httplib message object.""" # python2.7 does not expose a proper API for exporting multiheaders # efficiently. This function re-reads raw lines from the message # object and extracts the multiheaders properly. ...
python
def from_httplib(cls, message): # Python 2 """Read headers from a Python 2 httplib message object.""" # python2.7 does not expose a proper API for exporting multiheaders # efficiently. This function re-reads raw lines from the message # object and extracts the multiheaders properly. ...
[ "def", "from_httplib", "(", "cls", ",", "message", ")", ":", "# Python 2", "# python2.7 does not expose a proper API for exporting multiheaders", "# efficiently. This function re-reads raw lines from the message", "# object and extracts the multiheaders properly.", "obs_fold_continued_leader...
Read headers from a Python 2 httplib message object.
[ "Read", "headers", "from", "a", "Python", "2", "httplib", "message", "object", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/_collections.py#L304-L329
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
extract_cookies_to_jar
def extract_cookies_to_jar(jar, request, response): """Extract the cookies from the response into a CookieJar. :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) :param request: our own requests.Request object :param response: urllib3.HTTPResponse object """ if not (hasattr(r...
python
def extract_cookies_to_jar(jar, request, response): """Extract the cookies from the response into a CookieJar. :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) :param request: our own requests.Request object :param response: urllib3.HTTPResponse object """ if not (hasattr(r...
[ "def", "extract_cookies_to_jar", "(", "jar", ",", "request", ",", "response", ")", ":", "if", "not", "(", "hasattr", "(", "response", ",", "'_original_response'", ")", "and", "response", ".", "_original_response", ")", ":", "return", "# the _original_response fiel...
Extract the cookies from the response into a CookieJar. :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) :param request: our own requests.Request object :param response: urllib3.HTTPResponse object
[ "Extract", "the", "cookies", "from", "the", "response", "into", "a", "CookieJar", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L118-L132
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
get_cookie_header
def get_cookie_header(jar, request): """ Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str """ r = MockRequest(request) jar.add_cookie_header(r) return r.get_new_headers().get('Cookie')
python
def get_cookie_header(jar, request): """ Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str """ r = MockRequest(request) jar.add_cookie_header(r) return r.get_new_headers().get('Cookie')
[ "def", "get_cookie_header", "(", "jar", ",", "request", ")", ":", "r", "=", "MockRequest", "(", "request", ")", "jar", ".", "add_cookie_header", "(", "r", ")", "return", "r", ".", "get_new_headers", "(", ")", ".", "get", "(", "'Cookie'", ")" ]
Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str
[ "Produce", "an", "appropriate", "Cookie", "header", "string", "to", "be", "sent", "with", "request", "or", "None", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L135-L143
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
remove_cookie_by_name
def remove_cookie_by_name(cookiejar, name, domain=None, path=None): """Unsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n). """ clearables = [] for cookie in cookiejar: if cookie.name != name: continue if domain is not None an...
python
def remove_cookie_by_name(cookiejar, name, domain=None, path=None): """Unsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n). """ clearables = [] for cookie in cookiejar: if cookie.name != name: continue if domain is not None an...
[ "def", "remove_cookie_by_name", "(", "cookiejar", ",", "name", ",", "domain", "=", "None", ",", "path", "=", "None", ")", ":", "clearables", "=", "[", "]", "for", "cookie", "in", "cookiejar", ":", "if", "cookie", ".", "name", "!=", "name", ":", "contin...
Unsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n).
[ "Unsets", "a", "cookie", "by", "name", "by", "default", "over", "all", "domains", "and", "paths", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L146-L162
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
create_cookie
def create_cookie(name, value, **kwargs): """Make a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie"). """ result = { 'version': 0, 'name': name, ...
python
def create_cookie(name, value, **kwargs): """Make a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie"). """ result = { 'version': 0, 'name': name, ...
[ "def", "create_cookie", "(", "name", ",", "value", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "'version'", ":", "0", ",", "'name'", ":", "name", ",", "'value'", ":", "value", ",", "'port'", ":", "None", ",", "'domain'", ":", "''", ",", ...
Make a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie").
[ "Make", "a", "cookie", "from", "underspecified", "parameters", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L441-L474
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
morsel_to_cookie
def morsel_to_cookie(morsel): """Convert a Morsel object into a Cookie containing the one k/v pair.""" expires = None if morsel['max-age']: try: expires = int(time.time() + int(morsel['max-age'])) except ValueError: raise TypeError('max-age: %s must be integer' % mor...
python
def morsel_to_cookie(morsel): """Convert a Morsel object into a Cookie containing the one k/v pair.""" expires = None if morsel['max-age']: try: expires = int(time.time() + int(morsel['max-age'])) except ValueError: raise TypeError('max-age: %s must be integer' % mor...
[ "def", "morsel_to_cookie", "(", "morsel", ")", ":", "expires", "=", "None", "if", "morsel", "[", "'max-age'", "]", ":", "try", ":", "expires", "=", "int", "(", "time", ".", "time", "(", ")", "+", "int", "(", "morsel", "[", "'max-age'", "]", ")", ")...
Convert a Morsel object into a Cookie containing the one k/v pair.
[ "Convert", "a", "Morsel", "object", "into", "a", "Cookie", "containing", "the", "one", "k", "/", "v", "pair", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L477-L505
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
cookiejar_from_dict
def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): """Returns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not repl...
python
def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): """Returns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not repl...
[ "def", "cookiejar_from_dict", "(", "cookie_dict", ",", "cookiejar", "=", "None", ",", "overwrite", "=", "True", ")", ":", "if", "cookiejar", "is", "None", ":", "cookiejar", "=", "RequestsCookieJar", "(", ")", "if", "cookie_dict", "is", "not", "None", ":", ...
Returns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not replace cookies already in the jar with new ones. :rtype: CookieJar
[ "Returns", "a", "CookieJar", "from", "a", "key", "/", "value", "dictionary", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L508-L526
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
merge_cookies
def merge_cookies(cookiejar, cookies): """Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar """ if not isinstance(cookiejar, cookielib.CookieJar): ...
python
def merge_cookies(cookiejar, cookies): """Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar """ if not isinstance(cookiejar, cookielib.CookieJar): ...
[ "def", "merge_cookies", "(", "cookiejar", ",", "cookies", ")", ":", "if", "not", "isinstance", "(", "cookiejar", ",", "cookielib", ".", "CookieJar", ")", ":", "raise", "ValueError", "(", "'You can only merge into CookieJar'", ")", "if", "isinstance", "(", "cooki...
Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar
[ "Add", "cookies", "to", "cookiejar", "and", "returns", "a", "merged", "CookieJar", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L529-L549
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar.get
def get(self, name, default=None, domain=None, path=None): """Dict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1). """ try: ...
python
def get(self, name, default=None, domain=None, path=None): """Dict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1). """ try: ...
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "None", ",", "domain", "=", "None", ",", "path", "=", "None", ")", ":", "try", ":", "return", "self", ".", "_find_no_duplicates", "(", "name", ",", "domain", ",", "path", ")", "except", "...
Dict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1).
[ "Dict", "-", "like", "get", "()", "that", "also", "supports", "optional", "domain", "and", "path", "args", "in", "order", "to", "resolve", "naming", "collisions", "from", "using", "one", "cookie", "jar", "over", "multiple", "domains", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L189-L199
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar.set
def set(self, name, value, **kwargs): """Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. """ # support client code that unsets cookies by assignment of a None value: if...
python
def set(self, name, value, **kwargs): """Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. """ # support client code that unsets cookies by assignment of a None value: if...
[ "def", "set", "(", "self", ",", "name", ",", "value", ",", "*", "*", "kwargs", ")", ":", "# support client code that unsets cookies by assignment of a None value:", "if", "value", "is", "None", ":", "remove_cookie_by_name", "(", "self", ",", "name", ",", "domain",...
Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains.
[ "Dict", "-", "like", "set", "()", "that", "also", "supports", "optional", "domain", "and", "path", "args", "in", "order", "to", "resolve", "naming", "collisions", "from", "using", "one", "cookie", "jar", "over", "multiple", "domains", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L201-L216
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar.list_domains
def list_domains(self): """Utility method to list all the domains in the jar.""" domains = [] for cookie in iter(self): if cookie.domain not in domains: domains.append(cookie.domain) return domains
python
def list_domains(self): """Utility method to list all the domains in the jar.""" domains = [] for cookie in iter(self): if cookie.domain not in domains: domains.append(cookie.domain) return domains
[ "def", "list_domains", "(", "self", ")", ":", "domains", "=", "[", "]", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "domain", "not", "in", "domains", ":", "domains", ".", "append", "(", "cookie", ".", "domain", ")", "...
Utility method to list all the domains in the jar.
[ "Utility", "method", "to", "list", "all", "the", "domains", "in", "the", "jar", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L270-L276
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar.list_paths
def list_paths(self): """Utility method to list all the paths in the jar.""" paths = [] for cookie in iter(self): if cookie.path not in paths: paths.append(cookie.path) return paths
python
def list_paths(self): """Utility method to list all the paths in the jar.""" paths = [] for cookie in iter(self): if cookie.path not in paths: paths.append(cookie.path) return paths
[ "def", "list_paths", "(", "self", ")", ":", "paths", "=", "[", "]", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "path", "not", "in", "paths", ":", "paths", ".", "append", "(", "cookie", ".", "path", ")", "return", "...
Utility method to list all the paths in the jar.
[ "Utility", "method", "to", "list", "all", "the", "paths", "in", "the", "jar", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L278-L284
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar.multiple_domains
def multiple_domains(self): """Returns True if there are multiple domains in the jar. Returns False otherwise. :rtype: bool """ domains = [] for cookie in iter(self): if cookie.domain is not None and cookie.domain in domains: return True ...
python
def multiple_domains(self): """Returns True if there are multiple domains in the jar. Returns False otherwise. :rtype: bool """ domains = [] for cookie in iter(self): if cookie.domain is not None and cookie.domain in domains: return True ...
[ "def", "multiple_domains", "(", "self", ")", ":", "domains", "=", "[", "]", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "domain", "is", "not", "None", "and", "cookie", ".", "domain", "in", "domains", ":", "return", "Tru...
Returns True if there are multiple domains in the jar. Returns False otherwise. :rtype: bool
[ "Returns", "True", "if", "there", "are", "multiple", "domains", "in", "the", "jar", ".", "Returns", "False", "otherwise", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L286-L297
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar.update
def update(self, other): """Updates this jar with cookies from another CookieJar or dict-like""" if isinstance(other, cookielib.CookieJar): for cookie in other: self.set_cookie(copy.copy(cookie)) else: super(RequestsCookieJar, self).update(other)
python
def update(self, other): """Updates this jar with cookies from another CookieJar or dict-like""" if isinstance(other, cookielib.CookieJar): for cookie in other: self.set_cookie(copy.copy(cookie)) else: super(RequestsCookieJar, self).update(other)
[ "def", "update", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "cookielib", ".", "CookieJar", ")", ":", "for", "cookie", "in", "other", ":", "self", ".", "set_cookie", "(", "copy", ".", "copy", "(", "cookie", ")", ")", ...
Updates this jar with cookies from another CookieJar or dict-like
[ "Updates", "this", "jar", "with", "cookies", "from", "another", "CookieJar", "or", "dict", "-", "like" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L348-L354
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar._find
def _find(self, name, domain=None, path=None): """Requests uses this method internally to get cookie values. If there are conflicting cookies, _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown if there are conflicting cookies. :param name: a...
python
def _find(self, name, domain=None, path=None): """Requests uses this method internally to get cookie values. If there are conflicting cookies, _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown if there are conflicting cookies. :param name: a...
[ "def", "_find", "(", "self", ",", "name", ",", "domain", "=", "None", ",", "path", "=", "None", ")", ":", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "name", "==", "name", ":", "if", "domain", "is", "None", "or", ...
Requests uses this method internally to get cookie values. If there are conflicting cookies, _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown if there are conflicting cookies. :param name: a string containing name of cookie :param domain: (...
[ "Requests", "uses", "this", "method", "internally", "to", "get", "cookie", "values", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L356-L374
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar._find_no_duplicates
def _find_no_duplicates(self, name, domain=None, path=None): """Both ``__get_item__`` and ``get`` call this function: it's never used elsewhere in Requests. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: ...
python
def _find_no_duplicates(self, name, domain=None, path=None): """Both ``__get_item__`` and ``get`` call this function: it's never used elsewhere in Requests. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: ...
[ "def", "_find_no_duplicates", "(", "self", ",", "name", ",", "domain", "=", "None", ",", "path", "=", "None", ")", ":", "toReturn", "=", "None", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "name", "==", "name", ":", "...
Both ``__get_item__`` and ``get`` call this function: it's never used elsewhere in Requests. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: (optional) string containing path of cookie :raises KeyError: if...
[ "Both", "__get_item__", "and", "get", "call", "this", "function", ":", "it", "s", "never", "used", "elsewhere", "in", "Requests", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L376-L399
train
pypa/pipenv
pipenv/vendor/requests/cookies.py
RequestsCookieJar.copy
def copy(self): """Return a copy of this RequestsCookieJar.""" new_cj = RequestsCookieJar() new_cj.set_policy(self.get_policy()) new_cj.update(self) return new_cj
python
def copy(self): """Return a copy of this RequestsCookieJar.""" new_cj = RequestsCookieJar() new_cj.set_policy(self.get_policy()) new_cj.update(self) return new_cj
[ "def", "copy", "(", "self", ")", ":", "new_cj", "=", "RequestsCookieJar", "(", ")", "new_cj", ".", "set_policy", "(", "self", ".", "get_policy", "(", ")", ")", "new_cj", ".", "update", "(", "self", ")", "return", "new_cj" ]
Return a copy of this RequestsCookieJar.
[ "Return", "a", "copy", "of", "this", "RequestsCookieJar", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L414-L419
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
constrain
def constrain (n, min, max): '''This returns a number, n constrained to the min and max bounds. ''' if n < min: return min if n > max: return max return n
python
def constrain (n, min, max): '''This returns a number, n constrained to the min and max bounds. ''' if n < min: return min if n > max: return max return n
[ "def", "constrain", "(", "n", ",", "min", ",", "max", ")", ":", "if", "n", "<", "min", ":", "return", "min", "if", "n", ">", "max", ":", "return", "max", "return", "n" ]
This returns a number, n constrained to the min and max bounds.
[ "This", "returns", "a", "number", "n", "constrained", "to", "the", "min", "and", "max", "bounds", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L60-L68
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen._decode
def _decode(self, s): '''This converts from the external coding system (as passed to the constructor) to the internal one (unicode). ''' if self.decoder is not None: return self.decoder.decode(s) else: raise TypeError("This screen was constructed with encoding=Non...
python
def _decode(self, s): '''This converts from the external coding system (as passed to the constructor) to the internal one (unicode). ''' if self.decoder is not None: return self.decoder.decode(s) else: raise TypeError("This screen was constructed with encoding=Non...
[ "def", "_decode", "(", "self", ",", "s", ")", ":", "if", "self", ".", "decoder", "is", "not", "None", ":", "return", "self", ".", "decoder", ".", "decode", "(", "s", ")", "else", ":", "raise", "TypeError", "(", "\"This screen was constructed with encoding=...
This converts from the external coding system (as passed to the constructor) to the internal one (unicode).
[ "This", "converts", "from", "the", "external", "coding", "system", "(", "as", "passed", "to", "the", "constructor", ")", "to", "the", "internal", "one", "(", "unicode", ")", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L104-L111
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen._unicode
def _unicode(self): '''This returns a printable representation of the screen as a unicode string (which, under Python 3.x, is the same as 'str'). The end of each screen line is terminated by a newline.''' return u'\n'.join ([ u''.join(c) for c in self.w ])
python
def _unicode(self): '''This returns a printable representation of the screen as a unicode string (which, under Python 3.x, is the same as 'str'). The end of each screen line is terminated by a newline.''' return u'\n'.join ([ u''.join(c) for c in self.w ])
[ "def", "_unicode", "(", "self", ")", ":", "return", "u'\\n'", ".", "join", "(", "[", "u''", ".", "join", "(", "c", ")", "for", "c", "in", "self", ".", "w", "]", ")" ]
This returns a printable representation of the screen as a unicode string (which, under Python 3.x, is the same as 'str'). The end of each screen line is terminated by a newline.
[ "This", "returns", "a", "printable", "representation", "of", "the", "screen", "as", "a", "unicode", "string", "(", "which", "under", "Python", "3", ".", "x", "is", "the", "same", "as", "str", ")", ".", "The", "end", "of", "each", "screen", "line", "is"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L113-L118
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.dump
def dump (self): '''This returns a copy of the screen as a unicode string. This is similar to __str__/__unicode__ except that lines are not terminated with line feeds.''' return u''.join ([ u''.join(c) for c in self.w ])
python
def dump (self): '''This returns a copy of the screen as a unicode string. This is similar to __str__/__unicode__ except that lines are not terminated with line feeds.''' return u''.join ([ u''.join(c) for c in self.w ])
[ "def", "dump", "(", "self", ")", ":", "return", "u''", ".", "join", "(", "[", "u''", ".", "join", "(", "c", ")", "for", "c", "in", "self", ".", "w", "]", ")" ]
This returns a copy of the screen as a unicode string. This is similar to __str__/__unicode__ except that lines are not terminated with line feeds.
[ "This", "returns", "a", "copy", "of", "the", "screen", "as", "a", "unicode", "string", ".", "This", "is", "similar", "to", "__str__", "/", "__unicode__", "except", "that", "lines", "are", "not", "terminated", "with", "line", "feeds", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L131-L136
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.pretty
def pretty (self): '''This returns a copy of the screen as a unicode string with an ASCII text box around the screen border. This is similar to __str__/__unicode__ except that it adds a box.''' top_bot = u'+' + u'-'*self.cols + u'+\n' return top_bot + u'\n'.join([u'|'+line+u'|' ...
python
def pretty (self): '''This returns a copy of the screen as a unicode string with an ASCII text box around the screen border. This is similar to __str__/__unicode__ except that it adds a box.''' top_bot = u'+' + u'-'*self.cols + u'+\n' return top_bot + u'\n'.join([u'|'+line+u'|' ...
[ "def", "pretty", "(", "self", ")", ":", "top_bot", "=", "u'+'", "+", "u'-'", "*", "self", ".", "cols", "+", "u'+\\n'", "return", "top_bot", "+", "u'\\n'", ".", "join", "(", "[", "u'|'", "+", "line", "+", "u'|'", "for", "line", "in", "unicode", "(",...
This returns a copy of the screen as a unicode string with an ASCII text box around the screen border. This is similar to __str__/__unicode__ except that it adds a box.
[ "This", "returns", "a", "copy", "of", "the", "screen", "as", "a", "unicode", "string", "with", "an", "ASCII", "text", "box", "around", "the", "screen", "border", ".", "This", "is", "similar", "to", "__str__", "/", "__unicode__", "except", "that", "it", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L138-L144
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.lf
def lf (self): '''This moves the cursor down with scrolling. ''' old_r = self.cur_r self.cursor_down() if old_r == self.cur_r: self.scroll_up () self.erase_line()
python
def lf (self): '''This moves the cursor down with scrolling. ''' old_r = self.cur_r self.cursor_down() if old_r == self.cur_r: self.scroll_up () self.erase_line()
[ "def", "lf", "(", "self", ")", ":", "old_r", "=", "self", ".", "cur_r", "self", ".", "cursor_down", "(", ")", "if", "old_r", "==", "self", ".", "cur_r", ":", "self", ".", "scroll_up", "(", ")", "self", ".", "erase_line", "(", ")" ]
This moves the cursor down with scrolling.
[ "This", "moves", "the", "cursor", "down", "with", "scrolling", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L176-L184
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.put_abs
def put_abs (self, r, c, ch): '''Screen array starts at 1 index.''' r = constrain (r, 1, self.rows) c = constrain (c, 1, self.cols) if isinstance(ch, bytes): ch = self._decode(ch)[0] else: ch = ch[0] self.w[r-1][c-1] = ch
python
def put_abs (self, r, c, ch): '''Screen array starts at 1 index.''' r = constrain (r, 1, self.rows) c = constrain (c, 1, self.cols) if isinstance(ch, bytes): ch = self._decode(ch)[0] else: ch = ch[0] self.w[r-1][c-1] = ch
[ "def", "put_abs", "(", "self", ",", "r", ",", "c", ",", "ch", ")", ":", "r", "=", "constrain", "(", "r", ",", "1", ",", "self", ".", "rows", ")", "c", "=", "constrain", "(", "c", ",", "1", ",", "self", ".", "cols", ")", "if", "isinstance", ...
Screen array starts at 1 index.
[ "Screen", "array", "starts", "at", "1", "index", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L200-L209
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.put
def put (self, ch): '''This puts a characters at the current cursor position. ''' if isinstance(ch, bytes): ch = self._decode(ch) self.put_abs (self.cur_r, self.cur_c, ch)
python
def put (self, ch): '''This puts a characters at the current cursor position. ''' if isinstance(ch, bytes): ch = self._decode(ch) self.put_abs (self.cur_r, self.cur_c, ch)
[ "def", "put", "(", "self", ",", "ch", ")", ":", "if", "isinstance", "(", "ch", ",", "bytes", ")", ":", "ch", "=", "self", ".", "_decode", "(", "ch", ")", "self", ".", "put_abs", "(", "self", ".", "cur_r", ",", "self", ".", "cur_c", ",", "ch", ...
This puts a characters at the current cursor position.
[ "This", "puts", "a", "characters", "at", "the", "current", "cursor", "position", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L211-L218
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.insert_abs
def insert_abs (self, r, c, ch): '''This inserts a character at (r,c). Everything under and to the right is shifted right one character. The last character of the line is lost. ''' if isinstance(ch, bytes): ch = self._decode(ch) r = constrain (r, 1, self.row...
python
def insert_abs (self, r, c, ch): '''This inserts a character at (r,c). Everything under and to the right is shifted right one character. The last character of the line is lost. ''' if isinstance(ch, bytes): ch = self._decode(ch) r = constrain (r, 1, self.row...
[ "def", "insert_abs", "(", "self", ",", "r", ",", "c", ",", "ch", ")", ":", "if", "isinstance", "(", "ch", ",", "bytes", ")", ":", "ch", "=", "self", ".", "_decode", "(", "ch", ")", "r", "=", "constrain", "(", "r", ",", "1", ",", "self", ".", ...
This inserts a character at (r,c). Everything under and to the right is shifted right one character. The last character of the line is lost.
[ "This", "inserts", "a", "character", "at", "(", "r", "c", ")", ".", "Everything", "under", "and", "to", "the", "right", "is", "shifted", "right", "one", "character", ".", "The", "last", "character", "of", "the", "line", "is", "lost", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L220-L233
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.get_region
def get_region (self, rs,cs, re,ce): '''This returns a list of lines representing the region. ''' rs = constrain (rs, 1, self.rows) re = constrain (re, 1, self.rows) cs = constrain (cs, 1, self.cols) ce = constrain (ce, 1, self.cols) if rs > re: rs, r...
python
def get_region (self, rs,cs, re,ce): '''This returns a list of lines representing the region. ''' rs = constrain (rs, 1, self.rows) re = constrain (re, 1, self.rows) cs = constrain (cs, 1, self.cols) ce = constrain (ce, 1, self.cols) if rs > re: rs, r...
[ "def", "get_region", "(", "self", ",", "rs", ",", "cs", ",", "re", ",", "ce", ")", ":", "rs", "=", "constrain", "(", "rs", ",", "1", ",", "self", ".", "rows", ")", "re", "=", "constrain", "(", "re", ",", "1", ",", "self", ".", "rows", ")", ...
This returns a list of lines representing the region.
[ "This", "returns", "a", "list", "of", "lines", "representing", "the", "region", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L252-L271
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.cursor_constrain
def cursor_constrain (self): '''This keeps the cursor within the screen area. ''' self.cur_r = constrain (self.cur_r, 1, self.rows) self.cur_c = constrain (self.cur_c, 1, self.cols)
python
def cursor_constrain (self): '''This keeps the cursor within the screen area. ''' self.cur_r = constrain (self.cur_r, 1, self.rows) self.cur_c = constrain (self.cur_c, 1, self.cols)
[ "def", "cursor_constrain", "(", "self", ")", ":", "self", ".", "cur_r", "=", "constrain", "(", "self", ".", "cur_r", ",", "1", ",", "self", ".", "rows", ")", "self", ".", "cur_c", "=", "constrain", "(", "self", ".", "cur_c", ",", "1", ",", "self", ...
This keeps the cursor within the screen area.
[ "This", "keeps", "the", "cursor", "within", "the", "screen", "area", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L273-L278
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.cursor_save_attrs
def cursor_save_attrs (self): # <ESC>7 '''Save current cursor position.''' self.cur_saved_r = self.cur_r self.cur_saved_c = self.cur_c
python
def cursor_save_attrs (self): # <ESC>7 '''Save current cursor position.''' self.cur_saved_r = self.cur_r self.cur_saved_c = self.cur_c
[ "def", "cursor_save_attrs", "(", "self", ")", ":", "# <ESC>7", "self", ".", "cur_saved_r", "=", "self", ".", "cur_r", "self", ".", "cur_saved_c", "=", "self", ".", "cur_c" ]
Save current cursor position.
[ "Save", "current", "cursor", "position", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L328-L332
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.scroll_constrain
def scroll_constrain (self): '''This keeps the scroll region within the screen region.''' if self.scroll_row_start <= 0: self.scroll_row_start = 1 if self.scroll_row_end > self.rows: self.scroll_row_end = self.rows
python
def scroll_constrain (self): '''This keeps the scroll region within the screen region.''' if self.scroll_row_start <= 0: self.scroll_row_start = 1 if self.scroll_row_end > self.rows: self.scroll_row_end = self.rows
[ "def", "scroll_constrain", "(", "self", ")", ":", "if", "self", ".", "scroll_row_start", "<=", "0", ":", "self", ".", "scroll_row_start", "=", "1", "if", "self", ".", "scroll_row_end", ">", "self", ".", "rows", ":", "self", ".", "scroll_row_end", "=", "s...
This keeps the scroll region within the screen region.
[ "This", "keeps", "the", "scroll", "region", "within", "the", "screen", "region", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L339-L345
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.scroll_screen_rows
def scroll_screen_rows (self, rs, re): # <ESC>[{start};{end}r '''Enable scrolling from row {start} to row {end}.''' self.scroll_row_start = rs self.scroll_row_end = re self.scroll_constrain()
python
def scroll_screen_rows (self, rs, re): # <ESC>[{start};{end}r '''Enable scrolling from row {start} to row {end}.''' self.scroll_row_start = rs self.scroll_row_end = re self.scroll_constrain()
[ "def", "scroll_screen_rows", "(", "self", ",", "rs", ",", "re", ")", ":", "# <ESC>[{start};{end}r", "self", ".", "scroll_row_start", "=", "rs", "self", ".", "scroll_row_end", "=", "re", "self", ".", "scroll_constrain", "(", ")" ]
Enable scrolling from row {start} to row {end}.
[ "Enable", "scrolling", "from", "row", "{", "start", "}", "to", "row", "{", "end", "}", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L353-L358
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.scroll_down
def scroll_down (self): # <ESC>D '''Scroll display down one line.''' # Screen is indexed from 1, but arrays are indexed from 0. s = self.scroll_row_start - 1 e = self.scroll_row_end - 1 self.w[s+1:e+1] = copy.deepcopy(self.w[s:e])
python
def scroll_down (self): # <ESC>D '''Scroll display down one line.''' # Screen is indexed from 1, but arrays are indexed from 0. s = self.scroll_row_start - 1 e = self.scroll_row_end - 1 self.w[s+1:e+1] = copy.deepcopy(self.w[s:e])
[ "def", "scroll_down", "(", "self", ")", ":", "# <ESC>D", "# Screen is indexed from 1, but arrays are indexed from 0.", "s", "=", "self", ".", "scroll_row_start", "-", "1", "e", "=", "self", ".", "scroll_row_end", "-", "1", "self", ".", "w", "[", "s", "+", "1",...
Scroll display down one line.
[ "Scroll", "display", "down", "one", "line", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L360-L366
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.erase_end_of_line
def erase_end_of_line (self): # <ESC>[0K -or- <ESC>[K '''Erases from the current cursor position to the end of the current line.''' self.fill_region (self.cur_r, self.cur_c, self.cur_r, self.cols)
python
def erase_end_of_line (self): # <ESC>[0K -or- <ESC>[K '''Erases from the current cursor position to the end of the current line.''' self.fill_region (self.cur_r, self.cur_c, self.cur_r, self.cols)
[ "def", "erase_end_of_line", "(", "self", ")", ":", "# <ESC>[0K -or- <ESC>[K", "self", ".", "fill_region", "(", "self", ".", "cur_r", ",", "self", ".", "cur_c", ",", "self", ".", "cur_r", ",", "self", ".", "cols", ")" ]
Erases from the current cursor position to the end of the current line.
[ "Erases", "from", "the", "current", "cursor", "position", "to", "the", "end", "of", "the", "current", "line", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L376-L380
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.erase_start_of_line
def erase_start_of_line (self): # <ESC>[1K '''Erases from the current cursor position to the start of the current line.''' self.fill_region (self.cur_r, 1, self.cur_r, self.cur_c)
python
def erase_start_of_line (self): # <ESC>[1K '''Erases from the current cursor position to the start of the current line.''' self.fill_region (self.cur_r, 1, self.cur_r, self.cur_c)
[ "def", "erase_start_of_line", "(", "self", ")", ":", "# <ESC>[1K", "self", ".", "fill_region", "(", "self", ".", "cur_r", ",", "1", ",", "self", ".", "cur_r", ",", "self", ".", "cur_c", ")" ]
Erases from the current cursor position to the start of the current line.
[ "Erases", "from", "the", "current", "cursor", "position", "to", "the", "start", "of", "the", "current", "line", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L382-L386
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.erase_line
def erase_line (self): # <ESC>[2K '''Erases the entire current line.''' self.fill_region (self.cur_r, 1, self.cur_r, self.cols)
python
def erase_line (self): # <ESC>[2K '''Erases the entire current line.''' self.fill_region (self.cur_r, 1, self.cur_r, self.cols)
[ "def", "erase_line", "(", "self", ")", ":", "# <ESC>[2K", "self", ".", "fill_region", "(", "self", ".", "cur_r", ",", "1", ",", "self", ".", "cur_r", ",", "self", ".", "cols", ")" ]
Erases the entire current line.
[ "Erases", "the", "entire", "current", "line", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L388-L391
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.erase_down
def erase_down (self): # <ESC>[0J -or- <ESC>[J '''Erases the screen from the current line down to the bottom of the screen.''' self.erase_end_of_line () self.fill_region (self.cur_r + 1, 1, self.rows, self.cols)
python
def erase_down (self): # <ESC>[0J -or- <ESC>[J '''Erases the screen from the current line down to the bottom of the screen.''' self.erase_end_of_line () self.fill_region (self.cur_r + 1, 1, self.rows, self.cols)
[ "def", "erase_down", "(", "self", ")", ":", "# <ESC>[0J -or- <ESC>[J", "self", ".", "erase_end_of_line", "(", ")", "self", ".", "fill_region", "(", "self", ".", "cur_r", "+", "1", ",", "1", ",", "self", ".", "rows", ",", "self", ".", "cols", ")" ]
Erases the screen from the current line down to the bottom of the screen.
[ "Erases", "the", "screen", "from", "the", "current", "line", "down", "to", "the", "bottom", "of", "the", "screen", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L393-L398
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
screen.erase_up
def erase_up (self): # <ESC>[1J '''Erases the screen from the current line up to the top of the screen.''' self.erase_start_of_line () self.fill_region (self.cur_r-1, 1, 1, self.cols)
python
def erase_up (self): # <ESC>[1J '''Erases the screen from the current line up to the top of the screen.''' self.erase_start_of_line () self.fill_region (self.cur_r-1, 1, 1, self.cols)
[ "def", "erase_up", "(", "self", ")", ":", "# <ESC>[1J", "self", ".", "erase_start_of_line", "(", ")", "self", ".", "fill_region", "(", "self", ".", "cur_r", "-", "1", ",", "1", ",", "1", ",", "self", ".", "cols", ")" ]
Erases the screen from the current line up to the top of the screen.
[ "Erases", "the", "screen", "from", "the", "current", "line", "up", "to", "the", "top", "of", "the", "screen", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L400-L405
train
pypa/pipenv
pipenv/vendor/iso8601/iso8601.py
to_int
def to_int(d, key, default_to_zero=False, default=None, required=True): """Pull a value from the dict and convert to int :param default_to_zero: If the value is None or empty, treat it as zero :param default: If the value is missing in the dict use this default """ value = d.get(key) or default ...
python
def to_int(d, key, default_to_zero=False, default=None, required=True): """Pull a value from the dict and convert to int :param default_to_zero: If the value is None or empty, treat it as zero :param default: If the value is missing in the dict use this default """ value = d.get(key) or default ...
[ "def", "to_int", "(", "d", ",", "key", ",", "default_to_zero", "=", "False", ",", "default", "=", "None", ",", "required", "=", "True", ")", ":", "value", "=", "d", ".", "get", "(", "key", ")", "or", "default", "if", "(", "value", "in", "[", "\"\...
Pull a value from the dict and convert to int :param default_to_zero: If the value is None or empty, treat it as zero :param default: If the value is missing in the dict use this default
[ "Pull", "a", "value", "from", "the", "dict", "and", "convert", "to", "int" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/iso8601/iso8601.py#L137-L151
train
pypa/pipenv
pipenv/vendor/iso8601/iso8601.py
parse_timezone
def parse_timezone(matches, default_timezone=UTC): """Parses ISO 8601 time zone specs into tzinfo offsets """ if matches["timezone"] == "Z": return UTC # This isn't strictly correct, but it's common to encounter dates without # timezones so I'll assume the default (which defaults to UTC). ...
python
def parse_timezone(matches, default_timezone=UTC): """Parses ISO 8601 time zone specs into tzinfo offsets """ if matches["timezone"] == "Z": return UTC # This isn't strictly correct, but it's common to encounter dates without # timezones so I'll assume the default (which defaults to UTC). ...
[ "def", "parse_timezone", "(", "matches", ",", "default_timezone", "=", "UTC", ")", ":", "if", "matches", "[", "\"timezone\"", "]", "==", "\"Z\"", ":", "return", "UTC", "# This isn't strictly correct, but it's common to encounter dates without", "# timezones so I'll assume t...
Parses ISO 8601 time zone specs into tzinfo offsets
[ "Parses", "ISO", "8601", "time", "zone", "specs", "into", "tzinfo", "offsets" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/iso8601/iso8601.py#L153-L172
train
pypa/pipenv
pipenv/vendor/iso8601/iso8601.py
parse_date
def parse_date(datestring, default_timezone=UTC): """Parses ISO 8601 dates into datetime objects The timezone is parsed from the date string. However it is quite common to have dates without a timezone (not strictly correct). In this case the default timezone specified in default_timezone is used. This...
python
def parse_date(datestring, default_timezone=UTC): """Parses ISO 8601 dates into datetime objects The timezone is parsed from the date string. However it is quite common to have dates without a timezone (not strictly correct). In this case the default timezone specified in default_timezone is used. This...
[ "def", "parse_date", "(", "datestring", ",", "default_timezone", "=", "UTC", ")", ":", "if", "not", "isinstance", "(", "datestring", ",", "_basestring", ")", ":", "raise", "ParseError", "(", "\"Expecting a string %r\"", "%", "datestring", ")", "m", "=", "ISO86...
Parses ISO 8601 dates into datetime objects The timezone is parsed from the date string. However it is quite common to have dates without a timezone (not strictly correct). In this case the default timezone specified in default_timezone is used. This is UTC by default. :param datestring: The date ...
[ "Parses", "ISO", "8601", "dates", "into", "datetime", "objects" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/iso8601/iso8601.py#L174-L214
train
pypa/pipenv
pipenv/vendor/yaspin/signal_handlers.py
default_handler
def default_handler(signum, frame, spinner): """Signal handler, used to gracefully shut down the ``spinner`` instance when specified signal is received by the process running the ``spinner``. ``signum`` and ``frame`` are mandatory arguments. Check ``signal.signal`` function for more details. """ ...
python
def default_handler(signum, frame, spinner): """Signal handler, used to gracefully shut down the ``spinner`` instance when specified signal is received by the process running the ``spinner``. ``signum`` and ``frame`` are mandatory arguments. Check ``signal.signal`` function for more details. """ ...
[ "def", "default_handler", "(", "signum", ",", "frame", ",", "spinner", ")", ":", "spinner", ".", "fail", "(", ")", "spinner", ".", "stop", "(", ")", "sys", ".", "exit", "(", "0", ")" ]
Signal handler, used to gracefully shut down the ``spinner`` instance when specified signal is received by the process running the ``spinner``. ``signum`` and ``frame`` are mandatory arguments. Check ``signal.signal`` function for more details.
[ "Signal", "handler", "used", "to", "gracefully", "shut", "down", "the", "spinner", "instance", "when", "specified", "signal", "is", "received", "by", "the", "process", "running", "the", "spinner", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/signal_handlers.py#L14-L23
train
pypa/pipenv
pipenv/vendor/yaspin/signal_handlers.py
fancy_handler
def fancy_handler(signum, frame, spinner): """Signal handler, used to gracefully shut down the ``spinner`` instance when specified signal is received by the process running the ``spinner``. ``signum`` and ``frame`` are mandatory arguments. Check ``signal.signal`` function for more details. """ ...
python
def fancy_handler(signum, frame, spinner): """Signal handler, used to gracefully shut down the ``spinner`` instance when specified signal is received by the process running the ``spinner``. ``signum`` and ``frame`` are mandatory arguments. Check ``signal.signal`` function for more details. """ ...
[ "def", "fancy_handler", "(", "signum", ",", "frame", ",", "spinner", ")", ":", "spinner", ".", "red", ".", "fail", "(", "\"✘\")", "", "spinner", ".", "stop", "(", ")", "sys", ".", "exit", "(", "0", ")" ]
Signal handler, used to gracefully shut down the ``spinner`` instance when specified signal is received by the process running the ``spinner``. ``signum`` and ``frame`` are mandatory arguments. Check ``signal.signal`` function for more details.
[ "Signal", "handler", "used", "to", "gracefully", "shut", "down", "the", "spinner", "instance", "when", "specified", "signal", "is", "received", "by", "the", "process", "running", "the", "spinner", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/signal_handlers.py#L26-L35
train
pypa/pipenv
pipenv/vendor/idna/core.py
uts46_remap
def uts46_remap(domain, std3_rules=True, transitional=False): """Re-map the characters in the string according to UTS46 processing.""" from .uts46data import uts46data output = u"" try: for pos, char in enumerate(domain): code_point = ord(char) uts46row = uts46data[code_p...
python
def uts46_remap(domain, std3_rules=True, transitional=False): """Re-map the characters in the string according to UTS46 processing.""" from .uts46data import uts46data output = u"" try: for pos, char in enumerate(domain): code_point = ord(char) uts46row = uts46data[code_p...
[ "def", "uts46_remap", "(", "domain", ",", "std3_rules", "=", "True", ",", "transitional", "=", "False", ")", ":", "from", ".", "uts46data", "import", "uts46data", "output", "=", "u\"\"", "try", ":", "for", "pos", ",", "char", "in", "enumerate", "(", "dom...
Re-map the characters in the string according to UTS46 processing.
[ "Re", "-", "map", "the", "characters", "in", "the", "string", "according", "to", "UTS46", "processing", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/idna/core.py#L312-L337
train
pypa/pipenv
pipenv/vendor/requests/help.py
_implementation
def _implementation(): """Return a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 2.7.5 it will return {'name': 'CPython', 'version': '2.7.5'}. This function works best on CPython and Py...
python
def _implementation(): """Return a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 2.7.5 it will return {'name': 'CPython', 'version': '2.7.5'}. This function works best on CPython and Py...
[ "def", "_implementation", "(", ")", ":", "implementation", "=", "platform", ".", "python_implementation", "(", ")", "if", "implementation", "==", "'CPython'", ":", "implementation_version", "=", "platform", ".", "python_version", "(", ")", "elif", "implementation", ...
Return a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 2.7.5 it will return {'name': 'CPython', 'version': '2.7.5'}. This function works best on CPython and PyPy: in particular, it probably...
[ "Return", "a", "dict", "with", "the", "Python", "implementation", "and", "version", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/help.py#L26-L56
train
pypa/pipenv
pipenv/vendor/requests/help.py
info
def info(): """Generate information for a bug report.""" try: platform_info = { 'system': platform.system(), 'release': platform.release(), } except IOError: platform_info = { 'system': 'Unknown', 'release': 'Unknown', } im...
python
def info(): """Generate information for a bug report.""" try: platform_info = { 'system': platform.system(), 'release': platform.release(), } except IOError: platform_info = { 'system': 'Unknown', 'release': 'Unknown', } im...
[ "def", "info", "(", ")", ":", "try", ":", "platform_info", "=", "{", "'system'", ":", "platform", ".", "system", "(", ")", ",", "'release'", ":", "platform", ".", "release", "(", ")", ",", "}", "except", "IOError", ":", "platform_info", "=", "{", "'s...
Generate information for a bug report.
[ "Generate", "information", "for", "a", "bug", "report", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/help.py#L59-L110
train
pypa/pipenv
pipenv/vendor/yarg/release.py
Release.package_type
def package_type(self): """ >>> package = yarg.get('yarg') >>> v = "0.1.0" >>> r = package.release(v) >>> r.package_type u'wheel' """ mapping = {'bdist_egg': u'egg', 'bdist_wheel': u'wheel', 'sdist': u'source'} ...
python
def package_type(self): """ >>> package = yarg.get('yarg') >>> v = "0.1.0" >>> r = package.release(v) >>> r.package_type u'wheel' """ mapping = {'bdist_egg': u'egg', 'bdist_wheel': u'wheel', 'sdist': u'source'} ...
[ "def", "package_type", "(", "self", ")", ":", "mapping", "=", "{", "'bdist_egg'", ":", "u'egg'", ",", "'bdist_wheel'", ":", "u'wheel'", ",", "'sdist'", ":", "u'source'", "}", "ptype", "=", "self", ".", "_release", "[", "'packagetype'", "]", "if", "ptype", ...
>>> package = yarg.get('yarg') >>> v = "0.1.0" >>> r = package.release(v) >>> r.package_type u'wheel'
[ ">>>", "package", "=", "yarg", ".", "get", "(", "yarg", ")", ">>>", "v", "=", "0", ".", "1", ".", "0", ">>>", "r", "=", "package", ".", "release", "(", "v", ")", ">>>", "r", ".", "package_type", "u", "wheel" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/release.py#L123-L136
train
pypa/pipenv
pipenv/vendor/pexpect/ANSI.py
ANSI.process
def process (self, c): """Process a single character. Called by :meth:`write`.""" if isinstance(c, bytes): c = self._decode(c) self.state.process(c)
python
def process (self, c): """Process a single character. Called by :meth:`write`.""" if isinstance(c, bytes): c = self._decode(c) self.state.process(c)
[ "def", "process", "(", "self", ",", "c", ")", ":", "if", "isinstance", "(", "c", ",", "bytes", ")", ":", "c", "=", "self", ".", "_decode", "(", "c", ")", "self", ".", "state", ".", "process", "(", "c", ")" ]
Process a single character. Called by :meth:`write`.
[ "Process", "a", "single", "character", ".", "Called", "by", ":", "meth", ":", "write", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/ANSI.py#L281-L285
train
pypa/pipenv
pipenv/vendor/pexpect/ANSI.py
ANSI.write
def write (self, s): """Process text, writing it to the virtual screen while handling ANSI escape codes. """ if isinstance(s, bytes): s = self._decode(s) for c in s: self.process(c)
python
def write (self, s): """Process text, writing it to the virtual screen while handling ANSI escape codes. """ if isinstance(s, bytes): s = self._decode(s) for c in s: self.process(c)
[ "def", "write", "(", "self", ",", "s", ")", ":", "if", "isinstance", "(", "s", ",", "bytes", ")", ":", "s", "=", "self", ".", "_decode", "(", "s", ")", "for", "c", "in", "s", ":", "self", ".", "process", "(", "c", ")" ]
Process text, writing it to the virtual screen while handling ANSI escape codes.
[ "Process", "text", "writing", "it", "to", "the", "virtual", "screen", "while", "handling", "ANSI", "escape", "codes", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/ANSI.py#L291-L298
train
pypa/pipenv
pipenv/vendor/pexpect/ANSI.py
ANSI.write_ch
def write_ch (self, ch): '''This puts a character at the current cursor position. The cursor position is moved forward with wrap-around, but no scrolling is done if the cursor hits the lower-right corner of the screen. ''' if isinstance(ch, bytes): ch = self._decode(ch) ...
python
def write_ch (self, ch): '''This puts a character at the current cursor position. The cursor position is moved forward with wrap-around, but no scrolling is done if the cursor hits the lower-right corner of the screen. ''' if isinstance(ch, bytes): ch = self._decode(ch) ...
[ "def", "write_ch", "(", "self", ",", "ch", ")", ":", "if", "isinstance", "(", "ch", ",", "bytes", ")", ":", "ch", "=", "self", ".", "_decode", "(", "ch", ")", "#\\r and \\n both produce a call to cr() and lf(), respectively.", "ch", "=", "ch", "[", "0", "]...
This puts a character at the current cursor position. The cursor position is moved forward with wrap-around, but no scrolling is done if the cursor hits the lower-right corner of the screen.
[ "This", "puts", "a", "character", "at", "the", "current", "cursor", "position", ".", "The", "cursor", "position", "is", "moved", "forward", "with", "wrap", "-", "around", "but", "no", "scrolling", "is", "done", "if", "the", "cursor", "hits", "the", "lower"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/ANSI.py#L303-L334
train
pypa/pipenv
pipenv/vendor/click/_compat.py
get_best_encoding
def get_best_encoding(stream): """Returns the default stream encoding if not found.""" rv = getattr(stream, 'encoding', None) or sys.getdefaultencoding() if is_ascii_encoding(rv): return 'utf-8' return rv
python
def get_best_encoding(stream): """Returns the default stream encoding if not found.""" rv = getattr(stream, 'encoding', None) or sys.getdefaultencoding() if is_ascii_encoding(rv): return 'utf-8' return rv
[ "def", "get_best_encoding", "(", "stream", ")", ":", "rv", "=", "getattr", "(", "stream", ",", "'encoding'", ",", "None", ")", "or", "sys", ".", "getdefaultencoding", "(", ")", "if", "is_ascii_encoding", "(", "rv", ")", ":", "return", "'utf-8'", "return", ...
Returns the default stream encoding if not found.
[ "Returns", "the", "default", "stream", "encoding", "if", "not", "found", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_compat.py#L45-L50
train
pypa/pipenv
pipenv/vendor/backports/shutil_get_terminal_size/get_terminal_size.py
get_terminal_size
def get_terminal_size(fallback=(80, 24)): """Get the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, ...
python
def get_terminal_size(fallback=(80, 24)): """Get the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, ...
[ "def", "get_terminal_size", "(", "fallback", "=", "(", "80", ",", "24", ")", ")", ":", "# Try the environment first", "try", ":", "columns", "=", "int", "(", "os", ".", "environ", "[", "\"COLUMNS\"", "]", ")", "except", "(", "KeyError", ",", "ValueError", ...
Get the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connec...
[ "Get", "the", "size", "of", "the", "terminal", "window", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/shutil_get_terminal_size/get_terminal_size.py#L58-L100
train
pypa/pipenv
pipenv/vendor/urllib3/util/request.py
make_headers
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None): """ Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: ...
python
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None): """ Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: ...
[ "def", "make_headers", "(", "keep_alive", "=", "None", ",", "accept_encoding", "=", "None", ",", "user_agent", "=", "None", ",", "basic_auth", "=", "None", ",", "proxy_basic_auth", "=", "None", ",", "disable_cache", "=", "None", ")", ":", "headers", "=", "...
Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: Can be a boolean, list, or string. ``True`` translates to 'gzip,deflate'. List will get joined by comma. String will be used as provid...
[ "Shortcuts", "for", "generating", "request", "headers", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/request.py#L11-L74
train
pypa/pipenv
pipenv/vendor/urllib3/util/request.py
set_file_position
def set_file_position(body, pos): """ If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use. """ if pos is not None: rewind_body(body, pos) elif getattr(body, 'tell', None) is not None: try: pos = body.tell() ...
python
def set_file_position(body, pos): """ If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use. """ if pos is not None: rewind_body(body, pos) elif getattr(body, 'tell', None) is not None: try: pos = body.tell() ...
[ "def", "set_file_position", "(", "body", ",", "pos", ")", ":", "if", "pos", "is", "not", "None", ":", "rewind_body", "(", "body", ",", "pos", ")", "elif", "getattr", "(", "body", ",", "'tell'", ",", "None", ")", "is", "not", "None", ":", "try", ":"...
If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use.
[ "If", "a", "position", "is", "provided", "move", "file", "to", "that", "point", ".", "Otherwise", "we", "ll", "attempt", "to", "record", "a", "position", "for", "future", "use", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/request.py#L77-L92
train
pypa/pipenv
pipenv/vendor/urllib3/util/request.py
rewind_body
def rewind_body(body, body_pos): """ Attempt to rewind body to a certain position. Primarily used for request redirects and retries. :param body: File-like object that supports seek. :param int pos: Position to seek to in file. """ body_seek = getattr(body, 'seek', None) ...
python
def rewind_body(body, body_pos): """ Attempt to rewind body to a certain position. Primarily used for request redirects and retries. :param body: File-like object that supports seek. :param int pos: Position to seek to in file. """ body_seek = getattr(body, 'seek', None) ...
[ "def", "rewind_body", "(", "body", ",", "body_pos", ")", ":", "body_seek", "=", "getattr", "(", "body", ",", "'seek'", ",", "None", ")", "if", "body_seek", "is", "not", "None", "and", "isinstance", "(", "body_pos", ",", "integer_types", ")", ":", "try", ...
Attempt to rewind body to a certain position. Primarily used for request redirects and retries. :param body: File-like object that supports seek. :param int pos: Position to seek to in file.
[ "Attempt", "to", "rewind", "body", "to", "a", "certain", "position", ".", "Primarily", "used", "for", "request", "redirects", "and", "retries", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/request.py#L95-L118
train
pypa/pipenv
pipenv/vendor/plette/lockfiles.py
_copy_jsonsafe
def _copy_jsonsafe(value): """Deep-copy a value into JSON-safe types. """ if isinstance(value, six.string_types + (numbers.Number,)): return value if isinstance(value, collections_abc.Mapping): return {six.text_type(k): _copy_jsonsafe(v) for k, v in value.items()} if isinstance(value...
python
def _copy_jsonsafe(value): """Deep-copy a value into JSON-safe types. """ if isinstance(value, six.string_types + (numbers.Number,)): return value if isinstance(value, collections_abc.Mapping): return {six.text_type(k): _copy_jsonsafe(v) for k, v in value.items()} if isinstance(value...
[ "def", "_copy_jsonsafe", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", "+", "(", "numbers", ".", "Number", ",", ")", ")", ":", "return", "value", "if", "isinstance", "(", "value", ",", "collections_abc", ".", ...
Deep-copy a value into JSON-safe types.
[ "Deep", "-", "copy", "a", "value", "into", "JSON", "-", "safe", "types", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/plette/lockfiles.py#L53-L64
train
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/caches/redis_cache.py
RedisCache.clear
def clear(self): """Helper for clearing all the keys in a database. Use with caution!""" for key in self.conn.keys(): self.conn.delete(key)
python
def clear(self): """Helper for clearing all the keys in a database. Use with caution!""" for key in self.conn.keys(): self.conn.delete(key)
[ "def", "clear", "(", "self", ")", ":", "for", "key", "in", "self", ".", "conn", ".", "keys", "(", ")", ":", "self", ".", "conn", ".", "delete", "(", "key", ")" ]
Helper for clearing all the keys in a database. Use with caution!
[ "Helper", "for", "clearing", "all", "the", "keys", "in", "a", "database", ".", "Use", "with", "caution!" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/caches/redis_cache.py#L25-L29
train
pypa/pipenv
pipenv/vendor/cerberus/utils.py
mapping_to_frozenset
def mapping_to_frozenset(mapping): """ Be aware that this treats any sequence type with the equal members as equal. As it is used to identify equality of schemas, this can be considered okay as definitions are semantically equal regardless the container type. """ mapping = mapping.copy()...
python
def mapping_to_frozenset(mapping): """ Be aware that this treats any sequence type with the equal members as equal. As it is used to identify equality of schemas, this can be considered okay as definitions are semantically equal regardless the container type. """ mapping = mapping.copy()...
[ "def", "mapping_to_frozenset", "(", "mapping", ")", ":", "mapping", "=", "mapping", ".", "copy", "(", ")", "for", "key", ",", "value", "in", "mapping", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "Mapping", ")", ":", "mapping", ...
Be aware that this treats any sequence type with the equal members as equal. As it is used to identify equality of schemas, this can be considered okay as definitions are semantically equal regardless the container type.
[ "Be", "aware", "that", "this", "treats", "any", "sequence", "type", "with", "the", "equal", "members", "as", "equal", ".", "As", "it", "is", "used", "to", "identify", "equality", "of", "schemas", "this", "can", "be", "considered", "okay", "as", "definition...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/utils.py#L48-L63
train
pypa/pipenv
pipenv/vendor/cerberus/utils.py
validator_factory
def validator_factory(name, bases=None, namespace={}): """ Dynamically create a :class:`~cerberus.Validator` subclass. Docstrings of mixin-classes will be added to the resulting class' one if ``__doc__`` is not in :obj:`namespace`. :param name: The name of the new class. :type name: :class:...
python
def validator_factory(name, bases=None, namespace={}): """ Dynamically create a :class:`~cerberus.Validator` subclass. Docstrings of mixin-classes will be added to the resulting class' one if ``__doc__`` is not in :obj:`namespace`. :param name: The name of the new class. :type name: :class:...
[ "def", "validator_factory", "(", "name", ",", "bases", "=", "None", ",", "namespace", "=", "{", "}", ")", ":", "Validator", "=", "get_Validator_class", "(", ")", "if", "bases", "is", "None", ":", "bases", "=", "(", "Validator", ",", ")", "elif", "isins...
Dynamically create a :class:`~cerberus.Validator` subclass. Docstrings of mixin-classes will be added to the resulting class' one if ``__doc__`` is not in :obj:`namespace`. :param name: The name of the new class. :type name: :class:`str` :param bases: Class(es) with additional and overridin...
[ "Dynamically", "create", "a", ":", "class", ":", "~cerberus", ".", "Validator", "subclass", ".", "Docstrings", "of", "mixin", "-", "classes", "will", "be", "added", "to", "the", "resulting", "class", "one", "if", "__doc__", "is", "not", "in", ":", "obj", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/utils.py#L93-L119
train
pypa/pipenv
pipenv/vendor/vistir/cmdparse.py
Script.cmdify
def cmdify(self): """Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes before a quote are ...
python
def cmdify(self): """Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes before a quote are ...
[ "def", "cmdify", "(", "self", ")", ":", "return", "\" \"", ".", "join", "(", "itertools", ".", "chain", "(", "[", "_quote_if_contains", "(", "self", ".", "command", ",", "r\"[\\s^()]\"", ")", "]", ",", "(", "_quote_if_contains", "(", "arg", ",", "r\"[\\s...
Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes before a quote are doubled, so they are all ...
[ "Encode", "into", "a", "cmd", "-", "executable", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/cmdparse.py#L56-L85
train
pypa/pipenv
pipenv/vendor/attr/filters.py
_split_what
def _split_what(what): """ Returns a tuple of `frozenset`s of classes and attributes. """ return ( frozenset(cls for cls in what if isclass(cls)), frozenset(cls for cls in what if isinstance(cls, Attribute)), )
python
def _split_what(what): """ Returns a tuple of `frozenset`s of classes and attributes. """ return ( frozenset(cls for cls in what if isclass(cls)), frozenset(cls for cls in what if isinstance(cls, Attribute)), )
[ "def", "_split_what", "(", "what", ")", ":", "return", "(", "frozenset", "(", "cls", "for", "cls", "in", "what", "if", "isclass", "(", "cls", ")", ")", ",", "frozenset", "(", "cls", "for", "cls", "in", "what", "if", "isinstance", "(", "cls", ",", "...
Returns a tuple of `frozenset`s of classes and attributes.
[ "Returns", "a", "tuple", "of", "frozenset", "s", "of", "classes", "and", "attributes", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/filters.py#L11-L18
train
pypa/pipenv
pipenv/vendor/attr/filters.py
include
def include(*what): """ Whitelist *what*. :param what: What to whitelist. :type what: :class:`list` of :class:`type` or :class:`attr.Attribute`\\ s :rtype: :class:`callable` """ cls, attrs = _split_what(what) def include_(attribute, value): return value.__class__ in cls or att...
python
def include(*what): """ Whitelist *what*. :param what: What to whitelist. :type what: :class:`list` of :class:`type` or :class:`attr.Attribute`\\ s :rtype: :class:`callable` """ cls, attrs = _split_what(what) def include_(attribute, value): return value.__class__ in cls or att...
[ "def", "include", "(", "*", "what", ")", ":", "cls", ",", "attrs", "=", "_split_what", "(", "what", ")", "def", "include_", "(", "attribute", ",", "value", ")", ":", "return", "value", ".", "__class__", "in", "cls", "or", "attribute", "in", "attrs", ...
Whitelist *what*. :param what: What to whitelist. :type what: :class:`list` of :class:`type` or :class:`attr.Attribute`\\ s :rtype: :class:`callable`
[ "Whitelist", "*", "what", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/filters.py#L21-L35
train
pypa/pipenv
pipenv/vendor/attr/filters.py
exclude
def exclude(*what): """ Blacklist *what*. :param what: What to blacklist. :type what: :class:`list` of classes or :class:`attr.Attribute`\\ s. :rtype: :class:`callable` """ cls, attrs = _split_what(what) def exclude_(attribute, value): return value.__class__ not in cls and att...
python
def exclude(*what): """ Blacklist *what*. :param what: What to blacklist. :type what: :class:`list` of classes or :class:`attr.Attribute`\\ s. :rtype: :class:`callable` """ cls, attrs = _split_what(what) def exclude_(attribute, value): return value.__class__ not in cls and att...
[ "def", "exclude", "(", "*", "what", ")", ":", "cls", ",", "attrs", "=", "_split_what", "(", "what", ")", "def", "exclude_", "(", "attribute", ",", "value", ")", ":", "return", "value", ".", "__class__", "not", "in", "cls", "and", "attribute", "not", ...
Blacklist *what*. :param what: What to blacklist. :type what: :class:`list` of classes or :class:`attr.Attribute`\\ s. :rtype: :class:`callable`
[ "Blacklist", "*", "what", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/filters.py#L38-L52
train
pypa/pipenv
pipenv/vendor/attr/_funcs.py
asdict
def asdict( inst, recurse=True, filter=None, dict_factory=dict, retain_collection_types=False, ): """ Return the ``attrs`` attribute values of *inst* as a dict. Optionally recurse into other ``attrs``-decorated classes. :param inst: Instance of an ``attrs``-decorated class. :pa...
python
def asdict( inst, recurse=True, filter=None, dict_factory=dict, retain_collection_types=False, ): """ Return the ``attrs`` attribute values of *inst* as a dict. Optionally recurse into other ``attrs``-decorated classes. :param inst: Instance of an ``attrs``-decorated class. :pa...
[ "def", "asdict", "(", "inst", ",", "recurse", "=", "True", ",", "filter", "=", "None", ",", "dict_factory", "=", "dict", ",", "retain_collection_types", "=", "False", ",", ")", ":", "attrs", "=", "fields", "(", "inst", ".", "__class__", ")", "rv", "=",...
Return the ``attrs`` attribute values of *inst* as a dict. Optionally recurse into other ``attrs``-decorated classes. :param inst: Instance of an ``attrs``-decorated class. :param bool recurse: Recurse into classes that are also ``attrs``-decorated. :param callable filter: A callable whose ret...
[ "Return", "the", "attrs", "attribute", "values", "of", "*", "inst", "*", "as", "a", "dict", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_funcs.py#L10-L82
train
pypa/pipenv
pipenv/vendor/attr/_funcs.py
_asdict_anything
def _asdict_anything(val, filter, dict_factory, retain_collection_types): """ ``asdict`` only works on attrs instances, this works on anything. """ if getattr(val.__class__, "__attrs_attrs__", None) is not None: # Attrs class. rv = asdict(val, True, filter, dict_factory, retain_collectio...
python
def _asdict_anything(val, filter, dict_factory, retain_collection_types): """ ``asdict`` only works on attrs instances, this works on anything. """ if getattr(val.__class__, "__attrs_attrs__", None) is not None: # Attrs class. rv = asdict(val, True, filter, dict_factory, retain_collectio...
[ "def", "_asdict_anything", "(", "val", ",", "filter", ",", "dict_factory", ",", "retain_collection_types", ")", ":", "if", "getattr", "(", "val", ".", "__class__", ",", "\"__attrs_attrs__\"", ",", "None", ")", "is", "not", "None", ":", "# Attrs class.", "rv", ...
``asdict`` only works on attrs instances, this works on anything.
[ "asdict", "only", "works", "on", "attrs", "instances", "this", "works", "on", "anything", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_funcs.py#L85-L113
train
pypa/pipenv
pipenv/vendor/attr/_funcs.py
astuple
def astuple( inst, recurse=True, filter=None, tuple_factory=tuple, retain_collection_types=False, ): """ Return the ``attrs`` attribute values of *inst* as a tuple. Optionally recurse into other ``attrs``-decorated classes. :param inst: Instance of an ``attrs``-decorated class. ...
python
def astuple( inst, recurse=True, filter=None, tuple_factory=tuple, retain_collection_types=False, ): """ Return the ``attrs`` attribute values of *inst* as a tuple. Optionally recurse into other ``attrs``-decorated classes. :param inst: Instance of an ``attrs``-decorated class. ...
[ "def", "astuple", "(", "inst", ",", "recurse", "=", "True", ",", "filter", "=", "None", ",", "tuple_factory", "=", "tuple", ",", "retain_collection_types", "=", "False", ",", ")", ":", "attrs", "=", "fields", "(", "inst", ".", "__class__", ")", "rv", "...
Return the ``attrs`` attribute values of *inst* as a tuple. Optionally recurse into other ``attrs``-decorated classes. :param inst: Instance of an ``attrs``-decorated class. :param bool recurse: Recurse into classes that are also ``attrs``-decorated. :param callable filter: A callable whose re...
[ "Return", "the", "attrs", "attribute", "values", "of", "*", "inst", "*", "as", "a", "tuple", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_funcs.py#L116-L212
train
pypa/pipenv
pipenv/vendor/attr/_funcs.py
assoc
def assoc(inst, **changes): """ Copy *inst* and apply *changes*. :param inst: Instance of a class with ``attrs`` attributes. :param changes: Keyword changes in the new copy. :return: A copy of inst with *changes* incorporated. :raise attr.exceptions.AttrsAttributeNotFoundError: If *attr_name*...
python
def assoc(inst, **changes): """ Copy *inst* and apply *changes*. :param inst: Instance of a class with ``attrs`` attributes. :param changes: Keyword changes in the new copy. :return: A copy of inst with *changes* incorporated. :raise attr.exceptions.AttrsAttributeNotFoundError: If *attr_name*...
[ "def", "assoc", "(", "inst", ",", "*", "*", "changes", ")", ":", "import", "warnings", "warnings", ".", "warn", "(", "\"assoc is deprecated and will be removed after 2018/01.\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ",", ")", "new", "=", "copy...
Copy *inst* and apply *changes*. :param inst: Instance of a class with ``attrs`` attributes. :param changes: Keyword changes in the new copy. :return: A copy of inst with *changes* incorporated. :raise attr.exceptions.AttrsAttributeNotFoundError: If *attr_name* couldn't be found on *cls*. ...
[ "Copy", "*", "inst", "*", "and", "apply", "*", "changes", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_funcs.py#L227-L262
train
pypa/pipenv
pipenv/vendor/attr/_funcs.py
evolve
def evolve(inst, **changes): """ Create a new instance, based on *inst* with *changes* applied. :param inst: Instance of a class with ``attrs`` attributes. :param changes: Keyword changes in the new copy. :return: A copy of inst with *changes* incorporated. :raise TypeError: If *attr_name* co...
python
def evolve(inst, **changes): """ Create a new instance, based on *inst* with *changes* applied. :param inst: Instance of a class with ``attrs`` attributes. :param changes: Keyword changes in the new copy. :return: A copy of inst with *changes* incorporated. :raise TypeError: If *attr_name* co...
[ "def", "evolve", "(", "inst", ",", "*", "*", "changes", ")", ":", "cls", "=", "inst", ".", "__class__", "attrs", "=", "fields", "(", "cls", ")", "for", "a", "in", "attrs", ":", "if", "not", "a", ".", "init", ":", "continue", "attr_name", "=", "a"...
Create a new instance, based on *inst* with *changes* applied. :param inst: Instance of a class with ``attrs`` attributes. :param changes: Keyword changes in the new copy. :return: A copy of inst with *changes* incorporated. :raise TypeError: If *attr_name* couldn't be found in the class ``__...
[ "Create", "a", "new", "instance", "based", "on", "*", "inst", "*", "with", "*", "changes", "*", "applied", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_funcs.py#L265-L290
train
pypa/pipenv
pipenv/vendor/yarg/client.py
get
def get(package_name, pypi_server="https://pypi.python.org/pypi/"): """ Constructs a request to the PyPI server and returns a :class:`yarg.package.Package`. :param package_name: case sensitive name of the package on the PyPI server. :param pypi_server: (option) URL to the PyPI server. >>> ...
python
def get(package_name, pypi_server="https://pypi.python.org/pypi/"): """ Constructs a request to the PyPI server and returns a :class:`yarg.package.Package`. :param package_name: case sensitive name of the package on the PyPI server. :param pypi_server: (option) URL to the PyPI server. >>> ...
[ "def", "get", "(", "package_name", ",", "pypi_server", "=", "\"https://pypi.python.org/pypi/\"", ")", ":", "if", "not", "pypi_server", ".", "endswith", "(", "\"/\"", ")", ":", "pypi_server", "=", "pypi_server", "+", "\"/\"", "response", "=", "requests", ".", "...
Constructs a request to the PyPI server and returns a :class:`yarg.package.Package`. :param package_name: case sensitive name of the package on the PyPI server. :param pypi_server: (option) URL to the PyPI server. >>> import yarg >>> package = yarg.get('yarg') <Package yarg>
[ "Constructs", "a", "request", "to", "the", "PyPI", "server", "and", "returns", "a", ":", "class", ":", "yarg", ".", "package", ".", "Package", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/client.py#L32-L54
train
pypa/pipenv
pipenv/vendor/click/_bashcomplete.py
resolve_ctx
def resolve_ctx(cli, prog_name, args): """ Parse into a hierarchy of contexts. Contexts are connected through the parent variable. :param cli: command definition :param prog_name: the program that is running :param args: full list of args :return: the final context/command parsed """ ctx...
python
def resolve_ctx(cli, prog_name, args): """ Parse into a hierarchy of contexts. Contexts are connected through the parent variable. :param cli: command definition :param prog_name: the program that is running :param args: full list of args :return: the final context/command parsed """ ctx...
[ "def", "resolve_ctx", "(", "cli", ",", "prog_name", ",", "args", ")", ":", "ctx", "=", "cli", ".", "make_context", "(", "prog_name", ",", "args", ",", "resilient_parsing", "=", "True", ")", "args", "=", "ctx", ".", "protected_args", "+", "ctx", ".", "a...
Parse into a hierarchy of contexts. Contexts are connected through the parent variable. :param cli: command definition :param prog_name: the program that is running :param args: full list of args :return: the final context/command parsed
[ "Parse", "into", "a", "hierarchy", "of", "contexts", ".", "Contexts", "are", "connected", "through", "the", "parent", "variable", ".", ":", "param", "cli", ":", "command", "definition", ":", "param", "prog_name", ":", "the", "program", "that", "is", "running...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_bashcomplete.py#L85-L119
train
pypa/pipenv
pipenv/vendor/click/_bashcomplete.py
is_incomplete_option
def is_incomplete_option(all_args, cmd_param): """ :param all_args: the full original list of args supplied :param cmd_param: the current command paramter :return: whether or not the last option declaration (i.e. starts "-" or "--") is incomplete and corresponds to this cmd_param. In other words whe...
python
def is_incomplete_option(all_args, cmd_param): """ :param all_args: the full original list of args supplied :param cmd_param: the current command paramter :return: whether or not the last option declaration (i.e. starts "-" or "--") is incomplete and corresponds to this cmd_param. In other words whe...
[ "def", "is_incomplete_option", "(", "all_args", ",", "cmd_param", ")", ":", "if", "not", "isinstance", "(", "cmd_param", ",", "Option", ")", ":", "return", "False", "if", "cmd_param", ".", "is_flag", ":", "return", "False", "last_option", "=", "None", "for",...
:param all_args: the full original list of args supplied :param cmd_param: the current command paramter :return: whether or not the last option declaration (i.e. starts "-" or "--") is incomplete and corresponds to this cmd_param. In other words whether this cmd_param option can still accept values
[ ":", "param", "all_args", ":", "the", "full", "original", "list", "of", "args", "supplied", ":", "param", "cmd_param", ":", "the", "current", "command", "paramter", ":", "return", ":", "whether", "or", "not", "the", "last", "option", "declaration", "(", "i...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_bashcomplete.py#L130-L149
train