partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_get_wheel_metadata_from_wheel
Build a wheel and extract the metadata from it. Fallback for when the build backend does not define the 'get_wheel_metadata' hook.
pipenv/vendor/pep517/_in_process.py
def _get_wheel_metadata_from_wheel( backend, metadata_directory, config_settings): """Build a wheel and extract the metadata from it. Fallback for when the build backend does not define the 'get_wheel_metadata' hook. """ from zipfile import ZipFile whl_basename = backend.build_wheel(met...
def _get_wheel_metadata_from_wheel( backend, metadata_directory, config_settings): """Build a wheel and extract the metadata from it. Fallback for when the build backend does not define the 'get_wheel_metadata' hook. """ from zipfile import ZipFile whl_basename = backend.build_wheel(met...
[ "Build", "a", "wheel", "and", "extract", "the", "metadata", "from", "it", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L87-L103
[ "def", "_get_wheel_metadata_from_wheel", "(", "backend", ",", "metadata_directory", ",", "config_settings", ")", ":", "from", "zipfile", "import", "ZipFile", "whl_basename", "=", "backend", ".", "build_wheel", "(", "metadata_directory", ",", "config_settings", ")", "w...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_find_already_built_wheel
Check for a wheel already built during the get_wheel_metadata hook.
pipenv/vendor/pep517/_in_process.py
def _find_already_built_wheel(metadata_directory): """Check for a wheel already built during the get_wheel_metadata hook. """ if not metadata_directory: return None metadata_parent = os.path.dirname(metadata_directory) if not os.path.isfile(pjoin(metadata_parent, WHEEL_BUILT_MARKER)): ...
def _find_already_built_wheel(metadata_directory): """Check for a wheel already built during the get_wheel_metadata hook. """ if not metadata_directory: return None metadata_parent = os.path.dirname(metadata_directory) if not os.path.isfile(pjoin(metadata_parent, WHEEL_BUILT_MARKER)): ...
[ "Check", "for", "a", "wheel", "already", "built", "during", "the", "get_wheel_metadata", "hook", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L106-L125
[ "def", "_find_already_built_wheel", "(", "metadata_directory", ")", ":", "if", "not", "metadata_directory", ":", "return", "None", "metadata_parent", "=", "os", ".", "path", ".", "dirname", "(", "metadata_directory", ")", "if", "not", "os", ".", "path", ".", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
build_wheel
Invoke the mandatory build_wheel hook. If a wheel was already built in the prepare_metadata_for_build_wheel fallback, this will copy it rather than rebuilding the wheel.
pipenv/vendor/pep517/_in_process.py
def build_wheel(wheel_directory, config_settings, metadata_directory=None): """Invoke the mandatory build_wheel hook. If a wheel was already built in the prepare_metadata_for_build_wheel fallback, this will copy it rather than rebuilding the wheel. """ prebuilt_whl = _find_already_built_wheel(m...
def build_wheel(wheel_directory, config_settings, metadata_directory=None): """Invoke the mandatory build_wheel hook. If a wheel was already built in the prepare_metadata_for_build_wheel fallback, this will copy it rather than rebuilding the wheel. """ prebuilt_whl = _find_already_built_wheel(m...
[ "Invoke", "the", "mandatory", "build_wheel", "hook", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L128-L141
[ "def", "build_wheel", "(", "wheel_directory", ",", "config_settings", ",", "metadata_directory", "=", "None", ")", ":", "prebuilt_whl", "=", "_find_already_built_wheel", "(", "metadata_directory", ")", "if", "prebuilt_whl", ":", "shutil", ".", "copy2", "(", "prebuil...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_requires_for_build_sdist
Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined.
pipenv/vendor/pep517/_in_process.py
def get_requires_for_build_sdist(config_settings): """Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined. """ backend = _build_backend() try: hook = backend.get_requires_for_build_sdist except AttributeError: return [] else: r...
def get_requires_for_build_sdist(config_settings): """Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined. """ backend = _build_backend() try: hook = backend.get_requires_for_build_sdist except AttributeError: return [] else: r...
[ "Invoke", "the", "optional", "get_requires_for_build_wheel", "hook" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L144-L155
[ "def", "get_requires_for_build_sdist", "(", "config_settings", ")", ":", "backend", "=", "_build_backend", "(", ")", "try", ":", "hook", "=", "backend", ".", "get_requires_for_build_sdist", "except", "AttributeError", ":", "return", "[", "]", "else", ":", "return"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Table.append
Appends a (key, item) to the table.
pipenv/vendor/tomlkit/items.py
def append(self, key, _item): # type: (Union[Key, str], Any) -> Table """ Appends a (key, item) to the table. """ if not isinstance(_item, Item): _item = item(_item) self._value.append(key, _item) if isinstance(key, Key): key = key.key ...
def append(self, key, _item): # type: (Union[Key, str], Any) -> Table """ Appends a (key, item) to the table. """ if not isinstance(_item, Item): _item = item(_item) self._value.append(key, _item) if isinstance(key, Key): key = key.key ...
[ "Appends", "a", "(", "key", "item", ")", "to", "the", "table", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/items.py#L780-L808
[ "def", "append", "(", "self", ",", "key", ",", "_item", ")", ":", "# type: (Union[Key, str], Any) -> Table", "if", "not", "isinstance", "(", "_item", ",", "Item", ")", ":", "_item", "=", "item", "(", "_item", ")", "self", ".", "_value", ".", "append", "(...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
InlineTable.append
Appends a (key, item) to the table.
pipenv/vendor/tomlkit/items.py
def append(self, key, _item): # type: (Union[Key, str], Any) -> InlineTable """ Appends a (key, item) to the table. """ if not isinstance(_item, Item): _item = item(_item) if not isinstance(_item, (Whitespace, Comment)): if not _item.trivia.indent and le...
def append(self, key, _item): # type: (Union[Key, str], Any) -> InlineTable """ Appends a (key, item) to the table. """ if not isinstance(_item, Item): _item = item(_item) if not isinstance(_item, (Whitespace, Comment)): if not _item.trivia.indent and le...
[ "Appends", "a", "(", "key", "item", ")", "to", "the", "table", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/items.py#L932-L953
[ "def", "append", "(", "self", ",", "key", ",", "_item", ")", ":", "# type: (Union[Key, str], Any) -> InlineTable", "if", "not", "isinstance", "(", "_item", ",", "Item", ")", ":", "_item", "=", "item", "(", "_item", ")", "if", "not", "isinstance", "(", "_it...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
update_wrapper
Patch two bugs in functools.update_wrapper.
pipenv/vendor/backports/functools_lru_cache.py
def update_wrapper(wrapper, wrapped, assigned = functools.WRAPPER_ASSIGNMENTS, updated = functools.WRAPPER_UPDATES): """ Patch two bugs in functools.update_wrapper. """ # workaround for http://bugs.python.org/issue3445 assigned = tuple(attr fo...
def update_wrapper(wrapper, wrapped, assigned = functools.WRAPPER_ASSIGNMENTS, updated = functools.WRAPPER_UPDATES): """ Patch two bugs in functools.update_wrapper. """ # workaround for http://bugs.python.org/issue3445 assigned = tuple(attr fo...
[ "Patch", "two", "bugs", "in", "functools", ".", "update_wrapper", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/functools_lru_cache.py#L11-L23
[ "def", "update_wrapper", "(", "wrapper", ",", "wrapped", ",", "assigned", "=", "functools", ".", "WRAPPER_ASSIGNMENTS", ",", "updated", "=", "functools", ".", "WRAPPER_UPDATES", ")", ":", "# workaround for http://bugs.python.org/issue3445", "assigned", "=", "tuple", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
lru_cache
Least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache can grow without bound. If *typed* is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated as distinct calls with distinct results. ...
pipenv/vendor/backports/functools_lru_cache.py
def lru_cache(maxsize=100, typed=False): """Least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache can grow without bound. If *typed* is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated...
def lru_cache(maxsize=100, typed=False): """Least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache can grow without bound. If *typed* is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated...
[ "Least", "-", "recently", "-", "used", "cache", "decorator", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/functools_lru_cache.py#L57-L184
[ "def", "lru_cache", "(", "maxsize", "=", "100", ",", "typed", "=", "False", ")", ":", "# Users should only access the lru_cache through its public API:", "# cache_info, cache_clear, and f.__wrapped__", "# The internals of the lru_cache are encapsulated for thread safety and", "# ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
first
Return first element of `iterable` that evaluates true, else return None (or an optional default value). >>> first([0, False, None, [], (), 42]) 42 >>> first([0, False, None, [], ()]) is None True >>> first([0, False, None, [], ()], default='ohai') 'ohai' >>> import re >>> m = fi...
pipenv/vendor/first.py
def first(iterable, default=None, key=None): """ Return first element of `iterable` that evaluates true, else return None (or an optional default value). >>> first([0, False, None, [], (), 42]) 42 >>> first([0, False, None, [], ()]) is None True >>> first([0, False, None, [], ()], def...
def first(iterable, default=None, key=None): """ Return first element of `iterable` that evaluates true, else return None (or an optional default value). >>> first([0, False, None, [], (), 42]) 42 >>> first([0, False, None, [], ()]) is None True >>> first([0, False, None, [], ()], def...
[ "Return", "first", "element", "of", "iterable", "that", "evaluates", "true", "else", "return", "None", "(", "or", "an", "optional", "default", "value", ")", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/first.py#L42-L78
[ "def", "first", "(", "iterable", ",", "default", "=", "None", ",", "key", "=", "None", ")", ":", "if", "key", "is", "None", ":", "for", "el", "in", "iterable", ":", "if", "el", ":", "return", "el", "else", ":", "for", "el", "in", "iterable", ":",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_process_mapping
Try to look up the process tree via the output of `ps`.
pipenv/vendor/shellingham/posix/ps.py
def get_process_mapping(): """Try to look up the process tree via the output of `ps`. """ try: output = subprocess.check_output([ 'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=', ]) except OSError as e: # Python 2-compatible FileNotFoundError. if e.errno !=...
def get_process_mapping(): """Try to look up the process tree via the output of `ps`. """ try: output = subprocess.check_output([ 'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=', ]) except OSError as e: # Python 2-compatible FileNotFoundError. if e.errno !=...
[ "Try", "to", "look", "up", "the", "process", "tree", "via", "the", "output", "of", "ps", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/ps.py#L12-L45
[ "def", "get_process_mapping", "(", ")", ":", "try", ":", "output", "=", "subprocess", ".", "check_output", "(", "[", "'ps'", ",", "'-ww'", ",", "'-o'", ",", "'pid='", ",", "'-o'", ",", "'ppid='", ",", "'-o'", ",", "'args='", ",", "]", ")", "except", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
FrameSymbolVisitor.visit_Name
All assignments to names go through this function.
pipenv/vendor/jinja2/idtracking.py
def visit_Name(self, node, store_as_param=False, **kwargs): """All assignments to names go through this function.""" if store_as_param or node.ctx == 'param': self.symbols.declare_parameter(node.name) elif node.ctx == 'store': self.symbols.store(node.name) elif no...
def visit_Name(self, node, store_as_param=False, **kwargs): """All assignments to names go through this function.""" if store_as_param or node.ctx == 'param': self.symbols.declare_parameter(node.name) elif node.ctx == 'store': self.symbols.store(node.name) elif no...
[ "All", "assignments", "to", "names", "go", "through", "this", "function", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/idtracking.py#L209-L216
[ "def", "visit_Name", "(", "self", ",", "node", ",", "store_as_param", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "store_as_param", "or", "node", ".", "ctx", "==", "'param'", ":", "self", ".", "symbols", ".", "declare_parameter", "(", "node", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
FrameSymbolVisitor.visit_Assign
Visit assignments in the correct order.
pipenv/vendor/jinja2/idtracking.py
def visit_Assign(self, node, **kwargs): """Visit assignments in the correct order.""" self.visit(node.node, **kwargs) self.visit(node.target, **kwargs)
def visit_Assign(self, node, **kwargs): """Visit assignments in the correct order.""" self.visit(node.node, **kwargs) self.visit(node.target, **kwargs)
[ "Visit", "assignments", "in", "the", "correct", "order", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/idtracking.py#L254-L257
[ "def", "visit_Assign", "(", "self", ",", "node", ",", "*", "*", "kwargs", ")", ":", "self", ".", "visit", "(", "node", ".", "node", ",", "*", "*", "kwargs", ")", "self", ".", "visit", "(", "node", ".", "target", ",", "*", "*", "kwargs", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
make_set_closure_cell
Moved into a function for testability.
pipenv/vendor/attr/_compat.py
def make_set_closure_cell(): """ Moved into a function for testability. """ if PYPY: # pragma: no cover def set_closure_cell(cell, value): cell.__setstate__((value,)) else: try: ctypes = import_ctypes() set_closure_cell = ctypes.pythonapi.PyCel...
def make_set_closure_cell(): """ Moved into a function for testability. """ if PYPY: # pragma: no cover def set_closure_cell(cell, value): cell.__setstate__((value,)) else: try: ctypes = import_ctypes() set_closure_cell = ctypes.pythonapi.PyCel...
[ "Moved", "into", "a", "function", "for", "testability", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_compat.py#L136-L156
[ "def", "make_set_closure_cell", "(", ")", ":", "if", "PYPY", ":", "# pragma: no cover", "def", "set_closure_cell", "(", "cell", ",", "value", ")", ":", "cell", ".", "__setstate__", "(", "(", "value", ",", ")", ")", "else", ":", "try", ":", "ctypes", "=",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn._spawn
This starts the given command in a child process. This does all the fork/exec type of stuff for a pty. This is called by __init__. If args is empty then command will be parsed (split on spaces) and args will be set to parsed arguments.
pipenv/vendor/pexpect/pty_spawn.py
def _spawn(self, command, args=[], preexec_fn=None, dimensions=None): '''This starts the given command in a child process. This does all the fork/exec type of stuff for a pty. This is called by __init__. If args is empty then command will be parsed (split on spaces) and args will be set ...
def _spawn(self, command, args=[], preexec_fn=None, dimensions=None): '''This starts the given command in a child process. This does all the fork/exec type of stuff for a pty. This is called by __init__. If args is empty then command will be parsed (split on spaces) and args will be set ...
[ "This", "starts", "the", "given", "command", "in", "a", "child", "process", ".", "This", "does", "all", "the", "fork", "/", "exec", "type", "of", "stuff", "for", "a", "pty", ".", "This", "is", "called", "by", "__init__", ".", "If", "args", "is", "emp...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L239-L310
[ "def", "_spawn", "(", "self", ",", "command", ",", "args", "=", "[", "]", ",", "preexec_fn", "=", "None", ",", "dimensions", "=", "None", ")", ":", "# The pid and child_fd of this object get set by this method.", "# Note that it is difficult for this method to fail.", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.close
This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the child ignores SIGHUP and SIGINT).
pipenv/vendor/pexpect/pty_spawn.py
def close(self, force=True): '''This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the chi...
def close(self, force=True): '''This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the chi...
[ "This", "closes", "the", "connection", "with", "the", "child", "application", ".", "Note", "that", "calling", "close", "()", "more", "than", "once", "is", "valid", ".", "This", "emulates", "standard", "Python", "behavior", "with", "files", ".", "Set", "force...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L316-L330
[ "def", "close", "(", "self", ",", "force", "=", "True", ")", ":", "self", ".", "flush", "(", ")", "with", "_wrap_ptyprocess_err", "(", ")", ":", "# PtyProcessError may be raised if it is not possible to terminate", "# the child.", "self", ".", "ptyproc", ".", "clo...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.waitnoecho
This waits until the terminal ECHO flag is set False. This returns True if the echo mode is off. This returns False if the ECHO flag was not set False before the timeout. This can be used to detect when the child is waiting for a password. Usually a child application will turn off echo m...
pipenv/vendor/pexpect/pty_spawn.py
def waitnoecho(self, timeout=-1): '''This waits until the terminal ECHO flag is set False. This returns True if the echo mode is off. This returns False if the ECHO flag was not set False before the timeout. This can be used to detect when the child is waiting for a password. Usually a c...
def waitnoecho(self, timeout=-1): '''This waits until the terminal ECHO flag is set False. This returns True if the echo mode is off. This returns False if the ECHO flag was not set False before the timeout. This can be used to detect when the child is waiting for a password. Usually a c...
[ "This", "waits", "until", "the", "terminal", "ECHO", "flag", "is", "set", "False", ".", "This", "returns", "True", "if", "the", "echo", "mode", "is", "off", ".", "This", "returns", "False", "if", "the", "ECHO", "flag", "was", "not", "set", "False", "be...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L343-L371
[ "def", "waitnoecho", "(", "self", ",", "timeout", "=", "-", "1", ")", ":", "if", "timeout", "==", "-", "1", ":", "timeout", "=", "self", ".", "timeout", "if", "timeout", "is", "not", "None", ":", "end_time", "=", "time", ".", "time", "(", ")", "+...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.read_nonblocking
This reads at most size characters from the child application. It includes a timeout. If the read does not complete within the timeout period then a TIMEOUT exception is raised. If the end of file is read then an EOF exception will be raised. If a logfile is specified, a copy is written...
pipenv/vendor/pexpect/pty_spawn.py
def read_nonblocking(self, size=1, timeout=-1): '''This reads at most size characters from the child application. It includes a timeout. If the read does not complete within the timeout period then a TIMEOUT exception is raised. If the end of file is read then an EOF exception will be ra...
def read_nonblocking(self, size=1, timeout=-1): '''This reads at most size characters from the child application. It includes a timeout. If the read does not complete within the timeout period then a TIMEOUT exception is raised. If the end of file is read then an EOF exception will be ra...
[ "This", "reads", "at", "most", "size", "characters", "from", "the", "child", "application", ".", "It", "includes", "a", "timeout", ".", "If", "the", "read", "does", "not", "complete", "within", "the", "timeout", "period", "then", "a", "TIMEOUT", "exception",...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L415-L487
[ "def", "read_nonblocking", "(", "self", ",", "size", "=", "1", ",", "timeout", "=", "-", "1", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'I/O operation on closed file.'", ")", "if", "timeout", "==", "-", "1", ":", "timeout",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.send
Sends string ``s`` to the child process, returning the number of bytes written. If a logfile is specified, a copy is written to that log. The default terminal input mode is canonical processing unless set otherwise by the child process. This allows backspace and other line proce...
pipenv/vendor/pexpect/pty_spawn.py
def send(self, s): '''Sends string ``s`` to the child process, returning the number of bytes written. If a logfile is specified, a copy is written to that log. The default terminal input mode is canonical processing unless set otherwise by the child process. This allows backspac...
def send(self, s): '''Sends string ``s`` to the child process, returning the number of bytes written. If a logfile is specified, a copy is written to that log. The default terminal input mode is canonical processing unless set otherwise by the child process. This allows backspac...
[ "Sends", "string", "s", "to", "the", "child", "process", "returning", "the", "number", "of", "bytes", "written", ".", "If", "a", "logfile", "is", "specified", "a", "copy", "is", "written", "to", "that", "log", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L504-L546
[ "def", "send", "(", "self", ",", "s", ")", ":", "if", "self", ".", "delaybeforesend", "is", "not", "None", ":", "time", ".", "sleep", "(", "self", ".", "delaybeforesend", ")", "s", "=", "self", ".", "_coerce_send_string", "(", "s", ")", "self", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.sendline
Wraps send(), sending string ``s`` to child process, with ``os.linesep`` automatically appended. Returns number of bytes written. Only a limited number of bytes may be sent for each line in the default terminal mode, see docstring of :meth:`send`.
pipenv/vendor/pexpect/pty_spawn.py
def sendline(self, s=''): '''Wraps send(), sending string ``s`` to child process, with ``os.linesep`` automatically appended. Returns number of bytes written. Only a limited number of bytes may be sent for each line in the default terminal mode, see docstring of :meth:`send`. ''...
def sendline(self, s=''): '''Wraps send(), sending string ``s`` to child process, with ``os.linesep`` automatically appended. Returns number of bytes written. Only a limited number of bytes may be sent for each line in the default terminal mode, see docstring of :meth:`send`. ''...
[ "Wraps", "send", "()", "sending", "string", "s", "to", "child", "process", "with", "os", ".", "linesep", "automatically", "appended", ".", "Returns", "number", "of", "bytes", "written", ".", "Only", "a", "limited", "number", "of", "bytes", "may", "be", "se...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L548-L555
[ "def", "sendline", "(", "self", ",", "s", "=", "''", ")", ":", "s", "=", "self", ".", "_coerce_send_string", "(", "s", ")", "return", "self", ".", "send", "(", "s", "+", "self", ".", "linesep", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn._log_control
Write control characters to the appropriate log files
pipenv/vendor/pexpect/pty_spawn.py
def _log_control(self, s): """Write control characters to the appropriate log files""" if self.encoding is not None: s = s.decode(self.encoding, 'replace') self._log(s, 'send')
def _log_control(self, s): """Write control characters to the appropriate log files""" if self.encoding is not None: s = s.decode(self.encoding, 'replace') self._log(s, 'send')
[ "Write", "control", "characters", "to", "the", "appropriate", "log", "files" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L557-L561
[ "def", "_log_control", "(", "self", ",", "s", ")", ":", "if", "self", ".", "encoding", "is", "not", "None", ":", "s", "=", "s", ".", "decode", "(", "self", ".", "encoding", ",", "'replace'", ")", "self", ".", "_log", "(", "s", ",", "'send'", ")" ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.sendcontrol
Helper method that wraps send() with mnemonic access for sending control character to the child (such as Ctrl-C or Ctrl-D). For example, to send Ctrl-G (ASCII 7, bell, '\a'):: child.sendcontrol('g') See also, sendintr() and sendeof().
pipenv/vendor/pexpect/pty_spawn.py
def sendcontrol(self, char): '''Helper method that wraps send() with mnemonic access for sending control character to the child (such as Ctrl-C or Ctrl-D). For example, to send Ctrl-G (ASCII 7, bell, '\a'):: child.sendcontrol('g') See also, sendintr() and sendeof(). ...
def sendcontrol(self, char): '''Helper method that wraps send() with mnemonic access for sending control character to the child (such as Ctrl-C or Ctrl-D). For example, to send Ctrl-G (ASCII 7, bell, '\a'):: child.sendcontrol('g') See also, sendintr() and sendeof(). ...
[ "Helper", "method", "that", "wraps", "send", "()", "with", "mnemonic", "access", "for", "sending", "control", "character", "to", "the", "child", "(", "such", "as", "Ctrl", "-", "C", "or", "Ctrl", "-", "D", ")", ".", "For", "example", "to", "send", "Ctr...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L563-L574
[ "def", "sendcontrol", "(", "self", ",", "char", ")", ":", "n", ",", "byte", "=", "self", ".", "ptyproc", ".", "sendcontrol", "(", "char", ")", "self", ".", "_log_control", "(", "byte", ")", "return", "n" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.sendeof
This sends an EOF to the child. This sends a character which causes the pending parent output buffer to be sent to the waiting child program without waiting for end-of-line. If it is the first character of the line, the read() in the user program returns 0, which signifies end-of-file. T...
pipenv/vendor/pexpect/pty_spawn.py
def sendeof(self): '''This sends an EOF to the child. This sends a character which causes the pending parent output buffer to be sent to the waiting child program without waiting for end-of-line. If it is the first character of the line, the read() in the user program returns 0, which si...
def sendeof(self): '''This sends an EOF to the child. This sends a character which causes the pending parent output buffer to be sent to the waiting child program without waiting for end-of-line. If it is the first character of the line, the read() in the user program returns 0, which si...
[ "This", "sends", "an", "EOF", "to", "the", "child", ".", "This", "sends", "a", "character", "which", "causes", "the", "pending", "parent", "output", "buffer", "to", "be", "sent", "to", "the", "waiting", "child", "program", "without", "waiting", "for", "end...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L576-L587
[ "def", "sendeof", "(", "self", ")", ":", "n", ",", "byte", "=", "self", ".", "ptyproc", ".", "sendeof", "(", ")", "self", ".", "_log_control", "(", "byte", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.sendintr
This sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line.
pipenv/vendor/pexpect/pty_spawn.py
def sendintr(self): '''This sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line. ''' n, byte = self.ptyproc.sendintr() self._log_control(byte)
def sendintr(self): '''This sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line. ''' n, byte = self.ptyproc.sendintr() self._log_control(byte)
[ "This", "sends", "a", "SIGINT", "to", "the", "child", ".", "It", "does", "not", "require", "the", "SIGINT", "to", "be", "the", "first", "character", "on", "a", "line", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L589-L594
[ "def", "sendintr", "(", "self", ")", ":", "n", ",", "byte", "=", "self", ".", "ptyproc", ".", "sendintr", "(", ")", "self", ".", "_log_control", "(", "byte", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.wait
This waits until the child exits. This is a blocking call. This will not read any data from the child, so this will block forever if the child has unread output and has terminated. In other words, the child may have printed output then called exit(), but, the child is technically still a...
pipenv/vendor/pexpect/pty_spawn.py
def wait(self): '''This waits until the child exits. This is a blocking call. This will not read any data from the child, so this will block forever if the child has unread output and has terminated. In other words, the child may have printed output then called exit(), but, the child is ...
def wait(self): '''This waits until the child exits. This is a blocking call. This will not read any data from the child, so this will block forever if the child has unread output and has terminated. In other words, the child may have printed output then called exit(), but, the child is ...
[ "This", "waits", "until", "the", "child", "exits", ".", "This", "is", "a", "blocking", "call", ".", "This", "will", "not", "read", "any", "data", "from", "the", "child", "so", "this", "will", "block", "forever", "if", "the", "child", "has", "unread", "...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L649-L671
[ "def", "wait", "(", "self", ")", ":", "ptyproc", "=", "self", ".", "ptyproc", "with", "_wrap_ptyprocess_err", "(", ")", ":", "# exception may occur if \"Is some other process attempting", "# \"job control with our child pid?\"", "exitstatus", "=", "ptyproc", ".", "wait", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.isalive
This tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally SECONDS for Solaris to...
pipenv/vendor/pexpect/pty_spawn.py
def isalive(self): '''This tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally ...
def isalive(self): '''This tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally ...
[ "This", "tests", "if", "the", "child", "process", "is", "running", "or", "not", ".", "This", "is", "non", "-", "blocking", ".", "If", "the", "child", "was", "terminated", "then", "this", "will", "read", "the", "exitstatus", "or", "signalstatus", "of", "t...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L673-L690
[ "def", "isalive", "(", "self", ")", ":", "ptyproc", "=", "self", ".", "ptyproc", "with", "_wrap_ptyprocess_err", "(", ")", ":", "alive", "=", "ptyproc", ".", "isalive", "(", ")", "if", "not", "alive", ":", "self", ".", "status", "=", "ptyproc", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.interact
This gives control of the child process to the interactive user (the human at the keyboard). Keystrokes are sent to the child process, and the stdout and stderr output of the child process is printed. This simply echos the child stdout and child stderr to the real stdout and it echos the...
pipenv/vendor/pexpect/pty_spawn.py
def interact(self, escape_character=chr(29), input_filter=None, output_filter=None): '''This gives control of the child process to the interactive user (the human at the keyboard). Keystrokes are sent to the child process, and the stdout and stderr output of the child process is pri...
def interact(self, escape_character=chr(29), input_filter=None, output_filter=None): '''This gives control of the child process to the interactive user (the human at the keyboard). Keystrokes are sent to the child process, and the stdout and stderr output of the child process is pri...
[ "This", "gives", "control", "of", "the", "child", "process", "to", "the", "interactive", "user", "(", "the", "human", "at", "the", "keyboard", ")", ".", "Keystrokes", "are", "sent", "to", "the", "child", "process", "and", "the", "stdout", "and", "stderr", ...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L716-L768
[ "def", "interact", "(", "self", ",", "escape_character", "=", "chr", "(", "29", ")", ",", "input_filter", "=", "None", ",", "output_filter", "=", "None", ")", ":", "# Flush the buffer.", "self", ".", "write_to_stdout", "(", "self", ".", "buffer", ")", "sel...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.__interact_writen
This is used by the interact() method.
pipenv/vendor/pexpect/pty_spawn.py
def __interact_writen(self, fd, data): '''This is used by the interact() method. ''' while data != b'' and self.isalive(): n = os.write(fd, data) data = data[n:]
def __interact_writen(self, fd, data): '''This is used by the interact() method. ''' while data != b'' and self.isalive(): n = os.write(fd, data) data = data[n:]
[ "This", "is", "used", "by", "the", "interact", "()", "method", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L770-L776
[ "def", "__interact_writen", "(", "self", ",", "fd", ",", "data", ")", ":", "while", "data", "!=", "b''", "and", "self", ".", "isalive", "(", ")", ":", "n", "=", "os", ".", "write", "(", "fd", ",", "data", ")", "data", "=", "data", "[", "n", ":"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
spawn.__interact_copy
This is used by the interact() method.
pipenv/vendor/pexpect/pty_spawn.py
def __interact_copy( self, escape_character=None, input_filter=None, output_filter=None ): '''This is used by the interact() method. ''' while self.isalive(): if self.use_poll: r = poll_ignore_interrupts([self.child_fd, self.STDIN_FILENO]) el...
def __interact_copy( self, escape_character=None, input_filter=None, output_filter=None ): '''This is used by the interact() method. ''' while self.isalive(): if self.use_poll: r = poll_ignore_interrupts([self.child_fd, self.STDIN_FILENO]) el...
[ "This", "is", "used", "by", "the", "interact", "()", "method", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pty_spawn.py#L784-L827
[ "def", "__interact_copy", "(", "self", ",", "escape_character", "=", "None", ",", "input_filter", "=", "None", ",", "output_filter", "=", "None", ")", ":", "while", "self", ".", "isalive", "(", ")", ":", "if", "self", ".", "use_poll", ":", "r", "=", "p...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
extras_to_string
Turn a list of extras into a string
pipenv/vendor/requirementslib/models/utils.py
def extras_to_string(extras): # type: (Iterable[S]) -> S """Turn a list of extras into a string""" if isinstance(extras, six.string_types): if extras.startswith("["): return extras else: extras = [extras] if not extras: return "" return "[{0}]".format(...
def extras_to_string(extras): # type: (Iterable[S]) -> S """Turn a list of extras into a string""" if isinstance(extras, six.string_types): if extras.startswith("["): return extras else: extras = [extras] if not extras: return "" return "[{0}]".format(...
[ "Turn", "a", "list", "of", "extras", "into", "a", "string" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L143-L153
[ "def", "extras_to_string", "(", "extras", ")", ":", "# type: (Iterable[S]) -> S", "if", "isinstance", "(", "extras", ",", "six", ".", "string_types", ")", ":", "if", "extras", ".", "startswith", "(", "\"[\"", ")", ":", "return", "extras", "else", ":", "extra...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
parse_extras
Turn a string of extras into a parsed extras list
pipenv/vendor/requirementslib/models/utils.py
def parse_extras(extras_str): # type: (AnyStr) -> List[AnyStr] """ Turn a string of extras into a parsed extras list """ from pkg_resources import Requirement extras = Requirement.parse("fakepkg{0}".format(extras_to_string(extras_str))).extras return sorted(dedup([extra.lower() for extra i...
def parse_extras(extras_str): # type: (AnyStr) -> List[AnyStr] """ Turn a string of extras into a parsed extras list """ from pkg_resources import Requirement extras = Requirement.parse("fakepkg{0}".format(extras_to_string(extras_str))).extras return sorted(dedup([extra.lower() for extra i...
[ "Turn", "a", "string", "of", "extras", "into", "a", "parsed", "extras", "list" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L156-L165
[ "def", "parse_extras", "(", "extras_str", ")", ":", "# type: (AnyStr) -> List[AnyStr]", "from", "pkg_resources", "import", "Requirement", "extras", "=", "Requirement", ".", "parse", "(", "\"fakepkg{0}\"", ".", "format", "(", "extras_to_string", "(", "extras_str", ")",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
specs_to_string
Turn a list of specifier tuples into a string
pipenv/vendor/requirementslib/models/utils.py
def specs_to_string(specs): # type: (List[Union[STRING_TYPE, Specifier]]) -> AnyStr """ Turn a list of specifier tuples into a string """ if specs: if isinstance(specs, six.string_types): return specs try: extras = ",".join(["".join(spec) for spec in specs]) ...
def specs_to_string(specs): # type: (List[Union[STRING_TYPE, Specifier]]) -> AnyStr """ Turn a list of specifier tuples into a string """ if specs: if isinstance(specs, six.string_types): return specs try: extras = ",".join(["".join(spec) for spec in specs]) ...
[ "Turn", "a", "list", "of", "specifier", "tuples", "into", "a", "string" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L168-L182
[ "def", "specs_to_string", "(", "specs", ")", ":", "# type: (List[Union[STRING_TYPE, Specifier]]) -> AnyStr", "if", "specs", ":", "if", "isinstance", "(", "specs", ",", "six", ".", "string_types", ")", ":", "return", "specs", "try", ":", "extras", "=", "\",\"", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
convert_direct_url_to_url
Given a direct url as defined by *PEP 508*, convert to a :class:`~pip_shims.shims.Link` compatible URL by moving the name and extras into an **egg_fragment**. :param str direct_url: A pep-508 compliant direct url. :return: A reformatted URL for use with Link objects and :class:`~pip_shims.shims.InstallRequ...
pipenv/vendor/requirementslib/models/utils.py
def convert_direct_url_to_url(direct_url): # type: (AnyStr) -> AnyStr """ Given a direct url as defined by *PEP 508*, convert to a :class:`~pip_shims.shims.Link` compatible URL by moving the name and extras into an **egg_fragment**. :param str direct_url: A pep-508 compliant direct url. :return...
def convert_direct_url_to_url(direct_url): # type: (AnyStr) -> AnyStr """ Given a direct url as defined by *PEP 508*, convert to a :class:`~pip_shims.shims.Link` compatible URL by moving the name and extras into an **egg_fragment**. :param str direct_url: A pep-508 compliant direct url. :return...
[ "Given", "a", "direct", "url", "as", "defined", "by", "*", "PEP", "508", "*", "convert", "to", "a", ":", "class", ":", "~pip_shims", ".", "shims", ".", "Link", "compatible", "URL", "by", "moving", "the", "name", "and", "extras", "into", "an", "**", "...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L213-L250
[ "def", "convert_direct_url_to_url", "(", "direct_url", ")", ":", "# type: (AnyStr) -> AnyStr", "direct_match", "=", "DIRECT_URL_RE", ".", "match", "(", "direct_url", ")", "# type: Optional[Match]", "if", "direct_match", "is", "None", ":", "url_match", "=", "URL_RE", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
convert_url_to_direct_url
Given a :class:`~pip_shims.shims.Link` compatible URL, convert to a direct url as defined by *PEP 508* by extracting the name and extras from the **egg_fragment**. :param AnyStr url: A :class:`~pip_shims.shims.InstallRequirement` compliant URL. :param Optiona[AnyStr] name: A name to use in case the supplie...
pipenv/vendor/requirementslib/models/utils.py
def convert_url_to_direct_url(url, name=None): # type: (AnyStr, Optional[AnyStr]) -> AnyStr """ Given a :class:`~pip_shims.shims.Link` compatible URL, convert to a direct url as defined by *PEP 508* by extracting the name and extras from the **egg_fragment**. :param AnyStr url: A :class:`~pip_shims...
def convert_url_to_direct_url(url, name=None): # type: (AnyStr, Optional[AnyStr]) -> AnyStr """ Given a :class:`~pip_shims.shims.Link` compatible URL, convert to a direct url as defined by *PEP 508* by extracting the name and extras from the **egg_fragment**. :param AnyStr url: A :class:`~pip_shims...
[ "Given", "a", ":", "class", ":", "~pip_shims", ".", "shims", ".", "Link", "compatible", "URL", "convert", "to", "a", "direct", "url", "as", "defined", "by", "*", "PEP", "508", "*", "by", "extracting", "the", "name", "and", "extras", "from", "the", "**"...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L253-L298
[ "def", "convert_url_to_direct_url", "(", "url", ",", "name", "=", "None", ")", ":", "# type: (AnyStr, Optional[AnyStr]) -> AnyStr", "if", "not", "isinstance", "(", "url", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "\"Expected a string to c...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
strip_extras_markers_from_requirement
Given a :class:`~packaging.requirements.Requirement` instance with markers defining *extra == 'name'*, strip out the extras from the markers and return the cleaned requirement :param PackagingRequirement req: A packaging requirement to clean :return: A cleaned requirement :rtype: PackagingRequireme...
pipenv/vendor/requirementslib/models/utils.py
def strip_extras_markers_from_requirement(req): # type: (TRequirement) -> TRequirement """ Given a :class:`~packaging.requirements.Requirement` instance with markers defining *extra == 'name'*, strip out the extras from the markers and return the cleaned requirement :param PackagingRequirement ...
def strip_extras_markers_from_requirement(req): # type: (TRequirement) -> TRequirement """ Given a :class:`~packaging.requirements.Requirement` instance with markers defining *extra == 'name'*, strip out the extras from the markers and return the cleaned requirement :param PackagingRequirement ...
[ "Given", "a", ":", "class", ":", "~packaging", ".", "requirements", ".", "Requirement", "instance", "with", "markers", "defining", "*", "extra", "==", "name", "*", "strip", "out", "the", "extras", "from", "the", "markers", "and", "return", "the", "cleaned", ...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L316-L336
[ "def", "strip_extras_markers_from_requirement", "(", "req", ")", ":", "# type: (TRequirement) -> TRequirement", "if", "req", "is", "None", ":", "raise", "TypeError", "(", "\"Must pass in a valid requirement, received {0!r}\"", ".", "format", "(", "req", ")", ")", "if", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_pyproject
Given a base path, look for the corresponding ``pyproject.toml`` file and return its build_requires and build_backend. :param AnyStr path: The root path of the project, should be a directory (will be truncated) :return: A 2 tuple of build requirements and the build backend :rtype: Optional[Tuple[List[A...
pipenv/vendor/requirementslib/models/utils.py
def get_pyproject(path): # type: (Union[STRING_TYPE, Path]) -> Optional[Tuple[List[STRING_TYPE], STRING_TYPE]] """ Given a base path, look for the corresponding ``pyproject.toml`` file and return its build_requires and build_backend. :param AnyStr path: The root path of the project, should be a dir...
def get_pyproject(path): # type: (Union[STRING_TYPE, Path]) -> Optional[Tuple[List[STRING_TYPE], STRING_TYPE]] """ Given a base path, look for the corresponding ``pyproject.toml`` file and return its build_requires and build_backend. :param AnyStr path: The root path of the project, should be a dir...
[ "Given", "a", "base", "path", "look", "for", "the", "corresponding", "pyproject", ".", "toml", "file", "and", "return", "its", "build_requires", "and", "build_backend", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L382-L425
[ "def", "get_pyproject", "(", "path", ")", ":", "# type: (Union[STRING_TYPE, Path]) -> Optional[Tuple[List[STRING_TYPE], STRING_TYPE]]", "if", "not", "path", ":", "return", "from", "vistir", ".", "compat", "import", "Path", "if", "not", "isinstance", "(", "path", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
split_markers_from_line
Split markers from a dependency
pipenv/vendor/requirementslib/models/utils.py
def split_markers_from_line(line): # type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]] """Split markers from a dependency""" if not any(line.startswith(uri_prefix) for uri_prefix in SCHEME_LIST): marker_sep = ";" else: marker_sep = "; " markers = None if marker_sep in line: ...
def split_markers_from_line(line): # type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]] """Split markers from a dependency""" if not any(line.startswith(uri_prefix) for uri_prefix in SCHEME_LIST): marker_sep = ";" else: marker_sep = "; " markers = None if marker_sep in line: ...
[ "Split", "markers", "from", "a", "dependency" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L428-L439
[ "def", "split_markers_from_line", "(", "line", ")", ":", "# type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]]", "if", "not", "any", "(", "line", ".", "startswith", "(", "uri_prefix", ")", "for", "uri_prefix", "in", "SCHEME_LIST", ")", ":", "marker_sep", "=", "\";\""...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
split_vcs_method_from_uri
Split a vcs+uri formatted uri into (vcs, uri)
pipenv/vendor/requirementslib/models/utils.py
def split_vcs_method_from_uri(uri): # type: (AnyStr) -> Tuple[Optional[STRING_TYPE], STRING_TYPE] """Split a vcs+uri formatted uri into (vcs, uri)""" vcs_start = "{0}+" vcs = None # type: Optional[STRING_TYPE] vcs = first([vcs for vcs in VCS_LIST if uri.startswith(vcs_start.format(vcs))]) if vc...
def split_vcs_method_from_uri(uri): # type: (AnyStr) -> Tuple[Optional[STRING_TYPE], STRING_TYPE] """Split a vcs+uri formatted uri into (vcs, uri)""" vcs_start = "{0}+" vcs = None # type: Optional[STRING_TYPE] vcs = first([vcs for vcs in VCS_LIST if uri.startswith(vcs_start.format(vcs))]) if vc...
[ "Split", "a", "vcs", "+", "uri", "formatted", "uri", "into", "(", "vcs", "uri", ")" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L442-L450
[ "def", "split_vcs_method_from_uri", "(", "uri", ")", ":", "# type: (AnyStr) -> Tuple[Optional[STRING_TYPE], STRING_TYPE]", "vcs_start", "=", "\"{0}+\"", "vcs", "=", "None", "# type: Optional[STRING_TYPE]", "vcs", "=", "first", "(", "[", "vcs", "for", "vcs", "in", "VCS_L...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
split_ref_from_uri
Given a path or URI, check for a ref and split it from the path if it is present, returning a tuple of the original input and the ref or None. :param AnyStr uri: The path or URI to split :returns: A 2-tuple of the path or URI and the ref :rtype: Tuple[AnyStr, Optional[AnyStr]]
pipenv/vendor/requirementslib/models/utils.py
def split_ref_from_uri(uri): # type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]] """ Given a path or URI, check for a ref and split it from the path if it is present, returning a tuple of the original input and the ref or None. :param AnyStr uri: The path or URI to split :returns: A 2-tuple of ...
def split_ref_from_uri(uri): # type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]] """ Given a path or URI, check for a ref and split it from the path if it is present, returning a tuple of the original input and the ref or None. :param AnyStr uri: The path or URI to split :returns: A 2-tuple of ...
[ "Given", "a", "path", "or", "URI", "check", "for", "a", "ref", "and", "split", "it", "from", "the", "path", "if", "it", "is", "present", "returning", "a", "tuple", "of", "the", "original", "input", "and", "the", "ref", "or", "None", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L453-L471
[ "def", "split_ref_from_uri", "(", "uri", ")", ":", "# type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]]", "if", "not", "isinstance", "(", "uri", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "\"Expected a string, received {0!r}\"", ".", "format",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
key_from_ireq
Get a standardized key for an InstallRequirement.
pipenv/vendor/requirementslib/models/utils.py
def key_from_ireq(ireq): """Get a standardized key for an InstallRequirement.""" if ireq.req is None and ireq.link is not None: return str(ireq.link) else: return key_from_req(ireq.req)
def key_from_ireq(ireq): """Get a standardized key for an InstallRequirement.""" if ireq.req is None and ireq.link is not None: return str(ireq.link) else: return key_from_req(ireq.req)
[ "Get", "a", "standardized", "key", "for", "an", "InstallRequirement", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L500-L505
[ "def", "key_from_ireq", "(", "ireq", ")", ":", "if", "ireq", ".", "req", "is", "None", "and", "ireq", ".", "link", "is", "not", "None", ":", "return", "str", "(", "ireq", ".", "link", ")", "else", ":", "return", "key_from_req", "(", "ireq", ".", "r...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
key_from_req
Get an all-lowercase version of the requirement's name.
pipenv/vendor/requirementslib/models/utils.py
def key_from_req(req): """Get an all-lowercase version of the requirement's name.""" if hasattr(req, "key"): # from pkg_resources, such as installed dists for pip-sync key = req.key else: # from packaging, such as install requirements from requirements.txt key = req.name ...
def key_from_req(req): """Get an all-lowercase version of the requirement's name.""" if hasattr(req, "key"): # from pkg_resources, such as installed dists for pip-sync key = req.key else: # from packaging, such as install requirements from requirements.txt key = req.name ...
[ "Get", "an", "all", "-", "lowercase", "version", "of", "the", "requirement", "s", "name", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L508-L518
[ "def", "key_from_req", "(", "req", ")", ":", "if", "hasattr", "(", "req", ",", "\"key\"", ")", ":", "# from pkg_resources, such as installed dists for pip-sync", "key", "=", "req", ".", "key", "else", ":", "# from packaging, such as install requirements from requirements....
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_requirement_to_str_lowercase_name
Formats a packaging.requirements.Requirement with a lowercase name. This is simply a copy of https://github.com/pypa/packaging/blob/16.8/packaging/requirements.py#L109-L124 modified to lowercase the dependency name. Previously, we were invoking the original Requirement.__str__ method and lower-cas...
pipenv/vendor/requirementslib/models/utils.py
def _requirement_to_str_lowercase_name(requirement): """ Formats a packaging.requirements.Requirement with a lowercase name. This is simply a copy of https://github.com/pypa/packaging/blob/16.8/packaging/requirements.py#L109-L124 modified to lowercase the dependency name. Previously, we were i...
def _requirement_to_str_lowercase_name(requirement): """ Formats a packaging.requirements.Requirement with a lowercase name. This is simply a copy of https://github.com/pypa/packaging/blob/16.8/packaging/requirements.py#L109-L124 modified to lowercase the dependency name. Previously, we were i...
[ "Formats", "a", "packaging", ".", "requirements", ".", "Requirement", "with", "a", "lowercase", "name", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L521-L549
[ "def", "_requirement_to_str_lowercase_name", "(", "requirement", ")", ":", "parts", "=", "[", "requirement", ".", "name", ".", "lower", "(", ")", "]", "if", "requirement", ".", "extras", ":", "parts", ".", "append", "(", "\"[{0}]\"", ".", "format", "(", "\...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
format_requirement
Generic formatter for pretty printing InstallRequirements to the terminal in a less verbose way than using its `__str__` method.
pipenv/vendor/requirementslib/models/utils.py
def format_requirement(ireq): """ Generic formatter for pretty printing InstallRequirements to the terminal in a less verbose way than using its `__str__` method. """ if ireq.editable: line = "-e {}".format(ireq.link) else: line = _requirement_to_str_lowercase_name(ireq.req) ...
def format_requirement(ireq): """ Generic formatter for pretty printing InstallRequirements to the terminal in a less verbose way than using its `__str__` method. """ if ireq.editable: line = "-e {}".format(ireq.link) else: line = _requirement_to_str_lowercase_name(ireq.req) ...
[ "Generic", "formatter", "for", "pretty", "printing", "InstallRequirements", "to", "the", "terminal", "in", "a", "less", "verbose", "way", "than", "using", "its", "__str__", "method", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L552-L571
[ "def", "format_requirement", "(", "ireq", ")", ":", "if", "ireq", ".", "editable", ":", "line", "=", "\"-e {}\"", ".", "format", "(", "ireq", ".", "link", ")", "else", ":", "line", "=", "_requirement_to_str_lowercase_name", "(", "ireq", ".", "req", ")", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
format_specifier
Generic formatter for pretty printing the specifier part of InstallRequirements to the terminal.
pipenv/vendor/requirementslib/models/utils.py
def format_specifier(ireq): """ Generic formatter for pretty printing the specifier part of InstallRequirements to the terminal. """ # TODO: Ideally, this is carried over to the pip library itself specs = ireq.specifier._specs if ireq.req is not None else [] specs = sorted(specs, key=lambda ...
def format_specifier(ireq): """ Generic formatter for pretty printing the specifier part of InstallRequirements to the terminal. """ # TODO: Ideally, this is carried over to the pip library itself specs = ireq.specifier._specs if ireq.req is not None else [] specs = sorted(specs, key=lambda ...
[ "Generic", "formatter", "for", "pretty", "printing", "the", "specifier", "part", "of", "InstallRequirements", "to", "the", "terminal", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L574-L582
[ "def", "format_specifier", "(", "ireq", ")", ":", "# TODO: Ideally, this is carried over to the pip library itself", "specs", "=", "ireq", ".", "specifier", ".", "_specs", "if", "ireq", ".", "req", "is", "not", "None", "else", "[", "]", "specs", "=", "sorted", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
as_tuple
Pulls out the (name: str, version:str, extras:(str)) tuple from the pinned InstallRequirement.
pipenv/vendor/requirementslib/models/utils.py
def as_tuple(ireq): """ Pulls out the (name: str, version:str, extras:(str)) tuple from the pinned InstallRequirement. """ if not is_pinned_requirement(ireq): raise TypeError("Expected a pinned InstallRequirement, got {}".format(ireq)) name = key_from_req(ireq.req) version = first(ireq...
def as_tuple(ireq): """ Pulls out the (name: str, version:str, extras:(str)) tuple from the pinned InstallRequirement. """ if not is_pinned_requirement(ireq): raise TypeError("Expected a pinned InstallRequirement, got {}".format(ireq)) name = key_from_req(ireq.req) version = first(ireq...
[ "Pulls", "out", "the", "(", "name", ":", "str", "version", ":", "str", "extras", ":", "(", "str", "))", "tuple", "from", "the", "pinned", "InstallRequirement", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L650-L661
[ "def", "as_tuple", "(", "ireq", ")", ":", "if", "not", "is_pinned_requirement", "(", "ireq", ")", ":", "raise", "TypeError", "(", "\"Expected a pinned InstallRequirement, got {}\"", ".", "format", "(", "ireq", ")", ")", "name", "=", "key_from_req", "(", "ireq", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
full_groupby
Like groupby(), but sorts the input on the group key first.
pipenv/vendor/requirementslib/models/utils.py
def full_groupby(iterable, key=None): """ Like groupby(), but sorts the input on the group key first. """ return groupby(sorted(iterable, key=key), key=key)
def full_groupby(iterable, key=None): """ Like groupby(), but sorts the input on the group key first. """ return groupby(sorted(iterable, key=key), key=key)
[ "Like", "groupby", "()", "but", "sorts", "the", "input", "on", "the", "group", "key", "first", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L664-L669
[ "def", "full_groupby", "(", "iterable", ",", "key", "=", "None", ")", ":", "return", "groupby", "(", "sorted", "(", "iterable", ",", "key", "=", "key", ")", ",", "key", "=", "key", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
lookup_table
Builds a dict-based lookup table (index) elegantly. Supports building normal and unique lookup tables. For example: >>> assert lookup_table( ... ['foo', 'bar', 'baz', 'qux', 'quux'], lambda s: s[0]) == { ... 'b': {'bar', 'baz'}, ... 'f': {'foo'}, ... 'q': {'quux', 'qux'} ....
pipenv/vendor/requirementslib/models/utils.py
def lookup_table(values, key=None, keyval=None, unique=False, use_lists=False): """ Builds a dict-based lookup table (index) elegantly. Supports building normal and unique lookup tables. For example: >>> assert lookup_table( ... ['foo', 'bar', 'baz', 'qux', 'quux'], lambda s: s[0]) == { ....
def lookup_table(values, key=None, keyval=None, unique=False, use_lists=False): """ Builds a dict-based lookup table (index) elegantly. Supports building normal and unique lookup tables. For example: >>> assert lookup_table( ... ['foo', 'bar', 'baz', 'qux', 'quux'], lambda s: s[0]) == { ....
[ "Builds", "a", "dict", "-", "based", "lookup", "table", "(", "index", ")", "elegantly", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L680-L739
[ "def", "lookup_table", "(", "values", ",", "key", "=", "None", ",", "keyval", "=", "None", ",", "unique", "=", "False", ",", "use_lists", "=", "False", ")", ":", "if", "keyval", "is", "None", ":", "if", "key", "is", "None", ":", "keyval", "=", "lam...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
make_install_requirement
Generates an :class:`~pip._internal.req.req_install.InstallRequirement`. Create an InstallRequirement from the supplied metadata. :param name: The requirement's name. :type name: str :param version: The requirement version (must be pinned). :type version: str. :param extras: The desired extras...
pipenv/vendor/requirementslib/models/utils.py
def make_install_requirement(name, version, extras, markers, constraint=False): """ Generates an :class:`~pip._internal.req.req_install.InstallRequirement`. Create an InstallRequirement from the supplied metadata. :param name: The requirement's name. :type name: str :param version: The require...
def make_install_requirement(name, version, extras, markers, constraint=False): """ Generates an :class:`~pip._internal.req.req_install.InstallRequirement`. Create an InstallRequirement from the supplied metadata. :param name: The requirement's name. :type name: str :param version: The require...
[ "Generates", "an", ":", "class", ":", "~pip", ".", "_internal", ".", "req", ".", "req_install", ".", "InstallRequirement", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L752-L788
[ "def", "make_install_requirement", "(", "name", ",", "version", ",", "extras", ",", "markers", ",", "constraint", "=", "False", ")", ":", "# If no extras are specified, the extras string is blank", "from", "pip_shims", ".", "shims", "import", "install_req_from_line", "e...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
clean_requires_python
Get a cleaned list of all the candidates with valid specifiers in the `requires_python` attributes.
pipenv/vendor/requirementslib/models/utils.py
def clean_requires_python(candidates): """Get a cleaned list of all the candidates with valid specifiers in the `requires_python` attributes.""" all_candidates = [] sys_version = ".".join(map(str, sys.version_info[:3])) from packaging.version import parse as parse_version py_version = parse_version...
def clean_requires_python(candidates): """Get a cleaned list of all the candidates with valid specifiers in the `requires_python` attributes.""" all_candidates = [] sys_version = ".".join(map(str, sys.version_info[:3])) from packaging.version import parse as parse_version py_version = parse_version...
[ "Get", "a", "cleaned", "list", "of", "all", "the", "candidates", "with", "valid", "specifiers", "in", "the", "requires_python", "attributes", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L803-L828
[ "def", "clean_requires_python", "(", "candidates", ")", ":", "all_candidates", "=", "[", "]", "sys_version", "=", "\".\"", ".", "join", "(", "map", "(", "str", ",", "sys", ".", "version_info", "[", ":", "3", "]", ")", ")", "from", "packaging", ".", "ve...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_name_variants
Given a packager name, get the variants of its name for both the canonicalized and "safe" forms. :param AnyStr pkg: The package to lookup :returns: A list of names. :rtype: Set
pipenv/vendor/requirementslib/models/utils.py
def get_name_variants(pkg): # type: (STRING_TYPE) -> Set[STRING_TYPE] """ Given a packager name, get the variants of its name for both the canonicalized and "safe" forms. :param AnyStr pkg: The package to lookup :returns: A list of names. :rtype: Set """ if not isinstance(pkg, six....
def get_name_variants(pkg): # type: (STRING_TYPE) -> Set[STRING_TYPE] """ Given a packager name, get the variants of its name for both the canonicalized and "safe" forms. :param AnyStr pkg: The package to lookup :returns: A list of names. :rtype: Set """ if not isinstance(pkg, six....
[ "Given", "a", "packager", "name", "get", "the", "variants", "of", "its", "name", "for", "both", "the", "canonicalized", "and", "safe", "forms", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L870-L888
[ "def", "get_name_variants", "(", "pkg", ")", ":", "# type: (STRING_TYPE) -> Set[STRING_TYPE]", "if", "not", "isinstance", "(", "pkg", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "\"must provide a string to derive package names\"", ")", "from", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_best_version
Detect the best version depending on the fields used.
pipenv/vendor/distlib/metadata.py
def _best_version(fields): """Detect the best version depending on the fields used.""" def _has_marker(keys, markers): for marker in markers: if marker in keys: return True return False keys = [] for key, value in fields.items(): if value in ([], 'UNK...
def _best_version(fields): """Detect the best version depending on the fields used.""" def _has_marker(keys, markers): for marker in markers: if marker in keys: return True return False keys = [] for key, value in fields.items(): if value in ([], 'UNK...
[ "Detect", "the", "best", "version", "depending", "on", "the", "fields", "used", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L124-L193
[ "def", "_best_version", "(", "fields", ")", ":", "def", "_has_marker", "(", "keys", ",", "markers", ")", ":", "for", "marker", "in", "markers", ":", "if", "marker", "in", "keys", ":", "return", "True", "return", "False", "keys", "=", "[", "]", "for", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_get_name_and_version
Return the distribution name with version. If for_filename is true, return a filename-escaped form.
pipenv/vendor/distlib/metadata.py
def _get_name_and_version(name, version, for_filename=False): """Return the distribution name with version. If for_filename is true, return a filename-escaped form.""" if for_filename: # For both name and version any runs of non-alphanumeric or '.' # characters are replaced with a single '-...
def _get_name_and_version(name, version, for_filename=False): """Return the distribution name with version. If for_filename is true, return a filename-escaped form.""" if for_filename: # For both name and version any runs of non-alphanumeric or '.' # characters are replaced with a single '-...
[ "Return", "the", "distribution", "name", "with", "version", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L247-L257
[ "def", "_get_name_and_version", "(", "name", ",", "version", ",", "for_filename", "=", "False", ")", ":", "if", "for_filename", ":", "# For both name and version any runs of non-alphanumeric or '.'", "# characters are replaced with a single '-'. Additionally any", "# spaces in the...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
LegacyMetadata.read
Read the metadata values from a file path.
pipenv/vendor/distlib/metadata.py
def read(self, filepath): """Read the metadata values from a file path.""" fp = codecs.open(filepath, 'r', encoding='utf-8') try: self.read_file(fp) finally: fp.close()
def read(self, filepath): """Read the metadata values from a file path.""" fp = codecs.open(filepath, 'r', encoding='utf-8') try: self.read_file(fp) finally: fp.close()
[ "Read", "the", "metadata", "values", "from", "a", "file", "path", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L354-L360
[ "def", "read", "(", "self", ",", "filepath", ")", ":", "fp", "=", "codecs", ".", "open", "(", "filepath", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "try", ":", "self", ".", "read_file", "(", "fp", ")", "finally", ":", "fp", ".", "close", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
LegacyMetadata.write
Write the metadata fields to filepath.
pipenv/vendor/distlib/metadata.py
def write(self, filepath, skip_unknown=False): """Write the metadata fields to filepath.""" fp = codecs.open(filepath, 'w', encoding='utf-8') try: self.write_file(fp, skip_unknown) finally: fp.close()
def write(self, filepath, skip_unknown=False): """Write the metadata fields to filepath.""" fp = codecs.open(filepath, 'w', encoding='utf-8') try: self.write_file(fp, skip_unknown) finally: fp.close()
[ "Write", "the", "metadata", "fields", "to", "filepath", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L385-L391
[ "def", "write", "(", "self", ",", "filepath", ",", "skip_unknown", "=", "False", ")", ":", "fp", "=", "codecs", ".", "open", "(", "filepath", ",", "'w'", ",", "encoding", "=", "'utf-8'", ")", "try", ":", "self", ".", "write_file", "(", "fp", ",", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
LegacyMetadata.write_file
Write the PKG-INFO format data to a file object.
pipenv/vendor/distlib/metadata.py
def write_file(self, fileobject, skip_unknown=False): """Write the PKG-INFO format data to a file object.""" self.set_metadata_version() for field in _version2fieldlist(self['Metadata-Version']): values = self.get(field) if skip_unknown and values in ('UNKNOWN', [], ['UN...
def write_file(self, fileobject, skip_unknown=False): """Write the PKG-INFO format data to a file object.""" self.set_metadata_version() for field in _version2fieldlist(self['Metadata-Version']): values = self.get(field) if skip_unknown and values in ('UNKNOWN', [], ['UN...
[ "Write", "the", "PKG", "-", "INFO", "format", "data", "to", "a", "file", "object", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L393-L416
[ "def", "write_file", "(", "self", ",", "fileobject", ",", "skip_unknown", "=", "False", ")", ":", "self", ".", "set_metadata_version", "(", ")", "for", "field", "in", "_version2fieldlist", "(", "self", "[", "'Metadata-Version'", "]", ")", ":", "values", "=",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
LegacyMetadata.update
Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a met...
pipenv/vendor/distlib/metadata.py
def update(self, other=None, **kwargs): """Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value...
def update(self, other=None, **kwargs): """Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value...
[ "Set", "metadata", "values", "from", "the", "given", "iterable", "other", "and", "kwargs", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L418-L444
[ "def", "update", "(", "self", ",", "other", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "_set", "(", "key", ",", "value", ")", ":", "if", "key", "in", "_ATTR2FIELD", "and", "value", ":", "self", ".", "set", "(", "self", ".", "_convert_...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
LegacyMetadata.set
Control then set a metadata field.
pipenv/vendor/distlib/metadata.py
def set(self, name, value): """Control then set a metadata field.""" name = self._convert_name(name) if ((name in _ELEMENTSFIELD or name == 'Platform') and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [v.strip() for v...
def set(self, name, value): """Control then set a metadata field.""" name = self._convert_name(name) if ((name in _ELEMENTSFIELD or name == 'Platform') and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [v.strip() for v...
[ "Control", "then", "set", "a", "metadata", "field", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L446-L488
[ "def", "set", "(", "self", ",", "name", ",", "value", ")", ":", "name", "=", "self", ".", "_convert_name", "(", "name", ")", "if", "(", "(", "name", "in", "_ELEMENTSFIELD", "or", "name", "==", "'Platform'", ")", "and", "not", "isinstance", "(", "valu...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
LegacyMetadata.get
Get a metadata field.
pipenv/vendor/distlib/metadata.py
def get(self, name, default=_MISSING): """Get a metadata field.""" name = self._convert_name(name) if name not in self._fields: if default is _MISSING: default = self._default_value(name) return default if name in _UNICODEFIELDS: value ...
def get(self, name, default=_MISSING): """Get a metadata field.""" name = self._convert_name(name) if name not in self._fields: if default is _MISSING: default = self._default_value(name) return default if name in _UNICODEFIELDS: value ...
[ "Get", "a", "metadata", "field", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L490-L517
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "_MISSING", ")", ":", "name", "=", "self", ".", "_convert_name", "(", "name", ")", "if", "name", "not", "in", "self", ".", "_fields", ":", "if", "default", "is", "_MISSING", ":", "default",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
LegacyMetadata.todict
Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page).
pipenv/vendor/distlib/metadata.py
def todict(self, skip_missing=False): """Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). """ self.set_metadata_version() mapping_1_0 = ( ('metada...
def todict(self, skip_missing=False): """Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). """ self.set_metadata_version() mapping_1_0 = ( ('metada...
[ "Return", "fields", "as", "a", "dict", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L563-L620
[ "def", "todict", "(", "self", ",", "skip_missing", "=", "False", ")", ":", "self", ".", "set_metadata_version", "(", ")", "mapping_1_0", "=", "(", "(", "'metadata_version'", ",", "'Metadata-Version'", ")", ",", "(", "'name'", ",", "'Name'", ")", ",", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Metadata.get_requirements
Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. :...
pipenv/vendor/distlib/metadata.py
def get_requirements(self, reqts, extras=None, env=None): """ Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. ...
def get_requirements(self, reqts, extras=None, env=None): """ Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. ...
[ "Base", "method", "to", "get", "dependencies", "given", "a", "set", "of", "extras", "to", "satisfy", "and", "an", "optional", "environment", "context", ".", ":", "param", "reqts", ":", "A", "list", "of", "sometimes", "-", "wanted", "dependencies", "perhaps",...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L880-L920
[ "def", "get_requirements", "(", "self", ",", "reqts", ",", "extras", "=", "None", ",", "env", "=", "None", ")", ":", "if", "self", ".", "_legacy", ":", "result", "=", "reqts", "else", ":", "result", "=", "[", "]", "extras", "=", "get_extras", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
remove_move
Remove item from six.moves.
pipenv/vendor/six.py
def remove_move(name): """Remove item from six.moves.""" try: delattr(_MovedItems, name) except AttributeError: try: del moves.__dict__[name] except KeyError: raise AttributeError("no such move, %r" % (name,))
def remove_move(name): """Remove item from six.moves.""" try: delattr(_MovedItems, name) except AttributeError: try: del moves.__dict__[name] except KeyError: raise AttributeError("no such move, %r" % (name,))
[ "Remove", "item", "from", "six", ".", "moves", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/six.py#L497-L505
[ "def", "remove_move", "(", "name", ")", ":", "try", ":", "delattr", "(", "_MovedItems", ",", "name", ")", "except", "AttributeError", ":", "try", ":", "del", "moves", ".", "__dict__", "[", "name", "]", "except", "KeyError", ":", "raise", "AttributeError", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ensure_binary
Coerce **s** to six.binary_type. For Python 2: - `unicode` -> encoded to `str` - `str` -> `str` For Python 3: - `str` -> encoded to `bytes` - `bytes` -> `bytes`
pipenv/vendor/six.py
def ensure_binary(s, encoding='utf-8', errors='strict'): """Coerce **s** to six.binary_type. For Python 2: - `unicode` -> encoded to `str` - `str` -> `str` For Python 3: - `str` -> encoded to `bytes` - `bytes` -> `bytes` """ if isinstance(s, text_type): return s.enc...
def ensure_binary(s, encoding='utf-8', errors='strict'): """Coerce **s** to six.binary_type. For Python 2: - `unicode` -> encoded to `str` - `str` -> `str` For Python 3: - `str` -> encoded to `bytes` - `bytes` -> `bytes` """ if isinstance(s, text_type): return s.enc...
[ "Coerce", "**", "s", "**", "to", "six", ".", "binary_type", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/six.py#L853-L869
[ "def", "ensure_binary", "(", "s", ",", "encoding", "=", "'utf-8'", ",", "errors", "=", "'strict'", ")", ":", "if", "isinstance", "(", "s", ",", "text_type", ")", ":", "return", "s", ".", "encode", "(", "encoding", ",", "errors", ")", "elif", "isinstanc...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ensure_str
Coerce *s* to `str`. For Python 2: - `unicode` -> encoded to `str` - `str` -> `str` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str`
pipenv/vendor/six.py
def ensure_str(s, encoding='utf-8', errors='strict'): """Coerce *s* to `str`. For Python 2: - `unicode` -> encoded to `str` - `str` -> `str` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str` """ if not isinstance(s, (text_type, binary_type)): raise TypeEr...
def ensure_str(s, encoding='utf-8', errors='strict'): """Coerce *s* to `str`. For Python 2: - `unicode` -> encoded to `str` - `str` -> `str` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str` """ if not isinstance(s, (text_type, binary_type)): raise TypeEr...
[ "Coerce", "*", "s", "*", "to", "str", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/six.py#L872-L889
[ "def", "ensure_str", "(", "s", ",", "encoding", "=", "'utf-8'", ",", "errors", "=", "'strict'", ")", ":", "if", "not", "isinstance", "(", "s", ",", "(", "text_type", ",", "binary_type", ")", ")", ":", "raise", "TypeError", "(", "\"not expecting type '%s'\"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ensure_text
Coerce *s* to six.text_type. For Python 2: - `unicode` -> `unicode` - `str` -> `unicode` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str`
pipenv/vendor/six.py
def ensure_text(s, encoding='utf-8', errors='strict'): """Coerce *s* to six.text_type. For Python 2: - `unicode` -> `unicode` - `str` -> `unicode` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str` """ if isinstance(s, binary_type): return s.decode(encodin...
def ensure_text(s, encoding='utf-8', errors='strict'): """Coerce *s* to six.text_type. For Python 2: - `unicode` -> `unicode` - `str` -> `unicode` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str` """ if isinstance(s, binary_type): return s.decode(encodin...
[ "Coerce", "*", "s", "*", "to", "six", ".", "text_type", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/six.py#L892-L908
[ "def", "ensure_text", "(", "s", ",", "encoding", "=", "'utf-8'", ",", "errors", "=", "'strict'", ")", ":", "if", "isinstance", "(", "s", ",", "binary_type", ")", ":", "return", "s", ".", "decode", "(", "encoding", ",", "errors", ")", "elif", "isinstanc...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
python_2_unicode_compatible
A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing. To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class.
pipenv/vendor/six.py
def python_2_unicode_compatible(klass): """ A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing. To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class. """ if PY2: ...
def python_2_unicode_compatible(klass): """ A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing. To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class. """ if PY2: ...
[ "A", "decorator", "that", "defines", "__unicode__", "and", "__str__", "methods", "under", "Python", "2", ".", "Under", "Python", "3", "it", "does", "nothing", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/six.py#L912-L927
[ "def", "python_2_unicode_compatible", "(", "klass", ")", ":", "if", "PY2", ":", "if", "'__str__'", "not", "in", "klass", ".", "__dict__", ":", "raise", "ValueError", "(", "\"@python_2_unicode_compatible cannot be applied \"", "\"to %s because it doesn't define __str__().\""...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
parse_requirements
Parse a requirements file and yield InstallRequirement instances. :param filename: Path or url of requirements file. :param finder: Instance of pip.index.PackageFinder. :param comes_from: Origin description of requirements. :param options: cli options. :param session: Instance of p...
pipenv/patched/notpip/_internal/req/req_file.py
def parse_requirements( filename, # type: str finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] session=None, # type: Optional[PipSession] constraint=False, # type: bool wheel_cache=None, # type: Optiona...
def parse_requirements( filename, # type: str finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] session=None, # type: Optional[PipSession] constraint=False, # type: bool wheel_cache=None, # type: Optiona...
[ "Parse", "a", "requirements", "file", "and", "yield", "InstallRequirement", "instances", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L73-L113
[ "def", "parse_requirements", "(", "filename", ",", "# type: str", "finder", "=", "None", ",", "# type: Optional[PackageFinder]", "comes_from", "=", "None", ",", "# type: Optional[str]", "options", "=", "None", ",", "# type: Optional[optparse.Values]", "session", "=", "N...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
preprocess
Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file :param options: cli options
pipenv/patched/notpip/_internal/req/req_file.py
def preprocess(content, options): # type: (Text, Optional[optparse.Values]) -> ReqFileLines """Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file :param options: cli options """ lines_enum = enumerate(content.splitlines(), start=1) # ...
def preprocess(content, options): # type: (Text, Optional[optparse.Values]) -> ReqFileLines """Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file :param options: cli options """ lines_enum = enumerate(content.splitlines(), start=1) # ...
[ "Split", "filter", "and", "join", "lines", "and", "return", "a", "line", "iterator" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L116-L128
[ "def", "preprocess", "(", "content", ",", "options", ")", ":", "# type: (Text, Optional[optparse.Values]) -> ReqFileLines", "lines_enum", "=", "enumerate", "(", "content", ".", "splitlines", "(", ")", ",", "start", "=", "1", ")", "# type: ReqFileLines", "lines_enum", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
process_line
Process a single requirements line; This can result in creating/yielding requirements, or updating the finder. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be pr...
pipenv/patched/notpip/_internal/req/req_file.py
def process_line( line, # type: Text filename, # type: str line_number, # type: int finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] session=None, # type: Optional[PipSession] wheel_cache=None, # t...
def process_line( line, # type: Text filename, # type: str line_number, # type: int finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] session=None, # type: Optional[PipSession] wheel_cache=None, # t...
[ "Process", "a", "single", "requirements", "line", ";", "This", "can", "result", "in", "creating", "/", "yielding", "requirements", "or", "updating", "the", "finder", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L131-L255
[ "def", "process_line", "(", "line", ",", "# type: Text", "filename", ",", "# type: str", "line_number", ",", "# type: int", "finder", "=", "None", ",", "# type: Optional[PackageFinder]", "comes_from", "=", "None", ",", "# type: Optional[str]", "options", "=", "None", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
break_args_options
Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex.
pipenv/patched/notpip/_internal/req/req_file.py
def break_args_options(line): # type: (Text) -> Tuple[str, Text] """Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex. """ tokens = line.split(' ') args = [] opti...
def break_args_options(line): # type: (Text) -> Tuple[str, Text] """Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex. """ tokens = line.split(' ') args = [] opti...
[ "Break", "up", "the", "line", "into", "an", "args", "and", "options", "string", ".", "We", "only", "want", "to", "shlex", "(", "and", "then", "optparse", ")", "the", "options", "not", "the", "args", ".", "args", "can", "contain", "markers", "which", "a...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L258-L273
[ "def", "break_args_options", "(", "line", ")", ":", "# type: (Text) -> Tuple[str, Text]", "tokens", "=", "line", ".", "split", "(", "' '", ")", "args", "=", "[", "]", "options", "=", "tokens", "[", ":", "]", "for", "token", "in", "tokens", ":", "if", "to...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
build_parser
Return a parser for parsing requirement lines
pipenv/patched/notpip/_internal/req/req_file.py
def build_parser(line): # type: (Text) -> optparse.OptionParser """ Return a parser for parsing requirement lines """ parser = optparse.OptionParser(add_help_option=False) option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ for option_factory in option_factories: option = o...
def build_parser(line): # type: (Text) -> optparse.OptionParser """ Return a parser for parsing requirement lines """ parser = optparse.OptionParser(add_help_option=False) option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ for option_factory in option_factories: option = o...
[ "Return", "a", "parser", "for", "parsing", "requirement", "lines" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L276-L298
[ "def", "build_parser", "(", "line", ")", ":", "# type: (Text) -> optparse.OptionParser", "parser", "=", "optparse", ".", "OptionParser", "(", "add_help_option", "=", "False", ")", "option_factories", "=", "SUPPORTED_OPTIONS", "+", "SUPPORTED_OPTIONS_REQ", "for", "option...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
join_lines
Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line.
pipenv/patched/notpip/_internal/req/req_file.py
def join_lines(lines_enum): # type: (ReqFileLines) -> ReqFileLines """Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line. """ primary_line_number = None new_line = [] # type: List[Text] for line_number, l...
def join_lines(lines_enum): # type: (ReqFileLines) -> ReqFileLines """Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line. """ primary_line_number = None new_line = [] # type: List[Text] for line_number, l...
[ "Joins", "a", "line", "ending", "in", "\\", "with", "the", "previous", "line", "(", "except", "when", "following", "comments", ")", ".", "The", "joined", "line", "takes", "on", "the", "index", "of", "the", "first", "line", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L301-L326
[ "def", "join_lines", "(", "lines_enum", ")", ":", "# type: (ReqFileLines) -> ReqFileLines", "primary_line_number", "=", "None", "new_line", "=", "[", "]", "# type: List[Text]", "for", "line_number", ",", "line", "in", "lines_enum", ":", "if", "not", "line", ".", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ignore_comments
Strips comments and filter empty lines.
pipenv/patched/notpip/_internal/req/req_file.py
def ignore_comments(lines_enum): # type: (ReqFileLines) -> ReqFileLines """ Strips comments and filter empty lines. """ for line_number, line in lines_enum: line = COMMENT_RE.sub('', line) line = line.strip() if line: yield line_number, line
def ignore_comments(lines_enum): # type: (ReqFileLines) -> ReqFileLines """ Strips comments and filter empty lines. """ for line_number, line in lines_enum: line = COMMENT_RE.sub('', line) line = line.strip() if line: yield line_number, line
[ "Strips", "comments", "and", "filter", "empty", "lines", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L331-L340
[ "def", "ignore_comments", "(", "lines_enum", ")", ":", "# type: (ReqFileLines) -> ReqFileLines", "for", "line_number", ",", "line", "in", "lines_enum", ":", "line", "=", "COMMENT_RE", ".", "sub", "(", "''", ",", "line", ")", "line", "=", "line", ".", "strip", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
skip_regex
Skip lines that match '--skip-requirements-regex' pattern Note: the regex pattern is only built once
pipenv/patched/notpip/_internal/req/req_file.py
def skip_regex(lines_enum, options): # type: (ReqFileLines, Optional[optparse.Values]) -> ReqFileLines """ Skip lines that match '--skip-requirements-regex' pattern Note: the regex pattern is only built once """ skip_regex = options.skip_requirements_regex if options else None if skip_regex...
def skip_regex(lines_enum, options): # type: (ReqFileLines, Optional[optparse.Values]) -> ReqFileLines """ Skip lines that match '--skip-requirements-regex' pattern Note: the regex pattern is only built once """ skip_regex = options.skip_requirements_regex if options else None if skip_regex...
[ "Skip", "lines", "that", "match", "--", "skip", "-", "requirements", "-", "regex", "pattern" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L343-L354
[ "def", "skip_regex", "(", "lines_enum", ",", "options", ")", ":", "# type: (ReqFileLines, Optional[optparse.Values]) -> ReqFileLines", "skip_regex", "=", "options", ".", "skip_requirements_regex", "if", "options", "else", "None", "if", "skip_regex", ":", "pattern", "=", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
expand_env_variables
Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across pl...
pipenv/patched/notpip/_internal/req/req_file.py
def expand_env_variables(lines_enum): # type: (ReqFileLines) -> ReqFileLines """Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that con...
def expand_env_variables(lines_enum): # type: (ReqFileLines) -> ReqFileLines """Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that con...
[ "Replace", "all", "environment", "variables", "that", "can", "be", "retrieved", "via", "os", ".", "getenv", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_file.py#L357-L382
[ "def", "expand_env_variables", "(", "lines_enum", ")", ":", "# type: (ReqFileLines) -> ReqFileLines", "for", "line_number", ",", "line", "in", "lines_enum", ":", "for", "env_var", ",", "var_name", "in", "ENV_VAR_RE", ".", "findall", "(", "line", ")", ":", "value",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
InterruptibleMixin.finish
Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted.
pipenv/patched/notpip/_internal/utils/ui.py
def finish(self): """ Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. """ super(InterruptibleMixin, self).finish() signal(SIGINT, self.original_handler)
def finish(self): """ Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. """ super(InterruptibleMixin, self).finish() signal(SIGINT, self.original_handler)
[ "Restore", "the", "original", "SIGINT", "handler", "after", "finishing", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/ui.py#L100-L108
[ "def", "finish", "(", "self", ")", ":", "super", "(", "InterruptibleMixin", ",", "self", ")", ".", "finish", "(", ")", "signal", "(", "SIGINT", ",", "self", ".", "original_handler", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
InterruptibleMixin.handle_sigint
Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active.
pipenv/patched/notpip/_internal/utils/ui.py
def handle_sigint(self, signum, frame): """ Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active. """ self.finish() self.original_handler(signum, frame)
def handle_sigint(self, signum, frame): """ Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active. """ self.finish() self.original_handler(signum, frame)
[ "Call", "self", ".", "finish", "()", "before", "delegating", "to", "the", "original", "SIGINT", "handler", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/ui.py#L110-L118
[ "def", "handle_sigint", "(", "self", ",", "signum", ",", "frame", ")", ":", "self", ".", "finish", "(", ")", "self", ".", "original_handler", "(", "signum", ",", "frame", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Node.iter_fields
This method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the `exclude` parameter. Both should be sets or tuple...
pipenv/vendor/jinja2/nodes.py
def iter_fields(self, exclude=None, only=None): """This method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the...
def iter_fields(self, exclude=None, only=None): """This method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the...
[ "This", "method", "iterates", "over", "all", "fields", "that", "are", "defined", "and", "yields", "(", "key", "value", ")", "tuples", ".", "Per", "default", "all", "fields", "are", "returned", "but", "it", "s", "possible", "to", "limit", "that", "to", "s...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nodes.py#L148-L162
[ "def", "iter_fields", "(", "self", ",", "exclude", "=", "None", ",", "only", "=", "None", ")", ":", "for", "name", "in", "self", ".", "fields", ":", "if", "(", "exclude", "is", "only", "is", "None", ")", "or", "(", "exclude", "is", "not", "None", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Node.iter_child_nodes
Iterates over all direct child nodes of the node. This iterates over all fields and yields the values of they are nodes. If the value of a field is a list all the nodes in that list are returned.
pipenv/vendor/jinja2/nodes.py
def iter_child_nodes(self, exclude=None, only=None): """Iterates over all direct child nodes of the node. This iterates over all fields and yields the values of they are nodes. If the value of a field is a list all the nodes in that list are returned. """ for field, item in sel...
def iter_child_nodes(self, exclude=None, only=None): """Iterates over all direct child nodes of the node. This iterates over all fields and yields the values of they are nodes. If the value of a field is a list all the nodes in that list are returned. """ for field, item in sel...
[ "Iterates", "over", "all", "direct", "child", "nodes", "of", "the", "node", ".", "This", "iterates", "over", "all", "fields", "and", "yields", "the", "values", "of", "they", "are", "nodes", ".", "If", "the", "value", "of", "a", "field", "is", "a", "lis...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nodes.py#L164-L175
[ "def", "iter_child_nodes", "(", "self", ",", "exclude", "=", "None", ",", "only", "=", "None", ")", ":", "for", "field", ",", "item", "in", "self", ".", "iter_fields", "(", "exclude", ",", "only", ")", ":", "if", "isinstance", "(", "item", ",", "list...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Node.find_all
Find all the nodes of a given type. If the type is a tuple, the check is performed for any of the tuple items.
pipenv/vendor/jinja2/nodes.py
def find_all(self, node_type): """Find all the nodes of a given type. If the type is a tuple, the check is performed for any of the tuple items. """ for child in self.iter_child_nodes(): if isinstance(child, node_type): yield child for result in c...
def find_all(self, node_type): """Find all the nodes of a given type. If the type is a tuple, the check is performed for any of the tuple items. """ for child in self.iter_child_nodes(): if isinstance(child, node_type): yield child for result in c...
[ "Find", "all", "the", "nodes", "of", "a", "given", "type", ".", "If", "the", "type", "is", "a", "tuple", "the", "check", "is", "performed", "for", "any", "of", "the", "tuple", "items", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nodes.py#L184-L192
[ "def", "find_all", "(", "self", ",", "node_type", ")", ":", "for", "child", "in", "self", ".", "iter_child_nodes", "(", ")", ":", "if", "isinstance", "(", "child", ",", "node_type", ")", ":", "yield", "child", "for", "result", "in", "child", ".", "find...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Node.set_ctx
Reset the context of a node and all child nodes. Per default the parser will all generate nodes that have a 'load' context as it's the most common one. This method is used in the parser to set assignment targets and other nodes to a store context.
pipenv/vendor/jinja2/nodes.py
def set_ctx(self, ctx): """Reset the context of a node and all child nodes. Per default the parser will all generate nodes that have a 'load' context as it's the most common one. This method is used in the parser to set assignment targets and other nodes to a store context. """...
def set_ctx(self, ctx): """Reset the context of a node and all child nodes. Per default the parser will all generate nodes that have a 'load' context as it's the most common one. This method is used in the parser to set assignment targets and other nodes to a store context. """...
[ "Reset", "the", "context", "of", "a", "node", "and", "all", "child", "nodes", ".", "Per", "default", "the", "parser", "will", "all", "generate", "nodes", "that", "have", "a", "load", "context", "as", "it", "s", "the", "most", "common", "one", ".", "Thi...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nodes.py#L194-L206
[ "def", "set_ctx", "(", "self", ",", "ctx", ")", ":", "todo", "=", "deque", "(", "[", "self", "]", ")", "while", "todo", ":", "node", "=", "todo", ".", "popleft", "(", ")", "if", "'ctx'", "in", "node", ".", "fields", ":", "node", ".", "ctx", "="...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Node.set_lineno
Set the line numbers of the node and children.
pipenv/vendor/jinja2/nodes.py
def set_lineno(self, lineno, override=False): """Set the line numbers of the node and children.""" todo = deque([self]) while todo: node = todo.popleft() if 'lineno' in node.attributes: if node.lineno is None or override: node.lineno = ...
def set_lineno(self, lineno, override=False): """Set the line numbers of the node and children.""" todo = deque([self]) while todo: node = todo.popleft() if 'lineno' in node.attributes: if node.lineno is None or override: node.lineno = ...
[ "Set", "the", "line", "numbers", "of", "the", "node", "and", "children", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nodes.py#L208-L217
[ "def", "set_lineno", "(", "self", ",", "lineno", ",", "override", "=", "False", ")", ":", "todo", "=", "deque", "(", "[", "self", "]", ")", "while", "todo", ":", "node", "=", "todo", ".", "popleft", "(", ")", "if", "'lineno'", "in", "node", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Node.set_environment
Set the environment for all nodes.
pipenv/vendor/jinja2/nodes.py
def set_environment(self, environment): """Set the environment for all nodes.""" todo = deque([self]) while todo: node = todo.popleft() node.environment = environment todo.extend(node.iter_child_nodes()) return self
def set_environment(self, environment): """Set the environment for all nodes.""" todo = deque([self]) while todo: node = todo.popleft() node.environment = environment todo.extend(node.iter_child_nodes()) return self
[ "Set", "the", "environment", "for", "all", "nodes", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nodes.py#L219-L226
[ "def", "set_environment", "(", "self", ",", "environment", ")", ":", "todo", "=", "deque", "(", "[", "self", "]", ")", "while", "todo", ":", "node", "=", "todo", ".", "popleft", "(", ")", "node", ".", "environment", "=", "environment", "todo", ".", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Const.from_untrusted
Return a const object if the value is representable as constant value in the generated code, otherwise it will raise an `Impossible` exception.
pipenv/vendor/jinja2/nodes.py
def from_untrusted(cls, value, lineno=None, environment=None): """Return a const object if the value is representable as constant value in the generated code, otherwise it will raise an `Impossible` exception. """ from .compiler import has_safe_repr if not has_safe_repr(v...
def from_untrusted(cls, value, lineno=None, environment=None): """Return a const object if the value is representable as constant value in the generated code, otherwise it will raise an `Impossible` exception. """ from .compiler import has_safe_repr if not has_safe_repr(v...
[ "Return", "a", "const", "object", "if", "the", "value", "is", "representable", "as", "constant", "value", "in", "the", "generated", "code", "otherwise", "it", "will", "raise", "an", "Impossible", "exception", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nodes.py#L504-L512
[ "def", "from_untrusted", "(", "cls", ",", "value", ",", "lineno", "=", "None", ",", "environment", "=", "None", ")", ":", "from", ".", "compiler", "import", "has_safe_repr", "if", "not", "has_safe_repr", "(", "value", ")", ":", "raise", "Impossible", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
build_wheel
Build a wheel from a source directory using PEP 517 hooks. :param str source_dir: Source directory containing pyproject.toml :param str wheel_dir: Target directory to create wheel in :param dict config_settings: Options to pass to build backend This is a blocking function which will run pip in a subpr...
pipenv/vendor/pep517/envbuild.py
def build_wheel(source_dir, wheel_dir, config_settings=None): """Build a wheel from a source directory using PEP 517 hooks. :param str source_dir: Source directory containing pyproject.toml :param str wheel_dir: Target directory to create wheel in :param dict config_settings: Options to pass to build b...
def build_wheel(source_dir, wheel_dir, config_settings=None): """Build a wheel from a source directory using PEP 517 hooks. :param str source_dir: Source directory containing pyproject.toml :param str wheel_dir: Target directory to create wheel in :param dict config_settings: Options to pass to build b...
[ "Build", "a", "wheel", "from", "a", "source", "directory", "using", "PEP", "517", "hooks", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/envbuild.py#L117-L136
[ "def", "build_wheel", "(", "source_dir", ",", "wheel_dir", ",", "config_settings", "=", "None", ")", ":", "if", "config_settings", "is", "None", ":", "config_settings", "=", "{", "}", "requires", ",", "backend", "=", "_load_pyproject", "(", "source_dir", ")", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
build_sdist
Build an sdist from a source directory using PEP 517 hooks. :param str source_dir: Source directory containing pyproject.toml :param str sdist_dir: Target directory to place sdist in :param dict config_settings: Options to pass to build backend This is a blocking function which will run pip in a subpr...
pipenv/vendor/pep517/envbuild.py
def build_sdist(source_dir, sdist_dir, config_settings=None): """Build an sdist from a source directory using PEP 517 hooks. :param str source_dir: Source directory containing pyproject.toml :param str sdist_dir: Target directory to place sdist in :param dict config_settings: Options to pass to build b...
def build_sdist(source_dir, sdist_dir, config_settings=None): """Build an sdist from a source directory using PEP 517 hooks. :param str source_dir: Source directory containing pyproject.toml :param str sdist_dir: Target directory to place sdist in :param dict config_settings: Options to pass to build b...
[ "Build", "an", "sdist", "from", "a", "source", "directory", "using", "PEP", "517", "hooks", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/envbuild.py#L139-L158
[ "def", "build_sdist", "(", "source_dir", ",", "sdist_dir", ",", "config_settings", "=", "None", ")", ":", "if", "config_settings", "is", "None", ":", "config_settings", "=", "{", "}", "requires", ",", "backend", "=", "_load_pyproject", "(", "source_dir", ")", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
BuildEnvironment.pip_install
Install dependencies into this env by calling pip in a subprocess
pipenv/vendor/pep517/envbuild.py
def pip_install(self, reqs): """Install dependencies into this env by calling pip in a subprocess""" if not reqs: return log.info('Calling pip to install %s', reqs) check_call([ sys.executable, '-m', 'pip', 'install', '--ignore-installed', '--prefix', ...
def pip_install(self, reqs): """Install dependencies into this env by calling pip in a subprocess""" if not reqs: return log.info('Calling pip to install %s', reqs) check_call([ sys.executable, '-m', 'pip', 'install', '--ignore-installed', '--prefix', ...
[ "Install", "dependencies", "into", "this", "env", "by", "calling", "pip", "in", "a", "subprocess" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/envbuild.py#L88-L95
[ "def", "pip_install", "(", "self", ",", "reqs", ")", ":", "if", "not", "reqs", ":", "return", "log", ".", "info", "(", "'Calling pip to install %s'", ",", "reqs", ")", "check_call", "(", "[", "sys", ".", "executable", ",", "'-m'", ",", "'pip'", ",", "'...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Node.reparentChildren
Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way :arg newParent: the node to move all this node's children to
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def reparentChildren(self, newParent): """Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way :arg newParent: the node to move all this node's children to """ # XXX - should...
def reparentChildren(self, newParent): """Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way :arg newParent: the node to move all this node's children to """ # XXX - should...
[ "Move", "all", "the", "children", "of", "the", "current", "node", "to", "newParent", ".", "This", "is", "needed", "so", "that", "trees", "that", "don", "t", "store", "text", "as", "nodes", "move", "the", "text", "in", "the", "correct", "way" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L97-L108
[ "def", "reparentChildren", "(", "self", ",", "newParent", ")", ":", "# XXX - should this method be made more general?", "for", "child", "in", "self", ".", "childNodes", ":", "newParent", ".", "appendChild", "(", "child", ")", "self", ".", "childNodes", "=", "[", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TreeBuilder.elementInActiveFormattingElements
Check if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return false
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def elementInActiveFormattingElements(self, name): """Check if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return false""" for item in self.activeFormattingElements[::-1]: # Check for Marker first becau...
def elementInActiveFormattingElements(self, name): """Check if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return false""" for item in self.activeFormattingElements[::-1]: # Check for Marker first becau...
[ "Check", "if", "an", "element", "exists", "between", "the", "end", "of", "the", "active", "formatting", "elements", "and", "the", "last", "marker", ".", "If", "it", "does", "return", "it", "else", "return", "false" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L269-L281
[ "def", "elementInActiveFormattingElements", "(", "self", ",", "name", ")", ":", "for", "item", "in", "self", ".", "activeFormattingElements", "[", ":", ":", "-", "1", "]", ":", "# Check for Marker first because if it's a Marker it doesn't have a", "# name attribute.", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TreeBuilder.createElement
Create an element but don't insert it anywhere
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def createElement(self, token): """Create an element but don't insert it anywhere""" name = token["name"] namespace = token.get("namespace", self.defaultNamespace) element = self.elementClass(name, namespace) element.attributes = token["data"] return element
def createElement(self, token): """Create an element but don't insert it anywhere""" name = token["name"] namespace = token.get("namespace", self.defaultNamespace) element = self.elementClass(name, namespace) element.attributes = token["data"] return element
[ "Create", "an", "element", "but", "don", "t", "insert", "it", "anywhere" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L301-L307
[ "def", "createElement", "(", "self", ",", "token", ")", ":", "name", "=", "token", "[", "\"name\"", "]", "namespace", "=", "token", ".", "get", "(", "\"namespace\"", ",", "self", ".", "defaultNamespace", ")", "element", "=", "self", ".", "elementClass", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TreeBuilder._setInsertFromTable
Switch the function used to insert an element from the normal one to the misnested table one and back again
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def _setInsertFromTable(self, value): """Switch the function used to insert an element from the normal one to the misnested table one and back again""" self._insertFromTable = value if value: self.insertElement = self.insertElementTable else: self.insertEl...
def _setInsertFromTable(self, value): """Switch the function used to insert an element from the normal one to the misnested table one and back again""" self._insertFromTable = value if value: self.insertElement = self.insertElementTable else: self.insertEl...
[ "Switch", "the", "function", "used", "to", "insert", "an", "element", "from", "the", "normal", "one", "to", "the", "misnested", "table", "one", "and", "back", "again" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L312-L319
[ "def", "_setInsertFromTable", "(", "self", ",", "value", ")", ":", "self", ".", "_insertFromTable", "=", "value", "if", "value", ":", "self", ".", "insertElement", "=", "self", ".", "insertElementTable", "else", ":", "self", ".", "insertElement", "=", "self"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TreeBuilder.insertElementTable
Create an element and insert it into the tree
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def insertElementTable(self, token): """Create an element and insert it into the tree""" element = self.createElement(token) if self.openElements[-1].name not in tableInsertModeElements: return self.insertElementNormal(token) else: # We should be in the InTable mo...
def insertElementTable(self, token): """Create an element and insert it into the tree""" element = self.createElement(token) if self.openElements[-1].name not in tableInsertModeElements: return self.insertElementNormal(token) else: # We should be in the InTable mo...
[ "Create", "an", "element", "and", "insert", "it", "into", "the", "tree" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L333-L347
[ "def", "insertElementTable", "(", "self", ",", "token", ")", ":", "element", "=", "self", ".", "createElement", "(", "token", ")", "if", "self", ".", "openElements", "[", "-", "1", "]", ".", "name", "not", "in", "tableInsertModeElements", ":", "return", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TreeBuilder.insertText
Insert text data.
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def insertText(self, data, parent=None): """Insert text data.""" if parent is None: parent = self.openElements[-1] if (not self.insertFromTable or (self.insertFromTable and self.openElements[-1].name n...
def insertText(self, data, parent=None): """Insert text data.""" if parent is None: parent = self.openElements[-1] if (not self.insertFromTable or (self.insertFromTable and self.openElements[-1].name n...
[ "Insert", "text", "data", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L349-L362
[ "def", "insertText", "(", "self", ",", "data", ",", "parent", "=", "None", ")", ":", "if", "parent", "is", "None", ":", "parent", "=", "self", ".", "openElements", "[", "-", "1", "]", "if", "(", "not", "self", ".", "insertFromTable", "or", "(", "se...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TreeBuilder.getTableMisnestedNodePosition
Get the foster parent element, and sibling to insert before (or None) when inserting a misnested table node
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def getTableMisnestedNodePosition(self): """Get the foster parent element, and sibling to insert before (or None) when inserting a misnested table node""" # The foster parent element is the one which comes before the most # recently opened table element # XXX - this is really ine...
def getTableMisnestedNodePosition(self): """Get the foster parent element, and sibling to insert before (or None) when inserting a misnested table node""" # The foster parent element is the one which comes before the most # recently opened table element # XXX - this is really ine...
[ "Get", "the", "foster", "parent", "element", "and", "sibling", "to", "insert", "before", "(", "or", "None", ")", "when", "inserting", "a", "misnested", "table", "node" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L364-L388
[ "def", "getTableMisnestedNodePosition", "(", "self", ")", ":", "# The foster parent element is the one which comes before the most", "# recently opened table element", "# XXX - this is really inelegant", "lastTable", "=", "None", "fosterParent", "=", "None", "insertBefore", "=", "N...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TreeBuilder.getFragment
Return the final fragment
pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py
def getFragment(self): """Return the final fragment""" # assert self.innerHTML fragment = self.fragmentClass() self.openElements[0].reparentChildren(fragment) return fragment
def getFragment(self): """Return the final fragment""" # assert self.innerHTML fragment = self.fragmentClass() self.openElements[0].reparentChildren(fragment) return fragment
[ "Return", "the", "final", "fragment" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L404-L409
[ "def", "getFragment", "(", "self", ")", ":", "# assert self.innerHTML", "fragment", "=", "self", ".", "fragmentClass", "(", ")", "self", ".", "openElements", "[", "0", "]", ".", "reparentChildren", "(", "fragment", ")", "return", "fragment" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Marker.evaluate
Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Python process.
pipenv/vendor/packaging/markers.py
def evaluate(self, environment=None): """Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Pyt...
def evaluate(self, environment=None): """Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Pyt...
[ "Evaluate", "a", "marker", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/packaging/markers.py#L283-L296
[ "def", "evaluate", "(", "self", ",", "environment", "=", "None", ")", ":", "current_environment", "=", "default_environment", "(", ")", "if", "environment", "is", "not", "None", ":", "current_environment", ".", "update", "(", "environment", ")", "return", "_ev...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_allow_all_wheels
Monkey patch pip.Wheel to allow all wheels The usual checks against platforms and Python versions are ignored to allow fetching all available entries in PyPI. This also saves the candidate cache and set a new one, or else the results from the previous non-patched calls will interfere.
pipenv/vendor/passa/internals/hashes.py
def _allow_all_wheels(): """Monkey patch pip.Wheel to allow all wheels The usual checks against platforms and Python versions are ignored to allow fetching all available entries in PyPI. This also saves the candidate cache and set a new one, or else the results from the previous non-patched calls w...
def _allow_all_wheels(): """Monkey patch pip.Wheel to allow all wheels The usual checks against platforms and Python versions are ignored to allow fetching all available entries in PyPI. This also saves the candidate cache and set a new one, or else the results from the previous non-patched calls w...
[ "Monkey", "patch", "pip", ".", "Wheel", "to", "allow", "all", "wheels" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/hashes.py#L21-L36
[ "def", "_allow_all_wheels", "(", ")", ":", "original_wheel_supported", "=", "Wheel", ".", "supported", "original_support_index_min", "=", "Wheel", ".", "support_index_min", "Wheel", ".", "supported", "=", "_wheel_supported", "Wheel", ".", "support_index_min", "=", "_w...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TempDirectory.create
Create a temporary directory and store its path in self.path
pipenv/patched/notpip/_internal/utils/temp_dir.py
def create(self): """Create a temporary directory and store its path in self.path """ if self.path is not None: logger.debug( "Skipped creation of temporary directory: {}".format(self.path) ) return # We realpath here because some syste...
def create(self): """Create a temporary directory and store its path in self.path """ if self.path is not None: logger.debug( "Skipped creation of temporary directory: {}".format(self.path) ) return # We realpath here because some syste...
[ "Create", "a", "temporary", "directory", "and", "store", "its", "path", "in", "self", ".", "path" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/temp_dir.py#L78-L94
[ "def", "create", "(", "self", ")", ":", "if", "self", ".", "path", "is", "not", "None", ":", "logger", ".", "debug", "(", "\"Skipped creation of temporary directory: {}\"", ".", "format", "(", "self", ".", "path", ")", ")", "return", "# We realpath here becaus...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TempDirectory.cleanup
Remove the temporary directory created and reset state
pipenv/patched/notpip/_internal/utils/temp_dir.py
def cleanup(self): """Remove the temporary directory created and reset state """ if getattr(self._finalizer, "detach", None) and self._finalizer.detach(): if os.path.exists(self.path): try: rmtree(self.path) except OSError: ...
def cleanup(self): """Remove the temporary directory created and reset state """ if getattr(self._finalizer, "detach", None) and self._finalizer.detach(): if os.path.exists(self.path): try: rmtree(self.path) except OSError: ...
[ "Remove", "the", "temporary", "directory", "created", "and", "reset", "state" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/temp_dir.py#L106-L116
[ "def", "cleanup", "(", "self", ")", ":", "if", "getattr", "(", "self", ".", "_finalizer", ",", "\"detach\"", ",", "None", ")", "and", "self", ".", "_finalizer", ".", "detach", "(", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
AdjacentTempDirectory._generate_names
Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions of package).
pipenv/patched/notpip/_internal/utils/temp_dir.py
def _generate_names(cls, name): """Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions of package). """ ...
def _generate_names(cls, name): """Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions of package). """ ...
[ "Generates", "a", "series", "of", "temporary", "names", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/temp_dir.py#L145-L166
[ "def", "_generate_names", "(", "cls", ",", "name", ")", ":", "for", "i", "in", "range", "(", "1", ",", "len", "(", "name", ")", ")", ":", "for", "candidate", "in", "itertools", ".", "combinations_with_replacement", "(", "cls", ".", "LEADING_CHARS", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
detect
Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray``
pipenv/vendor/chardet/__init__.py
def detect(byte_str): """ Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` """ if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): raise TypeError('Expecte...
def detect(byte_str): """ Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` """ if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): raise TypeError('Expecte...
[ "Detect", "the", "encoding", "of", "the", "given", "byte", "string", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/__init__.py#L24-L39
[ "def", "detect", "(", "byte_str", ")", ":", "if", "not", "isinstance", "(", "byte_str", ",", "bytearray", ")", ":", "if", "not", "isinstance", "(", "byte_str", ",", "bytes", ")", ":", "raise", "TypeError", "(", "'Expected object of type bytes or bytearray, got: ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Markup.unescape
Convert escaped markup back into a text string. This replaces HTML entities with the characters they represent. >>> Markup('Main &raquo; <em>About</em>').unescape() 'Main » <em>About</em>'
pipenv/vendor/markupsafe/__init__.py
def unescape(self): """Convert escaped markup back into a text string. This replaces HTML entities with the characters they represent. >>> Markup('Main &raquo; <em>About</em>').unescape() 'Main » <em>About</em>' """ from ._constants import HTML_ENTITIES def hand...
def unescape(self): """Convert escaped markup back into a text string. This replaces HTML entities with the characters they represent. >>> Markup('Main &raquo; <em>About</em>').unescape() 'Main » <em>About</em>' """ from ._constants import HTML_ENTITIES def hand...
[ "Convert", "escaped", "markup", "back", "into", "a", "text", "string", ".", "This", "replaces", "HTML", "entities", "with", "the", "characters", "they", "represent", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/markupsafe/__init__.py#L127-L150
[ "def", "unescape", "(", "self", ")", ":", "from", ".", "_constants", "import", "HTML_ENTITIES", "def", "handle_match", "(", "m", ")", ":", "name", "=", "m", ".", "group", "(", "1", ")", "if", "name", "in", "HTML_ENTITIES", ":", "return", "unichr", "(",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde