repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
pypa/pipenv
pipenv/patched/notpip/_internal/req/__init__.py
install_given_reqs
def install_given_reqs( to_install, # type: List[InstallRequirement] install_options, # type: List[str] global_options=(), # type: Sequence[str] *args, **kwargs ): # type: (...) -> List[InstallRequirement] """ Install everything in the given list. (to be called after having downloade...
python
def install_given_reqs( to_install, # type: List[InstallRequirement] install_options, # type: List[str] global_options=(), # type: Sequence[str] *args, **kwargs ): # type: (...) -> List[InstallRequirement] """ Install everything in the given list. (to be called after having downloade...
[ "def", "install_given_reqs", "(", "to_install", ",", "# type: List[InstallRequirement]", "install_options", ",", "# type: List[str]", "global_options", "=", "(", ")", ",", "# type: Sequence[str]", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (...) -> List[In...
Install everything in the given list. (to be called after having downloaded and unpacked the packages)
[ "Install", "everything", "in", "the", "given", "list", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/__init__.py#L22-L77
train
pypa/pipenv
pipenv/vendor/yaspin/termcolor.py
cprint
def cprint(text, color=None, on_color=None, attrs=None, **kwargs): """Print colorize text. It accepts arguments of print function. """ print((colored(text, color, on_color, attrs)), **kwargs)
python
def cprint(text, color=None, on_color=None, attrs=None, **kwargs): """Print colorize text. It accepts arguments of print function. """ print((colored(text, color, on_color, attrs)), **kwargs)
[ "def", "cprint", "(", "text", ",", "color", "=", "None", ",", "on_color", "=", "None", ",", "attrs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "print", "(", "(", "colored", "(", "text", ",", "color", ",", "on_color", ",", "attrs", ")", ")",...
Print colorize text. It accepts arguments of print function.
[ "Print", "colorize", "text", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/termcolor.py#L118-L124
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
get_provider
def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq, Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except KeyError: __import__(mo...
python
def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq, Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except KeyError: __import__(mo...
[ "def", "get_provider", "(", "moduleOrReq", ")", ":", "if", "isinstance", "(", "moduleOrReq", ",", "Requirement", ")", ":", "return", "working_set", ".", "find", "(", "moduleOrReq", ")", "or", "require", "(", "str", "(", "moduleOrReq", ")", ")", "[", "0", ...
Return an IResourceProvider for the named module or requirement
[ "Return", "an", "IResourceProvider", "for", "the", "named", "module", "or", "requirement" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L352-L362
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
get_build_platform
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ from sysconfig import get_platform plat = get_platform() if sys.platform =...
python
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ from sysconfig import get_platform plat = get_platform() if sys.platform =...
[ "def", "get_build_platform", "(", ")", ":", "from", "sysconfig", "import", "get_platform", "plat", "=", "get_platform", "(", ")", "if", "sys", ".", "platform", "==", "\"darwin\"", "and", "not", "plat", ".", "startswith", "(", "'macosx-'", ")", ":", "try", ...
Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X.
[ "Return", "this", "platform", "s", "string", "for", "platform", "-", "specific", "distributions" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L385-L406
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
compatible_platforms
def compatible_platforms(provided, required): """Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes. """ if provided is None or required is None ...
python
def compatible_platforms(provided, required): """Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes. """ if provided is None or required is None ...
[ "def", "compatible_platforms", "(", "provided", ",", "required", ")", ":", "if", "provided", "is", "None", "or", "required", "is", "None", "or", "provided", "==", "required", ":", "# easy case", "return", "True", "# Mac OS X special cases", "reqMac", "=", "macos...
Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes.
[ "Can", "code", "for", "the", "provided", "platform", "run", "on", "the", "required", "platform?" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L415-L458
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
run_script
def run_script(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name require(dist_spec)[0].run_script(script_name, ns)
python
def run_script(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name require(dist_spec)[0].run_script(script_name, ns)
[ "def", "run_script", "(", "dist_spec", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", "]", "=", "n...
Locate distribution `dist_spec` and run its `script_name` script
[ "Locate", "distribution", "dist_spec", "and", "run", "its", "script_name", "script" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L461-L467
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
get_distribution
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, six.string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeEr...
python
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, six.string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeEr...
[ "def", "get_distribution", "(", "dist", ")", ":", "if", "isinstance", "(", "dist", ",", "six", ".", "string_types", ")", ":", "dist", "=", "Requirement", ".", "parse", "(", "dist", ")", "if", "isinstance", "(", "dist", ",", "Requirement", ")", ":", "di...
Return a current distribution object for a Requirement or string
[ "Return", "a", "current", "distribution", "object", "for", "a", "Requirement", "or", "string" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L474-L482
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
safe_version
def safe_version(version): """ Convert an arbitrary string to a standard version string """ try: # normalize the version return str(packaging.version.Version(version)) except packaging.version.InvalidVersion: version = version.replace(' ', '.') return re.sub('[^A-Za-z...
python
def safe_version(version): """ Convert an arbitrary string to a standard version string """ try: # normalize the version return str(packaging.version.Version(version)) except packaging.version.InvalidVersion: version = version.replace(' ', '.') return re.sub('[^A-Za-z...
[ "def", "safe_version", "(", "version", ")", ":", "try", ":", "# normalize the version", "return", "str", "(", "packaging", ".", "version", ".", "Version", "(", "version", ")", ")", "except", "packaging", ".", "version", ".", "InvalidVersion", ":", "version", ...
Convert an arbitrary string to a standard version string
[ "Convert", "an", "arbitrary", "string", "to", "a", "standard", "version", "string" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1323-L1332
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
invalid_marker
def invalid_marker(text): """ Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. """ try: evaluate_marker(text) except SyntaxError as e: e.filename = None e.lineno = None return e return False
python
def invalid_marker(text): """ Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. """ try: evaluate_marker(text) except SyntaxError as e: e.filename = None e.lineno = None return e return False
[ "def", "invalid_marker", "(", "text", ")", ":", "try", ":", "evaluate_marker", "(", "text", ")", "except", "SyntaxError", "as", "e", ":", "e", ".", "filename", "=", "None", "e", ".", "lineno", "=", "None", "return", "e", "return", "False" ]
Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise.
[ "Validate", "text", "as", "a", "PEP", "508", "environment", "marker", ";", "return", "an", "exception", "if", "invalid", "or", "False", "otherwise", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1352-L1363
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
evaluate_marker
def evaluate_marker(text, extra=None): """ Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. """ try: marker = packaging.markers.Marker(te...
python
def evaluate_marker(text, extra=None): """ Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. """ try: marker = packaging.markers.Marker(te...
[ "def", "evaluate_marker", "(", "text", ",", "extra", "=", "None", ")", ":", "try", ":", "marker", "=", "packaging", ".", "markers", ".", "Marker", "(", "text", ")", "return", "marker", ".", "evaluate", "(", ")", "except", "packaging", ".", "markers", "...
Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module.
[ "Evaluate", "a", "PEP", "508", "environment", "marker", ".", "Return", "a", "boolean", "indicating", "the", "marker", "result", "in", "this", "environment", ".", "Raise", "SyntaxError", "if", "marker", "is", "invalid", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1366-L1378
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
find_distributions
def find_distributions(path_item, only=False): """Yield distributions accessible via `path_item`""" importer = get_importer(path_item) finder = _find_adapter(_distribution_finders, importer) return finder(importer, path_item, only)
python
def find_distributions(path_item, only=False): """Yield distributions accessible via `path_item`""" importer = get_importer(path_item) finder = _find_adapter(_distribution_finders, importer) return finder(importer, path_item, only)
[ "def", "find_distributions", "(", "path_item", ",", "only", "=", "False", ")", ":", "importer", "=", "get_importer", "(", "path_item", ")", "finder", "=", "_find_adapter", "(", "_distribution_finders", ",", "importer", ")", "return", "finder", "(", "importer", ...
Yield distributions accessible via `path_item`
[ "Yield", "distributions", "accessible", "via", "path_item" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1870-L1874
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
find_eggs_in_zip
def find_eggs_in_zip(importer, path_item, only=False): """ Find eggs in zip files; possibly multiple nested eggs. """ if importer.archive.endswith('.whl'): # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return meta...
python
def find_eggs_in_zip(importer, path_item, only=False): """ Find eggs in zip files; possibly multiple nested eggs. """ if importer.archive.endswith('.whl'): # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return meta...
[ "def", "find_eggs_in_zip", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "if", "importer", ".", "archive", ".", "endswith", "(", "'.whl'", ")", ":", "# wheels are not supported with this finder", "# they don't have PKG-INFO metadata, and won't ...
Find eggs in zip files; possibly multiple nested eggs.
[ "Find", "eggs", "in", "zip", "files", ";", "possibly", "multiple", "nested", "eggs", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1877-L1901
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
_by_version_descending
def _by_version_descending(names): """ Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setup...
python
def _by_version_descending(names): """ Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setup...
[ "def", "_by_version_descending", "(", "names", ")", ":", "def", "_by_version", "(", "name", ")", ":", "\"\"\"\n Parse each component of the filename\n \"\"\"", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "name", ")", "parts", "=...
Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.egg' ...
[ "Given", "a", "list", "of", "filenames", "return", "them", "in", "descending", "order", "by", "version", "number", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1914-L1937
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
find_on_path
def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if _is_unpacked_egg(path_item): yield Distribution.from_filename( path_item, metadata=PathMetadata( path_item, os.path...
python
def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if _is_unpacked_egg(path_item): yield Distribution.from_filename( path_item, metadata=PathMetadata( path_item, os.path...
[ "def", "find_on_path", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "path_item", "=", "_normalize_cached", "(", "path_item", ")", "if", "_is_unpacked_egg", "(", "path_item", ")", ":", "yield", "Distribution", ".", "from_filename", "(...
Yield distributions accessible on a sys.path directory
[ "Yield", "distributions", "accessible", "on", "a", "sys", ".", "path", "directory" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1940-L1969
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
dist_factory
def dist_factory(path_item, entry, only): """ Return a dist_factory for a path_item and entry """ lower = entry.lower() is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info'))) return ( distributions_from_metadata if is_meta else find_distributions if not o...
python
def dist_factory(path_item, entry, only): """ Return a dist_factory for a path_item and entry """ lower = entry.lower() is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info'))) return ( distributions_from_metadata if is_meta else find_distributions if not o...
[ "def", "dist_factory", "(", "path_item", ",", "entry", ",", "only", ")", ":", "lower", "=", "entry", ".", "lower", "(", ")", "is_meta", "=", "any", "(", "map", "(", "lower", ".", "endswith", ",", "(", "'.egg-info'", ",", "'.dist-info'", ")", ")", ")"...
Return a dist_factory for a path_item and entry
[ "Return", "a", "dist_factory", "for", "a", "path_item", "and", "entry" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1972-L1986
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
safe_listdir
def safe_listdir(path): """ Attempt to list contents of path, but suppress some exceptions. """ try: return os.listdir(path) except (PermissionError, NotADirectoryError): pass except OSError as e: # Ignore the directory if does not exist, not a directory or # perm...
python
def safe_listdir(path): """ Attempt to list contents of path, but suppress some exceptions. """ try: return os.listdir(path) except (PermissionError, NotADirectoryError): pass except OSError as e: # Ignore the directory if does not exist, not a directory or # perm...
[ "def", "safe_listdir", "(", "path", ")", ":", "try", ":", "return", "os", ".", "listdir", "(", "path", ")", "except", "(", "PermissionError", ",", "NotADirectoryError", ")", ":", "pass", "except", "OSError", "as", "e", ":", "# Ignore the directory if does not ...
Attempt to list contents of path, but suppress some exceptions.
[ "Attempt", "to", "list", "contents", "of", "path", "but", "suppress", "some", "exceptions", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2006-L2024
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
non_empty_lines
def non_empty_lines(path): """ Yield non-empty lines from file at path """ with open(path) as f: for line in f: line = line.strip() if line: yield line
python
def non_empty_lines(path): """ Yield non-empty lines from file at path """ with open(path) as f: for line in f: line = line.strip() if line: yield line
[ "def", "non_empty_lines", "(", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "for", "line", "in", "f", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "line", ":", "yield", "line" ]
Yield non-empty lines from file at path
[ "Yield", "non", "-", "empty", "lines", "from", "file", "at", "path" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2042-L2050
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
resolve_egg_link
def resolve_egg_link(path): """ Given a path to an .egg-link, resolve distributions present in the referenced path. """ referenced_paths = non_empty_lines(path) resolved_paths = ( os.path.join(os.path.dirname(path), ref) for ref in referenced_paths ) dist_groups = map(fin...
python
def resolve_egg_link(path): """ Given a path to an .egg-link, resolve distributions present in the referenced path. """ referenced_paths = non_empty_lines(path) resolved_paths = ( os.path.join(os.path.dirname(path), ref) for ref in referenced_paths ) dist_groups = map(fin...
[ "def", "resolve_egg_link", "(", "path", ")", ":", "referenced_paths", "=", "non_empty_lines", "(", "path", ")", "resolved_paths", "=", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ",", "ref", ")", "for"...
Given a path to an .egg-link, resolve distributions present in the referenced path.
[ "Given", "a", "path", "to", "an", ".", "egg", "-", "link", "resolve", "distributions", "present", "in", "the", "referenced", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2053-L2064
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
_handle_ns
def _handle_ns(packageName, path_item): """Ensure that named package includes a subpath of path_item (if needed)""" importer = get_importer(path_item) if importer is None: return None # capture warnings due to #1111 with warnings.catch_warnings(): warnings.simplefilter("ignore") ...
python
def _handle_ns(packageName, path_item): """Ensure that named package includes a subpath of path_item (if needed)""" importer = get_importer(path_item) if importer is None: return None # capture warnings due to #1111 with warnings.catch_warnings(): warnings.simplefilter("ignore") ...
[ "def", "_handle_ns", "(", "packageName", ",", "path_item", ")", ":", "importer", "=", "get_importer", "(", "path_item", ")", "if", "importer", "is", "None", ":", "return", "None", "# capture warnings due to #1111", "with", "warnings", ".", "catch_warnings", "(", ...
Ensure that named package includes a subpath of path_item (if needed)
[ "Ensure", "that", "named", "package", "includes", "a", "subpath", "of", "path_item", "(", "if", "needed", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2094-L2122
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
_rebuild_mod_path
def _rebuild_mod_path(orig_path, package_name, module): """ Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order """ sys_path = [_normalize_cached(p) for p in sys.path] def safe_sys_path_index(entry): """ Workaround for #520 and #51...
python
def _rebuild_mod_path(orig_path, package_name, module): """ Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order """ sys_path = [_normalize_cached(p) for p in sys.path] def safe_sys_path_index(entry): """ Workaround for #520 and #51...
[ "def", "_rebuild_mod_path", "(", "orig_path", ",", "package_name", ",", "module", ")", ":", "sys_path", "=", "[", "_normalize_cached", "(", "p", ")", "for", "p", "in", "sys", ".", "path", "]", "def", "safe_sys_path_index", "(", "entry", ")", ":", "\"\"\"\n...
Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order
[ "Rebuild", "module", ".", "__path__", "ensuring", "that", "all", "entries", "are", "ordered", "corresponding", "to", "their", "sys", ".", "path", "order" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2125-L2156
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
declare_namespace
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" _imp.acquire_lock() try: if packageName in _namespace_packages: return path = sys.path parent, _, _ = packageName.rpartition('.') if parent: declare_...
python
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" _imp.acquire_lock() try: if packageName in _namespace_packages: return path = sys.path parent, _, _ = packageName.rpartition('.') if parent: declare_...
[ "def", "declare_namespace", "(", "packageName", ")", ":", "_imp", ".", "acquire_lock", "(", ")", "try", ":", "if", "packageName", "in", "_namespace_packages", ":", "return", "path", "=", "sys", ".", "path", "parent", ",", "_", ",", "_", "=", "packageName",...
Declare that package 'packageName' is a namespace package
[ "Declare", "that", "package", "packageName", "is", "a", "namespace", "package" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2159-L2190
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
fixup_namespace_packages
def fixup_namespace_packages(path_item, parent=None): """Ensure that previously-declared namespace packages include path_item""" _imp.acquire_lock() try: for package in _namespace_packages.get(parent, ()): subpath = _handle_ns(package, path_item) if subpath: f...
python
def fixup_namespace_packages(path_item, parent=None): """Ensure that previously-declared namespace packages include path_item""" _imp.acquire_lock() try: for package in _namespace_packages.get(parent, ()): subpath = _handle_ns(package, path_item) if subpath: f...
[ "def", "fixup_namespace_packages", "(", "path_item", ",", "parent", "=", "None", ")", ":", "_imp", ".", "acquire_lock", "(", ")", "try", ":", "for", "package", "in", "_namespace_packages", ".", "get", "(", "parent", ",", "(", ")", ")", ":", "subpath", "=...
Ensure that previously-declared namespace packages include path_item
[ "Ensure", "that", "previously", "-", "declared", "namespace", "packages", "include", "path_item" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2193-L2202
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
file_ns_handler
def file_ns_handler(importer, path_item, packageName, module): """Compute an ns-package subpath for a filesystem or zipfile importer""" subpath = os.path.join(path_item, packageName.split('.')[-1]) normalized = _normalize_cached(subpath) for item in module.__path__: if _normalize_cached(item) =...
python
def file_ns_handler(importer, path_item, packageName, module): """Compute an ns-package subpath for a filesystem or zipfile importer""" subpath = os.path.join(path_item, packageName.split('.')[-1]) normalized = _normalize_cached(subpath) for item in module.__path__: if _normalize_cached(item) =...
[ "def", "file_ns_handler", "(", "importer", ",", "path_item", ",", "packageName", ",", "module", ")", ":", "subpath", "=", "os", ".", "path", ".", "join", "(", "path_item", ",", "packageName", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "n...
Compute an ns-package subpath for a filesystem or zipfile importer
[ "Compute", "an", "ns", "-", "package", "subpath", "for", "a", "filesystem", "or", "zipfile", "importer" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2205-L2215
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
normalize_path
def normalize_path(filename): """Normalize a file/dir name for comparison purposes""" return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
python
def normalize_path(filename): """Normalize a file/dir name for comparison purposes""" return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
[ "def", "normalize_path", "(", "filename", ")", ":", "return", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "normpath", "(", "_cygwin_patch", "(", "filename", ")", ")", ")", ")" ]
Normalize a file/dir name for comparison purposes
[ "Normalize", "a", "file", "/", "dir", "name", "for", "comparison", "purposes" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2232-L2234
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
_is_unpacked_egg
def _is_unpacked_egg(path): """ Determine if given path appears to be an unpacked egg. """ return ( _is_egg_path(path) and os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO')) )
python
def _is_unpacked_egg(path): """ Determine if given path appears to be an unpacked egg. """ return ( _is_egg_path(path) and os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO')) )
[ "def", "_is_unpacked_egg", "(", "path", ")", ":", "return", "(", "_is_egg_path", "(", "path", ")", "and", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "path", ",", "'EGG-INFO'", ",", "'PKG-INFO'", ")", ")", ")" ]
Determine if given path appears to be an unpacked egg.
[ "Determine", "if", "given", "path", "appears", "to", "be", "an", "unpacked", "egg", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2263-L2270
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
_version_from_file
def _version_from_file(lines): """ Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise. """ def is_version_line(line): return line.lower().startswith('version:') version_lines = filter(is_version_line, lines) line = ne...
python
def _version_from_file(lines): """ Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise. """ def is_version_line(line): return line.lower().startswith('version:') version_lines = filter(is_version_line, lines) line = ne...
[ "def", "_version_from_file", "(", "lines", ")", ":", "def", "is_version_line", "(", "line", ")", ":", "return", "line", ".", "lower", "(", ")", ".", "startswith", "(", "'version:'", ")", "version_lines", "=", "filter", "(", "is_version_line", ",", "lines", ...
Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise.
[ "Given", "an", "iterable", "of", "lines", "from", "a", "Metadata", "file", "return", "the", "value", "of", "the", "Version", "field", "if", "present", "or", "None", "otherwise", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2451-L2461
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
parse_requirements
def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) for line in lines: # Dro...
python
def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) for line in lines: # Dro...
[ "def", "parse_requirements", "(", "strs", ")", ":", "# create a steppable iterator, so we can handle \\-continuations", "lines", "=", "iter", "(", "yield_lines", "(", "strs", ")", ")", "for", "line", "in", "lines", ":", "# Drop comments -- a hash without a space may be in a...
Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof.
[ "Yield", "Requirement", "objects", "for", "each", "specification", "in", "strs" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2951-L2970
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
_find_adapter
def _find_adapter(registry, ob): """Return an adapter factory for `ob` from `registry`""" types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob)))) for t in types: if t in registry: return registry[t]
python
def _find_adapter(registry, ob): """Return an adapter factory for `ob` from `registry`""" types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob)))) for t in types: if t in registry: return registry[t]
[ "def", "_find_adapter", "(", "registry", ",", "ob", ")", ":", "types", "=", "_always_object", "(", "inspect", ".", "getmro", "(", "getattr", "(", "ob", ",", "'__class__'", ",", "type", "(", "ob", ")", ")", ")", ")", "for", "t", "in", "types", ":", ...
Return an adapter factory for `ob` from `registry`
[ "Return", "an", "adapter", "factory", "for", "ob", "from", "registry" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3037-L3042
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
ensure_directory
def ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) py31compat.makedirs(dirname, exist_ok=True)
python
def ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) py31compat.makedirs(dirname, exist_ok=True)
[ "def", "ensure_directory", "(", "path", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", "py31compat", ".", "makedirs", "(", "dirname", ",", "exist_ok", "=", "True", ")" ]
Ensure that the parent directory of `path` exists
[ "Ensure", "that", "the", "parent", "directory", "of", "path", "exists" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3045-L3048
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
split_sections
def split_sections(s): """Split a string or iterable thereof into (section, content) pairs Each ``section`` is a stripped version of the section header ("[section]") and each ``content`` is a list of stripped lines excluding blank lines and comment-only lines. If there are any such lines before the fi...
python
def split_sections(s): """Split a string or iterable thereof into (section, content) pairs Each ``section`` is a stripped version of the section header ("[section]") and each ``content`` is a list of stripped lines excluding blank lines and comment-only lines. If there are any such lines before the fi...
[ "def", "split_sections", "(", "s", ")", ":", "section", "=", "None", "content", "=", "[", "]", "for", "line", "in", "yield_lines", "(", "s", ")", ":", "if", "line", ".", "startswith", "(", "\"[\"", ")", ":", "if", "line", ".", "endswith", "(", "\"]...
Split a string or iterable thereof into (section, content) pairs Each ``section`` is a stripped version of the section header ("[section]") and each ``content`` is a list of stripped lines excluding blank lines and comment-only lines. If there are any such lines before the first section header, they'r...
[ "Split", "a", "string", "or", "iterable", "thereof", "into", "(", "section", "content", ")", "pairs" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3064-L3087
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
VersionConflict.with_context
def with_context(self, required_by): """ If required_by is non-empty, return a version of self that is a ContextualVersionConflict. """ if not required_by: return self args = self.args + (required_by,) return ContextualVersionConflict(*args)
python
def with_context(self, required_by): """ If required_by is non-empty, return a version of self that is a ContextualVersionConflict. """ if not required_by: return self args = self.args + (required_by,) return ContextualVersionConflict(*args)
[ "def", "with_context", "(", "self", ",", "required_by", ")", ":", "if", "not", "required_by", ":", "return", "self", "args", "=", "self", ".", "args", "+", "(", "required_by", ",", ")", "return", "ContextualVersionConflict", "(", "*", "args", ")" ]
If required_by is non-empty, return a version of self that is a ContextualVersionConflict.
[ "If", "required_by", "is", "non", "-", "empty", "return", "a", "version", "of", "self", "that", "is", "a", "ContextualVersionConflict", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L277-L285
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet._build_master
def _build_master(cls): """ Prepare the master working set. """ ws = cls() try: from __main__ import __requires__ except ImportError: # The main program does not list any requirements return ws # ensure the requirements are met...
python
def _build_master(cls): """ Prepare the master working set. """ ws = cls() try: from __main__ import __requires__ except ImportError: # The main program does not list any requirements return ws # ensure the requirements are met...
[ "def", "_build_master", "(", "cls", ")", ":", "ws", "=", "cls", "(", ")", "try", ":", "from", "__main__", "import", "__requires__", "except", "ImportError", ":", "# The main program does not list any requirements", "return", "ws", "# ensure the requirements are met", ...
Prepare the master working set.
[ "Prepare", "the", "master", "working", "set", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L568-L585
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet._build_from_requirements
def _build_from_requirements(cls, req_spec): """ Build a working set from a requirement spec. Rewrites sys.path. """ # try it without defaults already on sys.path # by starting with an empty path ws = cls([]) reqs = parse_requirements(req_spec) dists = ws....
python
def _build_from_requirements(cls, req_spec): """ Build a working set from a requirement spec. Rewrites sys.path. """ # try it without defaults already on sys.path # by starting with an empty path ws = cls([]) reqs = parse_requirements(req_spec) dists = ws....
[ "def", "_build_from_requirements", "(", "cls", ",", "req_spec", ")", ":", "# try it without defaults already on sys.path", "# by starting with an empty path", "ws", "=", "cls", "(", "[", "]", ")", "reqs", "=", "parse_requirements", "(", "req_spec", ")", "dists", "=", ...
Build a working set from a requirement spec. Rewrites sys.path.
[ "Build", "a", "working", "set", "from", "a", "requirement", "spec", ".", "Rewrites", "sys", ".", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L588-L607
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet.add_entry
def add_entry(self, entry): """Add a path item to ``.entries``, finding any distributions on it ``find_distributions(entry, True)`` is used to find distributions corresponding to the path entry, and they are added. `entry` is always appended to ``.entries``, even if it is already prese...
python
def add_entry(self, entry): """Add a path item to ``.entries``, finding any distributions on it ``find_distributions(entry, True)`` is used to find distributions corresponding to the path entry, and they are added. `entry` is always appended to ``.entries``, even if it is already prese...
[ "def", "add_entry", "(", "self", ",", "entry", ")", ":", "self", ".", "entry_keys", ".", "setdefault", "(", "entry", ",", "[", "]", ")", "self", ".", "entries", ".", "append", "(", "entry", ")", "for", "dist", "in", "find_distributions", "(", "entry", ...
Add a path item to ``.entries``, finding any distributions on it ``find_distributions(entry, True)`` is used to find distributions corresponding to the path entry, and they are added. `entry` is always appended to ``.entries``, even if it is already present. (This is because ``sys.path...
[ "Add", "a", "path", "item", "to", ".", "entries", "finding", "any", "distributions", "on", "it" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L609-L622
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet.iter_entry_points
def iter_entry_points(self, group, name=None): """Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution ord...
python
def iter_entry_points(self, group, name=None): """Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution ord...
[ "def", "iter_entry_points", "(", "self", ",", "group", ",", "name", "=", "None", ")", ":", "return", "(", "entry", "for", "dist", "in", "self", "for", "entry", "in", "dist", ".", "get_entry_map", "(", "group", ")", ".", "values", "(", ")", "if", "nam...
Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution order).
[ "Yield", "entry", "point", "objects", "from", "group", "matching", "name" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L644-L656
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet.run_script
def run_script(self, requires, script_name): """Locate distribution for `requires` and run `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name self.require(requires)[0].run_script(script_name, ns)
python
def run_script(self, requires, script_name): """Locate distribution for `requires` and run `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name self.require(requires)[0].run_script(script_name, ns)
[ "def", "run_script", "(", "self", ",", "requires", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", ...
Locate distribution for `requires` and run `script_name` script
[ "Locate", "distribution", "for", "requires", "and", "run", "script_name", "script" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L658-L664
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet.require
def require(self, *requirements): """Ensure that distributions matching `requirements` are activated `requirements` must be a string or a (possibly-nested) sequence thereof, specifying the distributions and versions required. The return value is a sequence of the distributions that nee...
python
def require(self, *requirements): """Ensure that distributions matching `requirements` are activated `requirements` must be a string or a (possibly-nested) sequence thereof, specifying the distributions and versions required. The return value is a sequence of the distributions that nee...
[ "def", "require", "(", "self", ",", "*", "requirements", ")", ":", "needed", "=", "self", ".", "resolve", "(", "parse_requirements", "(", "requirements", ")", ")", "for", "dist", "in", "needed", ":", "self", ".", "add", "(", "dist", ")", "return", "nee...
Ensure that distributions matching `requirements` are activated `requirements` must be a string or a (possibly-nested) sequence thereof, specifying the distributions and versions required. The return value is a sequence of the distributions that needed to be activated to fulfill the re...
[ "Ensure", "that", "distributions", "matching", "requirements", "are", "activated" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L889-L903
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet.subscribe
def subscribe(self, callback, existing=True): """Invoke `callback` for all distributions If `existing=True` (default), call on all existing ones, as well. """ if callback in self.callbacks: return self.callbacks.append(callback) if not existing: ...
python
def subscribe(self, callback, existing=True): """Invoke `callback` for all distributions If `existing=True` (default), call on all existing ones, as well. """ if callback in self.callbacks: return self.callbacks.append(callback) if not existing: ...
[ "def", "subscribe", "(", "self", ",", "callback", ",", "existing", "=", "True", ")", ":", "if", "callback", "in", "self", ".", "callbacks", ":", "return", "self", ".", "callbacks", ".", "append", "(", "callback", ")", "if", "not", "existing", ":", "ret...
Invoke `callback` for all distributions If `existing=True` (default), call on all existing ones, as well.
[ "Invoke", "callback", "for", "all", "distributions" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L905-L917
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
_ReqExtras.markers_pass
def markers_pass(self, req, extras=None): """ Evaluate markers for req against each extra that demanded it. Return False if the req has a marker and fails evaluation. Otherwise, return True. """ extra_evals = ( req.marker.evaluate({'extra': extra}) ...
python
def markers_pass(self, req, extras=None): """ Evaluate markers for req against each extra that demanded it. Return False if the req has a marker and fails evaluation. Otherwise, return True. """ extra_evals = ( req.marker.evaluate({'extra': extra}) ...
[ "def", "markers_pass", "(", "self", ",", "req", ",", "extras", "=", "None", ")", ":", "extra_evals", "=", "(", "req", ".", "marker", ".", "evaluate", "(", "{", "'extra'", ":", "extra", "}", ")", "for", "extra", "in", "self", ".", "get", "(", "req",...
Evaluate markers for req against each extra that demanded it. Return False if the req has a marker and fails evaluation. Otherwise, return True.
[ "Evaluate", "markers", "for", "req", "against", "each", "extra", "that", "demanded", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L942-L954
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Environment.scan
def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to ...
python
def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to ...
[ "def", "scan", "(", "self", ",", "search_path", "=", "None", ")", ":", "if", "search_path", "is", "None", ":", "search_path", "=", "sys", ".", "path", "for", "item", "in", "search_path", ":", "for", "dist", "in", "find_distributions", "(", "item", ")", ...
Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined a...
[ "Scan", "search_path", "for", "distributions", "usable", "in", "this", "environment" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1002-L1015
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Environment.add
def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) dists.sort...
python
def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) dists.sort...
[ "def", "add", "(", "self", ",", "dist", ")", ":", "if", "self", ".", "can_add", "(", "dist", ")", "and", "dist", ".", "has_version", "(", ")", ":", "dists", "=", "self", ".", "_distmap", ".", "setdefault", "(", "dist", ".", "key", ",", "[", "]", ...
Add `dist` if we ``can_add()`` it and it has not already been added
[ "Add", "dist", "if", "we", "can_add", "()", "it", "and", "it", "has", "not", "already", "been", "added" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1028-L1035
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Environment.best_match
def best_match( self, req, working_set, installer=None, replace_conflicting=False): """Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ...
python
def best_match( self, req, working_set, installer=None, replace_conflicting=False): """Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ...
[ "def", "best_match", "(", "self", ",", "req", ",", "working_set", ",", "installer", "=", "None", ",", "replace_conflicting", "=", "False", ")", ":", "try", ":", "dist", "=", "working_set", ".", "find", "(", "req", ")", "except", "VersionConflict", ":", "...
Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitable version of the project is already active in the specified...
[ "Find", "distribution", "best", "matching", "req", "and", "usable", "on", "working_set" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1037-L1063
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
ResourceManager.extraction_error
def extraction_error(self): """Give an error message for problems extracting file(s)""" old_exc = sys.exc_info()[1] cache_path = self.extraction_path or get_default_cache() tmpl = textwrap.dedent(""" Can't extract file(s) to egg cache The following error occurr...
python
def extraction_error(self): """Give an error message for problems extracting file(s)""" old_exc = sys.exc_info()[1] cache_path = self.extraction_path or get_default_cache() tmpl = textwrap.dedent(""" Can't extract file(s) to egg cache The following error occurr...
[ "def", "extraction_error", "(", "self", ")", ":", "old_exc", "=", "sys", ".", "exc_info", "(", ")", "[", "1", "]", "cache_path", "=", "self", ".", "extraction_path", "or", "get_default_cache", "(", ")", "tmpl", "=", "textwrap", ".", "dedent", "(", "\"\"\...
Give an error message for problems extracting file(s)
[ "Give", "an", "error", "message", "for", "problems", "extracting", "file", "(", "s", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1164-L1190
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
ResourceManager._warn_unsafe_extraction_path
def _warn_unsafe_extraction_path(path): """ If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location...
python
def _warn_unsafe_extraction_path(path): """ If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location...
[ "def", "_warn_unsafe_extraction_path", "(", "path", ")", ":", "if", "os", ".", "name", "==", "'nt'", "and", "not", "path", ".", "startswith", "(", "os", ".", "environ", "[", "'windir'", "]", ")", ":", "# On Windows, permissions are generally restrictive by default...
If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location is used. See Distribute #375 for more details.
[ "If", "the", "default", "extraction", "path", "is", "overridden", "and", "set", "to", "an", "insecure", "location", "such", "as", "/", "tmp", "it", "opens", "up", "an", "opportunity", "for", "an", "attacker", "to", "replace", "an", "extracted", "file", "wi...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1218-L1241
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
ResourceManager.postprocess
def postprocess(self, tempname, filename): """Perform any platform-specific postprocessing of `tempname` This is where Mac header rewrites should be done; other platforms don't have anything special they should do. Resource providers should call this method ONLY after successfully ...
python
def postprocess(self, tempname, filename): """Perform any platform-specific postprocessing of `tempname` This is where Mac header rewrites should be done; other platforms don't have anything special they should do. Resource providers should call this method ONLY after successfully ...
[ "def", "postprocess", "(", "self", ",", "tempname", ",", "filename", ")", ":", "if", "os", ".", "name", "==", "'posix'", ":", "# Make the resource executable", "mode", "=", "(", "(", "os", ".", "stat", "(", "tempname", ")", ".", "st_mode", ")", "|", "0...
Perform any platform-specific postprocessing of `tempname` This is where Mac header rewrites should be done; other platforms don't have anything special they should do. Resource providers should call this method ONLY after successfully extracting a compressed resource. They must NOT c...
[ "Perform", "any", "platform", "-", "specific", "postprocessing", "of", "tempname" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1243-L1261
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
ZipManifests.build
def build(cls, path): """ Build a dictionary similar to the zipimport directory caches, except instead of tuples, store ZipInfo objects. Use a platform-specific path separator (os.sep) for the path keys for compatibility with pypy on Windows. """ with zipfile.Zip...
python
def build(cls, path): """ Build a dictionary similar to the zipimport directory caches, except instead of tuples, store ZipInfo objects. Use a platform-specific path separator (os.sep) for the path keys for compatibility with pypy on Windows. """ with zipfile.Zip...
[ "def", "build", "(", "cls", ",", "path", ")", ":", "with", "zipfile", ".", "ZipFile", "(", "path", ")", "as", "zfile", ":", "items", "=", "(", "(", "name", ".", "replace", "(", "'/'", ",", "os", ".", "sep", ")", ",", "zfile", ".", "getinfo", "(...
Build a dictionary similar to the zipimport directory caches, except instead of tuples, store ZipInfo objects. Use a platform-specific path separator (os.sep) for the path keys for compatibility with pypy on Windows.
[ "Build", "a", "dictionary", "similar", "to", "the", "zipimport", "directory", "caches", "except", "instead", "of", "tuples", "store", "ZipInfo", "objects", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1562-L1578
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
MemoizedZipManifests.load
def load(self, path): """ Load a manifest at path or return a suitable manifest already loaded. """ path = os.path.normpath(path) mtime = os.stat(path).st_mtime if path not in self or self[path].mtime != mtime: manifest = self.build(path) self[pat...
python
def load(self, path): """ Load a manifest at path or return a suitable manifest already loaded. """ path = os.path.normpath(path) mtime = os.stat(path).st_mtime if path not in self or self[path].mtime != mtime: manifest = self.build(path) self[pat...
[ "def", "load", "(", "self", ",", "path", ")", ":", "path", "=", "os", ".", "path", ".", "normpath", "(", "path", ")", "mtime", "=", "os", ".", "stat", "(", "path", ")", ".", "st_mtime", "if", "path", "not", "in", "self", "or", "self", "[", "pat...
Load a manifest at path or return a suitable manifest already loaded.
[ "Load", "a", "manifest", "at", "path", "or", "return", "a", "suitable", "manifest", "already", "loaded", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1589-L1600
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
ZipProvider._is_current
def _is_current(self, file_path, zip_path): """ Return True if the file_path is current for this zip_path """ timestamp, size = self._get_date_and_size(self.zipinfo[zip_path]) if not os.path.isfile(file_path): return False stat = os.stat(file_path) if ...
python
def _is_current(self, file_path, zip_path): """ Return True if the file_path is current for this zip_path """ timestamp, size = self._get_date_and_size(self.zipinfo[zip_path]) if not os.path.isfile(file_path): return False stat = os.stat(file_path) if ...
[ "def", "_is_current", "(", "self", ",", "file_path", ",", "zip_path", ")", ":", "timestamp", ",", "size", "=", "self", ".", "_get_date_and_size", "(", "self", ".", "zipinfo", "[", "zip_path", "]", ")", "if", "not", "os", ".", "path", ".", "isfile", "("...
Return True if the file_path is current for this zip_path
[ "Return", "True", "if", "the", "file_path", "is", "current", "for", "this", "zip_path" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1716-L1730
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
EntryPoint.load
def load(self, require=True, *args, **kwargs): """ Require packages for this EntryPoint, then resolve it. """ if not require or args or kwargs: warnings.warn( "Parameters to load are deprecated. Call .resolve and " ".require separately.", ...
python
def load(self, require=True, *args, **kwargs): """ Require packages for this EntryPoint, then resolve it. """ if not require or args or kwargs: warnings.warn( "Parameters to load are deprecated. Call .resolve and " ".require separately.", ...
[ "def", "load", "(", "self", ",", "require", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "require", "or", "args", "or", "kwargs", ":", "warnings", ".", "warn", "(", "\"Parameters to load are deprecated. Call .resolve and \"...
Require packages for this EntryPoint, then resolve it.
[ "Require", "packages", "for", "this", "EntryPoint", "then", "resolve", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2333-L2346
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
EntryPoint.resolve
def resolve(self): """ Resolve the entry point from its module and attrs. """ module = __import__(self.module_name, fromlist=['__name__'], level=0) try: return functools.reduce(getattr, self.attrs, module) except AttributeError as exc: raise Import...
python
def resolve(self): """ Resolve the entry point from its module and attrs. """ module = __import__(self.module_name, fromlist=['__name__'], level=0) try: return functools.reduce(getattr, self.attrs, module) except AttributeError as exc: raise Import...
[ "def", "resolve", "(", "self", ")", ":", "module", "=", "__import__", "(", "self", ".", "module_name", ",", "fromlist", "=", "[", "'__name__'", "]", ",", "level", "=", "0", ")", "try", ":", "return", "functools", ".", "reduce", "(", "getattr", ",", "...
Resolve the entry point from its module and attrs.
[ "Resolve", "the", "entry", "point", "from", "its", "module", "and", "attrs", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2348-L2356
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
EntryPoint.parse
def parse(cls, src, dist=None): """Parse a single entry point from string `src` Entry point syntax follows the form:: name = some.module:some.attr [extra1, extra2] The entry name and module name are required, but the ``:attrs`` and ``[extras]`` parts are optional "...
python
def parse(cls, src, dist=None): """Parse a single entry point from string `src` Entry point syntax follows the form:: name = some.module:some.attr [extra1, extra2] The entry name and module name are required, but the ``:attrs`` and ``[extras]`` parts are optional "...
[ "def", "parse", "(", "cls", ",", "src", ",", "dist", "=", "None", ")", ":", "m", "=", "cls", ".", "pattern", ".", "match", "(", "src", ")", "if", "not", "m", ":", "msg", "=", "\"EntryPoint must be in 'name=module:attrs [extras]' format\"", "raise", "ValueE...
Parse a single entry point from string `src` Entry point syntax follows the form:: name = some.module:some.attr [extra1, extra2] The entry name and module name are required, but the ``:attrs`` and ``[extras]`` parts are optional
[ "Parse", "a", "single", "entry", "point", "from", "string", "src" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2381-L2398
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
EntryPoint.parse_group
def parse_group(cls, group, lines, dist=None): """Parse an entry point group""" if not MODULE(group): raise ValueError("Invalid group name", group) this = {} for line in yield_lines(lines): ep = cls.parse(line, dist) if ep.name in this: ...
python
def parse_group(cls, group, lines, dist=None): """Parse an entry point group""" if not MODULE(group): raise ValueError("Invalid group name", group) this = {} for line in yield_lines(lines): ep = cls.parse(line, dist) if ep.name in this: ...
[ "def", "parse_group", "(", "cls", ",", "group", ",", "lines", ",", "dist", "=", "None", ")", ":", "if", "not", "MODULE", "(", "group", ")", ":", "raise", "ValueError", "(", "\"Invalid group name\"", ",", "group", ")", "this", "=", "{", "}", "for", "l...
Parse an entry point group
[ "Parse", "an", "entry", "point", "group" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2410-L2420
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
EntryPoint.parse_map
def parse_map(cls, data, dist=None): """Parse a map of entry point groups""" if isinstance(data, dict): data = data.items() else: data = split_sections(data) maps = {} for group, lines in data: if group is None: if not lines: ...
python
def parse_map(cls, data, dist=None): """Parse a map of entry point groups""" if isinstance(data, dict): data = data.items() else: data = split_sections(data) maps = {} for group, lines in data: if group is None: if not lines: ...
[ "def", "parse_map", "(", "cls", ",", "data", ",", "dist", "=", "None", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "data", "=", "data", ".", "items", "(", ")", "else", ":", "data", "=", "split_sections", "(", "data", ")", "m...
Parse a map of entry point groups
[ "Parse", "a", "map", "of", "entry", "point", "groups" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2423-L2439
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution._dep_map
def _dep_map(self): """ A map of extra to its list of (direct) requirements for this distribution, including the null extra. """ try: return self.__dep_map except AttributeError: self.__dep_map = self._filter_extras(self._build_dep_map()) r...
python
def _dep_map(self): """ A map of extra to its list of (direct) requirements for this distribution, including the null extra. """ try: return self.__dep_map except AttributeError: self.__dep_map = self._filter_extras(self._build_dep_map()) r...
[ "def", "_dep_map", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dep_map", "except", "AttributeError", ":", "self", ".", "__dep_map", "=", "self", ".", "_filter_extras", "(", "self", ".", "_build_dep_map", "(", ")", ")", "return", "self", ...
A map of extra to its list of (direct) requirements for this distribution, including the null extra.
[ "A", "map", "of", "extra", "to", "its", "list", "of", "(", "direct", ")", "requirements", "for", "this", "distribution", "including", "the", "null", "extra", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2593-L2602
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution._filter_extras
def _filter_extras(dm): """ Given a mapping of extras to dependencies, strip off environment markers and filter out any dependencies not matching the markers. """ for extra in list(filter(None, dm)): new_extra = extra reqs = dm.pop(extra) ...
python
def _filter_extras(dm): """ Given a mapping of extras to dependencies, strip off environment markers and filter out any dependencies not matching the markers. """ for extra in list(filter(None, dm)): new_extra = extra reqs = dm.pop(extra) ...
[ "def", "_filter_extras", "(", "dm", ")", ":", "for", "extra", "in", "list", "(", "filter", "(", "None", ",", "dm", ")", ")", ":", "new_extra", "=", "extra", "reqs", "=", "dm", ".", "pop", "(", "extra", ")", "new_extra", ",", "_", ",", "marker", "...
Given a mapping of extras to dependencies, strip off environment markers and filter out any dependencies not matching the markers.
[ "Given", "a", "mapping", "of", "extras", "to", "dependencies", "strip", "off", "environment", "markers", "and", "filter", "out", "any", "dependencies", "not", "matching", "the", "markers", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2605-L2624
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution.requires
def requires(self, extras=()): """List of Requirements needed for this distro if `extras` are used""" dm = self._dep_map deps = [] deps.extend(dm.get(None, ())) for ext in extras: try: deps.extend(dm[safe_extra(ext)]) except KeyError: ...
python
def requires(self, extras=()): """List of Requirements needed for this distro if `extras` are used""" dm = self._dep_map deps = [] deps.extend(dm.get(None, ())) for ext in extras: try: deps.extend(dm[safe_extra(ext)]) except KeyError: ...
[ "def", "requires", "(", "self", ",", "extras", "=", "(", ")", ")", ":", "dm", "=", "self", ".", "_dep_map", "deps", "=", "[", "]", "deps", ".", "extend", "(", "dm", ".", "get", "(", "None", ",", "(", ")", ")", ")", "for", "ext", "in", "extras...
List of Requirements needed for this distro if `extras` are used
[ "List", "of", "Requirements", "needed", "for", "this", "distro", "if", "extras", "are", "used" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2633-L2645
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution.activate
def activate(self, path=None, replace=False): """Ensure distribution is importable on `path` (default=sys.path)""" if path is None: path = sys.path self.insert_on(path, replace=replace) if path is sys.path: fixup_namespace_packages(self.location) for p...
python
def activate(self, path=None, replace=False): """Ensure distribution is importable on `path` (default=sys.path)""" if path is None: path = sys.path self.insert_on(path, replace=replace) if path is sys.path: fixup_namespace_packages(self.location) for p...
[ "def", "activate", "(", "self", ",", "path", "=", "None", ",", "replace", "=", "False", ")", ":", "if", "path", "is", "None", ":", "path", "=", "sys", ".", "path", "self", ".", "insert_on", "(", "path", ",", "replace", "=", "replace", ")", "if", ...
Ensure distribution is importable on `path` (default=sys.path)
[ "Ensure", "distribution", "is", "importable", "on", "path", "(", "default", "=", "sys", ".", "path", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2652-L2661
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution.egg_name
def egg_name(self): """Return what this distribution's standard .egg filename should be""" filename = "%s-%s-py%s" % ( to_filename(self.project_name), to_filename(self.version), self.py_version or PY_MAJOR ) if self.platform: filename += '-' + self.pl...
python
def egg_name(self): """Return what this distribution's standard .egg filename should be""" filename = "%s-%s-py%s" % ( to_filename(self.project_name), to_filename(self.version), self.py_version or PY_MAJOR ) if self.platform: filename += '-' + self.pl...
[ "def", "egg_name", "(", "self", ")", ":", "filename", "=", "\"%s-%s-py%s\"", "%", "(", "to_filename", "(", "self", ".", "project_name", ")", ",", "to_filename", "(", "self", ".", "version", ")", ",", "self", ".", "py_version", "or", "PY_MAJOR", ")", "if"...
Return what this distribution's standard .egg filename should be
[ "Return", "what", "this", "distribution", "s", "standard", ".", "egg", "filename", "should", "be" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2663-L2672
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution.as_requirement
def as_requirement(self): """Return a ``Requirement`` that matches this distribution exactly""" if isinstance(self.parsed_version, packaging.version.Version): spec = "%s==%s" % (self.project_name, self.parsed_version) else: spec = "%s===%s" % (self.project_name, self.pars...
python
def as_requirement(self): """Return a ``Requirement`` that matches this distribution exactly""" if isinstance(self.parsed_version, packaging.version.Version): spec = "%s==%s" % (self.project_name, self.parsed_version) else: spec = "%s===%s" % (self.project_name, self.pars...
[ "def", "as_requirement", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "parsed_version", ",", "packaging", ".", "version", ".", "Version", ")", ":", "spec", "=", "\"%s==%s\"", "%", "(", "self", ".", "project_name", ",", "self", ".", "parse...
Return a ``Requirement`` that matches this distribution exactly
[ "Return", "a", "Requirement", "that", "matches", "this", "distribution", "exactly" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2714-L2721
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution.load_entry_point
def load_entry_point(self, group, name): """Return the `name` entry point of `group` or raise ImportError""" ep = self.get_entry_info(group, name) if ep is None: raise ImportError("Entry point %r not found" % ((group, name),)) return ep.load()
python
def load_entry_point(self, group, name): """Return the `name` entry point of `group` or raise ImportError""" ep = self.get_entry_info(group, name) if ep is None: raise ImportError("Entry point %r not found" % ((group, name),)) return ep.load()
[ "def", "load_entry_point", "(", "self", ",", "group", ",", "name", ")", ":", "ep", "=", "self", ".", "get_entry_info", "(", "group", ",", "name", ")", "if", "ep", "is", "None", ":", "raise", "ImportError", "(", "\"Entry point %r not found\"", "%", "(", "...
Return the `name` entry point of `group` or raise ImportError
[ "Return", "the", "name", "entry", "point", "of", "group", "or", "raise", "ImportError" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2723-L2728
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution.get_entry_map
def get_entry_map(self, group=None): """Return the entry point map for `group`, or the full entry map""" try: ep_map = self._ep_map except AttributeError: ep_map = self._ep_map = EntryPoint.parse_map( self._get_metadata('entry_points.txt'), self ...
python
def get_entry_map(self, group=None): """Return the entry point map for `group`, or the full entry map""" try: ep_map = self._ep_map except AttributeError: ep_map = self._ep_map = EntryPoint.parse_map( self._get_metadata('entry_points.txt'), self ...
[ "def", "get_entry_map", "(", "self", ",", "group", "=", "None", ")", ":", "try", ":", "ep_map", "=", "self", ".", "_ep_map", "except", "AttributeError", ":", "ep_map", "=", "self", ".", "_ep_map", "=", "EntryPoint", ".", "parse_map", "(", "self", ".", ...
Return the entry point map for `group`, or the full entry map
[ "Return", "the", "entry", "point", "map", "for", "group", "or", "the", "full", "entry", "map" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2730-L2740
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
Distribution.clone
def clone(self, **kw): """Copy this distribution, substituting in any changed keyword args""" names = 'project_name version py_version platform location precedence' for attr in names.split(): kw.setdefault(attr, getattr(self, attr, None)) kw.setdefault('metadata', self._provi...
python
def clone(self, **kw): """Copy this distribution, substituting in any changed keyword args""" names = 'project_name version py_version platform location precedence' for attr in names.split(): kw.setdefault(attr, getattr(self, attr, None)) kw.setdefault('metadata', self._provi...
[ "def", "clone", "(", "self", ",", "*", "*", "kw", ")", ":", "names", "=", "'project_name version py_version platform location precedence'", "for", "attr", "in", "names", ".", "split", "(", ")", ":", "kw", ".", "setdefault", "(", "attr", ",", "getattr", "(", ...
Copy this distribution, substituting in any changed keyword args
[ "Copy", "this", "distribution", "substituting", "in", "any", "changed", "keyword", "args" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2844-L2850
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
EggInfoDistribution._reload_version
def _reload_version(self): """ Packages installed by distutils (e.g. numpy or scipy), which uses an old safe_version, and so their version numbers can get mangled when converted to filenames (e.g., 1.11.0.dev0+2329eae to 1.11.0.dev0_2329eae). These distributions will not ...
python
def _reload_version(self): """ Packages installed by distutils (e.g. numpy or scipy), which uses an old safe_version, and so their version numbers can get mangled when converted to filenames (e.g., 1.11.0.dev0+2329eae to 1.11.0.dev0_2329eae). These distributions will not ...
[ "def", "_reload_version", "(", "self", ")", ":", "md_version", "=", "_version_from_file", "(", "self", ".", "_get_metadata", "(", "self", ".", "PKG_INFO", ")", ")", "if", "md_version", ":", "self", ".", "_version", "=", "md_version", "return", "self" ]
Packages installed by distutils (e.g. numpy or scipy), which uses an old safe_version, and so their version numbers can get mangled when converted to filenames (e.g., 1.11.0.dev0+2329eae to 1.11.0.dev0_2329eae). These distributions will not be parsed properly downstream b...
[ "Packages", "installed", "by", "distutils", "(", "e", ".", "g", ".", "numpy", "or", "scipy", ")", "which", "uses", "an", "old", "safe_version", "and", "so", "their", "version", "numbers", "can", "get", "mangled", "when", "converted", "to", "filenames", "("...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2858-L2873
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
DistInfoDistribution._compute_dependencies
def _compute_dependencies(self): """Recompute this distribution's dependencies.""" dm = self.__dep_map = {None: []} reqs = [] # Including any condition expressions for req in self._parsed_pkg_info.get_all('Requires-Dist') or []: reqs.extend(parse_requirements(req)) ...
python
def _compute_dependencies(self): """Recompute this distribution's dependencies.""" dm = self.__dep_map = {None: []} reqs = [] # Including any condition expressions for req in self._parsed_pkg_info.get_all('Requires-Dist') or []: reqs.extend(parse_requirements(req)) ...
[ "def", "_compute_dependencies", "(", "self", ")", ":", "dm", "=", "self", ".", "__dep_map", "=", "{", "None", ":", "[", "]", "}", "reqs", "=", "[", "]", "# Including any condition expressions", "for", "req", "in", "self", ".", "_parsed_pkg_info", ".", "get...
Recompute this distribution's dependencies.
[ "Recompute", "this", "distribution", "s", "dependencies", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2902-L2923
train
pypa/pipenv
pipenv/vendor/cerberus/schema.py
DefinitionSchema._expand_logical_shortcuts
def _expand_logical_shortcuts(cls, schema): """ Expand agglutinated rules in a definition-schema. :param schema: The schema-definition to expand. :return: The expanded schema-definition. """ def is_of_rule(x): return isinstance(x, _str_type) and \ x.s...
python
def _expand_logical_shortcuts(cls, schema): """ Expand agglutinated rules in a definition-schema. :param schema: The schema-definition to expand. :return: The expanded schema-definition. """ def is_of_rule(x): return isinstance(x, _str_type) and \ x.s...
[ "def", "_expand_logical_shortcuts", "(", "cls", ",", "schema", ")", ":", "def", "is_of_rule", "(", "x", ")", ":", "return", "isinstance", "(", "x", ",", "_str_type", ")", "and", "x", ".", "startswith", "(", "(", "'allof_'", ",", "'anyof_'", ",", "'noneof...
Expand agglutinated rules in a definition-schema. :param schema: The schema-definition to expand. :return: The expanded schema-definition.
[ "Expand", "agglutinated", "rules", "in", "a", "definition", "-", "schema", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L116-L133
train
pypa/pipenv
pipenv/vendor/cerberus/schema.py
DefinitionSchema._validate
def _validate(self, schema): """ Validates a schema that defines rules against supported rules. :param schema: The schema to be validated as a legal cerberus schema according to the rules of this Validator object. """ if isinstance(schema, _str_type): ...
python
def _validate(self, schema): """ Validates a schema that defines rules against supported rules. :param schema: The schema to be validated as a legal cerberus schema according to the rules of this Validator object. """ if isinstance(schema, _str_type): ...
[ "def", "_validate", "(", "self", ",", "schema", ")", ":", "if", "isinstance", "(", "schema", ",", "_str_type", ")", ":", "schema", "=", "self", ".", "validator", ".", "schema_registry", ".", "get", "(", "schema", ",", "schema", ")", "if", "schema", "is...
Validates a schema that defines rules against supported rules. :param schema: The schema to be validated as a legal cerberus schema according to the rules of this Validator object.
[ "Validates", "a", "schema", "that", "defines", "rules", "against", "supported", "rules", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L200-L219
train
pypa/pipenv
pipenv/vendor/cerberus/schema.py
SchemaValidatorMixin._validate_logical
def _validate_logical(self, rule, field, value): """ {'allowed': ('allof', 'anyof', 'noneof', 'oneof')} """ if not isinstance(value, Sequence): self._error(field, errors.BAD_TYPE) return validator = self._get_child_validator( document_crumb=rule, allow_unknow...
python
def _validate_logical(self, rule, field, value): """ {'allowed': ('allof', 'anyof', 'noneof', 'oneof')} """ if not isinstance(value, Sequence): self._error(field, errors.BAD_TYPE) return validator = self._get_child_validator( document_crumb=rule, allow_unknow...
[ "def", "_validate_logical", "(", "self", ",", "rule", ",", "field", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "Sequence", ")", ":", "self", ".", "_error", "(", "field", ",", "errors", ".", "BAD_TYPE", ")", "return", "validat...
{'allowed': ('allof', 'anyof', 'noneof', 'oneof')}
[ "{", "allowed", ":", "(", "allof", "anyof", "noneof", "oneof", ")", "}" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L275-L295
train
pypa/pipenv
pipenv/vendor/cerberus/schema.py
Registry.add
def add(self, name, definition): """ Register a definition to the registry. Existing definitions are replaced silently. :param name: The name which can be used as reference in a validation schema. :type name: :class:`str` :param definition: The definition. ...
python
def add(self, name, definition): """ Register a definition to the registry. Existing definitions are replaced silently. :param name: The name which can be used as reference in a validation schema. :type name: :class:`str` :param definition: The definition. ...
[ "def", "add", "(", "self", ",", "name", ",", "definition", ")", ":", "self", ".", "_storage", "[", "name", "]", "=", "self", ".", "_expand_definition", "(", "definition", ")" ]
Register a definition to the registry. Existing definitions are replaced silently. :param name: The name which can be used as reference in a validation schema. :type name: :class:`str` :param definition: The definition. :type definition: any :term:`mapping`
[ "Register", "a", "definition", "to", "the", "registry", ".", "Existing", "definitions", "are", "replaced", "silently", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L423-L432
train
pypa/pipenv
pipenv/vendor/cerberus/schema.py
Registry.extend
def extend(self, definitions): """ Add several definitions at once. Existing definitions are replaced silently. :param definitions: The names and definitions. :type definitions: a :term:`mapping` or an :term:`iterable` with two-value :class:`tuple` s """ ...
python
def extend(self, definitions): """ Add several definitions at once. Existing definitions are replaced silently. :param definitions: The names and definitions. :type definitions: a :term:`mapping` or an :term:`iterable` with two-value :class:`tuple` s """ ...
[ "def", "extend", "(", "self", ",", "definitions", ")", ":", "for", "name", ",", "definition", "in", "dict", "(", "definitions", ")", ".", "items", "(", ")", ":", "self", ".", "add", "(", "name", ",", "definition", ")" ]
Add several definitions at once. Existing definitions are replaced silently. :param definitions: The names and definitions. :type definitions: a :term:`mapping` or an :term:`iterable` with two-value :class:`tuple` s
[ "Add", "several", "definitions", "at", "once", ".", "Existing", "definitions", "are", "replaced", "silently", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L443-L451
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/subversion.py
Subversion.export
def export(self, location): """Export the svn repository at the url to the destination location""" url, rev_options = self.get_url_rev_options(self.url) logger.info('Exporting svn repository %s to %s', url, location) with indent_log(): if os.path.exists(location): ...
python
def export(self, location): """Export the svn repository at the url to the destination location""" url, rev_options = self.get_url_rev_options(self.url) logger.info('Exporting svn repository %s to %s', url, location) with indent_log(): if os.path.exists(location): ...
[ "def", "export", "(", "self", ",", "location", ")", ":", "url", ",", "rev_options", "=", "self", ".", "get_url_rev_options", "(", "self", ".", "url", ")", "logger", ".", "info", "(", "'Exporting svn repository %s to %s'", ",", "url", ",", "location", ")", ...
Export the svn repository at the url to the destination location
[ "Export", "the", "svn", "repository", "at", "the", "url", "to", "the", "destination", "location" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/subversion.py#L31-L42
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/subversion.py
Subversion.get_netloc_and_auth
def get_netloc_and_auth(self, netloc, scheme): """ This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. """ if scheme == 'ssh': # The --username and --password options can't be used for ...
python
def get_netloc_and_auth(self, netloc, scheme): """ This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. """ if scheme == 'ssh': # The --username and --password options can't be used for ...
[ "def", "get_netloc_and_auth", "(", "self", ",", "netloc", ",", "scheme", ")", ":", "if", "scheme", "==", "'ssh'", ":", "# The --username and --password options can't be used for", "# svn+ssh URLs, so keep the auth information in the URL.", "return", "super", "(", "Subversion"...
This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL.
[ "This", "override", "allows", "the", "auth", "information", "to", "be", "passed", "to", "svn", "via", "the", "--", "username", "and", "--", "password", "options", "instead", "of", "via", "the", "URL", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/subversion.py#L91-L102
train
pypa/pipenv
pipenv/vendor/vistir/contextmanagers.py
cd
def cd(path): """Context manager to temporarily change working directories :param str path: The directory to move into >>> print(os.path.abspath(os.curdir)) '/home/user/code/myrepo' >>> with cd("/home/user/code/otherdir/subdir"): ... print("Changed directory: %s" % os.path.abspath(os.curdi...
python
def cd(path): """Context manager to temporarily change working directories :param str path: The directory to move into >>> print(os.path.abspath(os.curdir)) '/home/user/code/myrepo' >>> with cd("/home/user/code/otherdir/subdir"): ... print("Changed directory: %s" % os.path.abspath(os.curdi...
[ "def", "cd", "(", "path", ")", ":", "if", "not", "path", ":", "return", "prev_cwd", "=", "Path", ".", "cwd", "(", ")", ".", "as_posix", "(", ")", "if", "isinstance", "(", "path", ",", "Path", ")", ":", "path", "=", "path", ".", "as_posix", "(", ...
Context manager to temporarily change working directories :param str path: The directory to move into >>> print(os.path.abspath(os.curdir)) '/home/user/code/myrepo' >>> with cd("/home/user/code/otherdir/subdir"): ... print("Changed directory: %s" % os.path.abspath(os.curdir)) Changed direc...
[ "Context", "manager", "to", "temporarily", "change", "working", "directories" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L63-L85
train
pypa/pipenv
pipenv/vendor/vistir/contextmanagers.py
spinner
def spinner( spinner_name=None, start_text=None, handler_map=None, nospin=False, write_to_stdout=True, ): """Get a spinner object or a dummy spinner to wrap a context. :param str spinner_name: A spinner type e.g. "dots" or "bouncingBar" (default: {"bouncingBar"}) :param str start_text: ...
python
def spinner( spinner_name=None, start_text=None, handler_map=None, nospin=False, write_to_stdout=True, ): """Get a spinner object or a dummy spinner to wrap a context. :param str spinner_name: A spinner type e.g. "dots" or "bouncingBar" (default: {"bouncingBar"}) :param str start_text: ...
[ "def", "spinner", "(", "spinner_name", "=", "None", ",", "start_text", "=", "None", ",", "handler_map", "=", "None", ",", "nospin", "=", "False", ",", "write_to_stdout", "=", "True", ",", ")", ":", "from", ".", "spin", "import", "create_spinner", "has_yasp...
Get a spinner object or a dummy spinner to wrap a context. :param str spinner_name: A spinner type e.g. "dots" or "bouncingBar" (default: {"bouncingBar"}) :param str start_text: Text to start off the spinner with (default: {None}) :param dict handler_map: Handler map for signals to be handled gracefully (d...
[ "Get", "a", "spinner", "object", "or", "a", "dummy", "spinner", "to", "wrap", "a", "context", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L111-L162
train
pypa/pipenv
pipenv/vendor/vistir/contextmanagers.py
atomic_open_for_write
def atomic_open_for_write(target, binary=False, newline=None, encoding=None): """Atomically open `target` for writing. This is based on Lektor's `atomic_open()` utility, but simplified a lot to handle only writing, and skip many multi-process/thread edge cases handled by Werkzeug. :param str targe...
python
def atomic_open_for_write(target, binary=False, newline=None, encoding=None): """Atomically open `target` for writing. This is based on Lektor's `atomic_open()` utility, but simplified a lot to handle only writing, and skip many multi-process/thread edge cases handled by Werkzeug. :param str targe...
[ "def", "atomic_open_for_write", "(", "target", ",", "binary", "=", "False", ",", "newline", "=", "None", ",", "encoding", "=", "None", ")", ":", "mode", "=", "\"w+b\"", "if", "binary", "else", "\"w\"", "f", "=", "NamedTemporaryFile", "(", "dir", "=", "os...
Atomically open `target` for writing. This is based on Lektor's `atomic_open()` utility, but simplified a lot to handle only writing, and skip many multi-process/thread edge cases handled by Werkzeug. :param str target: Target filename to write :param bool binary: Whether to open in binary mode, d...
[ "Atomically", "open", "target", "for", "writing", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L166-L252
train
pypa/pipenv
pipenv/vendor/vistir/contextmanagers.py
open_file
def open_file(link, session=None, stream=True): """ Open local or remote file for reading. :type link: pip._internal.index.Link or str :type session: requests.Session :param bool stream: Try to stream if remote, default True :raises ValueError: If link points to a local directory. :return: ...
python
def open_file(link, session=None, stream=True): """ Open local or remote file for reading. :type link: pip._internal.index.Link or str :type session: requests.Session :param bool stream: Try to stream if remote, default True :raises ValueError: If link points to a local directory. :return: ...
[ "def", "open_file", "(", "link", ",", "session", "=", "None", ",", "stream", "=", "True", ")", ":", "if", "not", "isinstance", "(", "link", ",", "six", ".", "string_types", ")", ":", "try", ":", "link", "=", "link", ".", "url_without_fragment", "except...
Open local or remote file for reading. :type link: pip._internal.index.Link or str :type session: requests.Session :param bool stream: Try to stream if remote, default True :raises ValueError: If link points to a local directory. :return: a context manager to the opened file-like object
[ "Open", "local", "or", "remote", "file", "for", "reading", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L256-L300
train
pypa/pipenv
pipenv/vendor/vistir/contextmanagers.py
replaced_stream
def replaced_stream(stream_name): """ Context manager to temporarily swap out *stream_name* with a stream wrapper. :param str stream_name: The name of a sys stream to wrap :returns: A ``StreamWrapper`` replacement, temporarily >>> orig_stdout = sys.stdout >>> with replaced_stream("stdout") as ...
python
def replaced_stream(stream_name): """ Context manager to temporarily swap out *stream_name* with a stream wrapper. :param str stream_name: The name of a sys stream to wrap :returns: A ``StreamWrapper`` replacement, temporarily >>> orig_stdout = sys.stdout >>> with replaced_stream("stdout") as ...
[ "def", "replaced_stream", "(", "stream_name", ")", ":", "orig_stream", "=", "getattr", "(", "sys", ",", "stream_name", ")", "new_stream", "=", "six", ".", "StringIO", "(", ")", "try", ":", "setattr", "(", "sys", ",", "stream_name", ",", "new_stream", ")", ...
Context manager to temporarily swap out *stream_name* with a stream wrapper. :param str stream_name: The name of a sys stream to wrap :returns: A ``StreamWrapper`` replacement, temporarily >>> orig_stdout = sys.stdout >>> with replaced_stream("stdout") as stdout: ... sys.stdout.write("hello") ...
[ "Context", "manager", "to", "temporarily", "swap", "out", "*", "stream_name", "*", "with", "a", "stream", "wrapper", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L304-L325
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.read_nonblocking
def read_nonblocking(self, size=1, timeout=None): """This reads data from the file descriptor. This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it. The timeout parameter is ignored. """ try: s = os.read(sel...
python
def read_nonblocking(self, size=1, timeout=None): """This reads data from the file descriptor. This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it. The timeout parameter is ignored. """ try: s = os.read(sel...
[ "def", "read_nonblocking", "(", "self", ",", "size", "=", "1", ",", "timeout", "=", "None", ")", ":", "try", ":", "s", "=", "os", ".", "read", "(", "self", ".", "child_fd", ",", "size", ")", "except", "OSError", "as", "err", ":", "if", "err", "."...
This reads data from the file descriptor. This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it. The timeout parameter is ignored.
[ "This", "reads", "data", "from", "the", "file", "descriptor", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L157-L180
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.compile_pattern_list
def compile_pattern_list(self, patterns): '''This compiles a pattern-string or a list of pattern-strings. Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of those. Patterns may also be None which results in an empty list (you might do this if waiting for an EOF or TIM...
python
def compile_pattern_list(self, patterns): '''This compiles a pattern-string or a list of pattern-strings. Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of those. Patterns may also be None which results in an empty list (you might do this if waiting for an EOF or TIM...
[ "def", "compile_pattern_list", "(", "self", ",", "patterns", ")", ":", "if", "patterns", "is", "None", ":", "return", "[", "]", "if", "not", "isinstance", "(", "patterns", ",", "list", ")", ":", "patterns", "=", "[", "patterns", "]", "# Allow dot to match ...
This compiles a pattern-string or a list of pattern-strings. Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of those. Patterns may also be None which results in an empty list (you might do this if waiting for an EOF or TIMEOUT condition without expecting any pattern)...
[ "This", "compiles", "a", "pattern", "-", "string", "or", "a", "list", "of", "pattern", "-", "strings", ".", "Patterns", "must", "be", "a", "StringType", "EOF", "TIMEOUT", "SRE_Pattern", "or", "a", "list", "of", "those", ".", "Patterns", "may", "also", "b...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L192-L238
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.expect
def expect(self, pattern, timeout=-1, searchwindowsize=-1, async_=False, **kw): '''This seeks through the stream until a pattern is matched. The pattern is overloaded and may take several types. The pattern can be a StringType, EOF, a compiled re, or a list of any of those types. Strings...
python
def expect(self, pattern, timeout=-1, searchwindowsize=-1, async_=False, **kw): '''This seeks through the stream until a pattern is matched. The pattern is overloaded and may take several types. The pattern can be a StringType, EOF, a compiled re, or a list of any of those types. Strings...
[ "def", "expect", "(", "self", ",", "pattern", ",", "timeout", "=", "-", "1", ",", "searchwindowsize", "=", "-", "1", ",", "async_", "=", "False", ",", "*", "*", "kw", ")", ":", "if", "'async'", "in", "kw", ":", "async_", "=", "kw", ".", "pop", ...
This seeks through the stream until a pattern is matched. The pattern is overloaded and may take several types. The pattern can be a StringType, EOF, a compiled re, or a list of any of those types. Strings will be compiled to re types. This returns the index into the pattern list. If the...
[ "This", "seeks", "through", "the", "stream", "until", "a", "pattern", "is", "matched", ".", "The", "pattern", "is", "overloaded", "and", "may", "take", "several", "types", ".", "The", "pattern", "can", "be", "a", "StringType", "EOF", "a", "compiled", "re",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L240-L341
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.expect_list
def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1, async_=False, **kw): '''This takes a list of compiled regular expressions and returns the index into the pattern_list that matched the child output. The list may also contain EOF or TIMEOUT(which are not com...
python
def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1, async_=False, **kw): '''This takes a list of compiled regular expressions and returns the index into the pattern_list that matched the child output. The list may also contain EOF or TIMEOUT(which are not com...
[ "def", "expect_list", "(", "self", ",", "pattern_list", ",", "timeout", "=", "-", "1", ",", "searchwindowsize", "=", "-", "1", ",", "async_", "=", "False", ",", "*", "*", "kw", ")", ":", "if", "timeout", "==", "-", "1", ":", "timeout", "=", "self",...
This takes a list of compiled regular expressions and returns the index into the pattern_list that matched the child output. The list may also contain EOF or TIMEOUT(which are not compiled regular expressions). This method is similar to the expect() method except that expect_list() does ...
[ "This", "takes", "a", "list", "of", "compiled", "regular", "expressions", "and", "returns", "the", "index", "into", "the", "pattern_list", "that", "matched", "the", "child", "output", ".", "The", "list", "may", "also", "contain", "EOF", "or", "TIMEOUT", "(",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L343-L369
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.expect_exact
def expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1, async_=False, **kw): '''This is similar to expect(), but uses plain string matching instead of compiled regular expressions in 'pattern_list'. The 'pattern_list' may be a string; a list or other sequence ...
python
def expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1, async_=False, **kw): '''This is similar to expect(), but uses plain string matching instead of compiled regular expressions in 'pattern_list'. The 'pattern_list' may be a string; a list or other sequence ...
[ "def", "expect_exact", "(", "self", ",", "pattern_list", ",", "timeout", "=", "-", "1", ",", "searchwindowsize", "=", "-", "1", ",", "async_", "=", "False", ",", "*", "*", "kw", ")", ":", "if", "timeout", "==", "-", "1", ":", "timeout", "=", "self"...
This is similar to expect(), but uses plain string matching instead of compiled regular expressions in 'pattern_list'. The 'pattern_list' may be a string; a list or other sequence of strings; or TIMEOUT and EOF. This call might be faster than expect() for two reasons: string sea...
[ "This", "is", "similar", "to", "expect", "()", "but", "uses", "plain", "string", "matching", "instead", "of", "compiled", "regular", "expressions", "in", "pattern_list", ".", "The", "pattern_list", "may", "be", "a", "string", ";", "a", "list", "or", "other",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L371-L418
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.expect_loop
def expect_loop(self, searcher, timeout=-1, searchwindowsize=-1): '''This is the common loop used inside expect. The 'searcher' should be an instance of searcher_re or searcher_string, which describes how and what to search for in the input. See expect() for other arguments, return valu...
python
def expect_loop(self, searcher, timeout=-1, searchwindowsize=-1): '''This is the common loop used inside expect. The 'searcher' should be an instance of searcher_re or searcher_string, which describes how and what to search for in the input. See expect() for other arguments, return valu...
[ "def", "expect_loop", "(", "self", ",", "searcher", ",", "timeout", "=", "-", "1", ",", "searchwindowsize", "=", "-", "1", ")", ":", "exp", "=", "Expecter", "(", "self", ",", "searcher", ",", "searchwindowsize", ")", "return", "exp", ".", "expect_loop", ...
This is the common loop used inside expect. The 'searcher' should be an instance of searcher_re or searcher_string, which describes how and what to search for in the input. See expect() for other arguments, return value and exceptions.
[ "This", "is", "the", "common", "loop", "used", "inside", "expect", ".", "The", "searcher", "should", "be", "an", "instance", "of", "searcher_re", "or", "searcher_string", "which", "describes", "how", "and", "what", "to", "search", "for", "in", "the", "input"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L420-L428
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.read
def read(self, size=-1): '''This reads at most "size" bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when ...
python
def read(self, size=-1): '''This reads at most "size" bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when ...
[ "def", "read", "(", "self", ",", "size", "=", "-", "1", ")", ":", "if", "size", "==", "0", ":", "return", "self", ".", "string_type", "(", ")", "if", "size", "<", "0", ":", "# delimiter default is EOF", "self", ".", "expect", "(", "self", ".", "del...
This reads at most "size" bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediate...
[ "This", "reads", "at", "most", "size", "bytes", "from", "the", "file", "(", "less", "if", "the", "read", "hits", "EOF", "before", "obtaining", "size", "bytes", ")", ".", "If", "the", "size", "argument", "is", "negative", "or", "omitted", "read", "all", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L430-L457
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.readline
def readline(self, size=-1): '''This reads and returns one entire line. The newline at the end of line is returned as part of the string, unless the file ends without a newline. An empty string is returned if EOF is encountered immediately. This looks for a newline as a CR/LF pair (\\r\\...
python
def readline(self, size=-1): '''This reads and returns one entire line. The newline at the end of line is returned as part of the string, unless the file ends without a newline. An empty string is returned if EOF is encountered immediately. This looks for a newline as a CR/LF pair (\\r\\...
[ "def", "readline", "(", "self", ",", "size", "=", "-", "1", ")", ":", "if", "size", "==", "0", ":", "return", "self", ".", "string_type", "(", ")", "# delimiter default is EOF", "index", "=", "self", ".", "expect", "(", "[", "self", ".", "crlf", ",",...
This reads and returns one entire line. The newline at the end of line is returned as part of the string, unless the file ends without a newline. An empty string is returned if EOF is encountered immediately. This looks for a newline as a CR/LF pair (\\r\\n) even on UNIX because this is ...
[ "This", "reads", "and", "returns", "one", "entire", "line", ".", "The", "newline", "at", "the", "end", "of", "line", "is", "returned", "as", "part", "of", "the", "string", "unless", "the", "file", "ends", "without", "a", "newline", ".", "An", "empty", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L459-L478
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
SpawnBase.readlines
def readlines(self, sizehint=-1): '''This reads until EOF using readline() and returns a list containing the lines thus read. The optional 'sizehint' argument is ignored. Remember, because this reads until EOF that means the child process should have closed its stdout. If you run this me...
python
def readlines(self, sizehint=-1): '''This reads until EOF using readline() and returns a list containing the lines thus read. The optional 'sizehint' argument is ignored. Remember, because this reads until EOF that means the child process should have closed its stdout. If you run this me...
[ "def", "readlines", "(", "self", ",", "sizehint", "=", "-", "1", ")", ":", "lines", "=", "[", "]", "while", "True", ":", "line", "=", "self", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "lines", ".", "append", "(", "line", ")", ...
This reads until EOF using readline() and returns a list containing the lines thus read. The optional 'sizehint' argument is ignored. Remember, because this reads until EOF that means the child process should have closed its stdout. If you run this method on a child that is still running...
[ "This", "reads", "until", "EOF", "using", "readline", "()", "and", "returns", "a", "list", "containing", "the", "lines", "thus", "read", ".", "The", "optional", "sizehint", "argument", "is", "ignored", ".", "Remember", "because", "this", "reads", "until", "E...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L485-L499
train
pypa/pipenv
pipenv/vendor/click/_termui_impl.py
_length_hint
def _length_hint(obj): """Returns the length hint of an object.""" try: return len(obj) except (AttributeError, TypeError): try: get_hint = type(obj).__length_hint__ except AttributeError: return None try: hint = get_hint(obj) excep...
python
def _length_hint(obj): """Returns the length hint of an object.""" try: return len(obj) except (AttributeError, TypeError): try: get_hint = type(obj).__length_hint__ except AttributeError: return None try: hint = get_hint(obj) excep...
[ "def", "_length_hint", "(", "obj", ")", ":", "try", ":", "return", "len", "(", "obj", ")", "except", "(", "AttributeError", ",", "TypeError", ")", ":", "try", ":", "get_hint", "=", "type", "(", "obj", ")", ".", "__length_hint__", "except", "AttributeErro...
Returns the length hint of an object.
[ "Returns", "the", "length", "hint", "of", "an", "object", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L34-L51
train
pypa/pipenv
pipenv/vendor/click/_termui_impl.py
_tempfilepager
def _tempfilepager(generator, cmd, color): """Page through text by invoking a program on a temporary file.""" import tempfile filename = tempfile.mktemp() # TODO: This never terminates if the passed generator never terminates. text = "".join(generator) if not color: text = strip_ansi(tex...
python
def _tempfilepager(generator, cmd, color): """Page through text by invoking a program on a temporary file.""" import tempfile filename = tempfile.mktemp() # TODO: This never terminates if the passed generator never terminates. text = "".join(generator) if not color: text = strip_ansi(tex...
[ "def", "_tempfilepager", "(", "generator", ",", "cmd", ",", "color", ")", ":", "import", "tempfile", "filename", "=", "tempfile", ".", "mktemp", "(", ")", "# TODO: This never terminates if the passed generator never terminates.", "text", "=", "\"\"", ".", "join", "(...
Page through text by invoking a program on a temporary file.
[ "Page", "through", "text", "by", "invoking", "a", "program", "on", "a", "temporary", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L370-L384
train
pypa/pipenv
pipenv/vendor/click/_termui_impl.py
_nullpager
def _nullpager(stream, generator, color): """Simply print unformatted text. This is the ultimate fallback.""" for text in generator: if not color: text = strip_ansi(text) stream.write(text)
python
def _nullpager(stream, generator, color): """Simply print unformatted text. This is the ultimate fallback.""" for text in generator: if not color: text = strip_ansi(text) stream.write(text)
[ "def", "_nullpager", "(", "stream", ",", "generator", ",", "color", ")", ":", "for", "text", "in", "generator", ":", "if", "not", "color", ":", "text", "=", "strip_ansi", "(", "text", ")", "stream", ".", "write", "(", "text", ")" ]
Simply print unformatted text. This is the ultimate fallback.
[ "Simply", "print", "unformatted", "text", ".", "This", "is", "the", "ultimate", "fallback", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L387-L392
train
pypa/pipenv
pipenv/vendor/click/_termui_impl.py
ProgressBar.generator
def generator(self): """ Returns a generator which yields the items added to the bar during construction, and updates the progress bar *after* the yielded block returns. """ if not self.entered: raise RuntimeError('You need to use progress bars in a with block...
python
def generator(self): """ Returns a generator which yields the items added to the bar during construction, and updates the progress bar *after* the yielded block returns. """ if not self.entered: raise RuntimeError('You need to use progress bars in a with block...
[ "def", "generator", "(", "self", ")", ":", "if", "not", "self", ".", "entered", ":", "raise", "RuntimeError", "(", "'You need to use progress bars in a with block.'", ")", "if", "self", ".", "is_hidden", ":", "for", "rv", "in", "self", ".", "iter", ":", "yie...
Returns a generator which yields the items added to the bar during construction, and updates the progress bar *after* the yielded block returns.
[ "Returns", "a", "generator", "which", "yields", "the", "items", "added", "to", "the", "bar", "during", "construction", "and", "updates", "the", "progress", "bar", "*", "after", "*", "the", "yielded", "block", "returns", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L272-L290
train
pypa/pipenv
pipenv/progress.py
bar
def bar( it, label="", width=32, hide=None, empty_char=BAR_EMPTY_CHAR, filled_char=BAR_FILLED_CHAR, expected_size=None, every=1, ): """Progress iterator. Wrap your iterables with it.""" count = len(it) if expected_size is None else expected_size with Bar( label=label,...
python
def bar( it, label="", width=32, hide=None, empty_char=BAR_EMPTY_CHAR, filled_char=BAR_FILLED_CHAR, expected_size=None, every=1, ): """Progress iterator. Wrap your iterables with it.""" count = len(it) if expected_size is None else expected_size with Bar( label=label,...
[ "def", "bar", "(", "it", ",", "label", "=", "\"\"", ",", "width", "=", "32", ",", "hide", "=", "None", ",", "empty_char", "=", "BAR_EMPTY_CHAR", ",", "filled_char", "=", "BAR_FILLED_CHAR", ",", "expected_size", "=", "None", ",", "every", "=", "1", ",",...
Progress iterator. Wrap your iterables with it.
[ "Progress", "iterator", ".", "Wrap", "your", "iterables", "with", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/progress.py#L154-L178
train
pypa/pipenv
pipenv/progress.py
dots
def dots(it, label="", hide=None, every=1): """Progress iterator. Prints a dot for each item being iterated""" count = 0 if not hide: STREAM.write(label) for i, item in enumerate(it): if not hide: if i % every == 0: # True every "every" updates STREAM.write(D...
python
def dots(it, label="", hide=None, every=1): """Progress iterator. Prints a dot for each item being iterated""" count = 0 if not hide: STREAM.write(label) for i, item in enumerate(it): if not hide: if i % every == 0: # True every "every" updates STREAM.write(D...
[ "def", "dots", "(", "it", ",", "label", "=", "\"\"", ",", "hide", "=", "None", ",", "every", "=", "1", ")", ":", "count", "=", "0", "if", "not", "hide", ":", "STREAM", ".", "write", "(", "label", ")", "for", "i", ",", "item", "in", "enumerate",...
Progress iterator. Prints a dot for each item being iterated
[ "Progress", "iterator", ".", "Prints", "a", "dot", "for", "each", "item", "being", "iterated" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/progress.py#L181-L195
train
pypa/pipenv
pipenv/vendor/semver.py
parse
def parse(version): """Parse version to major, minor, patch, pre-release, build parts. :param version: version string :return: dictionary with the keys 'build', 'major', 'minor', 'patch', and 'prerelease'. The prerelease or build keys can be None if not provided :rtype: dict ...
python
def parse(version): """Parse version to major, minor, patch, pre-release, build parts. :param version: version string :return: dictionary with the keys 'build', 'major', 'minor', 'patch', and 'prerelease'. The prerelease or build keys can be None if not provided :rtype: dict ...
[ "def", "parse", "(", "version", ")", ":", "match", "=", "_REGEX", ".", "match", "(", "version", ")", "if", "match", "is", "None", ":", "raise", "ValueError", "(", "'%s is not valid SemVer string'", "%", "version", ")", "version_parts", "=", "match", ".", "...
Parse version to major, minor, patch, pre-release, build parts. :param version: version string :return: dictionary with the keys 'build', 'major', 'minor', 'patch', and 'prerelease'. The prerelease or build keys can be None if not provided :rtype: dict >>> import semver >...
[ "Parse", "version", "to", "major", "minor", "patch", "pre", "-", "release", "build", "parts", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L41-L73
train
pypa/pipenv
pipenv/vendor/semver.py
parse_version_info
def parse_version_info(version): """Parse version string to a VersionInfo instance. :param version: version string :return: a :class:`VersionInfo` instance :rtype: :class:`VersionInfo` >>> import semver >>> version_info = semver.parse_version_info("3.4.5-pre.2+build.4") >>> version_info.ma...
python
def parse_version_info(version): """Parse version string to a VersionInfo instance. :param version: version string :return: a :class:`VersionInfo` instance :rtype: :class:`VersionInfo` >>> import semver >>> version_info = semver.parse_version_info("3.4.5-pre.2+build.4") >>> version_info.ma...
[ "def", "parse_version_info", "(", "version", ")", ":", "parts", "=", "parse", "(", "version", ")", "version_info", "=", "VersionInfo", "(", "parts", "[", "'major'", "]", ",", "parts", "[", "'minor'", "]", ",", "parts", "[", "'patch'", "]", ",", "parts", ...
Parse version string to a VersionInfo instance. :param version: version string :return: a :class:`VersionInfo` instance :rtype: :class:`VersionInfo` >>> import semver >>> version_info = semver.parse_version_info("3.4.5-pre.2+build.4") >>> version_info.major 3 >>> version_info.minor ...
[ "Parse", "version", "string", "to", "a", "VersionInfo", "instance", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L190-L215
train
pypa/pipenv
pipenv/vendor/semver.py
compare
def compare(ver1, ver2): """Compare two versions :param ver1: version string 1 :param ver2: version string 2 :return: The return value is negative if ver1 < ver2, zero if ver1 == ver2 and strictly positive if ver1 > ver2 :rtype: int >>> import semver >>> semver.compare("1.0.0"...
python
def compare(ver1, ver2): """Compare two versions :param ver1: version string 1 :param ver2: version string 2 :return: The return value is negative if ver1 < ver2, zero if ver1 == ver2 and strictly positive if ver1 > ver2 :rtype: int >>> import semver >>> semver.compare("1.0.0"...
[ "def", "compare", "(", "ver1", ",", "ver2", ")", ":", "v1", ",", "v2", "=", "parse", "(", "ver1", ")", ",", "parse", "(", "ver2", ")", "return", "_compare_by_keys", "(", "v1", ",", "v2", ")" ]
Compare two versions :param ver1: version string 1 :param ver2: version string 2 :return: The return value is negative if ver1 < ver2, zero if ver1 == ver2 and strictly positive if ver1 > ver2 :rtype: int >>> import semver >>> semver.compare("1.0.0", "2.0.0") -1 >>> semver...
[ "Compare", "two", "versions" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L264-L284
train
pypa/pipenv
pipenv/vendor/semver.py
match
def match(version, match_expr): """Compare two versions through a comparison :param str version: a version string :param str match_expr: operator and version; valid operators are < smaller than > greater than >= greator or equal than <= smaller or equal than ...
python
def match(version, match_expr): """Compare two versions through a comparison :param str version: a version string :param str match_expr: operator and version; valid operators are < smaller than > greater than >= greator or equal than <= smaller or equal than ...
[ "def", "match", "(", "version", ",", "match_expr", ")", ":", "prefix", "=", "match_expr", "[", ":", "2", "]", "if", "prefix", "in", "(", "'>='", ",", "'<='", ",", "'=='", ",", "'!='", ")", ":", "match_version", "=", "match_expr", "[", "2", ":", "]"...
Compare two versions through a comparison :param str version: a version string :param str match_expr: operator and version; valid operators are < smaller than > greater than >= greator or equal than <= smaller or equal than == equal != not equ...
[ "Compare", "two", "versions", "through", "a", "comparison" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L287-L331
train
pypa/pipenv
pipenv/vendor/semver.py
max_ver
def max_ver(ver1, ver2): """Returns the greater version of two versions :param ver1: version string 1 :param ver2: version string 2 :return: the greater version of the two :rtype: :class:`VersionInfo` >>> import semver >>> semver.max_ver("1.0.0", "2.0.0") '2.0.0' """ cmp_res = ...
python
def max_ver(ver1, ver2): """Returns the greater version of two versions :param ver1: version string 1 :param ver2: version string 2 :return: the greater version of the two :rtype: :class:`VersionInfo` >>> import semver >>> semver.max_ver("1.0.0", "2.0.0") '2.0.0' """ cmp_res = ...
[ "def", "max_ver", "(", "ver1", ",", "ver2", ")", ":", "cmp_res", "=", "compare", "(", "ver1", ",", "ver2", ")", "if", "cmp_res", "==", "0", "or", "cmp_res", "==", "1", ":", "return", "ver1", "else", ":", "return", "ver2" ]
Returns the greater version of two versions :param ver1: version string 1 :param ver2: version string 2 :return: the greater version of the two :rtype: :class:`VersionInfo` >>> import semver >>> semver.max_ver("1.0.0", "2.0.0") '2.0.0'
[ "Returns", "the", "greater", "version", "of", "two", "versions" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L334-L350
train
pypa/pipenv
pipenv/vendor/semver.py
min_ver
def min_ver(ver1, ver2): """Returns the smaller version of two versions :param ver1: version string 1 :param ver2: version string 2 :return: the smaller version of the two :rtype: :class:`VersionInfo` >>> import semver >>> semver.min_ver("1.0.0", "2.0.0") '1.0.0' """ cmp_res = ...
python
def min_ver(ver1, ver2): """Returns the smaller version of two versions :param ver1: version string 1 :param ver2: version string 2 :return: the smaller version of the two :rtype: :class:`VersionInfo` >>> import semver >>> semver.min_ver("1.0.0", "2.0.0") '1.0.0' """ cmp_res = ...
[ "def", "min_ver", "(", "ver1", ",", "ver2", ")", ":", "cmp_res", "=", "compare", "(", "ver1", ",", "ver2", ")", "if", "cmp_res", "==", "0", "or", "cmp_res", "==", "-", "1", ":", "return", "ver1", "else", ":", "return", "ver2" ]
Returns the smaller version of two versions :param ver1: version string 1 :param ver2: version string 2 :return: the smaller version of the two :rtype: :class:`VersionInfo` >>> import semver >>> semver.min_ver("1.0.0", "2.0.0") '1.0.0'
[ "Returns", "the", "smaller", "version", "of", "two", "versions" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L353-L369
train
pypa/pipenv
pipenv/vendor/semver.py
format_version
def format_version(major, minor, patch, prerelease=None, build=None): """Format a version according to the Semantic Versioning specification :param str major: the required major part of a version :param str minor: the required minor part of a version :param str patch: the required patch part of a versi...
python
def format_version(major, minor, patch, prerelease=None, build=None): """Format a version according to the Semantic Versioning specification :param str major: the required major part of a version :param str minor: the required minor part of a version :param str patch: the required patch part of a versi...
[ "def", "format_version", "(", "major", ",", "minor", ",", "patch", ",", "prerelease", "=", "None", ",", "build", "=", "None", ")", ":", "version", "=", "\"%d.%d.%d\"", "%", "(", "major", ",", "minor", ",", "patch", ")", "if", "prerelease", "is", "not",...
Format a version according to the Semantic Versioning specification :param str major: the required major part of a version :param str minor: the required minor part of a version :param str patch: the required patch part of a version :param str prerelease: the optional prerelease part of a version :...
[ "Format", "a", "version", "according", "to", "the", "Semantic", "Versioning", "specification" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L372-L394
train
pypa/pipenv
pipenv/vendor/ptyprocess/ptyprocess.py
_make_eof_intr
def _make_eof_intr(): """Set constants _EOF and _INTR. This avoids doing potentially costly operations on module load. """ global _EOF, _INTR if (_EOF is not None) and (_INTR is not None): return # inherit EOF and INTR definitions from controlling process. try: from ter...
python
def _make_eof_intr(): """Set constants _EOF and _INTR. This avoids doing potentially costly operations on module load. """ global _EOF, _INTR if (_EOF is not None) and (_INTR is not None): return # inherit EOF and INTR definitions from controlling process. try: from ter...
[ "def", "_make_eof_intr", "(", ")", ":", "global", "_EOF", ",", "_INTR", "if", "(", "_EOF", "is", "not", "None", ")", "and", "(", "_INTR", "is", "not", "None", ")", ":", "return", "# inherit EOF and INTR definitions from controlling process.", "try", ":", "from...
Set constants _EOF and _INTR. This avoids doing potentially costly operations on module load.
[ "Set", "constants", "_EOF", "and", "_INTR", ".", "This", "avoids", "doing", "potentially", "costly", "operations", "on", "module", "load", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L51-L89
train
pypa/pipenv
pipenv/vendor/ptyprocess/ptyprocess.py
PtyProcess.spawn
def spawn( cls, argv, cwd=None, env=None, echo=True, preexec_fn=None, dimensions=(24, 80)): '''Start the given command in a child process in a pseudo terminal. This does all the fork/exec type of stuff for a pty, and returns an instance of PtyProcess. If preexec...
python
def spawn( cls, argv, cwd=None, env=None, echo=True, preexec_fn=None, dimensions=(24, 80)): '''Start the given command in a child process in a pseudo terminal. This does all the fork/exec type of stuff for a pty, and returns an instance of PtyProcess. If preexec...
[ "def", "spawn", "(", "cls", ",", "argv", ",", "cwd", "=", "None", ",", "env", "=", "None", ",", "echo", "=", "True", ",", "preexec_fn", "=", "None", ",", "dimensions", "=", "(", "24", ",", "80", ")", ")", ":", "# Note that it is difficult for this meth...
Start the given command in a child process in a pseudo terminal. This does all the fork/exec type of stuff for a pty, and returns an instance of PtyProcess. If preexec_fn is supplied, it will be called with no arguments in the child process before exec-ing the specified command. ...
[ "Start", "the", "given", "command", "in", "a", "child", "process", "in", "a", "pseudo", "terminal", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L179-L338
train