partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Distribution.fetch_build_egg
Fetch an egg needed for building
setuptools/dist.py
def fetch_build_egg(self, req): """Fetch an egg needed for building""" from setuptools.command.easy_install import easy_install dist = self.__class__({'script_args': ['easy_install']}) opts = dist.get_option_dict('easy_install') opts.clear() opts.update( (k, v...
def fetch_build_egg(self, req): """Fetch an egg needed for building""" from setuptools.command.easy_install import easy_install dist = self.__class__({'script_args': ['easy_install']}) opts = dist.get_option_dict('easy_install') opts.clear() opts.update( (k, v...
[ "Fetch", "an", "egg", "needed", "for", "building" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L757-L784
[ "def", "fetch_build_egg", "(", "self", ",", "req", ")", ":", "from", "setuptools", ".", "command", ".", "easy_install", "import", "easy_install", "dist", "=", "self", ".", "__class__", "(", "{", "'script_args'", ":", "[", "'easy_install'", "]", "}", ")", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution._set_global_opts_from_features
Add --with-X/--without-X options based on optional features
setuptools/dist.py
def _set_global_opts_from_features(self): """Add --with-X/--without-X options based on optional features""" go = [] no = self.negative_opt.copy() for name, feature in self.features.items(): self._set_feature(name, None) feature.validate(self) if fea...
def _set_global_opts_from_features(self): """Add --with-X/--without-X options based on optional features""" go = [] no = self.negative_opt.copy() for name, feature in self.features.items(): self._set_feature(name, None) feature.validate(self) if fea...
[ "Add", "--", "with", "-", "X", "/", "--", "without", "-", "X", "options", "based", "on", "optional", "features" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L786-L811
[ "def", "_set_global_opts_from_features", "(", "self", ")", ":", "go", "=", "[", "]", "no", "=", "self", ".", "negative_opt", ".", "copy", "(", ")", "for", "name", ",", "feature", "in", "self", ".", "features", ".", "items", "(", ")", ":", "self", "."...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution._finalize_features
Add/remove features and resolve dependencies between them
setuptools/dist.py
def _finalize_features(self): """Add/remove features and resolve dependencies between them""" # First, flag all the enabled items (and thus their dependencies) for name, feature in self.features.items(): enabled = self.feature_is_included(name) if enabled or (enabled is ...
def _finalize_features(self): """Add/remove features and resolve dependencies between them""" # First, flag all the enabled items (and thus their dependencies) for name, feature in self.features.items(): enabled = self.feature_is_included(name) if enabled or (enabled is ...
[ "Add", "/", "remove", "features", "and", "resolve", "dependencies", "between", "them" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L813-L828
[ "def", "_finalize_features", "(", "self", ")", ":", "# First, flag all the enabled items (and thus their dependencies)", "for", "name", ",", "feature", "in", "self", ".", "features", ".", "items", "(", ")", ":", "enabled", "=", "self", ".", "feature_is_included", "(...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.get_command_class
Pluggable version of get_command_class()
setuptools/dist.py
def get_command_class(self, command): """Pluggable version of get_command_class()""" if command in self.cmdclass: return self.cmdclass[command] eps = pkg_resources.iter_entry_points('distutils.commands', command) for ep in eps: ep.require(installer=self.fetch_bui...
def get_command_class(self, command): """Pluggable version of get_command_class()""" if command in self.cmdclass: return self.cmdclass[command] eps = pkg_resources.iter_entry_points('distutils.commands', command) for ep in eps: ep.require(installer=self.fetch_bui...
[ "Pluggable", "version", "of", "get_command_class", "()" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L830-L841
[ "def", "get_command_class", "(", "self", ",", "command", ")", ":", "if", "command", "in", "self", ".", "cmdclass", ":", "return", "self", ".", "cmdclass", "[", "command", "]", "eps", "=", "pkg_resources", ".", "iter_entry_points", "(", "'distutils.commands'", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution._set_feature
Set feature's inclusion status
setuptools/dist.py
def _set_feature(self, name, status): """Set feature's inclusion status""" setattr(self, self._feature_attrname(name), status)
def _set_feature(self, name, status): """Set feature's inclusion status""" setattr(self, self._feature_attrname(name), status)
[ "Set", "feature", "s", "inclusion", "status" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L859-L861
[ "def", "_set_feature", "(", "self", ",", "name", ",", "status", ")", ":", "setattr", "(", "self", ",", "self", ".", "_feature_attrname", "(", "name", ")", ",", "status", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.include_feature
Request inclusion of feature named 'name
setuptools/dist.py
def include_feature(self, name): """Request inclusion of feature named 'name'""" if self.feature_is_included(name) == 0: descr = self.features[name].description raise DistutilsOptionError( descr + " is required, but was excluded or is not available" )...
def include_feature(self, name): """Request inclusion of feature named 'name'""" if self.feature_is_included(name) == 0: descr = self.features[name].description raise DistutilsOptionError( descr + " is required, but was excluded or is not available" )...
[ "Request", "inclusion", "of", "feature", "named", "name" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L867-L876
[ "def", "include_feature", "(", "self", ",", "name", ")", ":", "if", "self", ".", "feature_is_included", "(", "name", ")", "==", "0", ":", "descr", "=", "self", ".", "features", "[", "name", "]", ".", "description", "raise", "DistutilsOptionError", "(", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.include
Add items to distribution that are named in keyword arguments For example, 'dist.include(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. Currently, this method only supports inclusion for attributes that are lists or t...
setuptools/dist.py
def include(self, **attrs): """Add items to distribution that are named in keyword arguments For example, 'dist.include(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. Currently, this method only supports inclusion for...
def include(self, **attrs): """Add items to distribution that are named in keyword arguments For example, 'dist.include(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. Currently, this method only supports inclusion for...
[ "Add", "items", "to", "distribution", "that", "are", "named", "in", "keyword", "arguments" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L878-L898
[ "def", "include", "(", "self", ",", "*", "*", "attrs", ")", ":", "for", "k", ",", "v", "in", "attrs", ".", "items", "(", ")", ":", "include", "=", "getattr", "(", "self", ",", "'_include_'", "+", "k", ",", "None", ")", "if", "include", ":", "in...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.exclude_package
Remove packages, modules, and extensions in named package
setuptools/dist.py
def exclude_package(self, package): """Remove packages, modules, and extensions in named package""" pfx = package + '.' if self.packages: self.packages = [ p for p in self.packages if p != package and not p.startswith(pfx) ] if se...
def exclude_package(self, package): """Remove packages, modules, and extensions in named package""" pfx = package + '.' if self.packages: self.packages = [ p for p in self.packages if p != package and not p.startswith(pfx) ] if se...
[ "Remove", "packages", "modules", "and", "extensions", "in", "named", "package" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L900-L920
[ "def", "exclude_package", "(", "self", ",", "package", ")", ":", "pfx", "=", "package", "+", "'.'", "if", "self", ".", "packages", ":", "self", ".", "packages", "=", "[", "p", "for", "p", "in", "self", ".", "packages", "if", "p", "!=", "package", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.has_contents_for
Return true if 'exclude_package(package)' would do something
setuptools/dist.py
def has_contents_for(self, package): """Return true if 'exclude_package(package)' would do something""" pfx = package + '.' for p in self.iter_distribution_names(): if p == package or p.startswith(pfx): return True
def has_contents_for(self, package): """Return true if 'exclude_package(package)' would do something""" pfx = package + '.' for p in self.iter_distribution_names(): if p == package or p.startswith(pfx): return True
[ "Return", "true", "if", "exclude_package", "(", "package", ")", "would", "do", "something" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L922-L929
[ "def", "has_contents_for", "(", "self", ",", "package", ")", ":", "pfx", "=", "package", "+", "'.'", "for", "p", "in", "self", ".", "iter_distribution_names", "(", ")", ":", "if", "p", "==", "package", "or", "p", ".", "startswith", "(", "pfx", ")", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.exclude
Remove items from distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from the distribution's 'py_modules' attribute. Excluding packages uses the 'exclude_package()' method, so all of the package's contained packages, modules,...
setuptools/dist.py
def exclude(self, **attrs): """Remove items from distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from the distribution's 'py_modules' attribute. Excluding packages uses the 'exclude_package()' method, so all of the package...
def exclude(self, **attrs): """Remove items from distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from the distribution's 'py_modules' attribute. Excluding packages uses the 'exclude_package()' method, so all of the package...
[ "Remove", "items", "from", "distribution", "that", "are", "named", "in", "keyword", "arguments" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L973-L994
[ "def", "exclude", "(", "self", ",", "*", "*", "attrs", ")", ":", "for", "k", ",", "v", "in", "attrs", ".", "items", "(", ")", ":", "exclude", "=", "getattr", "(", "self", ",", "'_exclude_'", "+", "k", ",", "None", ")", "if", "exclude", ":", "ex...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.get_cmdline_options
Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. Note that options provided by config fi...
setuptools/dist.py
def get_cmdline_options(self): """Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. ...
def get_cmdline_options(self): """Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. ...
[ "Return", "a", "{", "cmd", ":", "{", "opt", ":", "val", "}}", "map", "of", "all", "command", "-", "line", "options" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L1029-L1067
[ "def", "get_cmdline_options", "(", "self", ")", ":", "d", "=", "{", "}", "for", "cmd", ",", "opts", "in", "self", ".", "command_options", ".", "items", "(", ")", ":", "for", "opt", ",", "(", "src", ",", "val", ")", "in", "opts", ".", "items", "("...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution.iter_distribution_names
Yield all packages, modules, and extension names in distribution
setuptools/dist.py
def iter_distribution_names(self): """Yield all packages, modules, and extension names in distribution""" for pkg in self.packages or (): yield pkg for module in self.py_modules or (): yield module for ext in self.ext_modules or (): if isinstance(ex...
def iter_distribution_names(self): """Yield all packages, modules, and extension names in distribution""" for pkg in self.packages or (): yield pkg for module in self.py_modules or (): yield module for ext in self.ext_modules or (): if isinstance(ex...
[ "Yield", "all", "packages", "modules", "and", "extension", "names", "in", "distribution" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L1069-L1085
[ "def", "iter_distribution_names", "(", "self", ")", ":", "for", "pkg", "in", "self", ".", "packages", "or", "(", ")", ":", "yield", "pkg", "for", "module", "in", "self", ".", "py_modules", "or", "(", ")", ":", "yield", "module", "for", "ext", "in", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Feature.include_in
Ensure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on the distribution. Note that this method may be called more than once per feature, and so should be idempotent.
setuptools/dist.py
def include_in(self, dist): """Ensure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on the distribution. Note that this method may be called more than once per feature, and so should be idempotent. ...
def include_in(self, dist): """Ensure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on the distribution. Note that this method may be called more than once per feature, and so should be idempotent. ...
[ "Ensure", "feature", "and", "its", "requirements", "are", "included", "in", "distribution" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L1221-L1239
[ "def", "include_in", "(", "self", ",", "dist", ")", ":", "if", "not", "self", ".", "available", ":", "raise", "DistutilsPlatformError", "(", "self", ".", "description", "+", "\" is required, \"", "\"but is not available on this platform\"", ")", "dist", ".", "incl...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Feature.exclude_from
Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on the distribution. This method will be called at most once per feature, and only after all included features have been asked to include themselves.
setuptools/dist.py
def exclude_from(self, dist): """Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on the distribution. This method will be called at most once per feature, and only after all included features have been asked to i...
def exclude_from(self, dist): """Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on the distribution. This method will be called at most once per feature, and only after all included features have been asked to i...
[ "Ensure", "feature", "is", "excluded", "from", "distribution" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L1241-L1254
[ "def", "exclude_from", "(", "self", ",", "dist", ")", ":", "dist", ".", "exclude", "(", "*", "*", "self", ".", "extras", ")", "if", "self", ".", "remove", ":", "for", "item", "in", "self", ".", "remove", ":", "dist", ".", "exclude_package", "(", "i...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Feature.validate
Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present in the base distribution when ...
setuptools/dist.py
def validate(self, dist): """Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present i...
def validate(self, dist): """Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present i...
[ "Verify", "that", "feature", "makes", "sense", "in", "context", "of", "distribution" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L1256-L1273
[ "def", "validate", "(", "self", ",", "dist", ")", ":", "for", "item", "in", "self", ".", "remove", ":", "if", "not", "dist", ".", "has_contents_for", "(", "item", ")", ":", "raise", "DistutilsSetupError", "(", "\"%s wants to be able to remove %s, but the distrib...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
NullProvider._validate_resource_path
Validate the resource paths according to the docs. https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access >>> warned = getfixture('recwarn') >>> warnings.simplefilter('always') >>> vrp = NullProvider._validate_resource_path >>> vrp('foo/bar.txt') ...
pkg_resources/__init__.py
def _validate_resource_path(path): """ Validate the resource paths according to the docs. https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access >>> warned = getfixture('recwarn') >>> warnings.simplefilter('always') >>> vrp = NullProvider._v...
def _validate_resource_path(path): """ Validate the resource paths according to the docs. https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access >>> warned = getfixture('recwarn') >>> warnings.simplefilter('always') >>> vrp = NullProvider._v...
[ "Validate", "the", "resource", "paths", "according", "to", "the", "docs", ".", "https", ":", "//", "setuptools", ".", "readthedocs", ".", "io", "/", "en", "/", "latest", "/", "pkg_resources", ".", "html#basic", "-", "resource", "-", "access" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/pkg_resources/__init__.py#L1484-L1556
[ "def", "_validate_resource_path", "(", "path", ")", ":", "invalid", "=", "(", "os", ".", "path", ".", "pardir", "in", "path", ".", "split", "(", "posixpath", ".", "sep", ")", "or", "posixpath", ".", "isabs", "(", "path", ")", "or", "ntpath", ".", "is...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Distribution._get_metadata_path_for_display
Return the path to the given metadata file, if available.
pkg_resources/__init__.py
def _get_metadata_path_for_display(self, name): """ Return the path to the given metadata file, if available. """ try: # We need to access _get_metadata_path() on the provider object # directly rather than through this class's __getattr__() # since _ge...
def _get_metadata_path_for_display(self, name): """ Return the path to the given metadata file, if available. """ try: # We need to access _get_metadata_path() on the provider object # directly rather than through this class's __getattr__() # since _ge...
[ "Return", "the", "path", "to", "the", "given", "metadata", "file", "if", "available", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/pkg_resources/__init__.py#L2739-L2754
[ "def", "_get_metadata_path_for_display", "(", "self", ",", "name", ")", ":", "try", ":", "# We need to access _get_metadata_path() on the provider object", "# directly rather than through this class's __getattr__()", "# since _get_metadata_path() is marked private.", "path", "=", "self...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
EggInfoDistribution._reload_version
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...
pkg_resources/__init__.py
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): """ 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 ...
[ "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", "("...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/pkg_resources/__init__.py#L2973-L2988
[ "def", "_reload_version", "(", "self", ")", ":", "md_version", "=", "self", ".", "_get_version", "(", ")", "if", "md_version", ":", "self", ".", "_version", "=", "md_version", "return", "self" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
parse_bdist_wininst
Return (base,pyversion) or (None,None) for possible .exe name
setuptools/package_index.py
def parse_bdist_wininst(name): """Return (base,pyversion) or (None,None) for possible .exe name""" lower = name.lower() base, py_ver, plat = None, None, None if lower.endswith('.exe'): if lower.endswith('.win32.exe'): base = name[:-10] plat = 'win32' elif lower....
def parse_bdist_wininst(name): """Return (base,pyversion) or (None,None) for possible .exe name""" lower = name.lower() base, py_ver, plat = None, None, None if lower.endswith('.exe'): if lower.endswith('.win32.exe'): base = name[:-10] plat = 'win32' elif lower....
[ "Return", "(", "base", "pyversion", ")", "or", "(", "None", "None", ")", "for", "possible", ".", "exe", "name" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L61-L82
[ "def", "parse_bdist_wininst", "(", "name", ")", ":", "lower", "=", "name", ".", "lower", "(", ")", "base", ",", "py_ver", ",", "plat", "=", "None", ",", "None", ",", "None", "if", "lower", ".", "endswith", "(", "'.exe'", ")", ":", "if", "lower", "....
83c667e0b2a98193851c07115d1af65011ed0fb6
train
distros_for_url
Yield egg or source distribution objects that might be found at a URL
setuptools/package_index.py
def distros_for_url(url, metadata=None): """Yield egg or source distribution objects that might be found at a URL""" base, fragment = egg_info_for_url(url) for dist in distros_for_location(url, base, metadata): yield dist if fragment: match = EGG_FRAGMENT.match(fragment) if match...
def distros_for_url(url, metadata=None): """Yield egg or source distribution objects that might be found at a URL""" base, fragment = egg_info_for_url(url) for dist in distros_for_location(url, base, metadata): yield dist if fragment: match = EGG_FRAGMENT.match(fragment) if match...
[ "Yield", "egg", "or", "source", "distribution", "objects", "that", "might", "be", "found", "at", "a", "URL" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L96-L107
[ "def", "distros_for_url", "(", "url", ",", "metadata", "=", "None", ")", ":", "base", ",", "fragment", "=", "egg_info_for_url", "(", "url", ")", "for", "dist", "in", "distros_for_location", "(", "url", ",", "base", ",", "metadata", ")", ":", "yield", "di...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
distros_for_location
Yield egg or source distribution objects based on basename
setuptools/package_index.py
def distros_for_location(location, basename, metadata=None): """Yield egg or source distribution objects based on basename""" if basename.endswith('.egg.zip'): basename = basename[:-4] # strip the .zip if basename.endswith('.egg') and '-' in basename: # only one, unambiguous interpretation ...
def distros_for_location(location, basename, metadata=None): """Yield egg or source distribution objects based on basename""" if basename.endswith('.egg.zip'): basename = basename[:-4] # strip the .zip if basename.endswith('.egg') and '-' in basename: # only one, unambiguous interpretation ...
[ "Yield", "egg", "or", "source", "distribution", "objects", "based", "on", "basename" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L110-L140
[ "def", "distros_for_location", "(", "location", ",", "basename", ",", "metadata", "=", "None", ")", ":", "if", "basename", ".", "endswith", "(", "'.egg.zip'", ")", ":", "basename", "=", "basename", "[", ":", "-", "4", "]", "# strip the .zip", "if", "basena...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
distros_for_filename
Yield possible egg or source distribution objects based on a filename
setuptools/package_index.py
def distros_for_filename(filename, metadata=None): """Yield possible egg or source distribution objects based on a filename""" return distros_for_location( normalize_path(filename), os.path.basename(filename), metadata )
def distros_for_filename(filename, metadata=None): """Yield possible egg or source distribution objects based on a filename""" return distros_for_location( normalize_path(filename), os.path.basename(filename), metadata )
[ "Yield", "possible", "egg", "or", "source", "distribution", "objects", "based", "on", "a", "filename" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L143-L147
[ "def", "distros_for_filename", "(", "filename", ",", "metadata", "=", "None", ")", ":", "return", "distros_for_location", "(", "normalize_path", "(", "filename", ")", ",", "os", ".", "path", ".", "basename", "(", "filename", ")", ",", "metadata", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
interpret_distro_name
Generate alternative interpretations of a source distro name Note: if `location` is a filesystem filename, you should call ``pkg_resources.normalize_path()`` on it before passing it to this routine!
setuptools/package_index.py
def interpret_distro_name( location, basename, metadata, py_version=None, precedence=SOURCE_DIST, platform=None ): """Generate alternative interpretations of a source distro name Note: if `location` is a filesystem filename, you should call ``pkg_resources.normalize_path()`` on it before pa...
def interpret_distro_name( location, basename, metadata, py_version=None, precedence=SOURCE_DIST, platform=None ): """Generate alternative interpretations of a source distro name Note: if `location` is a filesystem filename, you should call ``pkg_resources.normalize_path()`` on it before pa...
[ "Generate", "alternative", "interpretations", "of", "a", "source", "distro", "name" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L150-L182
[ "def", "interpret_distro_name", "(", "location", ",", "basename", ",", "metadata", ",", "py_version", "=", "None", ",", "precedence", "=", "SOURCE_DIST", ",", "platform", "=", "None", ")", ":", "# Generate alternative interpretations of a source distro name", "# Because...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
unique_values
Wrap a function returning an iterable such that the resulting iterable only ever yields unique items.
setuptools/package_index.py
def unique_values(func): """ Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. """ @wraps(func) def wrapper(*args, **kwargs): return unique_everseen(func(*args, **kwargs)) return wrapper
def unique_values(func): """ Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. """ @wraps(func) def wrapper(*args, **kwargs): return unique_everseen(func(*args, **kwargs)) return wrapper
[ "Wrap", "a", "function", "returning", "an", "iterable", "such", "that", "the", "resulting", "iterable", "only", "ever", "yields", "unique", "items", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L204-L214
[ "def", "unique_values", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "unique_everseen", "(", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
_encode_auth
A function compatible with Python 2.3-3.3 that will encode auth from a URL suitable for an HTTP header. >>> str(_encode_auth('username%3Apassword')) 'dXNlcm5hbWU6cGFzc3dvcmQ=' Long auth strings should not cause a newline to be inserted. >>> long_auth = 'username:' + 'password'*10 >>> chr(10) in...
setuptools/package_index.py
def _encode_auth(auth): """ A function compatible with Python 2.3-3.3 that will encode auth from a URL suitable for an HTTP header. >>> str(_encode_auth('username%3Apassword')) 'dXNlcm5hbWU6cGFzc3dvcmQ=' Long auth strings should not cause a newline to be inserted. >>> long_auth = 'username:...
def _encode_auth(auth): """ A function compatible with Python 2.3-3.3 that will encode auth from a URL suitable for an HTTP header. >>> str(_encode_auth('username%3Apassword')) 'dXNlcm5hbWU6cGFzc3dvcmQ=' Long auth strings should not cause a newline to be inserted. >>> long_auth = 'username:...
[ "A", "function", "compatible", "with", "Python", "2", ".", "3", "-", "3", ".", "3", "that", "will", "encode", "auth", "from", "a", "URL", "suitable", "for", "an", "HTTP", "header", ".", ">>>", "str", "(", "_encode_auth", "(", "username%3Apassword", "))",...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L970-L989
[ "def", "_encode_auth", "(", "auth", ")", ":", "auth_s", "=", "urllib", ".", "parse", ".", "unquote", "(", "auth", ")", "# convert to bytes", "auth_bytes", "=", "auth_s", ".", "encode", "(", ")", "encoded_bytes", "=", "base64", ".", "b64encode", "(", "auth_...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
_splituser
splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.
setuptools/package_index.py
def _splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" user, delim, host = host.rpartition('@') return (user if delim else None), host
def _splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" user, delim, host = host.rpartition('@') return (user if delim else None), host
[ "splituser", "(", "user", "[", ":", "passwd", "]" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L1094-L1097
[ "def", "_splituser", "(", "host", ")", ":", "user", ",", "delim", ",", "host", "=", "host", ".", "rpartition", "(", "'@'", ")", "return", "(", "user", "if", "delim", "else", "None", ")", ",", "host" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
local_open
Read a local path, with special support for directories
setuptools/package_index.py
def local_open(url): """Read a local path, with special support for directories""" scheme, server, path, param, query, frag = urllib.parse.urlparse(url) filename = urllib.request.url2pathname(path) if os.path.isfile(filename): return urllib.request.urlopen(url) elif path.endswith('/') and os...
def local_open(url): """Read a local path, with special support for directories""" scheme, server, path, param, query, frag = urllib.parse.urlparse(url) filename = urllib.request.url2pathname(path) if os.path.isfile(filename): return urllib.request.urlopen(url) elif path.endswith('/') and os...
[ "Read", "a", "local", "path", "with", "special", "support", "for", "directories" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L1108-L1136
[ "def", "local_open", "(", "url", ")", ":", "scheme", ",", "server", ",", "path", ",", "param", ",", "query", ",", "frag", "=", "urllib", ".", "parse", ".", "urlparse", "(", "url", ")", "filename", "=", "urllib", ".", "request", ".", "url2pathname", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageIndex.process_index
Process the contents of a PyPI page
setuptools/package_index.py
def process_index(self, url, page): """Process the contents of a PyPI page""" def scan(link): # Process a URL to see if it's for a package page if link.startswith(self.index_url): parts = list(map( urllib.parse.unquote, link[len(self.index_url...
def process_index(self, url, page): """Process the contents of a PyPI page""" def scan(link): # Process a URL to see if it's for a package page if link.startswith(self.index_url): parts = list(map( urllib.parse.unquote, link[len(self.index_url...
[ "Process", "the", "contents", "of", "a", "PyPI", "page" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L428-L469
[ "def", "process_index", "(", "self", ",", "url", ",", "page", ")", ":", "def", "scan", "(", "link", ")", ":", "# Process a URL to see if it's for a package page", "if", "link", ".", "startswith", "(", "self", ".", "index_url", ")", ":", "parts", "=", "list",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageIndex.check_hash
checker is a ContentChecker
setuptools/package_index.py
def check_hash(self, checker, filename, tfp): """ checker is a ContentChecker """ checker.report( self.debug, "Validating %%s checksum for %s" % filename) if not checker.is_valid(): tfp.close() os.unlink(filename) raise ...
def check_hash(self, checker, filename, tfp): """ checker is a ContentChecker """ checker.report( self.debug, "Validating %%s checksum for %s" % filename) if not checker.is_valid(): tfp.close() os.unlink(filename) raise ...
[ "checker", "is", "a", "ContentChecker" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L510-L524
[ "def", "check_hash", "(", "self", ",", "checker", ",", "filename", ",", "tfp", ")", ":", "checker", ".", "report", "(", "self", ".", "debug", ",", "\"Validating %%s checksum for %s\"", "%", "filename", ")", "if", "not", "checker", ".", "is_valid", "(", ")"...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageIndex.add_find_links
Add `urls` to the list that will be prescanned for searches
setuptools/package_index.py
def add_find_links(self, urls): """Add `urls` to the list that will be prescanned for searches""" for url in urls: if ( self.to_scan is None # if we have already "gone online" or not URL_SCHEME(url) # or it's a local file/directory or url.sta...
def add_find_links(self, urls): """Add `urls` to the list that will be prescanned for searches""" for url in urls: if ( self.to_scan is None # if we have already "gone online" or not URL_SCHEME(url) # or it's a local file/directory or url.sta...
[ "Add", "urls", "to", "the", "list", "that", "will", "be", "prescanned", "for", "searches" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L526-L539
[ "def", "add_find_links", "(", "self", ",", "urls", ")", ":", "for", "url", "in", "urls", ":", "if", "(", "self", ".", "to_scan", "is", "None", "# if we have already \"gone online\"", "or", "not", "URL_SCHEME", "(", "url", ")", "# or it's a local file/directory",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageIndex.prescan
Scan urls scheduled for prescanning (e.g. --find-links)
setuptools/package_index.py
def prescan(self): """Scan urls scheduled for prescanning (e.g. --find-links)""" if self.to_scan: list(map(self.scan_url, self.to_scan)) self.to_scan = None
def prescan(self): """Scan urls scheduled for prescanning (e.g. --find-links)""" if self.to_scan: list(map(self.scan_url, self.to_scan)) self.to_scan = None
[ "Scan", "urls", "scheduled", "for", "prescanning", "(", "e", ".", "g", ".", "--", "find", "-", "links", ")" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L541-L545
[ "def", "prescan", "(", "self", ")", ":", "if", "self", ".", "to_scan", ":", "list", "(", "map", "(", "self", ".", "scan_url", ",", "self", ".", "to_scan", ")", ")", "self", ".", "to_scan", "=", "None" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageIndex.download
Locate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` object). If it is the URL of a .py file w...
setuptools/package_index.py
def download(self, spec, tmpdir): """Locate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` objec...
def download(self, spec, tmpdir): """Locate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` objec...
[ "Locate", "and", "/", "or", "download", "spec", "to", "tmpdir", "returning", "a", "local", "path" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L557-L589
[ "def", "download", "(", "self", ",", "spec", ",", "tmpdir", ")", ":", "if", "not", "isinstance", "(", "spec", ",", "Requirement", ")", ":", "scheme", "=", "URL_SCHEME", "(", "spec", ")", "if", "scheme", ":", "# It's a url, download it to tmpdir", "found", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageIndex.fetch
Obtain a file suitable for fulfilling `requirement` DEPRECATED; use the ``fetch_distribution()`` method now instead. For backward compatibility, this routine is identical but returns the ``location`` of the downloaded distribution instead of a distribution object.
setuptools/package_index.py
def fetch(self, requirement, tmpdir, force_scan=False, source=False): """Obtain a file suitable for fulfilling `requirement` DEPRECATED; use the ``fetch_distribution()`` method now instead. For backward compatibility, this routine is identical but returns the ``location`` of the downlo...
def fetch(self, requirement, tmpdir, force_scan=False, source=False): """Obtain a file suitable for fulfilling `requirement` DEPRECATED; use the ``fetch_distribution()`` method now instead. For backward compatibility, this routine is identical but returns the ``location`` of the downlo...
[ "Obtain", "a", "file", "suitable", "for", "fulfilling", "requirement" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L667-L678
[ "def", "fetch", "(", "self", ",", "requirement", ",", "tmpdir", ",", "force_scan", "=", "False", ",", "source", "=", "False", ")", ":", "dist", "=", "self", ".", "fetch_distribution", "(", "requirement", ",", "tmpdir", ",", "force_scan", ",", "source", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PyPIConfig.find_credential
If the URL indicated appears to be a repository defined in this config, return the credential for that repository.
setuptools/package_index.py
def find_credential(self, url): """ If the URL indicated appears to be a repository defined in this config, return the credential for that repository. """ for repository, cred in self.creds_by_repository.items(): if url.startswith(repository): return c...
def find_credential(self, url): """ If the URL indicated appears to be a repository defined in this config, return the credential for that repository. """ for repository, cred in self.creds_by_repository.items(): if url.startswith(repository): return c...
[ "If", "the", "URL", "indicated", "appears", "to", "be", "a", "repository", "defined", "in", "this", "config", "return", "the", "credential", "for", "that", "repository", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/package_index.py#L1037-L1044
[ "def", "find_credential", "(", "self", ",", "url", ")", ":", "for", "repository", ",", "cred", "in", "self", ".", "creds_by_repository", ".", "items", "(", ")", ":", "if", "url", ".", "startswith", "(", "repository", ")", ":", "return", "cred" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
config_file
Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user"
setuptools/command/setopt.py
def config_file(kind="local"): """Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" """ if kind == 'local': return 'setup.cfg' if kind == 'global': return os.path.join( os.path.dirname(distutils.__file...
def config_file(kind="local"): """Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" """ if kind == 'local': return 'setup.cfg' if kind == 'global': return os.path.join( os.path.dirname(distutils.__file...
[ "Get", "the", "filename", "of", "the", "distutils", "local", "global", "or", "per", "-", "user", "config" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/setopt.py#L14-L30
[ "def", "config_file", "(", "kind", "=", "\"local\"", ")", ":", "if", "kind", "==", "'local'", ":", "return", "'setup.cfg'", "if", "kind", "==", "'global'", ":", "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "d...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
edit_config
Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to ...
setuptools/command/setopt.py
def edit_config(filename, settings, dry_run=False): """Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or d...
def edit_config(filename, settings, dry_run=False): """Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or d...
[ "Edit", "a", "configuration", "file", "to", "include", "settings" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/setopt.py#L33-L73
[ "def", "edit_config", "(", "filename", ",", "settings", ",", "dry_run", "=", "False", ")", ":", "log", ".", "debug", "(", "\"Reading configuration from %s\"", ",", "filename", ")", "opts", "=", "configparser", ".", "RawConfigParser", "(", ")", "opts", ".", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
hide_file
Set the hidden attribute on a file or directory. From http://stackoverflow.com/questions/19622133/ `path` must be text.
setuptools/windows_support.py
def hide_file(path): """ Set the hidden attribute on a file or directory. From http://stackoverflow.com/questions/19622133/ `path` must be text. """ __import__('ctypes.wintypes') SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW SetFileAttributes.argtypes = ctypes.wintypes....
def hide_file(path): """ Set the hidden attribute on a file or directory. From http://stackoverflow.com/questions/19622133/ `path` must be text. """ __import__('ctypes.wintypes') SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW SetFileAttributes.argtypes = ctypes.wintypes....
[ "Set", "the", "hidden", "attribute", "on", "a", "file", "or", "directory", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/windows_support.py#L12-L29
[ "def", "hide_file", "(", "path", ")", ":", "__import__", "(", "'ctypes.wintypes'", ")", "SetFileAttributes", "=", "ctypes", ".", "windll", ".", "kernel32", ".", "SetFileAttributesW", "SetFileAttributes", ".", "argtypes", "=", "ctypes", ".", "wintypes", ".", "LPW...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
VendorImporter.find_module
Return self when fullname starts with root_name and the target module is one vendored through this importer.
pkg_resources/extern/__init__.py
def find_module(self, fullname, path=None): """ Return self when fullname starts with root_name and the target module is one vendored through this importer. """ root, base, target = fullname.partition(self.root_name + '.') if root: return if not any(ma...
def find_module(self, fullname, path=None): """ Return self when fullname starts with root_name and the target module is one vendored through this importer. """ root, base, target = fullname.partition(self.root_name + '.') if root: return if not any(ma...
[ "Return", "self", "when", "fullname", "starts", "with", "root_name", "and", "the", "target", "module", "is", "one", "vendored", "through", "this", "importer", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/pkg_resources/extern/__init__.py#L23-L33
[ "def", "find_module", "(", "self", ",", "fullname", ",", "path", "=", "None", ")", ":", "root", ",", "base", ",", "target", "=", "fullname", ".", "partition", "(", "self", ".", "root_name", "+", "'.'", ")", "if", "root", ":", "return", "if", "not", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
VendorImporter.load_module
Iterate over the search path to locate and load fullname.
pkg_resources/extern/__init__.py
def load_module(self, fullname): """ Iterate over the search path to locate and load fullname. """ root, base, target = fullname.partition(self.root_name + '.') for prefix in self.search_path: try: extant = prefix + target __import__(ex...
def load_module(self, fullname): """ Iterate over the search path to locate and load fullname. """ root, base, target = fullname.partition(self.root_name + '.') for prefix in self.search_path: try: extant = prefix + target __import__(ex...
[ "Iterate", "over", "the", "search", "path", "to", "locate", "and", "load", "fullname", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/pkg_resources/extern/__init__.py#L35-L62
[ "def", "load_module", "(", "self", ",", "fullname", ")", ":", "root", ",", "base", ",", "target", "=", "fullname", ".", "partition", "(", "self", ".", "root_name", "+", "'.'", ")", "for", "prefix", "in", "self", ".", "search_path", ":", "try", ":", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
sdist_add_defaults.add_defaults
Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_files. - all files defined as...
setuptools/command/py36compat.py
def add_defaults(self): """Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_file...
def add_defaults(self): """Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_file...
[ "Add", "all", "the", "default", "files", "to", "self", ".", "filelist", ":", "-", "README", "or", "README", ".", "txt", "-", "setup", ".", "py", "-", "test", "/", "test", "*", ".", "py", "-", "all", "pure", "Python", "modules", "mentioned", "in", "...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/py36compat.py#L18-L38
[ "def", "add_defaults", "(", "self", ")", ":", "self", ".", "_add_defaults_standards", "(", ")", "self", ".", "_add_defaults_optional", "(", ")", "self", ".", "_add_defaults_python", "(", ")", "self", ".", "_add_defaults_data_files", "(", ")", "self", ".", "_ad...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
sdist_add_defaults._cs_path_exists
Case-sensitive path existence check >>> sdist_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._cs_path_exists(__file__.upper()) False
setuptools/command/py36compat.py
def _cs_path_exists(fspath): """ Case-sensitive path existence check >>> sdist_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._cs_path_exists(__file__.upper()) False """ if not os.path.exists(fspath): return False #...
def _cs_path_exists(fspath): """ Case-sensitive path existence check >>> sdist_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._cs_path_exists(__file__.upper()) False """ if not os.path.exists(fspath): return False #...
[ "Case", "-", "sensitive", "path", "existence", "check" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/py36compat.py#L41-L55
[ "def", "_cs_path_exists", "(", "fspath", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "fspath", ")", ":", "return", "False", "# make absolute so we always have a directory", "abspath", "=", "os", ".", "path", ".", "abspath", "(", "fspath", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
filesys_decode
Ensure that the given path is decoded, NONE when no expected encoding works
setuptools/unicode_utils.py
def filesys_decode(path): """ Ensure that the given path is decoded, NONE when no expected encoding works """ if isinstance(path, six.text_type): return path fs_enc = sys.getfilesystemencoding() or 'utf-8' candidates = fs_enc, 'utf-8' for enc in candidates: try: ...
def filesys_decode(path): """ Ensure that the given path is decoded, NONE when no expected encoding works """ if isinstance(path, six.text_type): return path fs_enc = sys.getfilesystemencoding() or 'utf-8' candidates = fs_enc, 'utf-8' for enc in candidates: try: ...
[ "Ensure", "that", "the", "given", "path", "is", "decoded", "NONE", "when", "no", "expected", "encoding", "works" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/unicode_utils.py#L20-L36
[ "def", "filesys_decode", "(", "path", ")", ":", "if", "isinstance", "(", "path", ",", "six", ".", "text_type", ")", ":", "return", "path", "fs_enc", "=", "sys", ".", "getfilesystemencoding", "(", ")", "or", "'utf-8'", "candidates", "=", "fs_enc", ",", "'...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
get_flag
Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.
setuptools/pep425tags.py
def get_flag(var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = get_config_var(var) if val is None: if warn: log.debug("Config variable '%s' is unset, Python ABI tag may " ...
def get_flag(var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = get_config_var(var) if val is None: if warn: log.debug("Config variable '%s' is unset, Python ABI tag may " ...
[ "Use", "a", "fallback", "method", "for", "determining", "SOABI", "flags", "if", "the", "needed", "config", "var", "is", "unset", "or", "unavailable", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/pep425tags.py#L69-L78
[ "def", "get_flag", "(", "var", ",", "fallback", ",", "expected", "=", "True", ",", "warn", "=", "True", ")", ":", "val", "=", "get_config_var", "(", "var", ")", "if", "val", "is", "None", ":", "if", "warn", ":", "log", ".", "debug", "(", "\"Config ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
get_darwin_arches
Return a list of supported arches (including group arches) for the given major, minor and machine architecture of a macOS machine.
setuptools/pep425tags.py
def get_darwin_arches(major, minor, machine): """Return a list of supported arches (including group arches) for the given major, minor and machine architecture of a macOS machine. """ arches = [] def _supports_arch(major, minor, arch): # Looking at the application support for macOS versions...
def get_darwin_arches(major, minor, machine): """Return a list of supported arches (including group arches) for the given major, minor and machine architecture of a macOS machine. """ arches = [] def _supports_arch(major, minor, arch): # Looking at the application support for macOS versions...
[ "Return", "a", "list", "of", "supported", "arches", "(", "including", "group", "arches", ")", "for", "the", "given", "major", "minor", "and", "machine", "architecture", "of", "a", "macOS", "machine", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/pep425tags.py#L162-L220
[ "def", "get_darwin_arches", "(", "major", ",", "minor", ",", "machine", ")", ":", "arches", "=", "[", "]", "def", "_supports_arch", "(", "major", ",", "minor", ",", "arch", ")", ":", "# Looking at the application support for macOS versions in the chart", "# provided...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
get_supported
Return a list of supported tags for each version specified in `versions`. :param versions: a list of string versions, of the form ["33", "32"], or None. The first version will be assumed to support our ABI. :param platform: specify the exact platform you want valid tags for, or None. If Non...
setuptools/pep425tags.py
def get_supported(versions=None, noarch=False, platform=None, impl=None, abi=None): """Return a list of supported tags for each version specified in `versions`. :param versions: a list of string versions, of the form ["33", "32"], or None. The first version will be assumed to supp...
def get_supported(versions=None, noarch=False, platform=None, impl=None, abi=None): """Return a list of supported tags for each version specified in `versions`. :param versions: a list of string versions, of the form ["33", "32"], or None. The first version will be assumed to supp...
[ "Return", "a", "list", "of", "supported", "tags", "for", "each", "version", "specified", "in", "versions", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/pep425tags.py#L223-L316
[ "def", "get_supported", "(", "versions", "=", "None", ",", "noarch", "=", "False", ",", "platform", "=", "None", ",", "impl", "=", "None", ",", "abi", "=", "None", ")", ":", "supported", "=", "[", "]", "# Versions must be given with respect to the preference",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
_find_all_simple
Find all files under 'path'
setuptools/__init__.py
def _find_all_simple(path): """ Find all files under 'path' """ results = ( os.path.join(base, file) for base, dirs, files in os.walk(path, followlinks=True) for file in files ) return filter(os.path.isfile, results)
def _find_all_simple(path): """ Find all files under 'path' """ results = ( os.path.join(base, file) for base, dirs, files in os.walk(path, followlinks=True) for file in files ) return filter(os.path.isfile, results)
[ "Find", "all", "files", "under", "path" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/__init__.py#L203-L212
[ "def", "_find_all_simple", "(", "path", ")", ":", "results", "=", "(", "os", ".", "path", ".", "join", "(", "base", ",", "file", ")", "for", "base", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "path", ",", "followlinks", "=", "True", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
findall
Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended.
setuptools/__init__.py
def findall(dir=os.curdir): """ Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended. """ files = _find_all_simple(dir) if dir == os.curdir: make_rel = functools.partial(os.path.relpath, start=dir) files = m...
def findall(dir=os.curdir): """ Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended. """ files = _find_all_simple(dir) if dir == os.curdir: make_rel = functools.partial(os.path.relpath, start=dir) files = m...
[ "Find", "all", "files", "under", "dir", "and", "return", "the", "list", "of", "full", "filenames", ".", "Unless", "dir", "is", ".", "return", "full", "filenames", "with", "dir", "prepended", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/__init__.py#L215-L224
[ "def", "findall", "(", "dir", "=", "os", ".", "curdir", ")", ":", "files", "=", "_find_all_simple", "(", "dir", ")", "if", "dir", "==", "os", ".", "curdir", ":", "make_rel", "=", "functools", ".", "partial", "(", "os", ".", "path", ".", "relpath", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageFinder.find
Return a list all Python packages found within directory 'where' 'where' is the root directory which will be searched for packages. It should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of ...
setuptools/__init__.py
def find(cls, where='.', exclude=(), include=('*',)): """Return a list all Python packages found within directory 'where' 'where' is the root directory which will be searched for packages. It should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the ap...
def find(cls, where='.', exclude=(), include=('*',)): """Return a list all Python packages found within directory 'where' 'where' is the root directory which will be searched for packages. It should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the ap...
[ "Return", "a", "list", "all", "Python", "packages", "found", "within", "directory", "where" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/__init__.py#L53-L73
[ "def", "find", "(", "cls", ",", "where", "=", "'.'", ",", "exclude", "=", "(", ")", ",", "include", "=", "(", "'*'", ",", ")", ")", ":", "return", "list", "(", "cls", ".", "_find_packages_iter", "(", "convert_path", "(", "where", ")", ",", "cls", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageFinder._find_packages_iter
All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter.
setuptools/__init__.py
def _find_packages_iter(cls, where, exclude, include): """ All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter. """ for root, dirs, files in os.walk(where, followlinks=True): # Copy dirs to iterate over it, then empty dirs. ...
def _find_packages_iter(cls, where, exclude, include): """ All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter. """ for root, dirs, files in os.walk(where, followlinks=True): # Copy dirs to iterate over it, then empty dirs. ...
[ "All", "the", "packages", "found", "in", "where", "that", "pass", "the", "include", "filter", "but", "not", "the", "exclude", "filter", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/__init__.py#L76-L101
[ "def", "_find_packages_iter", "(", "cls", ",", "where", ",", "exclude", ",", "include", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "where", ",", "followlinks", "=", "True", ")", ":", "# Copy dirs to iterate over it, t...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
PackageFinder._build_filter
Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns.
setuptools/__init__.py
def _build_filter(*patterns): """ Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns. """ return lambda name: any(fnmatchcase(name, pat=pat) for pat in patterns)
def _build_filter(*patterns): """ Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns. """ return lambda name: any(fnmatchcase(name, pat=pat) for pat in patterns)
[ "Given", "a", "list", "of", "patterns", "return", "a", "callable", "that", "will", "be", "true", "only", "if", "the", "input", "matches", "at", "least", "one", "of", "the", "patterns", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/__init__.py#L109-L114
[ "def", "_build_filter", "(", "*", "patterns", ")", ":", "return", "lambda", "name", ":", "any", "(", "fnmatchcase", "(", "name", ",", "pat", "=", "pat", ")", "for", "pat", "in", "patterns", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Command.ensure_string_list
r"""Ensure that 'option' is a list of strings. If 'option' is currently a string, we split it either on /,\s*/ or /\s+/, so "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become ["foo", "bar", "baz"].
setuptools/__init__.py
def ensure_string_list(self, option): r"""Ensure that 'option' is a list of strings. If 'option' is currently a string, we split it either on /,\s*/ or /\s+/, so "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become ["foo", "bar", "baz"]. """ val = getattr(self, ...
def ensure_string_list(self, option): r"""Ensure that 'option' is a list of strings. If 'option' is currently a string, we split it either on /,\s*/ or /\s+/, so "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become ["foo", "bar", "baz"]. """ val = getattr(self, ...
[ "r", "Ensure", "that", "option", "is", "a", "list", "of", "strings", ".", "If", "option", "is", "currently", "a", "string", "we", "split", "it", "either", "on", "/", "\\", "s", "*", "/", "or", "/", "\\", "s", "+", "/", "so", "foo", "bar", "baz", ...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/__init__.py#L176-L195
[ "def", "ensure_string_list", "(", "self", ",", "option", ")", ":", "val", "=", "getattr", "(", "self", ",", "option", ")", "if", "val", "is", "None", ":", "return", "elif", "isinstance", "(", "val", ",", "string_types", ")", ":", "setattr", "(", "self"...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
install._called_from_setup
Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might* be 'run...
setuptools/command/install.py
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any ...
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any ...
[ "Attempt", "to", "detect", "whether", "run", "()", "was", "called", "from", "setup", "()", "or", "by", "another", "command", ".", "If", "called", "by", "setup", "()", "the", "parent", "caller", "will", "be", "the", "run_command", "method", "in", "distutils...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/install.py#L70-L94
[ "def", "_called_from_setup", "(", "run_frame", ")", ":", "if", "run_frame", "is", "None", ":", "msg", "=", "\"Call stack not available. bdist_* commands may fail.\"", "warnings", ".", "warn", "(", "msg", ")", "if", "platform", ".", "python_implementation", "(", ")",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
newer_pairwise_group
Walk both arguments in parallel, testing if each source group is newer than its corresponding target. Returns a pair of lists (sources_groups, targets) where sources is newer than target, according to the semantics of 'newer_group()'.
setuptools/dep_util.py
def newer_pairwise_group(sources_groups, targets): """Walk both arguments in parallel, testing if each source group is newer than its corresponding target. Returns a pair of lists (sources_groups, targets) where sources is newer than target, according to the semantics of 'newer_group()'. """ if ...
def newer_pairwise_group(sources_groups, targets): """Walk both arguments in parallel, testing if each source group is newer than its corresponding target. Returns a pair of lists (sources_groups, targets) where sources is newer than target, according to the semantics of 'newer_group()'. """ if ...
[ "Walk", "both", "arguments", "in", "parallel", "testing", "if", "each", "source", "group", "is", "newer", "than", "its", "corresponding", "target", ".", "Returns", "a", "pair", "of", "lists", "(", "sources_groups", "targets", ")", "where", "sources", "is", "...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dep_util.py#L6-L23
[ "def", "newer_pairwise_group", "(", "sources_groups", ",", "targets", ")", ":", "if", "len", "(", "sources_groups", ")", "!=", "len", "(", "targets", ")", ":", "raise", "ValueError", "(", "\"'sources_group' and 'targets' must be the same length\"", ")", "# build a pai...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
sorted_walk
Do os.walk in a reproducible way, independent of indeterministic filesystem readdir order
setuptools/command/bdist_egg.py
def sorted_walk(dir): """Do os.walk in a reproducible way, independent of indeterministic filesystem readdir order """ for base, dirs, files in os.walk(dir): dirs.sort() files.sort() yield base, dirs, files
def sorted_walk(dir): """Do os.walk in a reproducible way, independent of indeterministic filesystem readdir order """ for base, dirs, files in os.walk(dir): dirs.sort() files.sort() yield base, dirs, files
[ "Do", "os", ".", "walk", "in", "a", "reproducible", "way", "independent", "of", "indeterministic", "filesystem", "readdir", "order" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/bdist_egg.py#L43-L50
[ "def", "sorted_walk", "(", "dir", ")", ":", "for", "base", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "dir", ")", ":", "dirs", ".", "sort", "(", ")", "files", ".", "sort", "(", ")", "yield", "base", ",", "dirs", ",", "files" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
walk_egg
Walk an unpacked egg's contents, skipping the metadata directory
setuptools/command/bdist_egg.py
def walk_egg(egg_dir): """Walk an unpacked egg's contents, skipping the metadata directory""" walker = sorted_walk(egg_dir) base, dirs, files = next(walker) if 'EGG-INFO' in dirs: dirs.remove('EGG-INFO') yield base, dirs, files for bdf in walker: yield bdf
def walk_egg(egg_dir): """Walk an unpacked egg's contents, skipping the metadata directory""" walker = sorted_walk(egg_dir) base, dirs, files = next(walker) if 'EGG-INFO' in dirs: dirs.remove('EGG-INFO') yield base, dirs, files for bdf in walker: yield bdf
[ "Walk", "an", "unpacked", "egg", "s", "contents", "skipping", "the", "metadata", "directory" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/bdist_egg.py#L358-L366
[ "def", "walk_egg", "(", "egg_dir", ")", ":", "walker", "=", "sorted_walk", "(", "egg_dir", ")", "base", ",", "dirs", ",", "files", "=", "next", "(", "walker", ")", "if", "'EGG-INFO'", "in", "dirs", ":", "dirs", ".", "remove", "(", "'EGG-INFO'", ")", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
iter_symbols
Yield names and strings used by `code` and its nested code objects
setuptools/command/bdist_egg.py
def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in code.co_consts: if isinstance(const, six.string_types): yield const elif isinstance(const, CodeType): for name i...
def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in code.co_consts: if isinstance(const, six.string_types): yield const elif isinstance(const, CodeType): for name i...
[ "Yield", "names", "and", "strings", "used", "by", "code", "and", "its", "nested", "code", "objects" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/bdist_egg.py#L442-L451
[ "def", "iter_symbols", "(", "code", ")", ":", "for", "name", "in", "code", ".", "co_names", ":", "yield", "name", "for", "const", "in", "code", ".", "co_consts", ":", "if", "isinstance", "(", "const", ",", "six", ".", "string_types", ")", ":", "yield",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
make_zipfile
Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecErro...
setuptools/command/bdist_egg.py
def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=True, mode='w'): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if...
def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=True, mode='w'): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if...
[ "Create", "a", "zip", "file", "from", "all", "the", "files", "under", "base_dir", ".", "The", "output", "zip", "file", "will", "be", "named", "base_dir", "+", ".", "zip", ".", "Uses", "either", "the", "zipfile", "Python", "module", "(", "if", "available"...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/bdist_egg.py#L471-L502
[ "def", "make_zipfile", "(", "zip_filename", ",", "base_dir", ",", "verbose", "=", "0", ",", "dry_run", "=", "0", ",", "compress", "=", "True", ",", "mode", "=", "'w'", ")", ":", "import", "zipfile", "mkpath", "(", "os", ".", "path", ".", "dirname", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
bdist_egg.call_command
Invoke reinitialized command `cmdname` with keyword args
setuptools/command/bdist_egg.py
def call_command(self, cmdname, **kw): """Invoke reinitialized command `cmdname` with keyword args""" for dirname in INSTALL_DIRECTORY_ATTRS: kw.setdefault(dirname, self.bdist_dir) kw.setdefault('skip_build', self.skip_build) kw.setdefault('dry_run', self.dry_run) cmd...
def call_command(self, cmdname, **kw): """Invoke reinitialized command `cmdname` with keyword args""" for dirname in INSTALL_DIRECTORY_ATTRS: kw.setdefault(dirname, self.bdist_dir) kw.setdefault('skip_build', self.skip_build) kw.setdefault('dry_run', self.dry_run) cmd...
[ "Invoke", "reinitialized", "command", "cmdname", "with", "keyword", "args" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/bdist_egg.py#L151-L159
[ "def", "call_command", "(", "self", ",", "cmdname", ",", "*", "*", "kw", ")", ":", "for", "dirname", "in", "INSTALL_DIRECTORY_ATTRS", ":", "kw", ".", "setdefault", "(", "dirname", ",", "self", ".", "bdist_dir", ")", "kw", ".", "setdefault", "(", "'skip_b...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
bdist_egg.copy_metadata_to
Copy metadata (egg info) to the target_dir
setuptools/command/bdist_egg.py
def copy_metadata_to(self, target_dir): "Copy metadata (egg info) to the target_dir" # normalize the path (so that a forward-slash in egg_info will # match using startswith below) norm_egg_info = os.path.normpath(self.egg_info) prefix = os.path.join(norm_egg_info, '') for...
def copy_metadata_to(self, target_dir): "Copy metadata (egg info) to the target_dir" # normalize the path (so that a forward-slash in egg_info will # match using startswith below) norm_egg_info = os.path.normpath(self.egg_info) prefix = os.path.join(norm_egg_info, '') for...
[ "Copy", "metadata", "(", "egg", "info", ")", "to", "the", "target_dir" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/bdist_egg.py#L314-L324
[ "def", "copy_metadata_to", "(", "self", ",", "target_dir", ")", ":", "# normalize the path (so that a forward-slash in egg_info will", "# match using startswith below)", "norm_egg_info", "=", "os", ".", "path", ".", "normpath", "(", "self", ".", "egg_info", ")", "prefix",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
bdist_egg.get_ext_outputs
Get a list of relative paths to C extensions in the output distro
setuptools/command/bdist_egg.py
def get_ext_outputs(self): """Get a list of relative paths to C extensions in the output distro""" all_outputs = [] ext_outputs = [] paths = {self.bdist_dir: ''} for base, dirs, files in sorted_walk(self.bdist_dir): for filename in files: if os.path....
def get_ext_outputs(self): """Get a list of relative paths to C extensions in the output distro""" all_outputs = [] ext_outputs = [] paths = {self.bdist_dir: ''} for base, dirs, files in sorted_walk(self.bdist_dir): for filename in files: if os.path....
[ "Get", "a", "list", "of", "relative", "paths", "to", "C", "extensions", "in", "the", "output", "distro" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/bdist_egg.py#L326-L352
[ "def", "get_ext_outputs", "(", "self", ")", ":", "all_outputs", "=", "[", "]", "ext_outputs", "=", "[", "]", "paths", "=", "{", "self", ".", "bdist_dir", ":", "''", "}", "for", "base", ",", "dirs", ",", "files", "in", "sorted_walk", "(", "self", ".",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
translate_pattern
Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories.
setuptools/command/egg_info.py
def translate_pattern(glob): """ Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories. """ pat = '' # This will spli...
def translate_pattern(glob): """ Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories. """ pat = '' # This will spli...
[ "Translate", "a", "file", "path", "glob", "like", "*", ".", "txt", "in", "to", "a", "regular", "expression", ".", "This", "differs", "from", "fnmatch", ".", "translate", "which", "allows", "wildcards", "to", "match", "directory", "separators", ".", "It", "...
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L36-L116
[ "def", "translate_pattern", "(", "glob", ")", ":", "pat", "=", "''", "# This will split on '/' within [character classes]. This is deliberate.", "chunks", "=", "glob", ".", "split", "(", "os", ".", "path", ".", "sep", ")", "sep", "=", "re", ".", "escape", "(", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
write_file
Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.
setuptools/command/egg_info.py
def write_file(filename, contents): """Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. """ contents = "\n".join(contents) # assuming the contents has been vetted for utf-8 encoding contents = contents.encode("utf-8") with o...
def write_file(filename, contents): """Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. """ contents = "\n".join(contents) # assuming the contents has been vetted for utf-8 encoding contents = contents.encode("utf-8") with o...
[ "Create", "a", "file", "with", "the", "specified", "name", "and", "write", "contents", "(", "a", "sequence", "of", "strings", "without", "line", "terminators", ")", "to", "it", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L598-L608
[ "def", "write_file", "(", "filename", ",", "contents", ")", ":", "contents", "=", "\"\\n\"", ".", "join", "(", "contents", ")", "# assuming the contents has been vetted for utf-8 encoding", "contents", "=", "contents", ".", "encode", "(", "\"utf-8\"", ")", "with", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
get_pkg_info_revision
Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision.
setuptools/command/egg_info.py
def get_pkg_info_revision(): """ Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision. """ warnings.warn("get_pkg_info_revision is deprecated.", EggInfoDeprecationWarning) if os.path.exists('PKG-INFO'): with io.open('PKG-INFO') as f: for line ...
def get_pkg_info_revision(): """ Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision. """ warnings.warn("get_pkg_info_revision is deprecated.", EggInfoDeprecationWarning) if os.path.exists('PKG-INFO'): with io.open('PKG-INFO') as f: for line ...
[ "Get", "a", "-", "r###", "off", "of", "PKG", "-", "INFO", "Version", "in", "case", "this", "is", "an", "sdist", "of", "a", "subversion", "revision", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L701-L713
[ "def", "get_pkg_info_revision", "(", ")", ":", "warnings", ".", "warn", "(", "\"get_pkg_info_revision is deprecated.\"", ",", "EggInfoDeprecationWarning", ")", "if", "os", ".", "path", ".", "exists", "(", "'PKG-INFO'", ")", ":", "with", "io", ".", "open", "(", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
egg_info.save_version_info
Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds.
setuptools/command/egg_info.py
def save_version_info(self, filename): """ Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. """ egg_info = collections.OrderedDict() # follow the order these keys woul...
def save_version_info(self, filename): """ Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. """ egg_info = collections.OrderedDict() # follow the order these keys woul...
[ "Materialize", "the", "value", "of", "date", "into", "the", "build", "tag", ".", "Install", "build", "keys", "in", "a", "deterministic", "order", "to", "avoid", "arbitrary", "reordering", "on", "subsequent", "builds", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L180-L191
[ "def", "save_version_info", "(", "self", ",", "filename", ")", ":", "egg_info", "=", "collections", ".", "OrderedDict", "(", ")", "# follow the order these keys would have been added", "# when PYTHONHASHSEED=0", "egg_info", "[", "'tag_build'", "]", "=", "self", ".", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
egg_info.write_or_delete_file
Write `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data` is ``None``, then this is a no-op unless `filename` exists, in which ...
setuptools/command/egg_info.py
def write_or_delete_file(self, what, filename, data, force=False): """Write `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data`...
def write_or_delete_file(self, what, filename, data, force=False): """Write `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data`...
[ "Write", "data", "to", "filename", "or", "delete", "if", "empty" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L242-L260
[ "def", "write_or_delete_file", "(", "self", ",", "what", ",", "filename", ",", "data", ",", "force", "=", "False", ")", ":", "if", "data", ":", "self", ".", "write_file", "(", "what", ",", "filename", ",", "data", ")", "elif", "os", ".", "path", ".",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
egg_info.delete_file
Delete `filename` (if not a dry run) after announcing it
setuptools/command/egg_info.py
def delete_file(self, filename): """Delete `filename` (if not a dry run) after announcing it""" log.info("deleting %s", filename) if not self.dry_run: os.unlink(filename)
def delete_file(self, filename): """Delete `filename` (if not a dry run) after announcing it""" log.info("deleting %s", filename) if not self.dry_run: os.unlink(filename)
[ "Delete", "filename", "(", "if", "not", "a", "dry", "run", ")", "after", "announcing", "it" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L276-L280
[ "def", "delete_file", "(", "self", ",", "filename", ")", ":", "log", ".", "info", "(", "\"deleting %s\"", ",", "filename", ")", "if", "not", "self", ".", "dry_run", ":", "os", ".", "unlink", "(", "filename", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
egg_info.find_sources
Generate SOURCES.txt manifest file
setuptools/command/egg_info.py
def find_sources(self): """Generate SOURCES.txt manifest file""" manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") mm = manifest_maker(self.distribution) mm.manifest = manifest_filename mm.run() self.filelist = mm.filelist
def find_sources(self): """Generate SOURCES.txt manifest file""" manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") mm = manifest_maker(self.distribution) mm.manifest = manifest_filename mm.run() self.filelist = mm.filelist
[ "Generate", "SOURCES", ".", "txt", "manifest", "file" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L298-L304
[ "def", "find_sources", "(", "self", ")", ":", "manifest_filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "egg_info", ",", "\"SOURCES.txt\"", ")", "mm", "=", "manifest_maker", "(", "self", ".", "distribution", ")", "mm", ".", "manifest", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList._remove_files
Remove all files from the file list that match the predicate. Return True if any matching files were removed
setuptools/command/egg_info.py
def _remove_files(self, predicate): """ Remove all files from the file list that match the predicate. Return True if any matching files were removed """ found = False for i in range(len(self.files) - 1, -1, -1): if predicate(self.files[i]): sel...
def _remove_files(self, predicate): """ Remove all files from the file list that match the predicate. Return True if any matching files were removed """ found = False for i in range(len(self.files) - 1, -1, -1): if predicate(self.files[i]): sel...
[ "Remove", "all", "files", "from", "the", "file", "list", "that", "match", "the", "predicate", ".", "Return", "True", "if", "any", "matching", "files", "were", "removed" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L398-L409
[ "def", "_remove_files", "(", "self", ",", "predicate", ")", ":", "found", "=", "False", "for", "i", "in", "range", "(", "len", "(", "self", ".", "files", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "predicate", "(", "self", "."...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.include
Include files that match 'pattern'.
setuptools/command/egg_info.py
def include(self, pattern): """Include files that match 'pattern'.""" found = [f for f in glob(pattern) if not os.path.isdir(f)] self.extend(found) return bool(found)
def include(self, pattern): """Include files that match 'pattern'.""" found = [f for f in glob(pattern) if not os.path.isdir(f)] self.extend(found) return bool(found)
[ "Include", "files", "that", "match", "pattern", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L411-L415
[ "def", "include", "(", "self", ",", "pattern", ")", ":", "found", "=", "[", "f", "for", "f", "in", "glob", "(", "pattern", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "f", ")", "]", "self", ".", "extend", "(", "found", ")", "return"...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.exclude
Exclude files that match 'pattern'.
setuptools/command/egg_info.py
def exclude(self, pattern): """Exclude files that match 'pattern'.""" match = translate_pattern(pattern) return self._remove_files(match.match)
def exclude(self, pattern): """Exclude files that match 'pattern'.""" match = translate_pattern(pattern) return self._remove_files(match.match)
[ "Exclude", "files", "that", "match", "pattern", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L417-L420
[ "def", "exclude", "(", "self", ",", "pattern", ")", ":", "match", "=", "translate_pattern", "(", "pattern", ")", "return", "self", ".", "_remove_files", "(", "match", ".", "match", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.recursive_include
Include all files anywhere in 'dir/' that match the pattern.
setuptools/command/egg_info.py
def recursive_include(self, dir, pattern): """ Include all files anywhere in 'dir/' that match the pattern. """ full_pattern = os.path.join(dir, '**', pattern) found = [f for f in glob(full_pattern, recursive=True) if not os.path.isdir(f)] self.extend(fou...
def recursive_include(self, dir, pattern): """ Include all files anywhere in 'dir/' that match the pattern. """ full_pattern = os.path.join(dir, '**', pattern) found = [f for f in glob(full_pattern, recursive=True) if not os.path.isdir(f)] self.extend(fou...
[ "Include", "all", "files", "anywhere", "in", "dir", "/", "that", "match", "the", "pattern", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L422-L430
[ "def", "recursive_include", "(", "self", ",", "dir", ",", "pattern", ")", ":", "full_pattern", "=", "os", ".", "path", ".", "join", "(", "dir", ",", "'**'", ",", "pattern", ")", "found", "=", "[", "f", "for", "f", "in", "glob", "(", "full_pattern", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.recursive_exclude
Exclude any file anywhere in 'dir/' that match the pattern.
setuptools/command/egg_info.py
def recursive_exclude(self, dir, pattern): """ Exclude any file anywhere in 'dir/' that match the pattern. """ match = translate_pattern(os.path.join(dir, '**', pattern)) return self._remove_files(match.match)
def recursive_exclude(self, dir, pattern): """ Exclude any file anywhere in 'dir/' that match the pattern. """ match = translate_pattern(os.path.join(dir, '**', pattern)) return self._remove_files(match.match)
[ "Exclude", "any", "file", "anywhere", "in", "dir", "/", "that", "match", "the", "pattern", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L432-L437
[ "def", "recursive_exclude", "(", "self", ",", "dir", ",", "pattern", ")", ":", "match", "=", "translate_pattern", "(", "os", ".", "path", ".", "join", "(", "dir", ",", "'**'", ",", "pattern", ")", ")", "return", "self", ".", "_remove_files", "(", "matc...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.graft
Include all files from 'dir/'.
setuptools/command/egg_info.py
def graft(self, dir): """Include all files from 'dir/'.""" found = [ item for match_dir in glob(dir) for item in distutils.filelist.findall(match_dir) ] self.extend(found) return bool(found)
def graft(self, dir): """Include all files from 'dir/'.""" found = [ item for match_dir in glob(dir) for item in distutils.filelist.findall(match_dir) ] self.extend(found) return bool(found)
[ "Include", "all", "files", "from", "dir", "/", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L439-L447
[ "def", "graft", "(", "self", ",", "dir", ")", ":", "found", "=", "[", "item", "for", "match_dir", "in", "glob", "(", "dir", ")", "for", "item", "in", "distutils", ".", "filelist", ".", "findall", "(", "match_dir", ")", "]", "self", ".", "extend", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.prune
Filter out files from 'dir/'.
setuptools/command/egg_info.py
def prune(self, dir): """Filter out files from 'dir/'.""" match = translate_pattern(os.path.join(dir, '**')) return self._remove_files(match.match)
def prune(self, dir): """Filter out files from 'dir/'.""" match = translate_pattern(os.path.join(dir, '**')) return self._remove_files(match.match)
[ "Filter", "out", "files", "from", "dir", "/", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L449-L452
[ "def", "prune", "(", "self", ",", "dir", ")", ":", "match", "=", "translate_pattern", "(", "os", ".", "path", ".", "join", "(", "dir", ",", "'**'", ")", ")", "return", "self", ".", "_remove_files", "(", "match", ".", "match", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.global_include
Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees.
setuptools/command/egg_info.py
def global_include(self, pattern): """ Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. """ if self.allfiles is None: self.findall() match = translate_pattern(os.path.join('**', pattern))...
def global_include(self, pattern): """ Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. """ if self.allfiles is None: self.findall() match = translate_pattern(os.path.join('**', pattern))...
[ "Include", "all", "files", "anywhere", "in", "the", "current", "directory", "that", "match", "the", "pattern", ".", "This", "is", "very", "inefficient", "on", "large", "file", "trees", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L454-L464
[ "def", "global_include", "(", "self", ",", "pattern", ")", ":", "if", "self", ".", "allfiles", "is", "None", ":", "self", ".", "findall", "(", ")", "match", "=", "translate_pattern", "(", "os", ".", "path", ".", "join", "(", "'**'", ",", "pattern", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList.global_exclude
Exclude all files anywhere that match the pattern.
setuptools/command/egg_info.py
def global_exclude(self, pattern): """ Exclude all files anywhere that match the pattern. """ match = translate_pattern(os.path.join('**', pattern)) return self._remove_files(match.match)
def global_exclude(self, pattern): """ Exclude all files anywhere that match the pattern. """ match = translate_pattern(os.path.join('**', pattern)) return self._remove_files(match.match)
[ "Exclude", "all", "files", "anywhere", "that", "match", "the", "pattern", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L466-L471
[ "def", "global_exclude", "(", "self", ",", "pattern", ")", ":", "match", "=", "translate_pattern", "(", "os", ".", "path", ".", "join", "(", "'**'", ",", "pattern", ")", ")", "return", "self", ".", "_remove_files", "(", "match", ".", "match", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
FileList._repair
Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths.
setuptools/command/egg_info.py
def _repair(self): """ Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths. """ self.files = list(filter(self._safe_path, self.files))
def _repair(self): """ Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths. """ self.files = list(filter(self._safe_path, self.files))
[ "Replace", "self", ".", "files", "with", "only", "safe", "paths" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L484-L492
[ "def", "_repair", "(", "self", ")", ":", "self", ".", "files", "=", "list", "(", "filter", "(", "self", ".", "_safe_path", ",", "self", ".", "files", ")", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
manifest_maker.write_manifest
Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'.
setuptools/command/egg_info.py
def write_manifest(self): """ Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. """ self.filelist._repair() # Now _repairs should encodability, but not unicode files = [self._manifest_normalize(f) for f in self.filelist.files] ...
def write_manifest(self): """ Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. """ self.filelist._repair() # Now _repairs should encodability, but not unicode files = [self._manifest_normalize(f) for f in self.filelist.files] ...
[ "Write", "the", "file", "list", "in", "self", ".", "filelist", "to", "the", "manifest", "file", "named", "by", "self", ".", "manifest", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L546-L556
[ "def", "write_manifest", "(", "self", ")", ":", "self", ".", "filelist", ".", "_repair", "(", ")", "# Now _repairs should encodability, but not unicode", "files", "=", "[", "self", ".", "_manifest_normalize", "(", "f", ")", "for", "f", "in", "self", ".", "file...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
walk_revctrl
Find all files under revision control
setuptools/command/sdist.py
def walk_revctrl(dirname=''): """Find all files under revision control""" for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): for item in ep.load()(dirname): yield item
def walk_revctrl(dirname=''): """Find all files under revision control""" for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): for item in ep.load()(dirname): yield item
[ "Find", "all", "files", "under", "revision", "control" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/sdist.py#L17-L21
[ "def", "walk_revctrl", "(", "dirname", "=", "''", ")", ":", "for", "ep", "in", "pkg_resources", ".", "iter_entry_points", "(", "'setuptools.file_finders'", ")", ":", "for", "item", "in", "ep", ".", "load", "(", ")", "(", "dirname", ")", ":", "yield", "it...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
sdist._remove_os_link
In a context, remove and restore os.link if it exists
setuptools/command/sdist.py
def _remove_os_link(): """ In a context, remove and restore os.link if it exists """ class NoValue: pass orig_val = getattr(os, 'link', NoValue) try: del os.link except Exception: pass try: yield fi...
def _remove_os_link(): """ In a context, remove and restore os.link if it exists """ class NoValue: pass orig_val = getattr(os, 'link', NoValue) try: del os.link except Exception: pass try: yield fi...
[ "In", "a", "context", "remove", "and", "restore", "os", ".", "link", "if", "it", "exists" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/sdist.py#L82-L99
[ "def", "_remove_os_link", "(", ")", ":", "class", "NoValue", ":", "pass", "orig_val", "=", "getattr", "(", "os", ",", "'link'", ",", "NoValue", ")", "try", ":", "del", "os", ".", "link", "except", "Exception", ":", "pass", "try", ":", "yield", "finally...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
sdist._add_defaults_python
getting python files
setuptools/command/sdist.py
def _add_defaults_python(self): """getting python files""" if self.distribution.has_pure_modules(): build_py = self.get_finalized_command('build_py') self.filelist.extend(build_py.get_source_files()) # This functionality is incompatible with include_package_data, and ...
def _add_defaults_python(self): """getting python files""" if self.distribution.has_pure_modules(): build_py = self.get_finalized_command('build_py') self.filelist.extend(build_py.get_source_files()) # This functionality is incompatible with include_package_data, and ...
[ "getting", "python", "files" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/sdist.py#L124-L136
[ "def", "_add_defaults_python", "(", "self", ")", ":", "if", "self", ".", "distribution", ".", "has_pure_modules", "(", ")", ":", "build_py", "=", "self", ".", "get_finalized_command", "(", "'build_py'", ")", "self", ".", "filelist", ".", "extend", "(", "buil...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
sdist.read_manifest
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
setuptools/command/sdist.py
def read_manifest(self): """Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution. """ log.info("reading manifest file '%s'", self.manifest) manifest = open(self.manifest, 'rb') ...
def read_manifest(self): """Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution. """ log.info("reading manifest file '%s'", self.manifest) manifest = open(self.manifest, 'rb') ...
[ "Read", "the", "manifest", "file", "(", "named", "by", "self", ".", "manifest", ")", "and", "use", "it", "to", "fill", "in", "self", ".", "filelist", "the", "list", "of", "files", "to", "include", "in", "the", "source", "distribution", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/sdist.py#L180-L200
[ "def", "read_manifest", "(", "self", ")", ":", "log", ".", "info", "(", "\"reading manifest file '%s'\"", ",", "self", ".", "manifest", ")", "manifest", "=", "open", "(", "self", ".", "manifest", ",", "'rb'", ")", "for", "line", "in", "manifest", ":", "#...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
sdist.check_license
Checks if license_file' is configured and adds it to 'self.filelist' if the value contains a valid path.
setuptools/command/sdist.py
def check_license(self): """Checks if license_file' is configured and adds it to 'self.filelist' if the value contains a valid path. """ opts = self.distribution.get_option_dict('metadata') # ignore the source of the value _, license_file = opts.get('license_file', (Non...
def check_license(self): """Checks if license_file' is configured and adds it to 'self.filelist' if the value contains a valid path. """ opts = self.distribution.get_option_dict('metadata') # ignore the source of the value _, license_file = opts.get('license_file', (Non...
[ "Checks", "if", "license_file", "is", "configured", "and", "adds", "it", "to", "self", ".", "filelist", "if", "the", "value", "contains", "a", "valid", "path", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/sdist.py#L202-L221
[ "def", "check_license", "(", "self", ")", ":", "opts", "=", "self", ".", "distribution", ".", "get_option_dict", "(", "'metadata'", ")", "# ignore the source of the value", "_", ",", "license_file", "=", "opts", ".", "get", "(", "'license_file'", ",", "(", "No...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
install_lib.get_exclusions
Return a collections.Sized collections.Container of paths to be excluded for single_version_externally_managed installations.
setuptools/command/install_lib.py
def get_exclusions(self): """ Return a collections.Sized collections.Container of paths to be excluded for single_version_externally_managed installations. """ all_packages = ( pkg for ns_pkg in self._get_SVEM_NSPs() for pkg in self._all_packag...
def get_exclusions(self): """ Return a collections.Sized collections.Container of paths to be excluded for single_version_externally_managed installations. """ all_packages = ( pkg for ns_pkg in self._get_SVEM_NSPs() for pkg in self._all_packag...
[ "Return", "a", "collections", ".", "Sized", "collections", ".", "Container", "of", "paths", "to", "be", "excluded", "for", "single_version_externally_managed", "installations", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/install_lib.py#L17-L29
[ "def", "get_exclusions", "(", "self", ")", ":", "all_packages", "=", "(", "pkg", "for", "ns_pkg", "in", "self", ".", "_get_SVEM_NSPs", "(", ")", "for", "pkg", "in", "self", ".", "_all_packages", "(", "ns_pkg", ")", ")", "excl_specs", "=", "product", "(",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
install_lib._exclude_pkg_path
Given a package name and exclusion path within that package, compute the full exclusion path.
setuptools/command/install_lib.py
def _exclude_pkg_path(self, pkg, exclusion_path): """ Given a package name and exclusion path within that package, compute the full exclusion path. """ parts = pkg.split('.') + [exclusion_path] return os.path.join(self.install_dir, *parts)
def _exclude_pkg_path(self, pkg, exclusion_path): """ Given a package name and exclusion path within that package, compute the full exclusion path. """ parts = pkg.split('.') + [exclusion_path] return os.path.join(self.install_dir, *parts)
[ "Given", "a", "package", "name", "and", "exclusion", "path", "within", "that", "package", "compute", "the", "full", "exclusion", "path", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/install_lib.py#L31-L37
[ "def", "_exclude_pkg_path", "(", "self", ",", "pkg", ",", "exclusion_path", ")", ":", "parts", "=", "pkg", ".", "split", "(", "'.'", ")", "+", "[", "exclusion_path", "]", "return", "os", ".", "path", ".", "join", "(", "self", ".", "install_dir", ",", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
install_lib._get_SVEM_NSPs
Get namespace packages (list) but only for single_version_externally_managed installations and empty otherwise.
setuptools/command/install_lib.py
def _get_SVEM_NSPs(self): """ Get namespace packages (list) but only for single_version_externally_managed installations and empty otherwise. """ # TODO: is it necessary to short-circuit here? i.e. what's the cost # if get_finalized_command is called even when namespace_p...
def _get_SVEM_NSPs(self): """ Get namespace packages (list) but only for single_version_externally_managed installations and empty otherwise. """ # TODO: is it necessary to short-circuit here? i.e. what's the cost # if get_finalized_command is called even when namespace_p...
[ "Get", "namespace", "packages", "(", "list", ")", "but", "only", "for", "single_version_externally_managed", "installations", "and", "empty", "otherwise", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/install_lib.py#L49-L63
[ "def", "_get_SVEM_NSPs", "(", "self", ")", ":", "# TODO: is it necessary to short-circuit here? i.e. what's the cost", "# if get_finalized_command is called even when namespace_packages is", "# False?", "if", "not", "self", ".", "distribution", ".", "namespace_packages", ":", "retu...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
install_lib._gen_exclusion_paths
Generate file paths to be excluded for namespace packages (bytecode cache files).
setuptools/command/install_lib.py
def _gen_exclusion_paths(): """ Generate file paths to be excluded for namespace packages (bytecode cache files). """ # always exclude the package module itself yield '__init__.py' yield '__init__.pyc' yield '__init__.pyo' if not hasattr(imp, 'ge...
def _gen_exclusion_paths(): """ Generate file paths to be excluded for namespace packages (bytecode cache files). """ # always exclude the package module itself yield '__init__.py' yield '__init__.pyc' yield '__init__.pyo' if not hasattr(imp, 'ge...
[ "Generate", "file", "paths", "to", "be", "excluded", "for", "namespace", "packages", "(", "bytecode", "cache", "files", ")", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/install_lib.py#L66-L84
[ "def", "_gen_exclusion_paths", "(", ")", ":", "# always exclude the package module itself", "yield", "'__init__.py'", "yield", "'__init__.pyc'", "yield", "'__init__.pyo'", "if", "not", "hasattr", "(", "imp", ",", "'get_tag'", ")", ":", "return", "base", "=", "os", "...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
develop._resolve_setup_path
Generate a path from egg_base back to '.' where the setup script resides and ensure that path points to the setup path from $install_dir/$egg_path.
setuptools/command/develop.py
def _resolve_setup_path(egg_base, install_dir, egg_path): """ Generate a path from egg_base back to '.' where the setup script resides and ensure that path points to the setup path from $install_dir/$egg_path. """ path_to_setup = egg_base.replace(os.sep, '/').rstrip('/') ...
def _resolve_setup_path(egg_base, install_dir, egg_path): """ Generate a path from egg_base back to '.' where the setup script resides and ensure that path points to the setup path from $install_dir/$egg_path. """ path_to_setup = egg_base.replace(os.sep, '/').rstrip('/') ...
[ "Generate", "a", "path", "from", "egg_base", "back", "to", ".", "where", "the", "setup", "script", "resides", "and", "ensure", "that", "path", "points", "to", "the", "setup", "path", "from", "$install_dir", "/", "$egg_path", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/develop.py#L91-L108
[ "def", "_resolve_setup_path", "(", "egg_base", ",", "install_dir", ",", "egg_path", ")", ":", "path_to_setup", "=", "egg_base", ".", "replace", "(", "os", ".", "sep", ",", "'/'", ")", ".", "rstrip", "(", "'/'", ")", "if", "path_to_setup", "!=", "os", "."...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
find_module
Just like 'imp.find_module()', but with package support
setuptools/depends.py
def find_module(module, paths=None): """Just like 'imp.find_module()', but with package support""" parts = module.split('.') while parts: part = parts.pop(0) f, path, (suffix, mode, kind) = info = imp.find_module(part, paths) if kind == PKG_DIRECTORY: parts = parts or ...
def find_module(module, paths=None): """Just like 'imp.find_module()', but with package support""" parts = module.split('.') while parts: part = parts.pop(0) f, path, (suffix, mode, kind) = info = imp.find_module(part, paths) if kind == PKG_DIRECTORY: parts = parts or ...
[ "Just", "like", "imp", ".", "find_module", "()", "but", "with", "package", "support" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L82-L98
[ "def", "find_module", "(", "module", ",", "paths", "=", "None", ")", ":", "parts", "=", "module", ".", "split", "(", "'.'", ")", "while", "parts", ":", "part", "=", "parts", ".", "pop", "(", "0", ")", "f", ",", "path", ",", "(", "suffix", ",", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
get_module_constant
Find 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.
setuptools/depends.py
def get_module_constant(module, symbol, default=-1, paths=None): """Find 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'defau...
def get_module_constant(module, symbol, default=-1, paths=None): """Find 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'defau...
[ "Find", "module", "by", "searching", "paths", "and", "extract", "symbol" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L101-L132
[ "def", "get_module_constant", "(", "module", ",", "symbol", ",", "default", "=", "-", "1", ",", "paths", "=", "None", ")", ":", "try", ":", "f", ",", "path", ",", "(", "suffix", ",", "mode", ",", "kind", ")", "=", "find_module", "(", "module", ",",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
extract_constant
Extract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'sy...
setuptools/depends.py
def extract_constant(code, symbol, default=-1): """Extract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return v...
def extract_constant(code, symbol, default=-1): """Extract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return v...
[ "Extract", "the", "constant", "value", "of", "symbol", "from", "code" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L135-L168
[ "def", "extract_constant", "(", "code", ",", "symbol", ",", "default", "=", "-", "1", ")", ":", "if", "symbol", "not", "in", "code", ".", "co_names", ":", "# name's not there, can't possibly be an assignment", "return", "None", "name_idx", "=", "list", "(", "c...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
_update_globals
Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead.
setuptools/depends.py
def _update_globals(): """ Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead. """ if not sys.platform.startswith('java') and sys.platform != 'cli': return incompatible = 'extract_constant', 'get_module_...
def _update_globals(): """ Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead. """ if not sys.platform.startswith('java') and sys.platform != 'cli': return incompatible = 'extract_constant', 'get_module_...
[ "Patch", "the", "globals", "to", "remove", "the", "objects", "not", "available", "on", "some", "platforms", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L171-L183
[ "def", "_update_globals", "(", ")", ":", "if", "not", "sys", ".", "platform", ".", "startswith", "(", "'java'", ")", "and", "sys", ".", "platform", "!=", "'cli'", ":", "return", "incompatible", "=", "'extract_constant'", ",", "'get_module_constant'", "for", ...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Require.full_name
Return full package/distribution name, w/version
setuptools/depends.py
def full_name(self): """Return full package/distribution name, w/version""" if self.requested_version is not None: return '%s-%s' % (self.name, self.requested_version) return self.name
def full_name(self): """Return full package/distribution name, w/version""" if self.requested_version is not None: return '%s-%s' % (self.name, self.requested_version) return self.name
[ "Return", "full", "package", "/", "distribution", "name", "w", "/", "version" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L32-L36
[ "def", "full_name", "(", "self", ")", ":", "if", "self", ".", "requested_version", "is", "not", "None", ":", "return", "'%s-%s'", "%", "(", "self", ".", "name", ",", "self", ".", "requested_version", ")", "return", "self", ".", "name" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Require.version_ok
Is 'version' sufficiently up-to-date?
setuptools/depends.py
def version_ok(self, version): """Is 'version' sufficiently up-to-date?""" return self.attribute is None or self.format is None or \ str(version) != "unknown" and version >= self.requested_version
def version_ok(self, version): """Is 'version' sufficiently up-to-date?""" return self.attribute is None or self.format is None or \ str(version) != "unknown" and version >= self.requested_version
[ "Is", "version", "sufficiently", "up", "-", "to", "-", "date?" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L38-L41
[ "def", "version_ok", "(", "self", ",", "version", ")", ":", "return", "self", ".", "attribute", "is", "None", "or", "self", ".", "format", "is", "None", "or", "str", "(", "version", ")", "!=", "\"unknown\"", "and", "version", ">=", "self", ".", "reques...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Require.get_version
Get version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the value cannot be determined without importing the module. T...
setuptools/depends.py
def get_version(self, paths=None, default="unknown"): """Get version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the va...
def get_version(self, paths=None, default="unknown"): """Get version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the va...
[ "Get", "version", "number", "of", "installed", "module", "None", "or", "default" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L43-L68
[ "def", "get_version", "(", "self", ",", "paths", "=", "None", ",", "default", "=", "\"unknown\"", ")", ":", "if", "self", ".", "attribute", "is", "None", ":", "try", ":", "f", ",", "p", ",", "i", "=", "find_module", "(", "self", ".", "module", ",",...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Require.is_current
Return true if dependency is present and up-to-date on 'paths
setuptools/depends.py
def is_current(self, paths=None): """Return true if dependency is present and up-to-date on 'paths'""" version = self.get_version(paths) if version is None: return False return self.version_ok(version)
def is_current(self, paths=None): """Return true if dependency is present and up-to-date on 'paths'""" version = self.get_version(paths) if version is None: return False return self.version_ok(version)
[ "Return", "true", "if", "dependency", "is", "present", "and", "up", "-", "to", "-", "date", "on", "paths" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/depends.py#L74-L79
[ "def", "is_current", "(", "self", ",", "paths", "=", "None", ")", ":", "version", "=", "self", ".", "get_version", "(", "paths", ")", "if", "version", "is", "None", ":", "return", "False", "return", "self", ".", "version_ok", "(", "version", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Installer._get_all_ns_packages
Return sorted list of all package namespaces
setuptools/namespaces.py
def _get_all_ns_packages(self): """Return sorted list of all package namespaces""" pkgs = self.distribution.namespace_packages or [] return sorted(flatten(map(self._pkg_names, pkgs)))
def _get_all_ns_packages(self): """Return sorted list of all package namespaces""" pkgs = self.distribution.namespace_packages or [] return sorted(flatten(map(self._pkg_names, pkgs)))
[ "Return", "sorted", "list", "of", "all", "package", "namespaces" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/namespaces.py#L81-L84
[ "def", "_get_all_ns_packages", "(", "self", ")", ":", "pkgs", "=", "self", ".", "distribution", ".", "namespace_packages", "or", "[", "]", "return", "sorted", "(", "flatten", "(", "map", "(", "self", ".", "_pkg_names", ",", "pkgs", ")", ")", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
Installer._pkg_names
Given a namespace package, yield the components of that package. >>> names = Installer._pkg_names('a.b.c') >>> set(names) == set(['a', 'a.b', 'a.b.c']) True
setuptools/namespaces.py
def _pkg_names(pkg): """ Given a namespace package, yield the components of that package. >>> names = Installer._pkg_names('a.b.c') >>> set(names) == set(['a', 'a.b', 'a.b.c']) True """ parts = pkg.split('.') while parts: yield '.'.joi...
def _pkg_names(pkg): """ Given a namespace package, yield the components of that package. >>> names = Installer._pkg_names('a.b.c') >>> set(names) == set(['a', 'a.b', 'a.b.c']) True """ parts = pkg.split('.') while parts: yield '.'.joi...
[ "Given", "a", "namespace", "package", "yield", "the", "components", "of", "that", "package", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/namespaces.py#L87-L99
[ "def", "_pkg_names", "(", "pkg", ")", ":", "parts", "=", "pkg", ".", "split", "(", "'.'", ")", "while", "parts", ":", "yield", "'.'", ".", "join", "(", "parts", ")", "parts", ".", "pop", "(", ")" ]
83c667e0b2a98193851c07115d1af65011ed0fb6
train
find_ca_bundle
Return an existing CA bundle path, or None
setuptools/ssl_support.py
def find_ca_bundle(): """Return an existing CA bundle path, or None""" extant_cert_paths = filter(os.path.isfile, cert_paths) return ( get_win_certfile() or next(extant_cert_paths, None) or _certifi_where() )
def find_ca_bundle(): """Return an existing CA bundle path, or None""" extant_cert_paths = filter(os.path.isfile, cert_paths) return ( get_win_certfile() or next(extant_cert_paths, None) or _certifi_where() )
[ "Return", "an", "existing", "CA", "bundle", "path", "or", "None" ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/ssl_support.py#L246-L253
[ "def", "find_ca_bundle", "(", ")", ":", "extant_cert_paths", "=", "filter", "(", "os", ".", "path", ".", "isfile", ",", "cert_paths", ")", "return", "(", "get_win_certfile", "(", ")", "or", "next", "(", "extant_cert_paths", ",", "None", ")", "or", "_certif...
83c667e0b2a98193851c07115d1af65011ed0fb6
train
rewrite_packaging
Rewrite imports in packaging to redirect to vendored copies.
pavement.py
def rewrite_packaging(pkg_files, new_root): """ Rewrite imports in packaging to redirect to vendored copies. """ for file in pkg_files.glob('*.py'): text = file.text() text = re.sub(r' (pyparsing|six)', rf' {new_root}.\1', text) file.write_text(text)
def rewrite_packaging(pkg_files, new_root): """ Rewrite imports in packaging to redirect to vendored copies. """ for file in pkg_files.glob('*.py'): text = file.text() text = re.sub(r' (pyparsing|six)', rf' {new_root}.\1', text) file.write_text(text)
[ "Rewrite", "imports", "in", "packaging", "to", "redirect", "to", "vendored", "copies", "." ]
pypa/setuptools
python
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/pavement.py#L19-L26
[ "def", "rewrite_packaging", "(", "pkg_files", ",", "new_root", ")", ":", "for", "file", "in", "pkg_files", ".", "glob", "(", "'*.py'", ")", ":", "text", "=", "file", ".", "text", "(", ")", "text", "=", "re", ".", "sub", "(", "r' (pyparsing|six)'", ",",...
83c667e0b2a98193851c07115d1af65011ed0fb6