repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.list
def list(self, verbose=True): """Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. """ self._check() for tarinfo in self: if verbose: ...
python
def list(self, verbose=True): """Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. """ self._check() for tarinfo in self: if verbose: ...
[ "def", "list", "(", "self", ",", "verbose", "=", "True", ")", ":", "self", ".", "_check", "(", ")", "for", "tarinfo", "in", "self", ":", "if", "verbose", ":", "print", "(", "filemode", "(", "tarinfo", ".", "mode", ")", ",", "end", "=", "' '", ")"...
Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced.
[ "Print", "a", "table", "of", "contents", "to", "sys", ".", "stdout", ".", "If", "verbose", "is", "False", "only", "the", "names", "of", "the", "members", "are", "printed", ".", "If", "it", "is", "True", "an", "ls", "-", "l", "-", "like", "output", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2009-L2036
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.addfile
def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be ...
python
def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be ...
[ "def", "addfile", "(", "self", ",", "tarinfo", ",", "fileobj", "=", "None", ")", ":", "self", ".", "_check", "(", "\"aw\"", ")", "tarinfo", "=", "copy", ".", "copy", "(", "tarinfo", ")", "buf", "=", "tarinfo", ".", "tobuf", "(", "self", ".", "forma...
Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation ...
[ "Add", "the", "TarInfo", "object", "tarinfo", "to", "the", "archive", ".", "If", "fileobj", "is", "given", "tarinfo", ".", "size", "bytes", "are", "read", "from", "it", "and", "added", "to", "the", "archive", ".", "You", "can", "create", "TarInfo", "obje...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2100-L2124
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.extractall
def extractall(self, path=".", members=None): """Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must...
python
def extractall(self, path=".", members=None): """Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must...
[ "def", "extractall", "(", "self", ",", "path", "=", "\".\"", ",", "members", "=", "None", ")", ":", "directories", "=", "[", "]", "if", "members", "is", "None", ":", "members", "=", "self", "for", "tarinfo", "in", "members", ":", "if", "tarinfo", "."...
Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmember...
[ "Extract", "all", "members", "from", "the", "archive", "to", "the", "current", "working", "directory", "and", "set", "owner", "modification", "time", "and", "permissions", "on", "directories", "afterwards", ".", "path", "specifies", "a", "different", "directory", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2126-L2162
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.extract
def extract(self, member, path="", set_attrs=True): """Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a differen...
python
def extract(self, member, path="", set_attrs=True): """Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a differen...
[ "def", "extract", "(", "self", ",", "member", ",", "path", "=", "\"\"", ",", "set_attrs", "=", "True", ")", ":", "self", ".", "_check", "(", "\"r\"", ")", "if", "isinstance", "(", "member", ",", "str", ")", ":", "tarinfo", "=", "self", ".", "getmem...
Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mt...
[ "Extract", "a", "member", "from", "the", "archive", "to", "the", "current", "working", "directory", "using", "its", "full", "name", ".", "Its", "file", "information", "is", "extracted", "as", "accurately", "as", "possible", ".", "member", "may", "be", "a", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2164-L2197
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.extractfile
def extractfile(self, member): """Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. I...
python
def extractfile(self, member): """Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. I...
[ "def", "extractfile", "(", "self", ",", "member", ")", ":", "self", ".", "_check", "(", "\"r\"", ")", "if", "isinstance", "(", "member", ",", "str", ")", ":", "tarinfo", "=", "self", ".", "getmember", "(", "member", ")", "else", ":", "tarinfo", "=", ...
Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above...
[ "Extract", "a", "member", "from", "the", "archive", "as", "a", "file", "object", ".", "member", "may", "be", "a", "filename", "or", "a", "TarInfo", "object", ".", "If", "member", "is", "a", "regular", "file", "a", "file", "-", "like", "object", "is", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2199-L2235
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile._extract_member
def _extract_member(self, tarinfo, targetpath, set_attrs=True): """Extract the TarInfo object tarinfo to a physical file called targetpath. """ # Fetch the TarInfo object for the given name # and build the destination pathname, replacing # forward slashes to platform s...
python
def _extract_member(self, tarinfo, targetpath, set_attrs=True): """Extract the TarInfo object tarinfo to a physical file called targetpath. """ # Fetch the TarInfo object for the given name # and build the destination pathname, replacing # forward slashes to platform s...
[ "def", "_extract_member", "(", "self", ",", "tarinfo", ",", "targetpath", ",", "set_attrs", "=", "True", ")", ":", "# Fetch the TarInfo object for the given name", "# and build the destination pathname, replacing", "# forward slashes to platform specific separators.", "targetpath",...
Extract the TarInfo object tarinfo to a physical file called targetpath.
[ "Extract", "the", "TarInfo", "object", "tarinfo", "to", "a", "physical", "file", "called", "targetpath", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2237-L2278
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.makedir
def makedir(self, tarinfo, targetpath): """Make a directory called targetpath. """ try: # Use a safe mode for the directory, the real mode is set # later in _extract_member(). os.mkdir(targetpath, 0o700) except EnvironmentError as e: if e.e...
python
def makedir(self, tarinfo, targetpath): """Make a directory called targetpath. """ try: # Use a safe mode for the directory, the real mode is set # later in _extract_member(). os.mkdir(targetpath, 0o700) except EnvironmentError as e: if e.e...
[ "def", "makedir", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "try", ":", "# Use a safe mode for the directory, the real mode is set", "# later in _extract_member().", "os", ".", "mkdir", "(", "targetpath", ",", "0o700", ")", "except", "EnvironmentError", ...
Make a directory called targetpath.
[ "Make", "a", "directory", "called", "targetpath", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2285-L2294
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.makefile
def makefile(self, tarinfo, targetpath): """Make a file called targetpath. """ source = self.fileobj source.seek(tarinfo.offset_data) target = bltn_open(targetpath, "wb") if tarinfo.sparse is not None: for offset, size in tarinfo.sparse: target...
python
def makefile(self, tarinfo, targetpath): """Make a file called targetpath. """ source = self.fileobj source.seek(tarinfo.offset_data) target = bltn_open(targetpath, "wb") if tarinfo.sparse is not None: for offset, size in tarinfo.sparse: target...
[ "def", "makefile", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "source", "=", "self", ".", "fileobj", "source", ".", "seek", "(", "tarinfo", ".", "offset_data", ")", "target", "=", "bltn_open", "(", "targetpath", ",", "\"wb\"", ")", "if", ...
Make a file called targetpath.
[ "Make", "a", "file", "called", "targetpath", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2296-L2310
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.makeunknown
def makeunknown(self, tarinfo, targetpath): """Make a file from a TarInfo object with an unknown type at targetpath. """ self.makefile(tarinfo, targetpath) self._dbg(1, "tarfile: Unknown file type %r, " \ "extracted as regular file." % tarinfo.type)
python
def makeunknown(self, tarinfo, targetpath): """Make a file from a TarInfo object with an unknown type at targetpath. """ self.makefile(tarinfo, targetpath) self._dbg(1, "tarfile: Unknown file type %r, " \ "extracted as regular file." % tarinfo.type)
[ "def", "makeunknown", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "self", ".", "makefile", "(", "tarinfo", ",", "targetpath", ")", "self", ".", "_dbg", "(", "1", ",", "\"tarfile: Unknown file type %r, \"", "\"extracted as regular file.\"", "%", "ta...
Make a file from a TarInfo object with an unknown type at targetpath.
[ "Make", "a", "file", "from", "a", "TarInfo", "object", "with", "an", "unknown", "type", "at", "targetpath", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2312-L2318
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.makefifo
def makefifo(self, tarinfo, targetpath): """Make a fifo called targetpath. """ if hasattr(os, "mkfifo"): os.mkfifo(targetpath) else: raise ExtractError("fifo not supported by system")
python
def makefifo(self, tarinfo, targetpath): """Make a fifo called targetpath. """ if hasattr(os, "mkfifo"): os.mkfifo(targetpath) else: raise ExtractError("fifo not supported by system")
[ "def", "makefifo", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "if", "hasattr", "(", "os", ",", "\"mkfifo\"", ")", ":", "os", ".", "mkfifo", "(", "targetpath", ")", "else", ":", "raise", "ExtractError", "(", "\"fifo not supported by system\"", ...
Make a fifo called targetpath.
[ "Make", "a", "fifo", "called", "targetpath", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2320-L2326
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.makedev
def makedev(self, tarinfo, targetpath): """Make a character or block device called targetpath. """ if not hasattr(os, "mknod") or not hasattr(os, "makedev"): raise ExtractError("special devices not supported by system") mode = tarinfo.mode if tarinfo.isblk(): ...
python
def makedev(self, tarinfo, targetpath): """Make a character or block device called targetpath. """ if not hasattr(os, "mknod") or not hasattr(os, "makedev"): raise ExtractError("special devices not supported by system") mode = tarinfo.mode if tarinfo.isblk(): ...
[ "def", "makedev", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "if", "not", "hasattr", "(", "os", ",", "\"mknod\"", ")", "or", "not", "hasattr", "(", "os", ",", "\"makedev\"", ")", ":", "raise", "ExtractError", "(", "\"special devices not supp...
Make a character or block device called targetpath.
[ "Make", "a", "character", "or", "block", "device", "called", "targetpath", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2328-L2341
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.makelink
def makelink(self, tarinfo, targetpath): """Make a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. """ try: # For systems that support symbolic and hard links. ...
python
def makelink(self, tarinfo, targetpath): """Make a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. """ try: # For systems that support symbolic and hard links. ...
[ "def", "makelink", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "try", ":", "# For systems that support symbolic and hard links.", "if", "tarinfo", ".", "issym", "(", ")", ":", "os", ".", "symlink", "(", "tarinfo", ".", "linkname", ",", "targetpat...
Make a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link.
[ "Make", "a", "(", "symbolic", ")", "link", "called", "targetpath", ".", "If", "it", "cannot", "be", "created", "(", "platform", "limitation", ")", "we", "try", "to", "make", "a", "copy", "of", "the", "referenced", "file", "instead", "of", "a", "link", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2343-L2370
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.chown
def chown(self, tarinfo, targetpath): """Set owner of targetpath according to tarinfo. """ if pwd and hasattr(os, "geteuid") and os.geteuid() == 0: # We have to be root to do so. try: g = grp.getgrnam(tarinfo.gname)[2] except KeyError: ...
python
def chown(self, tarinfo, targetpath): """Set owner of targetpath according to tarinfo. """ if pwd and hasattr(os, "geteuid") and os.geteuid() == 0: # We have to be root to do so. try: g = grp.getgrnam(tarinfo.gname)[2] except KeyError: ...
[ "def", "chown", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "if", "pwd", "and", "hasattr", "(", "os", ",", "\"geteuid\"", ")", "and", "os", ".", "geteuid", "(", ")", "==", "0", ":", "# We have to be root to do so.", "try", ":", "g", "=", ...
Set owner of targetpath according to tarinfo.
[ "Set", "owner", "of", "targetpath", "according", "to", "tarinfo", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2372-L2392
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.chmod
def chmod(self, tarinfo, targetpath): """Set file permissions of targetpath according to tarinfo. """ if hasattr(os, 'chmod'): try: os.chmod(targetpath, tarinfo.mode) except EnvironmentError as e: raise ExtractError("could not change mode")
python
def chmod(self, tarinfo, targetpath): """Set file permissions of targetpath according to tarinfo. """ if hasattr(os, 'chmod'): try: os.chmod(targetpath, tarinfo.mode) except EnvironmentError as e: raise ExtractError("could not change mode")
[ "def", "chmod", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "if", "hasattr", "(", "os", ",", "'chmod'", ")", ":", "try", ":", "os", ".", "chmod", "(", "targetpath", ",", "tarinfo", ".", "mode", ")", "except", "EnvironmentError", "as", "...
Set file permissions of targetpath according to tarinfo.
[ "Set", "file", "permissions", "of", "targetpath", "according", "to", "tarinfo", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2394-L2401
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.utime
def utime(self, tarinfo, targetpath): """Set modification time of targetpath according to tarinfo. """ if not hasattr(os, 'utime'): return try: os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime)) except EnvironmentError as e: raise ExtractErro...
python
def utime(self, tarinfo, targetpath): """Set modification time of targetpath according to tarinfo. """ if not hasattr(os, 'utime'): return try: os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime)) except EnvironmentError as e: raise ExtractErro...
[ "def", "utime", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "if", "not", "hasattr", "(", "os", ",", "'utime'", ")", ":", "return", "try", ":", "os", ".", "utime", "(", "targetpath", ",", "(", "tarinfo", ".", "mtime", ",", "tarinfo", "...
Set modification time of targetpath according to tarinfo.
[ "Set", "modification", "time", "of", "targetpath", "according", "to", "tarinfo", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2403-L2411
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.next
def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firs...
python
def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firs...
[ "def", "next", "(", "self", ")", ":", "self", ".", "_check", "(", "\"ra\"", ")", "if", "self", ".", "firstmember", "is", "not", "None", ":", "m", "=", "self", ".", "firstmember", "self", ".", "firstmember", "=", "None", "return", "m", "# Read the next ...
Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available.
[ "Return", "the", "next", "member", "of", "the", "archive", "as", "a", "TarInfo", "object", "when", "TarFile", "is", "opened", "for", "reading", ".", "Return", "None", "if", "there", "is", "no", "more", "available", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2414-L2458
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile._getmember
def _getmember(self, name, tarinfo=None, normalize=False): """Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. """ # Ensure that all members have been loaded. members = self.getmembers() # Limit the member searc...
python
def _getmember(self, name, tarinfo=None, normalize=False): """Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. """ # Ensure that all members have been loaded. members = self.getmembers() # Limit the member searc...
[ "def", "_getmember", "(", "self", ",", "name", ",", "tarinfo", "=", "None", ",", "normalize", "=", "False", ")", ":", "# Ensure that all members have been loaded.", "members", "=", "self", ".", "getmembers", "(", ")", "# Limit the member search list up to tarinfo.", ...
Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point.
[ "Find", "an", "archive", "member", "by", "name", "from", "bottom", "to", "top", ".", "If", "tarinfo", "is", "given", "it", "is", "used", "as", "the", "starting", "point", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2463-L2484
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile._load
def _load(self): """Read through the entire archive file and look for readable members. """ while True: tarinfo = self.next() if tarinfo is None: break self._loaded = True
python
def _load(self): """Read through the entire archive file and look for readable members. """ while True: tarinfo = self.next() if tarinfo is None: break self._loaded = True
[ "def", "_load", "(", "self", ")", ":", "while", "True", ":", "tarinfo", "=", "self", ".", "next", "(", ")", "if", "tarinfo", "is", "None", ":", "break", "self", ".", "_loaded", "=", "True" ]
Read through the entire archive file and look for readable members.
[ "Read", "through", "the", "entire", "archive", "file", "and", "look", "for", "readable", "members", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2486-L2494
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile._check
def _check(self, mode=None): """Check if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. """ if self.closed: raise IOError("%s is closed" % self.__class__.__name__) if mode is not None and self.mode not in mode: raise I...
python
def _check(self, mode=None): """Check if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. """ if self.closed: raise IOError("%s is closed" % self.__class__.__name__) if mode is not None and self.mode not in mode: raise I...
[ "def", "_check", "(", "self", ",", "mode", "=", "None", ")", ":", "if", "self", ".", "closed", ":", "raise", "IOError", "(", "\"%s is closed\"", "%", "self", ".", "__class__", ".", "__name__", ")", "if", "mode", "is", "not", "None", "and", "self", "....
Check if TarFile is still open, and if the operation's mode corresponds to TarFile's mode.
[ "Check", "if", "TarFile", "is", "still", "open", "and", "if", "the", "operation", "s", "mode", "corresponds", "to", "TarFile", "s", "mode", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2496-L2503
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile._find_link_target
def _find_link_target(self, tarinfo): """Find the target member of a symlink or hardlink member in the archive. """ if tarinfo.issym(): # Always search the entire archive. linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname limit = Non...
python
def _find_link_target(self, tarinfo): """Find the target member of a symlink or hardlink member in the archive. """ if tarinfo.issym(): # Always search the entire archive. linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname limit = Non...
[ "def", "_find_link_target", "(", "self", ",", "tarinfo", ")", ":", "if", "tarinfo", ".", "issym", "(", ")", ":", "# Always search the entire archive.", "linkname", "=", "os", ".", "path", ".", "dirname", "(", "tarinfo", ".", "name", ")", "+", "\"/\"", "+",...
Find the target member of a symlink or hardlink member in the archive.
[ "Find", "the", "target", "member", "of", "a", "symlink", "or", "hardlink", "member", "in", "the", "archive", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2505-L2522
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile._dbg
def _dbg(self, level, msg): """Write debugging output to sys.stderr. """ if level <= self.debug: print(msg, file=sys.stderr)
python
def _dbg(self, level, msg): """Write debugging output to sys.stderr. """ if level <= self.debug: print(msg, file=sys.stderr)
[ "def", "_dbg", "(", "self", ",", "level", ",", "msg", ")", ":", "if", "level", "<=", "self", ".", "debug", ":", "print", "(", "msg", ",", "file", "=", "sys", ".", "stderr", ")" ]
Write debugging output to sys.stderr.
[ "Write", "debugging", "output", "to", "sys", ".", "stderr", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2532-L2536
train
pypa/pipenv
pipenv/project.py
Project.path_to
def path_to(self, p): """Returns the absolute path to a given relative path.""" if os.path.isabs(p): return p return os.sep.join([self._original_dir, p])
python
def path_to(self, p): """Returns the absolute path to a given relative path.""" if os.path.isabs(p): return p return os.sep.join([self._original_dir, p])
[ "def", "path_to", "(", "self", ",", "p", ")", ":", "if", "os", ".", "path", ".", "isabs", "(", "p", ")", ":", "return", "p", "return", "os", ".", "sep", ".", "join", "(", "[", "self", ".", "_original_dir", ",", "p", "]", ")" ]
Returns the absolute path to a given relative path.
[ "Returns", "the", "absolute", "path", "to", "a", "given", "relative", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L159-L164
train
pypa/pipenv
pipenv/project.py
Project._build_package_list
def _build_package_list(self, package_section): """Returns a list of packages for pip-tools to consume.""" from pipenv.vendor.requirementslib.utils import is_vcs ps = {} # TODO: Separate the logic for showing packages from the filters for supplying pip-tools for k, v in self.pars...
python
def _build_package_list(self, package_section): """Returns a list of packages for pip-tools to consume.""" from pipenv.vendor.requirementslib.utils import is_vcs ps = {} # TODO: Separate the logic for showing packages from the filters for supplying pip-tools for k, v in self.pars...
[ "def", "_build_package_list", "(", "self", ",", "package_section", ")", ":", "from", "pipenv", ".", "vendor", ".", "requirementslib", ".", "utils", "import", "is_vcs", "ps", "=", "{", "}", "# TODO: Separate the logic for showing packages from the filters for supplying pip...
Returns a list of packages for pip-tools to consume.
[ "Returns", "a", "list", "of", "packages", "for", "pip", "-", "tools", "to", "consume", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L166-L219
train
pypa/pipenv
pipenv/project.py
Project._get_virtualenv_hash
def _get_virtualenv_hash(self, name): """Get the name of the virtualenv adjusted for windows if needed Returns (name, encoded_hash) """ def get_name(name, location): name = self._sanitize(name) hash = hashlib.sha256(location.encode()).digest()[:6] en...
python
def _get_virtualenv_hash(self, name): """Get the name of the virtualenv adjusted for windows if needed Returns (name, encoded_hash) """ def get_name(name, location): name = self._sanitize(name) hash = hashlib.sha256(location.encode()).digest()[:6] en...
[ "def", "_get_virtualenv_hash", "(", "self", ",", "name", ")", ":", "def", "get_name", "(", "name", ",", "location", ")", ":", "name", "=", "self", ".", "_sanitize", "(", "name", ")", "hash", "=", "hashlib", ".", "sha256", "(", "location", ".", "encode"...
Get the name of the virtualenv adjusted for windows if needed Returns (name, encoded_hash)
[ "Get", "the", "name", "of", "the", "virtualenv", "adjusted", "for", "windows", "if", "needed" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L368-L407
train
pypa/pipenv
pipenv/project.py
Project.register_proper_name
def register_proper_name(self, name): """Registers a proper name to the database.""" with self.proper_names_db_path.open("a") as f: f.write(u"{0}\n".format(name))
python
def register_proper_name(self, name): """Registers a proper name to the database.""" with self.proper_names_db_path.open("a") as f: f.write(u"{0}\n".format(name))
[ "def", "register_proper_name", "(", "self", ",", "name", ")", ":", "with", "self", ".", "proper_names_db_path", ".", "open", "(", "\"a\"", ")", "as", "f", ":", "f", ".", "write", "(", "u\"{0}\\n\"", ".", "format", "(", "name", ")", ")" ]
Registers a proper name to the database.
[ "Registers", "a", "proper", "name", "to", "the", "database", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L462-L465
train
pypa/pipenv
pipenv/project.py
Project.parsed_pipfile
def parsed_pipfile(self): """Parse Pipfile into a TOMLFile and cache it (call clear_pipfile_cache() afterwards if mutating)""" contents = self.read_pipfile() # use full contents to get around str/bytes 2/3 issues cache_key = (self.pipfile_location, contents) if cache_key...
python
def parsed_pipfile(self): """Parse Pipfile into a TOMLFile and cache it (call clear_pipfile_cache() afterwards if mutating)""" contents = self.read_pipfile() # use full contents to get around str/bytes 2/3 issues cache_key = (self.pipfile_location, contents) if cache_key...
[ "def", "parsed_pipfile", "(", "self", ")", ":", "contents", "=", "self", ".", "read_pipfile", "(", ")", "# use full contents to get around str/bytes 2/3 issues", "cache_key", "=", "(", "self", ".", "pipfile_location", ",", "contents", ")", "if", "cache_key", "not", ...
Parse Pipfile into a TOMLFile and cache it (call clear_pipfile_cache() afterwards if mutating)
[ "Parse", "Pipfile", "into", "a", "TOMLFile", "and", "cache", "it" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L491-L501
train
pypa/pipenv
pipenv/project.py
Project._lockfile
def _lockfile(self): """Pipfile.lock divided by PyPI and external dependencies.""" pfile = pipfile.load(self.pipfile_location, inject_env=False) lockfile = json.loads(pfile.lock()) for section in ("default", "develop"): lock_section = lockfile.get(section, {}) for...
python
def _lockfile(self): """Pipfile.lock divided by PyPI and external dependencies.""" pfile = pipfile.load(self.pipfile_location, inject_env=False) lockfile = json.loads(pfile.lock()) for section in ("default", "develop"): lock_section = lockfile.get(section, {}) for...
[ "def", "_lockfile", "(", "self", ")", ":", "pfile", "=", "pipfile", ".", "load", "(", "self", ".", "pipfile_location", ",", "inject_env", "=", "False", ")", "lockfile", "=", "json", ".", "loads", "(", "pfile", ".", "lock", "(", ")", ")", "for", "sect...
Pipfile.lock divided by PyPI and external dependencies.
[ "Pipfile", ".", "lock", "divided", "by", "PyPI", "and", "external", "dependencies", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L581-L590
train
pypa/pipenv
pipenv/project.py
Project.all_packages
def all_packages(self): """Returns a list of all packages.""" p = dict(self.parsed_pipfile.get("dev-packages", {})) p.update(self.parsed_pipfile.get("packages", {})) return p
python
def all_packages(self): """Returns a list of all packages.""" p = dict(self.parsed_pipfile.get("dev-packages", {})) p.update(self.parsed_pipfile.get("packages", {})) return p
[ "def", "all_packages", "(", "self", ")", ":", "p", "=", "dict", "(", "self", ".", "parsed_pipfile", ".", "get", "(", "\"dev-packages\"", ",", "{", "}", ")", ")", "p", ".", "update", "(", "self", ".", "parsed_pipfile", ".", "get", "(", "\"packages\"", ...
Returns a list of all packages.
[ "Returns", "a", "list", "of", "all", "packages", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L648-L652
train
pypa/pipenv
pipenv/project.py
Project.create_pipfile
def create_pipfile(self, python=None): """Creates the Pipfile, filled with juicy defaults.""" from .vendor.pip_shims.shims import ( ConfigOptionParser, make_option_group, index_group ) config_parser = ConfigOptionParser(name=self.name) config_parser.add_option_group(...
python
def create_pipfile(self, python=None): """Creates the Pipfile, filled with juicy defaults.""" from .vendor.pip_shims.shims import ( ConfigOptionParser, make_option_group, index_group ) config_parser = ConfigOptionParser(name=self.name) config_parser.add_option_group(...
[ "def", "create_pipfile", "(", "self", ",", "python", "=", "None", ")", ":", "from", ".", "vendor", ".", "pip_shims", ".", "shims", "import", "(", "ConfigOptionParser", ",", "make_option_group", ",", "index_group", ")", "config_parser", "=", "ConfigOptionParser",...
Creates the Pipfile, filled with juicy defaults.
[ "Creates", "the", "Pipfile", "filled", "with", "juicy", "defaults", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L674-L715
train
pypa/pipenv
pipenv/project.py
Project.write_toml
def write_toml(self, data, path=None): """Writes the given data structure out as TOML.""" if path is None: path = self.pipfile_location data = convert_toml_outline_tables(data) try: formatted_data = tomlkit.dumps(data).rstrip() except Exception: ...
python
def write_toml(self, data, path=None): """Writes the given data structure out as TOML.""" if path is None: path = self.pipfile_location data = convert_toml_outline_tables(data) try: formatted_data = tomlkit.dumps(data).rstrip() except Exception: ...
[ "def", "write_toml", "(", "self", ",", "data", ",", "path", "=", "None", ")", ":", "if", "path", "is", "None", ":", "path", "=", "self", ".", "pipfile_location", "data", "=", "convert_toml_outline_tables", "(", "data", ")", "try", ":", "formatted_data", ...
Writes the given data structure out as TOML.
[ "Writes", "the", "given", "data", "structure", "out", "as", "TOML", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L783-L815
train
pypa/pipenv
pipenv/project.py
Project.write_lockfile
def write_lockfile(self, content): """Write out the lockfile. """ s = self._lockfile_encoder.encode(content) open_kwargs = {"newline": self._lockfile_newlines, "encoding": "utf-8"} with vistir.contextmanagers.atomic_open_for_write( self.lockfile_location, **open_kwarg...
python
def write_lockfile(self, content): """Write out the lockfile. """ s = self._lockfile_encoder.encode(content) open_kwargs = {"newline": self._lockfile_newlines, "encoding": "utf-8"} with vistir.contextmanagers.atomic_open_for_write( self.lockfile_location, **open_kwarg...
[ "def", "write_lockfile", "(", "self", ",", "content", ")", ":", "s", "=", "self", ".", "_lockfile_encoder", ".", "encode", "(", "content", ")", "open_kwargs", "=", "{", "\"newline\"", ":", "self", ".", "_lockfile_newlines", ",", "\"encoding\"", ":", "\"utf-8...
Write out the lockfile.
[ "Write", "out", "the", "lockfile", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L817-L829
train
pypa/pipenv
pipenv/project.py
Project.find_source
def find_source(self, source): """ Given a source, find it. source can be a url or an index name. """ if not is_valid_url(source): try: source = self.get_source(name=source) except SourceNotFound: source = self.get_source(u...
python
def find_source(self, source): """ Given a source, find it. source can be a url or an index name. """ if not is_valid_url(source): try: source = self.get_source(name=source) except SourceNotFound: source = self.get_source(u...
[ "def", "find_source", "(", "self", ",", "source", ")", ":", "if", "not", "is_valid_url", "(", "source", ")", ":", "try", ":", "source", "=", "self", ".", "get_source", "(", "name", "=", "source", ")", "except", "SourceNotFound", ":", "source", "=", "se...
Given a source, find it. source can be a url or an index name.
[ "Given", "a", "source", "find", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L854-L867
train
pypa/pipenv
pipenv/project.py
Project.get_package_name_in_pipfile
def get_package_name_in_pipfile(self, package_name, dev=False): """Get the equivalent package name in pipfile""" key = "dev-packages" if dev else "packages" section = self.parsed_pipfile.get(key, {}) package_name = pep423_name(package_name) for name in section.keys(): ...
python
def get_package_name_in_pipfile(self, package_name, dev=False): """Get the equivalent package name in pipfile""" key = "dev-packages" if dev else "packages" section = self.parsed_pipfile.get(key, {}) package_name = pep423_name(package_name) for name in section.keys(): ...
[ "def", "get_package_name_in_pipfile", "(", "self", ",", "package_name", ",", "dev", "=", "False", ")", ":", "key", "=", "\"dev-packages\"", "if", "dev", "else", "\"packages\"", "section", "=", "self", ".", "parsed_pipfile", ".", "get", "(", "key", ",", "{", ...
Get the equivalent package name in pipfile
[ "Get", "the", "equivalent", "package", "name", "in", "pipfile" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L898-L906
train
pypa/pipenv
pipenv/project.py
Project.add_index_to_pipfile
def add_index_to_pipfile(self, index, verify_ssl=True): """Adds a given index to the Pipfile.""" # Read and append Pipfile. p = self.parsed_pipfile try: self.get_source(url=index) except SourceNotFound: source = {"url": index, "verify_ssl": verify_ssl} ...
python
def add_index_to_pipfile(self, index, verify_ssl=True): """Adds a given index to the Pipfile.""" # Read and append Pipfile. p = self.parsed_pipfile try: self.get_source(url=index) except SourceNotFound: source = {"url": index, "verify_ssl": verify_ssl} ...
[ "def", "add_index_to_pipfile", "(", "self", ",", "index", ",", "verify_ssl", "=", "True", ")", ":", "# Read and append Pipfile.", "p", "=", "self", ".", "parsed_pipfile", "try", ":", "self", ".", "get_source", "(", "url", "=", "index", ")", "except", "Source...
Adds a given index to the Pipfile.
[ "Adds", "a", "given", "index", "to", "the", "Pipfile", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L969-L986
train
pypa/pipenv
pipenv/project.py
Project.ensure_proper_casing
def ensure_proper_casing(self): """Ensures proper casing of Pipfile packages""" pfile = self.parsed_pipfile casing_changed = self.proper_case_section(pfile.get("packages", {})) casing_changed |= self.proper_case_section(pfile.get("dev-packages", {})) return casing_changed
python
def ensure_proper_casing(self): """Ensures proper casing of Pipfile packages""" pfile = self.parsed_pipfile casing_changed = self.proper_case_section(pfile.get("packages", {})) casing_changed |= self.proper_case_section(pfile.get("dev-packages", {})) return casing_changed
[ "def", "ensure_proper_casing", "(", "self", ")", ":", "pfile", "=", "self", ".", "parsed_pipfile", "casing_changed", "=", "self", ".", "proper_case_section", "(", "pfile", ".", "get", "(", "\"packages\"", ",", "{", "}", ")", ")", "casing_changed", "|=", "sel...
Ensures proper casing of Pipfile packages
[ "Ensures", "proper", "casing", "of", "Pipfile", "packages" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L1028-L1033
train
pypa/pipenv
pipenv/project.py
Project.proper_case_section
def proper_case_section(self, section): """Verify proper casing is retrieved, when available, for each dependency in the section. """ # Casing for section. changed_values = False unknown_names = [k for k in section.keys() if k not in set(self.proper_names)] # Repl...
python
def proper_case_section(self, section): """Verify proper casing is retrieved, when available, for each dependency in the section. """ # Casing for section. changed_values = False unknown_names = [k for k in section.keys() if k not in set(self.proper_names)] # Repl...
[ "def", "proper_case_section", "(", "self", ",", "section", ")", ":", "# Casing for section.", "changed_values", "=", "False", "unknown_names", "=", "[", "k", "for", "k", "in", "section", ".", "keys", "(", ")", "if", "k", "not", "in", "set", "(", "self", ...
Verify proper casing is retrieved, when available, for each dependency in the section.
[ "Verify", "proper", "casing", "is", "retrieved", "when", "available", "for", "each", "dependency", "in", "the", "section", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L1035-L1059
train
pypa/pipenv
pipenv/vendor/jinja2/nativetypes.py
native_concat
def native_concat(nodes): """Return a native Python type from the list of compiled nodes. If the result is a single node, its value is returned. Otherwise, the nodes are concatenated as strings. If the result can be parsed with :func:`ast.literal_eval`, the parsed value is returned. Otherwise, the s...
python
def native_concat(nodes): """Return a native Python type from the list of compiled nodes. If the result is a single node, its value is returned. Otherwise, the nodes are concatenated as strings. If the result can be parsed with :func:`ast.literal_eval`, the parsed value is returned. Otherwise, the s...
[ "def", "native_concat", "(", "nodes", ")", ":", "head", "=", "list", "(", "islice", "(", "nodes", ",", "2", ")", ")", "if", "not", "head", ":", "return", "None", "if", "len", "(", "head", ")", "==", "1", ":", "out", "=", "head", "[", "0", "]", ...
Return a native Python type from the list of compiled nodes. If the result is a single node, its value is returned. Otherwise, the nodes are concatenated as strings. If the result can be parsed with :func:`ast.literal_eval`, the parsed value is returned. Otherwise, the string is returned.
[ "Return", "a", "native", "Python", "type", "from", "the", "list", "of", "compiled", "nodes", ".", "If", "the", "result", "is", "a", "single", "node", "its", "value", "is", "returned", ".", "Otherwise", "the", "nodes", "are", "concatenated", "as", "strings"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nativetypes.py#L11-L31
train
pypa/pipenv
pipenv/vendor/jinja2/nativetypes.py
NativeCodeGenerator.visit_Output
def visit_Output(self, node, frame): """Same as :meth:`CodeGenerator.visit_Output`, but do not call ``to_string`` on output nodes in generated code. """ if self.has_known_extends and frame.require_output_check: return finalize = self.environment.finalize fina...
python
def visit_Output(self, node, frame): """Same as :meth:`CodeGenerator.visit_Output`, but do not call ``to_string`` on output nodes in generated code. """ if self.has_known_extends and frame.require_output_check: return finalize = self.environment.finalize fina...
[ "def", "visit_Output", "(", "self", ",", "node", ",", "frame", ")", ":", "if", "self", ".", "has_known_extends", "and", "frame", ".", "require_output_check", ":", "return", "finalize", "=", "self", ".", "environment", ".", "finalize", "finalize_context", "=", ...
Same as :meth:`CodeGenerator.visit_Output`, but do not call ``to_string`` on output nodes in generated code.
[ "Same", "as", ":", "meth", ":", "CodeGenerator", ".", "visit_Output", "but", "do", "not", "call", "to_string", "on", "output", "nodes", "in", "generated", "code", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nativetypes.py#L39-L195
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.load
def load(self, *args, **kwargs): """ Clear all existing key:value items and import all key:value items from <mapping>. If multiple values exist for the same key in <mapping>, they are all be imported. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) ...
python
def load(self, *args, **kwargs): """ Clear all existing key:value items and import all key:value items from <mapping>. If multiple values exist for the same key in <mapping>, they are all be imported. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) ...
[ "def", "load", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "clear", "(", ")", "self", ".", "updateall", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "self" ]
Clear all existing key:value items and import all key:value items from <mapping>. If multiple values exist for the same key in <mapping>, they are all be imported. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.load([(4,4), (4,44), (5,5)]) omd.al...
[ "Clear", "all", "existing", "key", ":", "value", "items", "and", "import", "all", "key", ":", "value", "items", "from", "<mapping", ">", ".", "If", "multiple", "values", "exist", "for", "the", "same", "key", "in", "<mapping", ">", "they", "are", "all", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L156-L171
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.updateall
def updateall(self, *args, **kwargs): """ Update this dictionary with the items from <mapping>, replacing existing key:value items with shared keys before adding new key:value items. Example: omd = omdict([(1,1), (2,2)]) omd.updateall([(2,'two'), (1,'one'), (...
python
def updateall(self, *args, **kwargs): """ Update this dictionary with the items from <mapping>, replacing existing key:value items with shared keys before adding new key:value items. Example: omd = omdict([(1,1), (2,2)]) omd.updateall([(2,'two'), (1,'one'), (...
[ "def", "updateall", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_update_updateall", "(", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", "return", "self" ]
Update this dictionary with the items from <mapping>, replacing existing key:value items with shared keys before adding new key:value items. Example: omd = omdict([(1,1), (2,2)]) omd.updateall([(2,'two'), (1,'one'), (2,222), (1,111)]) omd.allitems() == [(1, 'one'),...
[ "Update", "this", "dictionary", "with", "the", "items", "from", "<mapping", ">", "replacing", "existing", "key", ":", "value", "items", "with", "shared", "keys", "before", "adding", "new", "key", ":", "value", "items", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L201-L215
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict._bin_update_items
def _bin_update_items(self, items, replace_at_most_one, replacements, leftovers): """ <replacements and <leftovers> are modified directly, ala pass by reference. """ for key, value in items: # If there are existing items with key <key> that h...
python
def _bin_update_items(self, items, replace_at_most_one, replacements, leftovers): """ <replacements and <leftovers> are modified directly, ala pass by reference. """ for key, value in items: # If there are existing items with key <key> that h...
[ "def", "_bin_update_items", "(", "self", ",", "items", ",", "replace_at_most_one", ",", "replacements", ",", "leftovers", ")", ":", "for", "key", ",", "value", "in", "items", ":", "# If there are existing items with key <key> that have yet to be", "# marked for replacemen...
<replacements and <leftovers> are modified directly, ala pass by reference.
[ "<replacements", "and", "<leftovers", ">", "are", "modified", "directly", "ala", "pass", "by", "reference", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L235-L254
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.getlist
def getlist(self, key, default=[]): """ Returns: The list of values for <key> if <key> is in the dictionary, else <default>. If <default> is not provided, an empty list is returned. """ if key in self: return [node.value for node in self._map[key]] ret...
python
def getlist(self, key, default=[]): """ Returns: The list of values for <key> if <key> is in the dictionary, else <default>. If <default> is not provided, an empty list is returned. """ if key in self: return [node.value for node in self._map[key]] ret...
[ "def", "getlist", "(", "self", ",", "key", ",", "default", "=", "[", "]", ")", ":", "if", "key", "in", "self", ":", "return", "[", "node", ".", "value", "for", "node", "in", "self", ".", "_map", "[", "key", "]", "]", "return", "default" ]
Returns: The list of values for <key> if <key> is in the dictionary, else <default>. If <default> is not provided, an empty list is returned.
[ "Returns", ":", "The", "list", "of", "values", "for", "<key", ">", "if", "<key", ">", "is", "in", "the", "dictionary", "else", "<default", ">", ".", "If", "<default", ">", "is", "not", "provided", "an", "empty", "list", "is", "returned", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L274-L282
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.setdefaultlist
def setdefaultlist(self, key, defaultlist=[None]): """ Similar to setdefault() except <defaultlist> is a list of values to set for <key>. If <key> already exists, its existing list of values is returned. If <key> isn't a key and <defaultlist> is an empty list, [], no values ...
python
def setdefaultlist(self, key, defaultlist=[None]): """ Similar to setdefault() except <defaultlist> is a list of values to set for <key>. If <key> already exists, its existing list of values is returned. If <key> isn't a key and <defaultlist> is an empty list, [], no values ...
[ "def", "setdefaultlist", "(", "self", ",", "key", ",", "defaultlist", "=", "[", "None", "]", ")", ":", "if", "key", "in", "self", ":", "return", "self", ".", "getlist", "(", "key", ")", "self", ".", "addlist", "(", "key", ",", "defaultlist", ")", "...
Similar to setdefault() except <defaultlist> is a list of values to set for <key>. If <key> already exists, its existing list of values is returned. If <key> isn't a key and <defaultlist> is an empty list, [], no values are added for <key> and <key> will not be added as a key. ...
[ "Similar", "to", "setdefault", "()", "except", "<defaultlist", ">", "is", "a", "list", "of", "values", "to", "set", "for", "<key", ">", ".", "If", "<key", ">", "already", "exists", "its", "existing", "list", "of", "values", "is", "returned", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L290-L305
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.addlist
def addlist(self, key, valuelist=[]): """ Add the values in <valuelist> to the list of values for <key>. If <key> is not in the dictionary, the values in <valuelist> become the values for <key>. Example: omd = omdict([(1,1)]) omd.addlist(1, [11, 111]) ...
python
def addlist(self, key, valuelist=[]): """ Add the values in <valuelist> to the list of values for <key>. If <key> is not in the dictionary, the values in <valuelist> become the values for <key>. Example: omd = omdict([(1,1)]) omd.addlist(1, [11, 111]) ...
[ "def", "addlist", "(", "self", ",", "key", ",", "valuelist", "=", "[", "]", ")", ":", "for", "value", "in", "valuelist", ":", "self", ".", "add", "(", "key", ",", "value", ")", "return", "self" ]
Add the values in <valuelist> to the list of values for <key>. If <key> is not in the dictionary, the values in <valuelist> become the values for <key>. Example: omd = omdict([(1,1)]) omd.addlist(1, [11, 111]) omd.allitems() == [(1, 1), (1, 11), (1, 111)] ...
[ "Add", "the", "values", "in", "<valuelist", ">", "to", "the", "list", "of", "values", "for", "<key", ">", ".", "If", "<key", ">", "is", "not", "in", "the", "dictionary", "the", "values", "in", "<valuelist", ">", "become", "the", "values", "for", "<key"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L325-L342
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.setlist
def setlist(self, key, values): """ Sets <key>'s list of values to <values>. Existing items with key <key> are first replaced with new values from <values>. Any remaining old items that haven't been replaced with new values are deleted, and any new values from <values> that don't...
python
def setlist(self, key, values): """ Sets <key>'s list of values to <values>. Existing items with key <key> are first replaced with new values from <values>. Any remaining old items that haven't been replaced with new values are deleted, and any new values from <values> that don't...
[ "def", "setlist", "(", "self", ",", "key", ",", "values", ")", ":", "if", "not", "values", "and", "key", "in", "self", ":", "self", ".", "pop", "(", "key", ")", "else", ":", "it", "=", "zip_longest", "(", "list", "(", "self", ".", "_map", ".", ...
Sets <key>'s list of values to <values>. Existing items with key <key> are first replaced with new values from <values>. Any remaining old items that haven't been replaced with new values are deleted, and any new values from <values> that don't have corresponding items with <key> to repl...
[ "Sets", "<key", ">", "s", "list", "of", "values", "to", "<values", ">", ".", "Existing", "items", "with", "key", "<key", ">", "are", "first", "replaced", "with", "new", "values", "from", "<values", ">", ".", "Any", "remaining", "old", "items", "that", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L353-L392
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.removevalues
def removevalues(self, key, values): """ Removes all <values> from the values of <key>. If <key> has no remaining values after removevalues(), the key is popped. Example: omd = omdict([(1, 1), (1, 11), (1, 1), (1, 111)]) omd.removevalues(1, [1, 111]) omd.al...
python
def removevalues(self, key, values): """ Removes all <values> from the values of <key>. If <key> has no remaining values after removevalues(), the key is popped. Example: omd = omdict([(1, 1), (1, 11), (1, 1), (1, 111)]) omd.removevalues(1, [1, 111]) omd.al...
[ "def", "removevalues", "(", "self", ",", "key", ",", "values", ")", ":", "self", ".", "setlist", "(", "key", ",", "[", "v", "for", "v", "in", "self", ".", "getlist", "(", "key", ")", "if", "v", "not", "in", "values", "]", ")", "return", "self" ]
Removes all <values> from the values of <key>. If <key> has no remaining values after removevalues(), the key is popped. Example: omd = omdict([(1, 1), (1, 11), (1, 1), (1, 111)]) omd.removevalues(1, [1, 111]) omd.allitems() == [(1, 11)] Returns: <self>.
[ "Removes", "all", "<values", ">", "from", "the", "values", "of", "<key", ">", ".", "If", "<key", ">", "has", "no", "remaining", "values", "after", "removevalues", "()", "the", "key", "is", "popped", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L394-L407
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.poplist
def poplist(self, key, default=_absent): """ If <key> is in the dictionary, pop it and return its list of values. If <key> is not in the dictionary, return <default>. KeyError is raised if <default> is not provided and <key> is not in the dictionary. Example: omd = omd...
python
def poplist(self, key, default=_absent): """ If <key> is in the dictionary, pop it and return its list of values. If <key> is not in the dictionary, return <default>. KeyError is raised if <default> is not provided and <key> is not in the dictionary. Example: omd = omd...
[ "def", "poplist", "(", "self", ",", "key", ",", "default", "=", "_absent", ")", ":", "if", "key", "in", "self", ":", "values", "=", "self", ".", "getlist", "(", "key", ")", "del", "self", ".", "_map", "[", "key", "]", "for", "node", ",", "nodekey...
If <key> is in the dictionary, pop it and return its list of values. If <key> is not in the dictionary, return <default>. KeyError is raised if <default> is not provided and <key> is not in the dictionary. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.pop...
[ "If", "<key", ">", "is", "in", "the", "dictionary", "pop", "it", "and", "return", "its", "list", "of", "values", ".", "If", "<key", ">", "is", "not", "in", "the", "dictionary", "return", "<default", ">", ".", "KeyError", "is", "raised", "if", "<default...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L416-L442
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.popvalue
def popvalue(self, key, value=_absent, default=_absent, last=True): """ If <value> is provided, pops the first or last (key,value) item in the dictionary if <key> is in the dictionary. If <value> is not provided, pops the first or last value for <key> if <key> is in the dictiona...
python
def popvalue(self, key, value=_absent, default=_absent, last=True): """ If <value> is provided, pops the first or last (key,value) item in the dictionary if <key> is in the dictionary. If <value> is not provided, pops the first or last value for <key> if <key> is in the dictiona...
[ "def", "popvalue", "(", "self", ",", "key", ",", "value", "=", "_absent", ",", "default", "=", "_absent", ",", "last", "=", "True", ")", ":", "def", "pop_node_with_index", "(", "key", ",", "index", ")", ":", "node", "=", "self", ".", "_map", "[", "...
If <value> is provided, pops the first or last (key,value) item in the dictionary if <key> is in the dictionary. If <value> is not provided, pops the first or last value for <key> if <key> is in the dictionary. If <key> no longer has any values after a popvalue() call, <key> is ...
[ "If", "<value", ">", "is", "provided", "pops", "the", "first", "or", "last", "(", "key", "value", ")", "item", "in", "the", "dictionary", "if", "<key", ">", "is", "in", "the", "dictionary", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L444-L501
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.popitem
def popitem(self, fromall=False, last=True): """ Pop and return a key:value item. If <fromall> is False, items()[0] is popped if <last> is False or items()[-1] is popped if <last> is True. All remaining items with the same key are removed. If <fromall> is True, allitems...
python
def popitem(self, fromall=False, last=True): """ Pop and return a key:value item. If <fromall> is False, items()[0] is popped if <last> is False or items()[-1] is popped if <last> is True. All remaining items with the same key are removed. If <fromall> is True, allitems...
[ "def", "popitem", "(", "self", ",", "fromall", "=", "False", ",", "last", "=", "True", ")", ":", "if", "not", "self", ".", "_items", ":", "raise", "KeyError", "(", "'popitem(): %s is empty'", "%", "self", ".", "__class__", ".", "__name__", ")", "if", "...
Pop and return a key:value item. If <fromall> is False, items()[0] is popped if <last> is False or items()[-1] is popped if <last> is True. All remaining items with the same key are removed. If <fromall> is True, allitems()[0] is popped if <last> is False or allitems()[-1] is p...
[ "Pop", "and", "return", "a", "key", ":", "value", "item", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L503-L544
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.poplistitem
def poplistitem(self, last=True): """ Pop and return a key:valuelist item comprised of a key and that key's list of values. If <last> is False, a key:valuelist item comprised of keys()[0] and its list of values is popped and returned. If <last> is True, a key:valuelist item compr...
python
def poplistitem(self, last=True): """ Pop and return a key:valuelist item comprised of a key and that key's list of values. If <last> is False, a key:valuelist item comprised of keys()[0] and its list of values is popped and returned. If <last> is True, a key:valuelist item compr...
[ "def", "poplistitem", "(", "self", ",", "last", "=", "True", ")", ":", "if", "not", "self", ".", "_items", ":", "s", "=", "'poplistitem(): %s is empty'", "%", "self", ".", "__class__", ".", "__name__", "raise", "KeyError", "(", "s", ")", "key", "=", "s...
Pop and return a key:valuelist item comprised of a key and that key's list of values. If <last> is False, a key:valuelist item comprised of keys()[0] and its list of values is popped and returned. If <last> is True, a key:valuelist item comprised of keys()[-1] and its list of values is p...
[ "Pop", "and", "return", "a", "key", ":", "valuelist", "item", "comprised", "of", "a", "key", "and", "that", "key", "s", "list", "of", "values", ".", "If", "<last", ">", "is", "False", "a", "key", ":", "valuelist", "item", "comprised", "of", "keys", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L546-L571
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.values
def values(self, key=_absent): """ Raises: KeyError if <key> is provided and not in the dictionary. Returns: List created from itervalues(<key>).If <key> is provided and is a dictionary key, only values of items with key <key> are returned. """ if key is not _...
python
def values(self, key=_absent): """ Raises: KeyError if <key> is provided and not in the dictionary. Returns: List created from itervalues(<key>).If <key> is provided and is a dictionary key, only values of items with key <key> are returned. """ if key is not _...
[ "def", "values", "(", "self", ",", "key", "=", "_absent", ")", ":", "if", "key", "is", "not", "_absent", "and", "key", "in", "self", ".", "_map", ":", "return", "self", ".", "getlist", "(", "key", ")", "return", "list", "(", "self", ".", "itervalue...
Raises: KeyError if <key> is provided and not in the dictionary. Returns: List created from itervalues(<key>).If <key> is provided and is a dictionary key, only values of items with key <key> are returned.
[ "Raises", ":", "KeyError", "if", "<key", ">", "is", "provided", "and", "not", "in", "the", "dictionary", ".", "Returns", ":", "List", "created", "from", "itervalues", "(", "<key", ">", ")", ".", "If", "<key", ">", "is", "provided", "and", "is", "a", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L584-L593
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.iteritems
def iteritems(self, key=_absent): """ Parity with dict.iteritems() except the optional <key> parameter has been added. If <key> is provided, only items with the provided key are iterated over. KeyError is raised if <key> is provided and not in the dictionary. Example: ...
python
def iteritems(self, key=_absent): """ Parity with dict.iteritems() except the optional <key> parameter has been added. If <key> is provided, only items with the provided key are iterated over. KeyError is raised if <key> is provided and not in the dictionary. Example: ...
[ "def", "iteritems", "(", "self", ",", "key", "=", "_absent", ")", ":", "if", "key", "is", "not", "_absent", ":", "if", "key", "in", "self", ":", "items", "=", "[", "(", "node", ".", "key", ",", "node", ".", "value", ")", "for", "node", "in", "s...
Parity with dict.iteritems() except the optional <key> parameter has been added. If <key> is provided, only items with the provided key are iterated over. KeyError is raised if <key> is provided and not in the dictionary. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (...
[ "Parity", "with", "dict", ".", "iteritems", "()", "except", "the", "optional", "<key", ">", "parameter", "has", "been", "added", ".", "If", "<key", ">", "is", "provided", "only", "items", "with", "the", "provided", "key", "are", "iterated", "over", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L607-L629
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.itervalues
def itervalues(self, key=_absent): """ Parity with dict.itervalues() except the optional <key> parameter has been added. If <key> is provided, only values from items with the provided key are iterated over. KeyError is raised if <key> is provided and not in the dictionary. ...
python
def itervalues(self, key=_absent): """ Parity with dict.itervalues() except the optional <key> parameter has been added. If <key> is provided, only values from items with the provided key are iterated over. KeyError is raised if <key> is provided and not in the dictionary. ...
[ "def", "itervalues", "(", "self", ",", "key", "=", "_absent", ")", ":", "if", "key", "is", "not", "_absent", ":", "if", "key", "in", "self", ":", "return", "iter", "(", "[", "node", ".", "value", "for", "node", "in", "self", ".", "_map", "[", "ke...
Parity with dict.itervalues() except the optional <key> parameter has been added. If <key> is provided, only values from items with the provided key are iterated over. KeyError is raised if <key> is provided and not in the dictionary. Example: omd = omdict([(1,1), (1,11), (1,1...
[ "Parity", "with", "dict", ".", "itervalues", "()", "except", "the", "optional", "<key", ">", "parameter", "has", "been", "added", ".", "If", "<key", ">", "is", "provided", "only", "values", "from", "items", "with", "the", "provided", "key", "are", "iterate...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L634-L654
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.iterallitems
def iterallitems(self, key=_absent): ''' Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.iterallitems() == (1,1) -> (1,11) -> (1,111) -> (2,2) -> (3,3) omd.iterallitems(1) == (1,1) -> (1,11) -> (1,111) Raises: KeyError if <key> is provided and not...
python
def iterallitems(self, key=_absent): ''' Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.iterallitems() == (1,1) -> (1,11) -> (1,111) -> (2,2) -> (3,3) omd.iterallitems(1) == (1,1) -> (1,11) -> (1,111) Raises: KeyError if <key> is provided and not...
[ "def", "iterallitems", "(", "self", ",", "key", "=", "_absent", ")", ":", "if", "key", "is", "not", "_absent", ":", "# Raises KeyError if <key> is not in self._map.", "return", "self", ".", "iteritems", "(", "key", ")", "return", "self", ".", "_items", ".", ...
Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.iterallitems() == (1,1) -> (1,11) -> (1,111) -> (2,2) -> (3,3) omd.iterallitems(1) == (1,1) -> (1,11) -> (1,111) Raises: KeyError if <key> is provided and not in the dictionary. Returns: An iterator over eve...
[ "Example", ":", "omd", "=", "omdict", "(", "[", "(", "1", "1", ")", "(", "1", "11", ")", "(", "1", "111", ")", "(", "2", "2", ")", "(", "3", "3", ")", "]", ")", "omd", ".", "iterallitems", "()", "==", "(", "1", "1", ")", "-", ">", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L685-L699
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.iterallvalues
def iterallvalues(self, key=_absent): ''' Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.iterallvalues() == 1 -> 11 -> 111 -> 2 -> 3 Returns: An iterator over the values of every item in the dictionary. ''' if key is not _absent: ...
python
def iterallvalues(self, key=_absent): ''' Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.iterallvalues() == 1 -> 11 -> 111 -> 2 -> 3 Returns: An iterator over the values of every item in the dictionary. ''' if key is not _absent: ...
[ "def", "iterallvalues", "(", "self", ",", "key", "=", "_absent", ")", ":", "if", "key", "is", "not", "_absent", ":", "if", "key", "in", "self", ":", "return", "iter", "(", "self", ".", "getlist", "(", "key", ")", ")", "raise", "KeyError", "(", "key...
Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.iterallvalues() == 1 -> 11 -> 111 -> 2 -> 3 Returns: An iterator over the values of every item in the dictionary.
[ "Example", ":", "omd", "=", "omdict", "(", "[", "(", "1", "1", ")", "(", "1", "11", ")", "(", "1", "111", ")", "(", "2", "2", ")", "(", "3", "3", ")", "]", ")", "omd", ".", "iterallvalues", "()", "==", "1", "-", ">", "11", "-", ">", "11...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L711-L723
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
omdict.reverse
def reverse(self): """ Reverse the order of all items in the dictionary. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.reverse() omd.allitems() == [(3,3), (2,2), (1,111), (1,11), (1,1)] Returns: <self>. """ for key in si...
python
def reverse(self): """ Reverse the order of all items in the dictionary. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.reverse() omd.allitems() == [(3,3), (2,2), (1,111), (1,11), (1,1)] Returns: <self>. """ for key in si...
[ "def", "reverse", "(", "self", ")", ":", "for", "key", "in", "six", ".", "iterkeys", "(", "self", ".", "_map", ")", ":", "self", ".", "_map", "[", "key", "]", ".", "reverse", "(", ")", "self", ".", "_items", ".", "reverse", "(", ")", "return", ...
Reverse the order of all items in the dictionary. Example: omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)]) omd.reverse() omd.allitems() == [(3,3), (2,2), (1,111), (1,11), (1,1)] Returns: <self>.
[ "Reverse", "the", "order", "of", "all", "items", "in", "the", "dictionary", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L746-L760
train
pypa/pipenv
pipenv/patched/notpip/_internal/build_env.py
BuildEnvironment.check_requirements
def check_requirements(self, reqs): # type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]] """Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs """ missing = set() conflicting = ...
python
def check_requirements(self, reqs): # type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]] """Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs """ missing = set() conflicting = ...
[ "def", "check_requirements", "(", "self", ",", "reqs", ")", ":", "# type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]", "missing", "=", "set", "(", ")", "conflicting", "=", "set", "(", ")", "if", "reqs", ":", "ws", "=", "WorkingSet", "(", "self", "....
Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs
[ "Return", "2", "sets", ":", "-", "conflicting", "requirements", ":", "set", "of", "(", "installed", "wanted", ")", "reqs", "tuples", "-", "missing", "requirements", ":", "set", "of", "reqs" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/build_env.py#L137-L154
train
pypa/pipenv
pipenv/vendor/click/parser.py
_unpack_args
def _unpack_args(args, nargs_spec): """Given an iterable of arguments and an iterable of nargs specifications, it returns a tuple with all the unpacked arguments at the first index and all remaining arguments as the second. The nargs specification is the number of arguments that should be consumed ...
python
def _unpack_args(args, nargs_spec): """Given an iterable of arguments and an iterable of nargs specifications, it returns a tuple with all the unpacked arguments at the first index and all remaining arguments as the second. The nargs specification is the number of arguments that should be consumed ...
[ "def", "_unpack_args", "(", "args", ",", "nargs_spec", ")", ":", "args", "=", "deque", "(", "args", ")", "nargs_spec", "=", "deque", "(", "nargs_spec", ")", "rv", "=", "[", "]", "spos", "=", "None", "def", "_fetch", "(", "c", ")", ":", "try", ":", ...
Given an iterable of arguments and an iterable of nargs specifications, it returns a tuple with all the unpacked arguments at the first index and all remaining arguments as the second. The nargs specification is the number of arguments that should be consumed or `-1` to indicate that this position shou...
[ "Given", "an", "iterable", "of", "arguments", "and", "an", "iterable", "of", "nargs", "specifications", "it", "returns", "a", "tuple", "with", "all", "the", "unpacked", "arguments", "at", "the", "first", "index", "and", "all", "remaining", "arguments", "as", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L25-L73
train
pypa/pipenv
pipenv/vendor/click/parser.py
split_arg_string
def split_arg_string(string): """Given an argument string this attempts to split it into small parts.""" rv = [] for match in re.finditer(r"('([^'\\]*(?:\\.[^'\\]*)*)'" r'|"([^"\\]*(?:\\.[^"\\]*)*)"' r'|\S+)\s*', string, re.S): arg = match.gr...
python
def split_arg_string(string): """Given an argument string this attempts to split it into small parts.""" rv = [] for match in re.finditer(r"('([^'\\]*(?:\\.[^'\\]*)*)'" r'|"([^"\\]*(?:\\.[^"\\]*)*)"' r'|\S+)\s*', string, re.S): arg = match.gr...
[ "def", "split_arg_string", "(", "string", ")", ":", "rv", "=", "[", "]", "for", "match", "in", "re", ".", "finditer", "(", "r\"('([^'\\\\]*(?:\\\\.[^'\\\\]*)*)'\"", "r'|\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"'", "r'|\\S+)\\s*'", ",", "string", ",", "re", ".", "S", ")...
Given an argument string this attempts to split it into small parts.
[ "Given", "an", "argument", "string", "this", "attempts", "to", "split", "it", "into", "small", "parts", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L98-L113
train
pypa/pipenv
pipenv/vendor/click/parser.py
OptionParser.add_option
def add_option(self, opts, dest, action=None, nargs=1, const=None, obj=None): """Adds a new option named `dest` to the parser. The destination is not inferred (unlike with optparse) and needs to be explicitly provided. Action can be any of ``store``, ``store_const``, ...
python
def add_option(self, opts, dest, action=None, nargs=1, const=None, obj=None): """Adds a new option named `dest` to the parser. The destination is not inferred (unlike with optparse) and needs to be explicitly provided. Action can be any of ``store``, ``store_const``, ...
[ "def", "add_option", "(", "self", ",", "opts", ",", "dest", ",", "action", "=", "None", ",", "nargs", "=", "1", ",", "const", "=", "None", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "obj", "=", "dest", "opts", "=", "[", ...
Adds a new option named `dest` to the parser. The destination is not inferred (unlike with optparse) and needs to be explicitly provided. Action can be any of ``store``, ``store_const``, ``append``, ``appnd_const`` or ``count``. The `obj` can be used to identify the option in the orde...
[ "Adds", "a", "new", "option", "named", "dest", "to", "the", "parser", ".", "The", "destination", "is", "not", "inferred", "(", "unlike", "with", "optparse", ")", "and", "needs", "to", "be", "explicitly", "provided", ".", "Action", "can", "be", "any", "of...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L228-L247
train
pypa/pipenv
pipenv/vendor/click/parser.py
OptionParser.add_argument
def add_argument(self, dest, nargs=1, obj=None): """Adds a positional argument named `dest` to the parser. The `obj` can be used to identify the option in the order list that is returned from the parser. """ if obj is None: obj = dest self._args.append(Argume...
python
def add_argument(self, dest, nargs=1, obj=None): """Adds a positional argument named `dest` to the parser. The `obj` can be used to identify the option in the order list that is returned from the parser. """ if obj is None: obj = dest self._args.append(Argume...
[ "def", "add_argument", "(", "self", ",", "dest", ",", "nargs", "=", "1", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "obj", "=", "dest", "self", ".", "_args", ".", "append", "(", "Argument", "(", "dest", "=", "dest", ",", ...
Adds a positional argument named `dest` to the parser. The `obj` can be used to identify the option in the order list that is returned from the parser.
[ "Adds", "a", "positional", "argument", "named", "dest", "to", "the", "parser", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L249-L257
train
pypa/pipenv
pipenv/vendor/click/parser.py
OptionParser.parse_args
def parse_args(self, args): """Parses positional arguments and returns ``(values, args, order)`` for the parsed options and arguments as well as the leftover arguments if there are any. The order is a list of objects as they appear on the command line. If arguments appear multiple time...
python
def parse_args(self, args): """Parses positional arguments and returns ``(values, args, order)`` for the parsed options and arguments as well as the leftover arguments if there are any. The order is a list of objects as they appear on the command line. If arguments appear multiple time...
[ "def", "parse_args", "(", "self", ",", "args", ")", ":", "state", "=", "ParsingState", "(", "args", ")", "try", ":", "self", ".", "_process_args_for_options", "(", "state", ")", "self", ".", "_process_args_for_args", "(", "state", ")", "except", "UsageError"...
Parses positional arguments and returns ``(values, args, order)`` for the parsed options and arguments as well as the leftover arguments if there are any. The order is a list of objects as they appear on the command line. If arguments appear multiple times they will be memorized multip...
[ "Parses", "positional", "arguments", "and", "returns", "(", "values", "args", "order", ")", "for", "the", "parsed", "options", "and", "arguments", "as", "well", "as", "the", "leftover", "arguments", "if", "there", "are", "any", ".", "The", "order", "is", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L259-L273
train
pypa/pipenv
pipenv/vendor/distlib/database.py
make_graph
def make_graph(dists, scheme='default'): """Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a ...
python
def make_graph(dists, scheme='default'): """Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a ...
[ "def", "make_graph", "(", "dists", ",", "scheme", "=", "'default'", ")", ":", "scheme", "=", "get_scheme", "(", "scheme", ")", "graph", "=", "DependencyGraph", "(", ")", "provided", "=", "{", "}", "# maps names to lists of (version, dist) tuples", "# first, build ...
Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance
[ "Makes", "a", "dependency", "graph", "from", "the", "given", "distributions", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1225-L1276
train
pypa/pipenv
pipenv/vendor/distlib/database.py
get_dependent_dists
def get_dependent_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibExcept...
python
def get_dependent_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibExcept...
[ "def", "get_dependent_dists", "(", "dists", ",", "dist", ")", ":", "if", "dist", "not", "in", "dists", ":", "raise", "DistlibException", "(", "'given distribution %r is not a member '", "'of the list'", "%", "dist", ".", "name", ")", "graph", "=", "make_graph", ...
Recursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested
[ "Recursively", "generate", "a", "list", "of", "distributions", "from", "*", "dists", "*", "that", "are", "dependent", "on", "*", "dist", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1279-L1302
train
pypa/pipenv
pipenv/vendor/distlib/database.py
get_required_dists
def get_required_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibExceptio...
python
def get_required_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibExceptio...
[ "def", "get_required_dists", "(", "dists", ",", "dist", ")", ":", "if", "dist", "not", "in", "dists", ":", "raise", "DistlibException", "(", "'given distribution %r is not a member '", "'of the list'", "%", "dist", ".", "name", ")", "graph", "=", "make_graph", "...
Recursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested
[ "Recursively", "generate", "a", "list", "of", "distributions", "from", "*", "dists", "*", "that", "are", "required", "by", "*", "dist", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1305-L1327
train
pypa/pipenv
pipenv/vendor/distlib/database.py
make_dist
def make_dist(name, version, **kwargs): """ A convenience method for making a dist given just a name and version. """ summary = kwargs.pop('summary', 'Placeholder for summary') md = Metadata(**kwargs) md.name = name md.version = version md.summary = summary or 'Placeholder for summary' ...
python
def make_dist(name, version, **kwargs): """ A convenience method for making a dist given just a name and version. """ summary = kwargs.pop('summary', 'Placeholder for summary') md = Metadata(**kwargs) md.name = name md.version = version md.summary = summary or 'Placeholder for summary' ...
[ "def", "make_dist", "(", "name", ",", "version", ",", "*", "*", "kwargs", ")", ":", "summary", "=", "kwargs", ".", "pop", "(", "'summary'", ",", "'Placeholder for summary'", ")", "md", "=", "Metadata", "(", "*", "*", "kwargs", ")", "md", ".", "name", ...
A convenience method for making a dist given just a name and version.
[ "A", "convenience", "method", "for", "making", "a", "dist", "given", "just", "a", "name", "and", "version", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1330-L1339
train
pypa/pipenv
pipenv/vendor/distlib/database.py
_Cache.clear
def clear(self): """ Clear the cache, setting it to its initial state. """ self.name.clear() self.path.clear() self.generated = False
python
def clear(self): """ Clear the cache, setting it to its initial state. """ self.name.clear() self.path.clear() self.generated = False
[ "def", "clear", "(", "self", ")", ":", "self", ".", "name", ".", "clear", "(", ")", "self", ".", "path", ".", "clear", "(", ")", "self", ".", "generated", "=", "False" ]
Clear the cache, setting it to its initial state.
[ "Clear", "the", "cache", "setting", "it", "to", "its", "initial", "state", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L57-L63
train
pypa/pipenv
pipenv/vendor/distlib/database.py
_Cache.add
def add(self, dist): """ Add a distribution to the cache. :param dist: The distribution to add. """ if dist.path not in self.path: self.path[dist.path] = dist self.name.setdefault(dist.key, []).append(dist)
python
def add(self, dist): """ Add a distribution to the cache. :param dist: The distribution to add. """ if dist.path not in self.path: self.path[dist.path] = dist self.name.setdefault(dist.key, []).append(dist)
[ "def", "add", "(", "self", ",", "dist", ")", ":", "if", "dist", ".", "path", "not", "in", "self", ".", "path", ":", "self", ".", "path", "[", "dist", ".", "path", "]", "=", "dist", "self", ".", "name", ".", "setdefault", "(", "dist", ".", "key"...
Add a distribution to the cache. :param dist: The distribution to add.
[ "Add", "a", "distribution", "to", "the", "cache", ".", ":", "param", "dist", ":", "The", "distribution", "to", "add", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L65-L72
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DistributionPath._generate_cache
def _generate_cache(self): """ Scan the path for distributions and populate the cache with those that are found. """ gen_dist = not self._cache.generated gen_egg = self._include_egg and not self._cache_egg.generated if gen_dist or gen_egg: for dist in ...
python
def _generate_cache(self): """ Scan the path for distributions and populate the cache with those that are found. """ gen_dist = not self._cache.generated gen_egg = self._include_egg and not self._cache_egg.generated if gen_dist or gen_egg: for dist in ...
[ "def", "_generate_cache", "(", "self", ")", ":", "gen_dist", "=", "not", "self", ".", "_cache", ".", "generated", "gen_egg", "=", "self", ".", "_include_egg", "and", "not", "self", ".", "_cache_egg", ".", "generated", "if", "gen_dist", "or", "gen_egg", ":"...
Scan the path for distributions and populate the cache with those that are found.
[ "Scan", "the", "path", "for", "distributions", "and", "populate", "the", "cache", "with", "those", "that", "are", "found", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L159-L176
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DistributionPath.distinfo_dirname
def distinfo_dirname(cls, name, version): """ The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. ...
python
def distinfo_dirname(cls, name, version): """ The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. ...
[ "def", "distinfo_dirname", "(", "cls", ",", "name", ",", "version", ")", ":", "name", "=", "name", ".", "replace", "(", "'-'", ",", "'_'", ")", "return", "'-'", ".", "join", "(", "[", "name", ",", "version", "]", ")", "+", "DISTINFO_EXT" ]
The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distributi...
[ "The", "*", "name", "*", "and", "*", "version", "*", "parameters", "are", "converted", "into", "their", "filename", "-", "escaped", "form", "i", ".", "e", ".", "any", "-", "characters", "are", "replaced", "with", "_", "other", "than", "the", "one", "in...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L179-L198
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DistributionPath.get_distributions
def get_distributions(self): """ Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDis...
python
def get_distributions(self): """ Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDis...
[ "def", "get_distributions", "(", "self", ")", ":", "if", "not", "self", ".", "_cache_enabled", ":", "for", "dist", "in", "self", ".", "_yield_distributions", "(", ")", ":", "yield", "dist", "else", ":", "self", ".", "_generate_cache", "(", ")", "for", "d...
Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances
[ "Provides", "an", "iterator", "that", "looks", "for", "distributions", "and", "returns", ":", "class", ":", "InstalledDistribution", "or", ":", "class", ":", "EggInfoDistribution", "instances", "for", "each", "one", "of", "them", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L200-L220
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DistributionPath.get_distribution
def get_distribution(self, name): """ Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribu...
python
def get_distribution(self, name): """ Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribu...
[ "def", "get_distribution", "(", "self", ",", "name", ")", ":", "result", "=", "None", "name", "=", "name", ".", "lower", "(", ")", "if", "not", "self", ".", "_cache_enabled", ":", "for", "dist", "in", "self", ".", "_yield_distributions", "(", ")", ":",...
Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None``
[ "Looks", "for", "a", "named", "distribution", "on", "the", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L222-L246
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DistributionPath.provides_distribution
def provides_distribution(self, name, version=None): """ Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one value...
python
def provides_distribution(self, name, version=None): """ Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one value...
[ "def", "provides_distribution", "(", "self", ",", "name", ",", "version", "=", "None", ")", ":", "matcher", "=", "None", "if", "version", "is", "not", "None", ":", "try", ":", "matcher", "=", "self", ".", "_scheme", ".", "matcher", "(", "'%s (%s)'", "%...
Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. ...
[ "Iterates", "over", "all", "distributions", "to", "find", "which", "distributions", "provide", "*", "name", "*", ".", "If", "a", "*", "version", "*", "is", "provided", "it", "will", "be", "used", "to", "filter", "the", "results", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L248-L287
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DistributionPath.get_file_path
def get_file_path(self, name, relative_path): """ Return the path to a resource file. """ dist = self.get_distribution(name) if dist is None: raise LookupError('no distribution named %r found' % name) return dist.get_resource_path(relative_path)
python
def get_file_path(self, name, relative_path): """ Return the path to a resource file. """ dist = self.get_distribution(name) if dist is None: raise LookupError('no distribution named %r found' % name) return dist.get_resource_path(relative_path)
[ "def", "get_file_path", "(", "self", ",", "name", ",", "relative_path", ")", ":", "dist", "=", "self", ".", "get_distribution", "(", "name", ")", "if", "dist", "is", "None", ":", "raise", "LookupError", "(", "'no distribution named %r found'", "%", "name", "...
Return the path to a resource file.
[ "Return", "the", "path", "to", "a", "resource", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L289-L296
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DistributionPath.get_exported_entries
def get_exported_entries(self, category, name=None): """ Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. """ for dist in self.get_distri...
python
def get_exported_entries(self, category, name=None): """ Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. """ for dist in self.get_distri...
[ "def", "get_exported_entries", "(", "self", ",", "category", ",", "name", "=", "None", ")", ":", "for", "dist", "in", "self", ".", "get_distributions", "(", ")", ":", "r", "=", "dist", ".", "exports", "if", "category", "in", "r", ":", "d", "=", "r", ...
Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned.
[ "Return", "all", "of", "the", "exported", "entries", "in", "a", "particular", "category", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L298-L314
train
pypa/pipenv
pipenv/vendor/distlib/database.py
Distribution.provides
def provides(self): """ A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. """ plist = self.metadata.provides s = '%s (%s)' % (self.name, self.version) if s not in plist: plist.append(s) ...
python
def provides(self): """ A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. """ plist = self.metadata.provides s = '%s (%s)' % (self.name, self.version) if s not in plist: plist.append(s) ...
[ "def", "provides", "(", "self", ")", ":", "plist", "=", "self", ".", "metadata", ".", "provides", "s", "=", "'%s (%s)'", "%", "(", "self", ".", "name", ",", "self", ".", "version", ")", "if", "s", "not", "in", "plist", ":", "plist", ".", "append", ...
A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings.
[ "A", "set", "of", "distribution", "names", "and", "versions", "provided", "by", "this", "distribution", ".", ":", "return", ":", "A", "set", "of", "name", "(", "version", ")", "strings", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L369-L378
train
pypa/pipenv
pipenv/vendor/distlib/database.py
Distribution.matches_requirement
def matches_requirement(self, req): """ Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. """ # Requirement may contain extras - parse to lose those # from ...
python
def matches_requirement(self, req): """ Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. """ # Requirement may contain extras - parse to lose those # from ...
[ "def", "matches_requirement", "(", "self", ",", "req", ")", ":", "# Requirement may contain extras - parse to lose those", "# from what's passed to the matcher", "r", "=", "parse_requirement", "(", "req", ")", "scheme", "=", "get_scheme", "(", "self", ".", "metadata", "...
Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False.
[ "Say", "if", "this", "instance", "matches", "(", "fulfills", ")", "a", "requirement", ".", ":", "param", "req", ":", "The", "requirement", "to", "match", ".", ":", "rtype", "req", ":", "str", ":", "return", ":", "True", "if", "it", "matches", "else", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L407-L439
train
pypa/pipenv
pipenv/vendor/distlib/database.py
BaseInstalledDistribution.get_hash
def get_hash(self, data, hasher=None): """ Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ...
python
def get_hash(self, data, hasher=None): """ Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ...
[ "def", "get_hash", "(", "self", ",", "data", ",", "hasher", "=", "None", ")", ":", "if", "hasher", "is", "None", ":", "hasher", "=", "self", ".", "hasher", "if", "hasher", "is", "None", ":", "hasher", "=", "hashlib", ".", "md5", "prefix", "=", "''"...
Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ...
[ "Get", "the", "hash", "of", "some", "data", "using", "a", "particular", "hash", "algorithm", "if", "specified", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L497-L526
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution._get_records
def _get_records(self): """ Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). ...
python
def _get_records(self): """ Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). ...
[ "def", "_get_records", "(", "self", ")", ":", "results", "=", "[", "]", "r", "=", "self", ".", "get_distinfo_resource", "(", "'RECORD'", ")", "with", "contextlib", ".", "closing", "(", "r", ".", "as_stream", "(", ")", ")", "as", "stream", ":", "with", ...
Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376).
[ "Get", "the", "list", "of", "installed", "files", "for", "the", "distribution", ":", "return", ":", "A", "list", "of", "tuples", "of", "path", "hash", "and", "size", ".", "Note", "that", "hash", "and", "size", "might", "be", "None", "for", "some", "ent...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L580-L601
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.exports
def exports(self): """ Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. """ ...
python
def exports(self): """ Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. """ ...
[ "def", "exports", "(", "self", ")", ":", "result", "=", "{", "}", "r", "=", "self", ".", "get_distinfo_resource", "(", "EXPORTS_FILENAME", ")", "if", "r", ":", "result", "=", "self", ".", "read_exports", "(", ")", "return", "result" ]
Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name.
[ "Return", "the", "information", "exported", "by", "this", "distribution", ".", ":", "return", ":", "A", "dictionary", "of", "exports", "mapping", "an", "export", "category", "to", "a", "dict", "of", ":", "class", ":", "ExportEntry", "instances", "describing", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L604-L615
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.read_exports
def read_exports(self): """ Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ result = {} ...
python
def read_exports(self): """ Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ result = {} ...
[ "def", "read_exports", "(", "self", ")", ":", "result", "=", "{", "}", "r", "=", "self", ".", "get_distinfo_resource", "(", "EXPORTS_FILENAME", ")", "if", "r", ":", "with", "contextlib", ".", "closing", "(", "r", ".", "as_stream", "(", ")", ")", "as", ...
Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries.
[ "Read", "exports", "data", "from", "a", "file", "in", ".", "ini", "format", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L617-L630
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.write_exports
def write_exports(self, exports): """ Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. ...
python
def write_exports(self, exports): """ Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. ...
[ "def", "write_exports", "(", "self", ",", "exports", ")", ":", "rf", "=", "self", ".", "get_distinfo_file", "(", "EXPORTS_FILENAME", ")", "with", "open", "(", "rf", ",", "'w'", ")", "as", "f", ":", "write_exports", "(", "exports", ",", "f", ")" ]
Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries.
[ "Write", "a", "dictionary", "of", "exports", "to", "a", "file", "in", ".", "ini", "format", ".", ":", "param", "exports", ":", "A", "dictionary", "of", "exports", "mapping", "an", "export", "category", "to", "a", "list", "of", ":", "class", ":", "Expor...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L632-L641
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.get_resource_path
def get_resource_path(self, relative_path): """ NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. ...
python
def get_resource_path(self, relative_path): """ NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. ...
[ "def", "get_resource_path", "(", "self", ",", "relative_path", ")", ":", "r", "=", "self", ".", "get_distinfo_resource", "(", "'RESOURCES'", ")", "with", "contextlib", ".", "closing", "(", "r", ".", "as_stream", "(", ")", ")", "as", "stream", ":", "with", ...
NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be f...
[ "NOTE", ":", "This", "API", "may", "change", "in", "the", "future", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L643-L661
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.write_installed_files
def write_installed_files(self, paths, prefix, dry_run=False): """ Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. """ prefix = os.path.joi...
python
def write_installed_files(self, paths, prefix, dry_run=False): """ Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. """ prefix = os.path.joi...
[ "def", "write_installed_files", "(", "self", ",", "paths", ",", "prefix", ",", "dry_run", "=", "False", ")", ":", "prefix", "=", "os", ".", "path", ".", "join", "(", "prefix", ",", "''", ")", "base", "=", "os", ".", "path", ".", "dirname", "(", "se...
Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths.
[ "Writes", "the", "RECORD", "file", "using", "the", "paths", "iterable", "passed", "in", ".", "Any", "existing", "RECORD", "file", "is", "silently", "overwritten", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L673-L706
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.check_installed_files
def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' ...
python
def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' ...
[ "def", "check_installed_files", "(", "self", ")", ":", "mismatches", "=", "[", "]", "base", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "path", ")", "record_path", "=", "self", ".", "get_distinfo_file", "(", "'RECORD'", ")", "for", "path", ...
Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is ...
[ "Checks", "that", "the", "hashes", "and", "sizes", "of", "the", "files", "in", "RECORD", "are", "matched", "by", "the", "files", "themselves", ".", "Returns", "a", "(", "possibly", "empty", ")", "list", "of", "mismatches", ".", "Each", "entry", "in", "th...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L708-L741
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.shared_locations
def shared_locations(self): """ A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any...
python
def shared_locations(self): """ A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any...
[ "def", "shared_locations", "(", "self", ")", ":", "result", "=", "{", "}", "shared_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'SHARED'", ")", "if", "os", ".", "path", ".", "isfile", "(", "shared_path", ")", ":", "wi...
A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any paths selected by the user at installat...
[ "A", "dictionary", "of", "shared", "locations", "whose", "keys", "are", "in", "the", "set", "prefix", "purelib", "platlib", "scripts", "headers", "data", "and", "namespace", ".", "The", "corresponding", "value", "is", "the", "absolute", "path", "of", "that", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L744-L768
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.write_shared_locations
def write_shared_locations(self, paths, dry_run=False): """ Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is ...
python
def write_shared_locations(self, paths, dry_run=False): """ Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is ...
[ "def", "write_shared_locations", "(", "self", ",", "paths", ",", "dry_run", "=", "False", ")", ":", "shared_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'SHARED'", ")", "logger", ".", "info", "(", "'creating %s'", ",", "s...
Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is actually written. :return: The path of the f...
[ "Write", "shared", "location", "information", "to", "the", "SHARED", "file", "in", ".", "dist", "-", "info", ".", ":", "param", "paths", ":", "A", "dictionary", "as", "described", "in", "the", "documentation", "for", ":", "meth", ":", "shared_locations", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L770-L793
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.get_distinfo_file
def get_distinfo_file(self, path): """ Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; ...
python
def get_distinfo_file(self, path): """ Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; ...
[ "def", "get_distinfo_file", "(", "self", ",", "path", ")", ":", "# Check if it is an absolute path # XXX use relpath, add tests", "if", "path", ".", "find", "(", "os", ".", "sep", ")", ">=", "0", ":", "# it's an absolute path?", "distinfo_dirname", ",", "path", "="...
Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; If *path* is an absolute path and doesn't start ...
[ "Returns", "a", "path", "located", "under", "the", ".", "dist", "-", "info", "directory", ".", "Returns", "a", "string", "representing", "the", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L804-L831
train
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.list_distinfo_files
def list_distinfo_files(self): """ Iterates over the ``RECORD`` entries and returns paths for each line if the path is pointing to a file located in the ``.dist-info`` directory or one of its subdirectories. :returns: iterator of paths """ base = os.path.dirname(...
python
def list_distinfo_files(self): """ Iterates over the ``RECORD`` entries and returns paths for each line if the path is pointing to a file located in the ``.dist-info`` directory or one of its subdirectories. :returns: iterator of paths """ base = os.path.dirname(...
[ "def", "list_distinfo_files", "(", "self", ")", ":", "base", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "path", ")", "for", "path", ",", "checksum", ",", "size", "in", "self", ".", "_get_records", "(", ")", ":", "# XXX add separator or use...
Iterates over the ``RECORD`` entries and returns paths for each line if the path is pointing to a file located in the ``.dist-info`` directory or one of its subdirectories. :returns: iterator of paths
[ "Iterates", "over", "the", "RECORD", "entries", "and", "returns", "paths", "for", "each", "line", "if", "the", "path", "is", "pointing", "to", "a", "file", "located", "in", "the", ".", "dist", "-", "info", "directory", "or", "one", "of", "its", "subdirec...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L833-L847
train
pypa/pipenv
pipenv/vendor/distlib/database.py
EggInfoDistribution.check_installed_files
def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' ...
python
def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' ...
[ "def", "check_installed_files", "(", "self", ")", ":", "mismatches", "=", "[", "]", "record_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'installed-files.txt'", ")", "if", "os", ".", "path", ".", "exists", "(", "record_path...
Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is ...
[ "Checks", "that", "the", "hashes", "and", "sizes", "of", "the", "files", "in", "RECORD", "are", "matched", "by", "the", "files", "themselves", ".", "Returns", "a", "(", "possibly", "empty", ")", "list", "of", "mismatches", ".", "Each", "entry", "in", "th...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L984-L1001
train
pypa/pipenv
pipenv/vendor/distlib/database.py
EggInfoDistribution.list_installed_files
def list_installed_files(self): """ Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) """ def _md5(path): f = open(path, 'rb') try: c...
python
def list_installed_files(self): """ Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) """ def _md5(path): f = open(path, 'rb') try: c...
[ "def", "list_installed_files", "(", "self", ")", ":", "def", "_md5", "(", "path", ")", ":", "f", "=", "open", "(", "path", ",", "'rb'", ")", "try", ":", "content", "=", "f", ".", "read", "(", ")", "finally", ":", "f", ".", "close", "(", ")", "r...
Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size)
[ "Iterates", "over", "the", "installed", "-", "files", ".", "txt", "entries", "and", "returns", "a", "tuple", "(", "path", "hash", "size", ")", "for", "each", "line", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1003-L1039
train
pypa/pipenv
pipenv/vendor/distlib/database.py
EggInfoDistribution.list_distinfo_files
def list_distinfo_files(self, absolute=False): """ Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``Tru...
python
def list_distinfo_files(self, absolute=False): """ Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``Tru...
[ "def", "list_distinfo_files", "(", "self", ",", "absolute", "=", "False", ")", ":", "record_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'installed-files.txt'", ")", "if", "os", ".", "path", ".", "exists", "(", "record_path...
Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed in...
[ "Iterates", "over", "the", "installed", "-", "files", ".", "txt", "entries", "and", "returns", "paths", "for", "each", "line", "if", "the", "path", "is", "pointing", "to", "a", "file", "located", "in", "the", ".", "egg", "-", "info", "directory", "or", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1041-L1068
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DependencyGraph.add_edge
def add_edge(self, x, y, label=None): """Add an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.In...
python
def add_edge(self, x, y, label=None): """Add an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.In...
[ "def", "add_edge", "(", "self", ",", "x", ",", "y", ",", "label", "=", "None", ")", ":", "self", ".", "adjacency_list", "[", "x", "]", ".", "append", "(", "(", "y", ",", "label", ")", ")", "# multiple edges are allowed, so be careful", "if", "x", "not"...
Add an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.InstalledDistribution` or :class:`...
[ "Add", "an", "edge", "from", "distribution", "*", "x", "*", "to", "distribution", "*", "y", "*", "with", "the", "given", "*", "label", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1112-L1125
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DependencyGraph.add_missing
def add_missing(self, distribution, requirement): """ Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str...
python
def add_missing(self, distribution, requirement): """ Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str...
[ "def", "add_missing", "(", "self", ",", "distribution", ",", "requirement", ")", ":", "logger", ".", "debug", "(", "'%s missing %r'", ",", "distribution", ",", "requirement", ")", "self", ".", "missing", ".", "setdefault", "(", "distribution", ",", "[", "]",...
Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str``
[ "Add", "a", "missing", "*", "requirement", "*", "for", "the", "given", "*", "distribution", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1127-L1136
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DependencyGraph.repr_node
def repr_node(self, dist, level=1): """Prints only a subgraph""" output = [self._repr_dist(dist)] for other, label in self.adjacency_list[dist]: dist = self._repr_dist(other) if label is not None: dist = '%s [%s]' % (dist, label) output.append(...
python
def repr_node(self, dist, level=1): """Prints only a subgraph""" output = [self._repr_dist(dist)] for other, label in self.adjacency_list[dist]: dist = self._repr_dist(other) if label is not None: dist = '%s [%s]' % (dist, label) output.append(...
[ "def", "repr_node", "(", "self", ",", "dist", ",", "level", "=", "1", ")", ":", "output", "=", "[", "self", ".", "_repr_dist", "(", "dist", ")", "]", "for", "other", ",", "label", "in", "self", ".", "adjacency_list", "[", "dist", "]", ":", "dist", ...
Prints only a subgraph
[ "Prints", "only", "a", "subgraph" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1141-L1152
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DependencyGraph.to_dot
def to_dot(self, f, skip_disconnected=True): """Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations ...
python
def to_dot(self, f, skip_disconnected=True): """Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations ...
[ "def", "to_dot", "(", "self", ",", "f", ",", "skip_disconnected", "=", "True", ")", ":", "disconnected", "=", "[", "]", "f", ".", "write", "(", "\"digraph dependencies {\\n\"", ")", "for", "dist", ",", "adjs", "in", "self", ".", "adjacency_list", ".", "i...
Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool``
[ "Writes", "a", "DOT", "output", "for", "the", "graph", "to", "the", "provided", "file", "*", "f", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1154-L1184
train
pypa/pipenv
pipenv/vendor/distlib/database.py
DependencyGraph.topological_sort
def topological_sort(self): """ Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they h...
python
def topological_sort(self): """ Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they h...
[ "def", "topological_sort", "(", "self", ")", ":", "result", "=", "[", "]", "# Make a shallow copy of the adjacency list", "alist", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "adjacency_list", ".", "items", "(", ")", ":", "alist", "[", "k", "...
Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they have circular dependencies and s...
[ "Perform", "a", "topological", "sort", "of", "the", "graph", ".", ":", "return", ":", "A", "tuple", "the", "first", "element", "of", "which", "is", "a", "topologically", "sorted", "list", "of", "distributions", "and", "the", "second", "element", "of", "whi...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1186-L1215
train
pypa/pipenv
pipenv/vendor/cerberus/errors.py
encode_unicode
def encode_unicode(f): """Cerberus error messages expect regular binary strings. If unicode is used in a ValidationError message can't be printed. This decorator ensures that if legacy Python is used unicode strings are encoded before passing to a function. """ @wraps(f) def wrapped(obj, er...
python
def encode_unicode(f): """Cerberus error messages expect regular binary strings. If unicode is used in a ValidationError message can't be printed. This decorator ensures that if legacy Python is used unicode strings are encoded before passing to a function. """ @wraps(f) def wrapped(obj, er...
[ "def", "encode_unicode", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapped", "(", "obj", ",", "error", ")", ":", "def", "_encode", "(", "value", ")", ":", "\"\"\"Helper encoding unicode strings into binary utf-8\"\"\"", "if", "isinstance", "(", ...
Cerberus error messages expect regular binary strings. If unicode is used in a ValidationError message can't be printed. This decorator ensures that if legacy Python is used unicode strings are encoded before passing to a function.
[ "Cerberus", "error", "messages", "expect", "regular", "binary", "strings", ".", "If", "unicode", "is", "used", "in", "a", "ValidationError", "message", "can", "t", "be", "printed", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L407-L431
train
pypa/pipenv
pipenv/vendor/cerberus/errors.py
ValidationError.definitions_errors
def definitions_errors(self): """ Dictionary with errors of an *of-rule mapped to the index of the definition it occurred in. Returns :obj:`None` if not applicable. """ if not self.is_logic_error: return None result = defaultdict(list) for error in se...
python
def definitions_errors(self): """ Dictionary with errors of an *of-rule mapped to the index of the definition it occurred in. Returns :obj:`None` if not applicable. """ if not self.is_logic_error: return None result = defaultdict(list) for error in se...
[ "def", "definitions_errors", "(", "self", ")", ":", "if", "not", "self", ".", "is_logic_error", ":", "return", "None", "result", "=", "defaultdict", "(", "list", ")", "for", "error", "in", "self", ".", "child_errors", ":", "i", "=", "error", ".", "schema...
Dictionary with errors of an *of-rule mapped to the index of the definition it occurred in. Returns :obj:`None` if not applicable.
[ "Dictionary", "with", "errors", "of", "an", "*", "of", "-", "rule", "mapped", "to", "the", "index", "of", "the", "definition", "it", "occurred", "in", ".", "Returns", ":", "obj", ":", "None", "if", "not", "applicable", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L151-L162
train
pypa/pipenv
pipenv/vendor/cerberus/errors.py
ErrorTree.add
def add(self, error): """ Add an error to the tree. :param error: :class:`~cerberus.errors.ValidationError` """ if not self._path_of_(error): self.errors.append(error) self.errors.sort() else: super(ErrorTree, self).add(error)
python
def add(self, error): """ Add an error to the tree. :param error: :class:`~cerberus.errors.ValidationError` """ if not self._path_of_(error): self.errors.append(error) self.errors.sort() else: super(ErrorTree, self).add(error)
[ "def", "add", "(", "self", ",", "error", ")", ":", "if", "not", "self", ".", "_path_of_", "(", "error", ")", ":", "self", ".", "errors", ".", "append", "(", "error", ")", "self", ".", "errors", ".", "sort", "(", ")", "else", ":", "super", "(", ...
Add an error to the tree. :param error: :class:`~cerberus.errors.ValidationError`
[ "Add", "an", "error", "to", "the", "tree", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L286-L295
train