repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
nerdvegas/rez
src/rez/backport/zipfile.py
_EndRecData
def _EndRecData(fpin): """Return data from the "End of Central Directory" record, or None. The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.""" # Determine file size fpin.seek(0, 2) filesize = fpin.tell() ...
python
def _EndRecData(fpin): """Return data from the "End of Central Directory" record, or None. The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.""" # Determine file size fpin.seek(0, 2) filesize = fpin.tell() ...
[ "def", "_EndRecData", "(", "fpin", ")", ":", "fpin", ".", "seek", "(", "0", ",", "2", ")", "filesize", "=", "fpin", ".", "tell", "(", ")", "try", ":", "fpin", ".", "seek", "(", "-", "sizeEndCentDir", ",", "2", ")", "except", "IOError", ":", "retu...
Return data from the "End of Central Directory" record, or None. The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.
[ "Return", "data", "from", "the", "End", "of", "Central", "Directory", "record", "or", "None", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L178-L233
train
nerdvegas/rez
src/rez/backport/zipfile.py
_ZipDecrypter._GenerateCRCTable
def _GenerateCRCTable(): """Generate a CRC-32 table. ZIP encryption uses the CRC32 one-byte primitive for scrambling some internal keys. We noticed that a direct implementation is faster than relying on binascii.crc32(). """ poly = 0xedb88320 table = [0] * 256 ...
python
def _GenerateCRCTable(): """Generate a CRC-32 table. ZIP encryption uses the CRC32 one-byte primitive for scrambling some internal keys. We noticed that a direct implementation is faster than relying on binascii.crc32(). """ poly = 0xedb88320 table = [0] * 256 ...
[ "def", "_GenerateCRCTable", "(", ")", ":", "poly", "=", "0xedb88320", "table", "=", "[", "0", "]", "*", "256", "for", "i", "in", "range", "(", "256", ")", ":", "crc", "=", "i", "for", "j", "in", "range", "(", "8", ")", ":", "if", "crc", "&", ...
Generate a CRC-32 table. ZIP encryption uses the CRC32 one-byte primitive for scrambling some internal keys. We noticed that a direct implementation is faster than relying on binascii.crc32().
[ "Generate", "a", "CRC", "-", "32", "table", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L398-L415
train
nerdvegas/rez
src/rez/backport/zipfile.py
_ZipDecrypter._crc32
def _crc32(self, ch, crc): """Compute the CRC32 primitive on one byte.""" return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ord(ch)) & 0xff]
python
def _crc32(self, ch, crc): """Compute the CRC32 primitive on one byte.""" return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ord(ch)) & 0xff]
[ "def", "_crc32", "(", "self", ",", "ch", ",", "crc", ")", ":", "return", "(", "(", "crc", ">>", "8", ")", "&", "0xffffff", ")", "^", "self", ".", "crctable", "[", "(", "crc", "^", "ord", "(", "ch", ")", ")", "&", "0xff", "]" ]
Compute the CRC32 primitive on one byte.
[ "Compute", "the", "CRC32", "primitive", "on", "one", "byte", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L418-L420
train
nerdvegas/rez
src/rez/backport/zipfile.py
ZipExtFile.readline
def readline(self, size = -1): """Read a line with approx. size. If size is negative, read a whole line. """ if size < 0: size = sys.maxint elif size == 0: return '' # check for a newline already in buffer nl, nllen = self._checkfornewl...
python
def readline(self, size = -1): """Read a line with approx. size. If size is negative, read a whole line. """ if size < 0: size = sys.maxint elif size == 0: return '' # check for a newline already in buffer nl, nllen = self._checkfornewl...
[ "def", "readline", "(", "self", ",", "size", "=", "-", "1", ")", ":", "if", "size", "<", "0", ":", "size", "=", "sys", ".", "maxint", "elif", "size", "==", "0", ":", "return", "''", "nl", ",", "nllen", "=", "self", ".", "_checkfornewline", "(", ...
Read a line with approx. size. If size is negative, read a whole line.
[ "Read", "a", "line", "with", "approx", ".", "size", ".", "If", "size", "is", "negative", "read", "a", "whole", "line", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L511-L553
train
nerdvegas/rez
src/rez/backport/zipfile.py
ZipFile._GetContents
def _GetContents(self): """Read the directory, making sure we close the file if the format is bad.""" try: self._RealGetContents() except BadZipfile: if not self._filePassed: self.fp.close() self.fp = None raise
python
def _GetContents(self): """Read the directory, making sure we close the file if the format is bad.""" try: self._RealGetContents() except BadZipfile: if not self._filePassed: self.fp.close() self.fp = None raise
[ "def", "_GetContents", "(", "self", ")", ":", "try", ":", "self", ".", "_RealGetContents", "(", ")", "except", "BadZipfile", ":", "if", "not", "self", ".", "_filePassed", ":", "self", ".", "fp", ".", "close", "(", ")", "self", ".", "fp", "=", "None",...
Read the directory, making sure we close the file if the format is bad.
[ "Read", "the", "directory", "making", "sure", "we", "close", "the", "file", "if", "the", "format", "is", "bad", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L714-L723
train
nerdvegas/rez
src/rez/backport/zipfile.py
ZipFile.namelist
def namelist(self): """Return a list of file names in the archive.""" l = [] for data in self.filelist: l.append(data.filename) return l
python
def namelist(self): """Return a list of file names in the archive.""" l = [] for data in self.filelist: l.append(data.filename) return l
[ "def", "namelist", "(", "self", ")", ":", "l", "=", "[", "]", "for", "data", "in", "self", ".", "filelist", ":", "l", ".", "append", "(", "data", ".", "filename", ")", "return", "l" ]
Return a list of file names in the archive.
[ "Return", "a", "list", "of", "file", "names", "in", "the", "archive", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L789-L794
train
nerdvegas/rez
src/rez/backport/zipfile.py
ZipFile.printdir
def printdir(self): """Print a table of contents for the zip file.""" print "%-46s %19s %12s" % ("File Name", "Modified ", "Size") for zinfo in self.filelist: date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6] print "%-46s %s %12d" % (zinfo.filename, date, zinf...
python
def printdir(self): """Print a table of contents for the zip file.""" print "%-46s %19s %12s" % ("File Name", "Modified ", "Size") for zinfo in self.filelist: date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6] print "%-46s %s %12d" % (zinfo.filename, date, zinf...
[ "def", "printdir", "(", "self", ")", ":", "print", "\"%-46s %19s %12s\"", "%", "(", "\"File Name\"", ",", "\"Modified \"", ",", "\"Size\"", ")", "for", "zinfo", "in", "self", ".", "filelist", ":", "date", "=", "\"%d-%02d-%02d %02d:%02d:%02d\"", "%", "zinfo", ...
Print a table of contents for the zip file.
[ "Print", "a", "table", "of", "contents", "for", "the", "zip", "file", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L801-L806
train
nerdvegas/rez
src/rez/backport/zipfile.py
ZipFile.getinfo
def getinfo(self, name): """Return the instance of ZipInfo given 'name'.""" info = self.NameToInfo.get(name) if info is None: raise KeyError( 'There is no item named %r in the archive' % name) return info
python
def getinfo(self, name): """Return the instance of ZipInfo given 'name'.""" info = self.NameToInfo.get(name) if info is None: raise KeyError( 'There is no item named %r in the archive' % name) return info
[ "def", "getinfo", "(", "self", ",", "name", ")", ":", "info", "=", "self", ".", "NameToInfo", ".", "get", "(", "name", ")", "if", "info", "is", "None", ":", "raise", "KeyError", "(", "'There is no item named %r in the archive'", "%", "name", ")", "return",...
Return the instance of ZipInfo given 'name'.
[ "Return", "the", "instance", "of", "ZipInfo", "given", "name", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L821-L828
train
nerdvegas/rez
src/rez/backport/zipfile.py
ZipFile.extract
def extract(self, member, path=None, pwd=None): """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 ZipInfo object. You can specify a different di...
python
def extract(self, member, path=None, pwd=None): """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 ZipInfo object. You can specify a different di...
[ "def", "extract", "(", "self", ",", "member", ",", "path", "=", "None", ",", "pwd", "=", "None", ")", ":", "if", "not", "isinstance", "(", "member", ",", "ZipInfo", ")", ":", "member", "=", "self", ".", "getinfo", "(", "member", ")", "if", "path", ...
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 ZipInfo object. You can specify a different directory using `path'.
[ "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", ...
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L916-L928
train
nerdvegas/rez
src/rez/backport/zipfile.py
PyZipFile.writepy
def writepy(self, pathname, basename = ""): """Add all files from "pathname" to the ZIP archive. If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain direc...
python
def writepy(self, pathname, basename = ""): """Add all files from "pathname" to the ZIP archive. If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain direc...
[ "def", "writepy", "(", "self", ",", "pathname", ",", "basename", "=", "\"\"", ")", ":", "dir", ",", "name", "=", "os", ".", "path", ".", "split", "(", "pathname", ")", "if", "os", ".", "path", ".", "isdir", "(", "pathname", ")", ":", "initname", ...
Add all files from "pathname" to the ZIP archive. If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain directory, listdir *.py and enter all modules. Else, pathna...
[ "Add", "all", "files", "from", "pathname", "to", "the", "ZIP", "archive", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L1241-L1304
train
nerdvegas/rez
src/rez/vendor/atomicwrites/__init__.py
AtomicWriter.get_fileobject
def get_fileobject(self, dir=None, **kwargs): '''Return the temporary file to use.''' if dir is None: dir = os.path.normpath(os.path.dirname(self._path)) descriptor, name = tempfile.mkstemp(dir=dir) # io.open() will take either the descriptor or the name, but we need ...
python
def get_fileobject(self, dir=None, **kwargs): '''Return the temporary file to use.''' if dir is None: dir = os.path.normpath(os.path.dirname(self._path)) descriptor, name = tempfile.mkstemp(dir=dir) # io.open() will take either the descriptor or the name, but we need ...
[ "def", "get_fileobject", "(", "self", ",", "dir", "=", "None", ",", "**", "kwargs", ")", ":", "if", "dir", "is", "None", ":", "dir", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "dirname", "(", "self", ".", "_path", ")", ...
Return the temporary file to use.
[ "Return", "the", "temporary", "file", "to", "use", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/atomicwrites/__init__.py#L163-L174
train
nerdvegas/rez
src/rez/vendor/atomicwrites/__init__.py
AtomicWriter.commit
def commit(self, f): '''Move the temporary file to the target location.''' if self._overwrite: replace_atomic(f.name, self._path) else: move_atomic(f.name, self._path)
python
def commit(self, f): '''Move the temporary file to the target location.''' if self._overwrite: replace_atomic(f.name, self._path) else: move_atomic(f.name, self._path)
[ "def", "commit", "(", "self", ",", "f", ")", ":", "if", "self", ".", "_overwrite", ":", "replace_atomic", "(", "f", ".", "name", ",", "self", ".", "_path", ")", "else", ":", "move_atomic", "(", "f", ".", "name", ",", "self", ".", "_path", ")" ]
Move the temporary file to the target location.
[ "Move", "the", "temporary", "file", "to", "the", "target", "location", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/atomicwrites/__init__.py#L182-L187
train
nerdvegas/rez
src/rez/vendor/lockfile/pidlockfile.py
read_pid_from_pidfile
def read_pid_from_pidfile(pidfile_path): """ Read the PID recorded in the named PID file. Read and return the numeric PID recorded as text in the named PID file. If the PID file cannot be read, or if the content is not a valid PID, return ``None``. """ pid = None try: ...
python
def read_pid_from_pidfile(pidfile_path): """ Read the PID recorded in the named PID file. Read and return the numeric PID recorded as text in the named PID file. If the PID file cannot be read, or if the content is not a valid PID, return ``None``. """ pid = None try: ...
[ "def", "read_pid_from_pidfile", "(", "pidfile_path", ")", ":", "pid", "=", "None", "try", ":", "pidfile", "=", "open", "(", "pidfile_path", ",", "'r'", ")", "except", "IOError", ":", "pass", "else", ":", "line", "=", "pidfile", ".", "readline", "(", ")",...
Read the PID recorded in the named PID file. Read and return the numeric PID recorded as text in the named PID file. If the PID file cannot be read, or if the content is not a valid PID, return ``None``.
[ "Read", "the", "PID", "recorded", "in", "the", "named", "PID", "file", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/lockfile/pidlockfile.py#L120-L151
train
nerdvegas/rez
src/rezgui/widgets/ConfiguredSplitter.py
ConfiguredSplitter.apply_saved_layout
def apply_saved_layout(self): """Call this after adding your child widgets.""" num_widgets = self.config.get(self.config_key + "/num_widgets", int) if num_widgets: sizes = [] for i in range(num_widgets): key = "%s/size_%d" % (self.config_key, i) ...
python
def apply_saved_layout(self): """Call this after adding your child widgets.""" num_widgets = self.config.get(self.config_key + "/num_widgets", int) if num_widgets: sizes = [] for i in range(num_widgets): key = "%s/size_%d" % (self.config_key, i) ...
[ "def", "apply_saved_layout", "(", "self", ")", ":", "num_widgets", "=", "self", ".", "config", ".", "get", "(", "self", ".", "config_key", "+", "\"/num_widgets\"", ",", "int", ")", "if", "num_widgets", ":", "sizes", "=", "[", "]", "for", "i", "in", "ra...
Call this after adding your child widgets.
[ "Call", "this", "after", "adding", "your", "child", "widgets", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/widgets/ConfiguredSplitter.py#L14-L25
train
nerdvegas/rez
src/rez/utils/data_utils.py
remove_nones
def remove_nones(**kwargs): """Return diict copy with nones removed. """ return dict((k, v) for k, v in kwargs.iteritems() if v is not None)
python
def remove_nones(**kwargs): """Return diict copy with nones removed. """ return dict((k, v) for k, v in kwargs.iteritems() if v is not None)
[ "def", "remove_nones", "(", "**", "kwargs", ")", ":", "return", "dict", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "kwargs", ".", "iteritems", "(", ")", "if", "v", "is", "not", "None", ")" ]
Return diict copy with nones removed.
[ "Return", "diict", "copy", "with", "nones", "removed", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/data_utils.py#L33-L36
train
nerdvegas/rez
src/rez/utils/data_utils.py
deep_update
def deep_update(dict1, dict2): """Perform a deep merge of `dict2` into `dict1`. Note that `dict2` and any nested dicts are unchanged. Supports `ModifyList` instances. """ def flatten(v): if isinstance(v, ModifyList): return v.apply([]) elif isinstance(v, dict): ...
python
def deep_update(dict1, dict2): """Perform a deep merge of `dict2` into `dict1`. Note that `dict2` and any nested dicts are unchanged. Supports `ModifyList` instances. """ def flatten(v): if isinstance(v, ModifyList): return v.apply([]) elif isinstance(v, dict): ...
[ "def", "deep_update", "(", "dict1", ",", "dict2", ")", ":", "def", "flatten", "(", "v", ")", ":", "if", "isinstance", "(", "v", ",", "ModifyList", ")", ":", "return", "v", ".", "apply", "(", "[", "]", ")", "elif", "isinstance", "(", "v", ",", "di...
Perform a deep merge of `dict2` into `dict1`. Note that `dict2` and any nested dicts are unchanged. Supports `ModifyList` instances.
[ "Perform", "a", "deep", "merge", "of", "dict2", "into", "dict1", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/data_utils.py#L39-L74
train
nerdvegas/rez
src/rez/utils/data_utils.py
deep_del
def deep_del(data, fn): """Create dict copy with removed items. Recursively remove items where fn(value) is True. Returns: dict: New dict with matching items removed. """ result = {} for k, v in data.iteritems(): if not fn(v): if isinstance(v, dict): ...
python
def deep_del(data, fn): """Create dict copy with removed items. Recursively remove items where fn(value) is True. Returns: dict: New dict with matching items removed. """ result = {} for k, v in data.iteritems(): if not fn(v): if isinstance(v, dict): ...
[ "def", "deep_del", "(", "data", ",", "fn", ")", ":", "result", "=", "{", "}", "for", "k", ",", "v", "in", "data", ".", "iteritems", "(", ")", ":", "if", "not", "fn", "(", "v", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "...
Create dict copy with removed items. Recursively remove items where fn(value) is True. Returns: dict: New dict with matching items removed.
[ "Create", "dict", "copy", "with", "removed", "items", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/data_utils.py#L77-L94
train
nerdvegas/rez
src/rez/utils/data_utils.py
get_dict_diff_str
def get_dict_diff_str(d1, d2, title): """Returns same as `get_dict_diff`, but as a readable string. """ added, removed, changed = get_dict_diff(d1, d2) lines = [title] if added: lines.append("Added attributes: %s" % ['.'.join(x) for x in added]) if removed: ...
python
def get_dict_diff_str(d1, d2, title): """Returns same as `get_dict_diff`, but as a readable string. """ added, removed, changed = get_dict_diff(d1, d2) lines = [title] if added: lines.append("Added attributes: %s" % ['.'.join(x) for x in added]) if removed: ...
[ "def", "get_dict_diff_str", "(", "d1", ",", "d2", ",", "title", ")", ":", "added", ",", "removed", ",", "changed", "=", "get_dict_diff", "(", "d1", ",", "d2", ")", "lines", "=", "[", "title", "]", "if", "added", ":", "lines", ".", "append", "(", "\...
Returns same as `get_dict_diff`, but as a readable string.
[ "Returns", "same", "as", "get_dict_diff", "but", "as", "a", "readable", "string", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/data_utils.py#L138-L154
train
nerdvegas/rez
src/rez/utils/data_utils.py
convert_dicts
def convert_dicts(d, to_class=AttrDictWrapper, from_class=dict): """Recursively convert dict and UserDict types. Note that `d` is unchanged. Args: to_class (type): Dict-like type to convert values to, usually UserDict subclass, or dict. from_class (type): Dict-like type to conv...
python
def convert_dicts(d, to_class=AttrDictWrapper, from_class=dict): """Recursively convert dict and UserDict types. Note that `d` is unchanged. Args: to_class (type): Dict-like type to convert values to, usually UserDict subclass, or dict. from_class (type): Dict-like type to conv...
[ "def", "convert_dicts", "(", "d", ",", "to_class", "=", "AttrDictWrapper", ",", "from_class", "=", "dict", ")", ":", "d_", "=", "to_class", "(", ")", "for", "key", ",", "value", "in", "d", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "va...
Recursively convert dict and UserDict types. Note that `d` is unchanged. Args: to_class (type): Dict-like type to convert values to, usually UserDict subclass, or dict. from_class (type): Dict-like type to convert values from. If a tuple, multiple types are converted. ...
[ "Recursively", "convert", "dict", "and", "UserDict", "types", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/data_utils.py#L319-L340
train
nerdvegas/rez
src/rez/package_repository.py
PackageRepositoryGlobalStats.package_loading
def package_loading(self): """Use this around code in your package repository that is loading a package, for example from file or cache. """ t1 = time.time() yield None t2 = time.time() self.package_load_time += t2 - t1
python
def package_loading(self): """Use this around code in your package repository that is loading a package, for example from file or cache. """ t1 = time.time() yield None t2 = time.time() self.package_load_time += t2 - t1
[ "def", "package_loading", "(", "self", ")", ":", "t1", "=", "time", ".", "time", "(", ")", "yield", "None", "t2", "=", "time", ".", "time", "(", ")", "self", ".", "package_load_time", "+=", "t2", "-", "t1" ]
Use this around code in your package repository that is loading a package, for example from file or cache.
[ "Use", "this", "around", "code", "in", "your", "package", "repository", "that", "is", "loading", "a", "package", "for", "example", "from", "file", "or", "cache", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_repository.py#L42-L50
train
nerdvegas/rez
src/rez/package_repository.py
PackageRepository.is_empty
def is_empty(self): """Determine if the repository contains any packages. Returns: True if there are no packages, False if there are at least one. """ for family in self.iter_package_families(): for pkg in self.iter_packages(family): return False ...
python
def is_empty(self): """Determine if the repository contains any packages. Returns: True if there are no packages, False if there are at least one. """ for family in self.iter_package_families(): for pkg in self.iter_packages(family): return False ...
[ "def", "is_empty", "(", "self", ")", ":", "for", "family", "in", "self", ".", "iter_package_families", "(", ")", ":", "for", "pkg", "in", "self", ".", "iter_packages", "(", "family", ")", ":", "return", "False", "return", "True" ]
Determine if the repository contains any packages. Returns: True if there are no packages, False if there are at least one.
[ "Determine", "if", "the", "repository", "contains", "any", "packages", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_repository.py#L119-L129
train
nerdvegas/rez
src/rez/package_repository.py
PackageRepository.make_resource_handle
def make_resource_handle(self, resource_key, **variables): """Create a `ResourceHandle` Nearly all `ResourceHandle` creation should go through here, because it gives the various resource classes a chance to normalize / standardize the resource handles, to improve caching / comparison / ...
python
def make_resource_handle(self, resource_key, **variables): """Create a `ResourceHandle` Nearly all `ResourceHandle` creation should go through here, because it gives the various resource classes a chance to normalize / standardize the resource handles, to improve caching / comparison / ...
[ "def", "make_resource_handle", "(", "self", ",", "resource_key", ",", "**", "variables", ")", ":", "if", "variables", ".", "get", "(", "\"repository_type\"", ",", "self", ".", "name", "(", ")", ")", "!=", "self", ".", "name", "(", ")", ":", "raise", "R...
Create a `ResourceHandle` Nearly all `ResourceHandle` creation should go through here, because it gives the various resource classes a chance to normalize / standardize the resource handles, to improve caching / comparison / etc.
[ "Create", "a", "ResourceHandle" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_repository.py#L256-L278
train
nerdvegas/rez
src/rez/package_repository.py
PackageRepositoryManager.get_repository
def get_repository(self, path): """Get a package repository. Args: path (str): Entry from the 'packages_path' config setting. This may simply be a path (which is managed by the 'filesystem' package repository plugin), or a string in the form "type@location", ...
python
def get_repository(self, path): """Get a package repository. Args: path (str): Entry from the 'packages_path' config setting. This may simply be a path (which is managed by the 'filesystem' package repository plugin), or a string in the form "type@location", ...
[ "def", "get_repository", "(", "self", ",", "path", ")", ":", "parts", "=", "path", ".", "split", "(", "'@'", ",", "1", ")", "if", "len", "(", "parts", ")", "==", "1", ":", "parts", "=", "(", "\"filesystem\"", ",", "parts", "[", "0", "]", ")", "...
Get a package repository. Args: path (str): Entry from the 'packages_path' config setting. This may simply be a path (which is managed by the 'filesystem' package repository plugin), or a string in the form "type@location", where 'type' identifies the...
[ "Get", "a", "package", "repository", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_repository.py#L368-L394
train
nerdvegas/rez
src/rez/package_repository.py
PackageRepositoryManager.are_same
def are_same(self, path_1, path_2): """Test that `path_1` and `path_2` refer to the same repository. This is more reliable than testing that the strings match, since slightly different strings might refer to the same repository (consider small differences in a filesystem path for exampl...
python
def are_same(self, path_1, path_2): """Test that `path_1` and `path_2` refer to the same repository. This is more reliable than testing that the strings match, since slightly different strings might refer to the same repository (consider small differences in a filesystem path for exampl...
[ "def", "are_same", "(", "self", ",", "path_1", ",", "path_2", ")", ":", "if", "path_1", "==", "path_2", ":", "return", "True", "repo_1", "=", "self", ".", "get_repository", "(", "path_1", ")", "repo_2", "=", "self", ".", "get_repository", "(", "path_2", ...
Test that `path_1` and `path_2` refer to the same repository. This is more reliable than testing that the strings match, since slightly different strings might refer to the same repository (consider small differences in a filesystem path for example, eg '//svr/foo', '/svr/foo'). Return...
[ "Test", "that", "path_1", "and", "path_2", "refer", "to", "the", "same", "repository", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_repository.py#L396-L411
train
nerdvegas/rez
src/rez/vendor/amqp/transport.py
create_transport
def create_transport(host, connect_timeout, ssl=False): """Given a few parameters from the Connection constructor, select and create a subclass of _AbstractTransport.""" if ssl: return SSLTransport(host, connect_timeout, ssl) else: return TCPTransport(host, connect_timeout)
python
def create_transport(host, connect_timeout, ssl=False): """Given a few parameters from the Connection constructor, select and create a subclass of _AbstractTransport.""" if ssl: return SSLTransport(host, connect_timeout, ssl) else: return TCPTransport(host, connect_timeout)
[ "def", "create_transport", "(", "host", ",", "connect_timeout", ",", "ssl", "=", "False", ")", ":", "if", "ssl", ":", "return", "SSLTransport", "(", "host", ",", "connect_timeout", ",", "ssl", ")", "else", ":", "return", "TCPTransport", "(", "host", ",", ...
Given a few parameters from the Connection constructor, select and create a subclass of _AbstractTransport.
[ "Given", "a", "few", "parameters", "from", "the", "Connection", "constructor", "select", "and", "create", "a", "subclass", "of", "_AbstractTransport", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/transport.py#L293-L299
train
nerdvegas/rez
src/rez/plugin_managers.py
RezPluginType.get_plugin_class
def get_plugin_class(self, plugin_name): """Returns the class registered under the given plugin name.""" try: return self.plugin_classes[plugin_name] except KeyError: raise RezPluginError("Unrecognised %s plugin: '%s'" % (self.pretty_type_...
python
def get_plugin_class(self, plugin_name): """Returns the class registered under the given plugin name.""" try: return self.plugin_classes[plugin_name] except KeyError: raise RezPluginError("Unrecognised %s plugin: '%s'" % (self.pretty_type_...
[ "def", "get_plugin_class", "(", "self", ",", "plugin_name", ")", ":", "try", ":", "return", "self", ".", "plugin_classes", "[", "plugin_name", "]", "except", "KeyError", ":", "raise", "RezPluginError", "(", "\"Unrecognised %s plugin: '%s'\"", "%", "(", "self", "...
Returns the class registered under the given plugin name.
[ "Returns", "the", "class", "registered", "under", "the", "given", "plugin", "name", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/plugin_managers.py#L157-L163
train
nerdvegas/rez
src/rez/plugin_managers.py
RezPluginType.get_plugin_module
def get_plugin_module(self, plugin_name): """Returns the module containing the plugin of the given name.""" try: return self.plugin_modules[plugin_name] except KeyError: raise RezPluginError("Unrecognised %s plugin: '%s'" % (self.pretty_ty...
python
def get_plugin_module(self, plugin_name): """Returns the module containing the plugin of the given name.""" try: return self.plugin_modules[plugin_name] except KeyError: raise RezPluginError("Unrecognised %s plugin: '%s'" % (self.pretty_ty...
[ "def", "get_plugin_module", "(", "self", ",", "plugin_name", ")", ":", "try", ":", "return", "self", ".", "plugin_modules", "[", "plugin_name", "]", "except", "KeyError", ":", "raise", "RezPluginError", "(", "\"Unrecognised %s plugin: '%s'\"", "%", "(", "self", ...
Returns the module containing the plugin of the given name.
[ "Returns", "the", "module", "containing", "the", "plugin", "of", "the", "given", "name", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/plugin_managers.py#L165-L171
train
nerdvegas/rez
src/rez/plugin_managers.py
RezPluginType.config_schema
def config_schema(self): """Returns the merged configuration data schema for this plugin type.""" from rez.config import _plugin_config_dict d = _plugin_config_dict.get(self.type_name, {}) for name, plugin_class in self.plugin_classes.iteritems(): if hasattr(plugin_c...
python
def config_schema(self): """Returns the merged configuration data schema for this plugin type.""" from rez.config import _plugin_config_dict d = _plugin_config_dict.get(self.type_name, {}) for name, plugin_class in self.plugin_classes.iteritems(): if hasattr(plugin_c...
[ "def", "config_schema", "(", "self", ")", ":", "from", "rez", ".", "config", "import", "_plugin_config_dict", "d", "=", "_plugin_config_dict", ".", "get", "(", "self", ".", "type_name", ",", "{", "}", ")", "for", "name", ",", "plugin_class", "in", "self", ...
Returns the merged configuration data schema for this plugin type.
[ "Returns", "the", "merged", "configuration", "data", "schema", "for", "this", "plugin", "type", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/plugin_managers.py#L174-L185
train
nerdvegas/rez
src/rez/plugin_managers.py
RezPluginManager.get_plugin_class
def get_plugin_class(self, plugin_type, plugin_name): """Return the class registered under the given plugin name.""" plugin = self._get_plugin_type(plugin_type) return plugin.get_plugin_class(plugin_name)
python
def get_plugin_class(self, plugin_type, plugin_name): """Return the class registered under the given plugin name.""" plugin = self._get_plugin_type(plugin_type) return plugin.get_plugin_class(plugin_name)
[ "def", "get_plugin_class", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "plugin", "=", "self", ".", "_get_plugin_type", "(", "plugin_type", ")", "return", "plugin", ".", "get_plugin_class", "(", "plugin_name", ")" ]
Return the class registered under the given plugin name.
[ "Return", "the", "class", "registered", "under", "the", "given", "plugin", "name", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/plugin_managers.py#L278-L281
train
nerdvegas/rez
src/rez/plugin_managers.py
RezPluginManager.get_plugin_module
def get_plugin_module(self, plugin_type, plugin_name): """Return the module defining the class registered under the given plugin name.""" plugin = self._get_plugin_type(plugin_type) return plugin.get_plugin_module(plugin_name)
python
def get_plugin_module(self, plugin_type, plugin_name): """Return the module defining the class registered under the given plugin name.""" plugin = self._get_plugin_type(plugin_type) return plugin.get_plugin_module(plugin_name)
[ "def", "get_plugin_module", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "plugin", "=", "self", ".", "_get_plugin_type", "(", "plugin_type", ")", "return", "plugin", ".", "get_plugin_module", "(", "plugin_name", ")" ]
Return the module defining the class registered under the given plugin name.
[ "Return", "the", "module", "defining", "the", "class", "registered", "under", "the", "given", "plugin", "name", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/plugin_managers.py#L283-L287
train
nerdvegas/rez
src/rez/plugin_managers.py
RezPluginManager.create_instance
def create_instance(self, plugin_type, plugin_name, **instance_kwargs): """Create and return an instance of the given plugin.""" plugin_type = self._get_plugin_type(plugin_type) return plugin_type.create_instance(plugin_name, **instance_kwargs)
python
def create_instance(self, plugin_type, plugin_name, **instance_kwargs): """Create and return an instance of the given plugin.""" plugin_type = self._get_plugin_type(plugin_type) return plugin_type.create_instance(plugin_name, **instance_kwargs)
[ "def", "create_instance", "(", "self", ",", "plugin_type", ",", "plugin_name", ",", "**", "instance_kwargs", ")", ":", "plugin_type", "=", "self", ".", "_get_plugin_type", "(", "plugin_type", ")", "return", "plugin_type", ".", "create_instance", "(", "plugin_name"...
Create and return an instance of the given plugin.
[ "Create", "and", "return", "an", "instance", "of", "the", "given", "plugin", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/plugin_managers.py#L308-L311
train
nerdvegas/rez
src/rez/plugin_managers.py
RezPluginManager.get_summary_string
def get_summary_string(self): """Get a formatted string summarising the plugins that were loaded.""" rows = [["PLUGIN TYPE", "NAME", "DESCRIPTION", "STATUS"], ["-----------", "----", "-----------", "------"]] for plugin_type in sorted(self.get_plugin_types()): type_na...
python
def get_summary_string(self): """Get a formatted string summarising the plugins that were loaded.""" rows = [["PLUGIN TYPE", "NAME", "DESCRIPTION", "STATUS"], ["-----------", "----", "-----------", "------"]] for plugin_type in sorted(self.get_plugin_types()): type_na...
[ "def", "get_summary_string", "(", "self", ")", ":", "rows", "=", "[", "[", "\"PLUGIN TYPE\"", ",", "\"NAME\"", ",", "\"DESCRIPTION\"", ",", "\"STATUS\"", "]", ",", "[", "\"-----------\"", ",", "\"----\"", ",", "\"-----------\"", ",", "\"------\"", "]", "]", ...
Get a formatted string summarising the plugins that were loaded.
[ "Get", "a", "formatted", "string", "summarising", "the", "plugins", "that", "were", "loaded", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/plugin_managers.py#L313-L326
train
nerdvegas/rez
src/rez/vendor/distlib/markers.py
Evaluator.get_fragment
def get_fragment(self, offset): """ Get the part of the source which is causing a problem. """ fragment_len = 10 s = '%r' % (self.source[offset:offset + fragment_len]) if offset + fragment_len < len(self.source): s += '...' return s
python
def get_fragment(self, offset): """ Get the part of the source which is causing a problem. """ fragment_len = 10 s = '%r' % (self.source[offset:offset + fragment_len]) if offset + fragment_len < len(self.source): s += '...' return s
[ "def", "get_fragment", "(", "self", ",", "offset", ")", ":", "fragment_len", "=", "10", "s", "=", "'%r'", "%", "(", "self", ".", "source", "[", "offset", ":", "offset", "+", "fragment_len", "]", ")", "if", "offset", "+", "fragment_len", "<", "len", "...
Get the part of the source which is causing a problem.
[ "Get", "the", "part", "of", "the", "source", "which", "is", "causing", "a", "problem", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/markers.py#L60-L68
train
nerdvegas/rez
src/rez/vendor/distlib/markers.py
Evaluator.evaluate
def evaluate(self, node, filename=None): """ Evaluate a source string or node, using ``filename`` when displaying errors. """ if isinstance(node, string_types): self.source = node kwargs = {'mode': 'eval'} if filename: kwargs['f...
python
def evaluate(self, node, filename=None): """ Evaluate a source string or node, using ``filename`` when displaying errors. """ if isinstance(node, string_types): self.source = node kwargs = {'mode': 'eval'} if filename: kwargs['f...
[ "def", "evaluate", "(", "self", ",", "node", ",", "filename", "=", "None", ")", ":", "if", "isinstance", "(", "node", ",", "string_types", ")", ":", "self", ".", "source", "=", "node", "kwargs", "=", "{", "'mode'", ":", "'eval'", "}", "if", "filename...
Evaluate a source string or node, using ``filename`` when displaying errors.
[ "Evaluate", "a", "source", "string", "or", "node", "using", "filename", "when", "displaying", "errors", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/markers.py#L76-L100
train
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedlist.py
recursive_repr
def recursive_repr(func): """Decorator to prevent infinite repr recursion.""" repr_running = set() @wraps(func) def wrapper(self): "Return ellipsis on recursive re-entry to function." key = id(self), get_ident() if key in repr_running: return '...' repr_run...
python
def recursive_repr(func): """Decorator to prevent infinite repr recursion.""" repr_running = set() @wraps(func) def wrapper(self): "Return ellipsis on recursive re-entry to function." key = id(self), get_ident() if key in repr_running: return '...' repr_run...
[ "def", "recursive_repr", "(", "func", ")", ":", "repr_running", "=", "set", "(", ")", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ")", ":", "\"Return ellipsis on recursive re-entry to function.\"", "key", "=", "id", "(", "self", ")", ",", ...
Decorator to prevent infinite repr recursion.
[ "Decorator", "to", "prevent", "infinite", "repr", "recursion", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedlist.py#L33-L52
train
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedlist.py
SortedList._reset
def _reset(self, load): """ Reset sorted list load. The *load* specifies the load-factor of the list. The default load factor of '1000' works well for lists from tens to tens of millions of elements. Good practice is to use a value that is the cube root of the list size...
python
def _reset(self, load): """ Reset sorted list load. The *load* specifies the load-factor of the list. The default load factor of '1000' works well for lists from tens to tens of millions of elements. Good practice is to use a value that is the cube root of the list size...
[ "def", "_reset", "(", "self", ",", "load", ")", ":", "values", "=", "reduce", "(", "iadd", ",", "self", ".", "_lists", ",", "[", "]", ")", "self", ".", "_clear", "(", ")", "self", ".", "_load", "=", "load", "self", ".", "_half", "=", "load", ">...
Reset sorted list load. The *load* specifies the load-factor of the list. The default load factor of '1000' works well for lists from tens to tens of millions of elements. Good practice is to use a value that is the cube root of the list size. With billions of elements, the best load ...
[ "Reset", "sorted", "list", "load", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedlist.py#L105-L121
train
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedlist.py
SortedList._build_index
def _build_index(self): """Build an index for indexing the sorted list. Indexes are represented as binary trees in a dense array notation similar to a binary heap. For example, given a _lists representation storing integers: [0]: 1 2 3 [1]: 4 5 [2]: 6 7 8 9 ...
python
def _build_index(self): """Build an index for indexing the sorted list. Indexes are represented as binary trees in a dense array notation similar to a binary heap. For example, given a _lists representation storing integers: [0]: 1 2 3 [1]: 4 5 [2]: 6 7 8 9 ...
[ "def", "_build_index", "(", "self", ")", ":", "row0", "=", "list", "(", "map", "(", "len", ",", "self", ".", "_lists", ")", ")", "if", "len", "(", "row0", ")", "==", "1", ":", "self", ".", "_index", "[", ":", "]", "=", "row0", "self", ".", "_...
Build an index for indexing the sorted list. Indexes are represented as binary trees in a dense array notation similar to a binary heap. For example, given a _lists representation storing integers: [0]: 1 2 3 [1]: 4 5 [2]: 6 7 8 9 [3]: 10 11 12 13 14 T...
[ "Build", "an", "index", "for", "indexing", "the", "sorted", "list", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedlist.py#L494-L558
train
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedlist.py
SortedListWithKey.irange_key
def irange_key(self, min_key=None, max_key=None, inclusive=(True, True), reverse=False): """ Create an iterator of values between `min_key` and `max_key`. `inclusive` is a pair of booleans that indicates whether the min_key and max_key ought to be included in the rang...
python
def irange_key(self, min_key=None, max_key=None, inclusive=(True, True), reverse=False): """ Create an iterator of values between `min_key` and `max_key`. `inclusive` is a pair of booleans that indicates whether the min_key and max_key ought to be included in the rang...
[ "def", "irange_key", "(", "self", ",", "min_key", "=", "None", ",", "max_key", "=", "None", ",", "inclusive", "=", "(", "True", ",", "True", ")", ",", "reverse", "=", "False", ")", ":", "_maxes", "=", "self", ".", "_maxes", "if", "not", "_maxes", "...
Create an iterator of values between `min_key` and `max_key`. `inclusive` is a pair of booleans that indicates whether the min_key and max_key ought to be included in the range, respectively. The default is (True, True) such that the range is inclusive of both `min_key` and `max_key`. ...
[ "Create", "an", "iterator", "of", "values", "between", "min_key", "and", "max_key", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedlist.py#L1966-L2035
train
nerdvegas/rez
src/rezgui/dialogs/WriteGraphDialog.py
view_graph
def view_graph(graph_str, parent=None, prune_to=None): """View a graph.""" from rezgui.dialogs.ImageViewerDialog import ImageViewerDialog from rez.config import config # check for already written tempfile h = hash((graph_str, prune_to)) filepath = graph_file_lookup.get(h) if filepath and no...
python
def view_graph(graph_str, parent=None, prune_to=None): """View a graph.""" from rezgui.dialogs.ImageViewerDialog import ImageViewerDialog from rez.config import config # check for already written tempfile h = hash((graph_str, prune_to)) filepath = graph_file_lookup.get(h) if filepath and no...
[ "def", "view_graph", "(", "graph_str", ",", "parent", "=", "None", ",", "prune_to", "=", "None", ")", ":", "from", "rezgui", ".", "dialogs", ".", "ImageViewerDialog", "import", "ImageViewerDialog", "from", "rez", ".", "config", "import", "config", "h", "=", ...
View a graph.
[ "View", "a", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/dialogs/WriteGraphDialog.py#L109-L133
train
nerdvegas/rez
src/rezgui/widgets/PackageVersionsTable.py
PackageVersionsTable.select_version
def select_version(self, version_range): """Select the latest versioned package in the given range. If there are no packages in the range, the selection is cleared. """ row = -1 version = None for i, package in self.packages.iteritems(): if package.version in...
python
def select_version(self, version_range): """Select the latest versioned package in the given range. If there are no packages in the range, the selection is cleared. """ row = -1 version = None for i, package in self.packages.iteritems(): if package.version in...
[ "def", "select_version", "(", "self", ",", "version_range", ")", ":", "row", "=", "-", "1", "version", "=", "None", "for", "i", ",", "package", "in", "self", ".", "packages", ".", "iteritems", "(", ")", ":", "if", "package", ".", "version", "in", "ve...
Select the latest versioned package in the given range. If there are no packages in the range, the selection is cleared.
[ "Select", "the", "latest", "versioned", "package", "in", "the", "given", "range", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/widgets/PackageVersionsTable.py#L46-L62
train
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedset.py
SortedSet._fromset
def _fromset(cls, values, key=None): """Initialize sorted set from existing set.""" sorted_set = object.__new__(cls) sorted_set._set = values # pylint: disable=protected-access sorted_set.__init__(key=key) return sorted_set
python
def _fromset(cls, values, key=None): """Initialize sorted set from existing set.""" sorted_set = object.__new__(cls) sorted_set._set = values # pylint: disable=protected-access sorted_set.__init__(key=key) return sorted_set
[ "def", "_fromset", "(", "cls", ",", "values", ",", "key", "=", "None", ")", ":", "sorted_set", "=", "object", ".", "__new__", "(", "cls", ")", "sorted_set", ".", "_set", "=", "values", "sorted_set", ".", "__init__", "(", "key", "=", "key", ")", "retu...
Initialize sorted set from existing set.
[ "Initialize", "sorted", "set", "from", "existing", "set", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedset.py#L73-L78
train
nerdvegas/rez
src/rez/cli/build.py
setup_parser_common
def setup_parser_common(parser): """Parser setup common to both rez-build and rez-release.""" from rez.build_process_ import get_build_process_types from rez.build_system import get_valid_build_systems process_types = get_build_process_types() parser.add_argument( "--process", type=str, cho...
python
def setup_parser_common(parser): """Parser setup common to both rez-build and rez-release.""" from rez.build_process_ import get_build_process_types from rez.build_system import get_valid_build_systems process_types = get_build_process_types() parser.add_argument( "--process", type=str, cho...
[ "def", "setup_parser_common", "(", "parser", ")", ":", "from", "rez", ".", "build_process_", "import", "get_build_process_types", "from", "rez", ".", "build_system", "import", "get_valid_build_systems", "process_types", "=", "get_build_process_types", "(", ")", "parser"...
Parser setup common to both rez-build and rez-release.
[ "Parser", "setup", "common", "to", "both", "rez", "-", "build", "and", "rez", "-", "release", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/cli/build.py#L30-L71
train
nerdvegas/rez
src/rez/utils/scope.py
scoped_format
def scoped_format(txt, **objects): """Format a string with respect to a set of objects' attributes. Example: >>> Class Foo(object): >>> def __init__(self): >>> self.name = "Dave" >>> print scoped_format("hello {foo.name}", foo=Foo()) hello Dave Args: ...
python
def scoped_format(txt, **objects): """Format a string with respect to a set of objects' attributes. Example: >>> Class Foo(object): >>> def __init__(self): >>> self.name = "Dave" >>> print scoped_format("hello {foo.name}", foo=Foo()) hello Dave Args: ...
[ "def", "scoped_format", "(", "txt", ",", "**", "objects", ")", ":", "pretty", "=", "objects", ".", "pop", "(", "\"pretty\"", ",", "RecursiveAttribute", ".", "format_pretty", ")", "expand", "=", "objects", ".", "pop", "(", "\"expand\"", ",", "RecursiveAttribu...
Format a string with respect to a set of objects' attributes. Example: >>> Class Foo(object): >>> def __init__(self): >>> self.name = "Dave" >>> print scoped_format("hello {foo.name}", foo=Foo()) hello Dave Args: objects (dict): Dict of objects to f...
[ "Format", "a", "string", "with", "respect", "to", "a", "set", "of", "objects", "attributes", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/scope.py#L238-L260
train
nerdvegas/rez
src/rez/utils/scope.py
RecursiveAttribute.to_dict
def to_dict(self): """Get an equivalent dict representation.""" d = {} for k, v in self.__dict__["data"].iteritems(): if isinstance(v, RecursiveAttribute): d[k] = v.to_dict() else: d[k] = v return d
python
def to_dict(self): """Get an equivalent dict representation.""" d = {} for k, v in self.__dict__["data"].iteritems(): if isinstance(v, RecursiveAttribute): d[k] = v.to_dict() else: d[k] = v return d
[ "def", "to_dict", "(", "self", ")", ":", "d", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "__dict__", "[", "\"data\"", "]", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", "RecursiveAttribute", ")", ":", "d", "[", ...
Get an equivalent dict representation.
[ "Get", "an", "equivalent", "dict", "representation", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/scope.py#L89-L97
train
nerdvegas/rez
src/rezgui/objects/Config.py
Config.value
def value(self, key, type_=None): """Get the value of a setting. If `type` is not provided, the key must be for a known setting, present in `self.default_settings`. Conversely if `type` IS provided, the key must be for an unknown setting. """ if type_ is None: ...
python
def value(self, key, type_=None): """Get the value of a setting. If `type` is not provided, the key must be for a known setting, present in `self.default_settings`. Conversely if `type` IS provided, the key must be for an unknown setting. """ if type_ is None: ...
[ "def", "value", "(", "self", ",", "key", ",", "type_", "=", "None", ")", ":", "if", "type_", "is", "None", ":", "default", "=", "self", ".", "_default_value", "(", "key", ")", "val", "=", "self", ".", "_value", "(", "key", ",", "default", ")", "i...
Get the value of a setting. If `type` is not provided, the key must be for a known setting, present in `self.default_settings`. Conversely if `type` IS provided, the key must be for an unknown setting.
[ "Get", "the", "value", "of", "a", "setting", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/Config.py#L15-L33
train
nerdvegas/rez
src/rezgui/objects/Config.py
Config.get_string_list
def get_string_list(self, key): """Get a list of strings.""" strings = [] size = self.beginReadArray(key) for i in range(size): self.setArrayIndex(i) entry = str(self._value("entry")) strings.append(entry) self.endArray() return strings
python
def get_string_list(self, key): """Get a list of strings.""" strings = [] size = self.beginReadArray(key) for i in range(size): self.setArrayIndex(i) entry = str(self._value("entry")) strings.append(entry) self.endArray() return strings
[ "def", "get_string_list", "(", "self", ",", "key", ")", ":", "strings", "=", "[", "]", "size", "=", "self", ".", "beginReadArray", "(", "key", ")", "for", "i", "in", "range", "(", "size", ")", ":", "self", ".", "setArrayIndex", "(", "i", ")", "entr...
Get a list of strings.
[ "Get", "a", "list", "of", "strings", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/Config.py#L38-L47
train
nerdvegas/rez
src/rezgui/objects/Config.py
Config.prepend_string_list
def prepend_string_list(self, key, value, max_length_key): """Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' e...
python
def prepend_string_list(self, key, value, max_length_key): """Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' e...
[ "def", "prepend_string_list", "(", "self", ",", "key", ",", "value", ",", "max_length_key", ")", ":", "max_len", "=", "self", ".", "get", "(", "max_length_key", ")", "strings", "=", "self", ".", "get_string_list", "(", "key", ")", "strings", "=", "[", "v...
Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' entry.
[ "Prepend", "a", "fixed", "-", "length", "string", "list", "with", "a", "new", "string", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/Config.py#L49-L65
train
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/utils.py
priority_queue.insert
def insert(self, item, priority): """ Insert item into the queue, with the given priority. """ heappush(self.heap, HeapItem(item, priority))
python
def insert(self, item, priority): """ Insert item into the queue, with the given priority. """ heappush(self.heap, HeapItem(item, priority))
[ "def", "insert", "(", "self", ",", "item", ",", "priority", ")", ":", "heappush", "(", "self", ".", "heap", ",", "HeapItem", "(", "item", ",", "priority", ")", ")" ]
Insert item into the queue, with the given priority.
[ "Insert", "item", "into", "the", "queue", "with", "the", "given", "priority", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/utils.py#L57-L61
train
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
connected_components
def connected_components(graph): """ Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component. """ recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes(...
python
def connected_components(graph): """ Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component. """ recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes(...
[ "def", "connected_components", "(", "graph", ")", ":", "recursionlimit", "=", "getrecursionlimit", "(", ")", "setrecursionlimit", "(", "max", "(", "len", "(", "graph", ".", "nodes", "(", ")", ")", "*", "2", ",", "recursionlimit", ")", ")", "visited", "=", ...
Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component.
[ "Connected", "components", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L114-L138
train
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
cut_edges
def cut_edges(graph): """ Return the cut-edges of the given graph. A cut edge, or bridge, is an edge of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @return: List of cut-...
python
def cut_edges(graph): """ Return the cut-edges of the given graph. A cut edge, or bridge, is an edge of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @return: List of cut-...
[ "def", "cut_edges", "(", "graph", ")", ":", "recursionlimit", "=", "getrecursionlimit", "(", ")", "setrecursionlimit", "(", "max", "(", "len", "(", "graph", ".", "nodes", "(", ")", ")", "*", "2", ",", "recursionlimit", ")", ")", "if", "'hypergraph'", "==...
Return the cut-edges of the given graph. A cut edge, or bridge, is an edge of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @return: List of cut-edges.
[ "Return", "the", "cut", "-", "edges", "of", "the", "given", "graph", ".", "A", "cut", "edge", "or", "bridge", "is", "an", "edge", "of", "a", "graph", "whose", "removal", "increases", "the", "number", "of", "connected", "components", "in", "the", "graph",...
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L182-L214
train
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
_cut_hyperedges
def _cut_hyperedges(hypergraph): """ Return the cut-hyperedges of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes. """ edges_ = cut_nodes(hypergraph.graph) edges = [] for each in edges_: ...
python
def _cut_hyperedges(hypergraph): """ Return the cut-hyperedges of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes. """ edges_ = cut_nodes(hypergraph.graph) edges = [] for each in edges_: ...
[ "def", "_cut_hyperedges", "(", "hypergraph", ")", ":", "edges_", "=", "cut_nodes", "(", "hypergraph", ".", "graph", ")", "edges", "=", "[", "]", "for", "each", "in", "edges_", ":", "if", "(", "each", "[", "1", "]", "==", "'h'", ")", ":", "edges", "...
Return the cut-hyperedges of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes.
[ "Return", "the", "cut", "-", "hyperedges", "of", "the", "given", "hypergraph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L217-L234
train
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
cut_nodes
def cut_nodes(graph): """ Return the cut-nodes of the given graph. A cut node, or articulation point, is a node of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @retur...
python
def cut_nodes(graph): """ Return the cut-nodes of the given graph. A cut node, or articulation point, is a node of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @retur...
[ "def", "cut_nodes", "(", "graph", ")", ":", "recursionlimit", "=", "getrecursionlimit", "(", ")", "setrecursionlimit", "(", "max", "(", "len", "(", "graph", ".", "nodes", "(", ")", ")", "*", "2", ",", "recursionlimit", ")", ")", "if", "'hypergraph'", "==...
Return the cut-nodes of the given graph. A cut node, or articulation point, is a node of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @return: List of cut-nodes.
[ "Return", "the", "cut", "-", "nodes", "of", "the", "given", "graph", ".", "A", "cut", "node", "or", "articulation", "point", "is", "a", "node", "of", "a", "graph", "whose", "removal", "increases", "the", "number", "of", "connected", "components", "in", "...
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L237-L288
train
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
_cut_hypernodes
def _cut_hypernodes(hypergraph): """ Return the cut-nodes of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes. """ nodes_ = cut_nodes(hypergraph.graph) nodes = [] for each in nodes_: ...
python
def _cut_hypernodes(hypergraph): """ Return the cut-nodes of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes. """ nodes_ = cut_nodes(hypergraph.graph) nodes = [] for each in nodes_: ...
[ "def", "_cut_hypernodes", "(", "hypergraph", ")", ":", "nodes_", "=", "cut_nodes", "(", "hypergraph", ".", "graph", ")", "nodes", "=", "[", "]", "for", "each", "in", "nodes_", ":", "if", "(", "each", "[", "1", "]", "==", "'n'", ")", ":", "nodes", "...
Return the cut-nodes of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes.
[ "Return", "the", "cut", "-", "nodes", "of", "the", "given", "hypergraph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L291-L308
train
nerdvegas/rez
src/rez/vendor/pygraph/classes/graph.py
graph.del_edge
def del_edge(self, edge): """ Remove an edge from the graph. @type edge: tuple @param edge: Edge. """ u, v = edge self.node_neighbors[u].remove(v) self.del_edge_labeling((u, v)) if (u != v): self.node_neighbors[v].remove(u) ...
python
def del_edge(self, edge): """ Remove an edge from the graph. @type edge: tuple @param edge: Edge. """ u, v = edge self.node_neighbors[u].remove(v) self.del_edge_labeling((u, v)) if (u != v): self.node_neighbors[v].remove(u) ...
[ "def", "del_edge", "(", "self", ",", "edge", ")", ":", "u", ",", "v", "=", "edge", "self", ".", "node_neighbors", "[", "u", "]", ".", "remove", "(", "v", ")", "self", ".", "del_edge_labeling", "(", "(", "u", ",", "v", ")", ")", "if", "(", "u", ...
Remove an edge from the graph. @type edge: tuple @param edge: Edge.
[ "Remove", "an", "edge", "from", "the", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/graph.py#L170-L182
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.edge_weight
def edge_weight(self, edge): """ Get the weight of an edge. @type edge: edge @param edge: One edge. @rtype: number @return: Edge weight. """ return self.get_edge_properties( edge ).setdefault( self.WEIGHT_ATTRIBUTE_NAME, self.DEFAULT_WEIGHT )
python
def edge_weight(self, edge): """ Get the weight of an edge. @type edge: edge @param edge: One edge. @rtype: number @return: Edge weight. """ return self.get_edge_properties( edge ).setdefault( self.WEIGHT_ATTRIBUTE_NAME, self.DEFAULT_WEIGHT )
[ "def", "edge_weight", "(", "self", ",", "edge", ")", ":", "return", "self", ".", "get_edge_properties", "(", "edge", ")", ".", "setdefault", "(", "self", ".", "WEIGHT_ATTRIBUTE_NAME", ",", "self", ".", "DEFAULT_WEIGHT", ")" ]
Get the weight of an edge. @type edge: edge @param edge: One edge. @rtype: number @return: Edge weight.
[ "Get", "the", "weight", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L66-L76
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.set_edge_weight
def set_edge_weight(self, edge, wt): """ Set the weight of an edge. @type edge: edge @param edge: One edge. @type wt: number @param wt: Edge weight. """ self.set_edge_properties(edge, weight=wt ) if not self.DIRECTED: self.set_edge_...
python
def set_edge_weight(self, edge, wt): """ Set the weight of an edge. @type edge: edge @param edge: One edge. @type wt: number @param wt: Edge weight. """ self.set_edge_properties(edge, weight=wt ) if not self.DIRECTED: self.set_edge_...
[ "def", "set_edge_weight", "(", "self", ",", "edge", ",", "wt", ")", ":", "self", ".", "set_edge_properties", "(", "edge", ",", "weight", "=", "wt", ")", "if", "not", "self", ".", "DIRECTED", ":", "self", ".", "set_edge_properties", "(", "(", "edge", "[...
Set the weight of an edge. @type edge: edge @param edge: One edge. @type wt: number @param wt: Edge weight.
[ "Set", "the", "weight", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L79-L91
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.edge_label
def edge_label(self, edge): """ Get the label of an edge. @type edge: edge @param edge: One edge. @rtype: string @return: Edge label """ return self.get_edge_properties( edge ).setdefault( self.LABEL_ATTRIBUTE_NAME, self.DEFAULT_LABEL )
python
def edge_label(self, edge): """ Get the label of an edge. @type edge: edge @param edge: One edge. @rtype: string @return: Edge label """ return self.get_edge_properties( edge ).setdefault( self.LABEL_ATTRIBUTE_NAME, self.DEFAULT_LABEL )
[ "def", "edge_label", "(", "self", ",", "edge", ")", ":", "return", "self", ".", "get_edge_properties", "(", "edge", ")", ".", "setdefault", "(", "self", ".", "LABEL_ATTRIBUTE_NAME", ",", "self", ".", "DEFAULT_LABEL", ")" ]
Get the label of an edge. @type edge: edge @param edge: One edge. @rtype: string @return: Edge label
[ "Get", "the", "label", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L94-L104
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.set_edge_label
def set_edge_label(self, edge, label): """ Set the label of an edge. @type edge: edge @param edge: One edge. @type label: string @param label: Edge label. """ self.set_edge_properties(edge, label=label ) if not self.DIRECTED: self.s...
python
def set_edge_label(self, edge, label): """ Set the label of an edge. @type edge: edge @param edge: One edge. @type label: string @param label: Edge label. """ self.set_edge_properties(edge, label=label ) if not self.DIRECTED: self.s...
[ "def", "set_edge_label", "(", "self", ",", "edge", ",", "label", ")", ":", "self", ".", "set_edge_properties", "(", "edge", ",", "label", "=", "label", ")", "if", "not", "self", ".", "DIRECTED", ":", "self", ".", "set_edge_properties", "(", "(", "edge", ...
Set the label of an edge. @type edge: edge @param edge: One edge. @type label: string @param label: Edge label.
[ "Set", "the", "label", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L106-L118
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.add_edge_attribute
def add_edge_attribute(self, edge, attr): """ Add attribute to the given edge. @type edge: edge @param edge: One edge. @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value). """ self.edge_attr[edge] = self.ed...
python
def add_edge_attribute(self, edge, attr): """ Add attribute to the given edge. @type edge: edge @param edge: One edge. @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value). """ self.edge_attr[edge] = self.ed...
[ "def", "add_edge_attribute", "(", "self", ",", "edge", ",", "attr", ")", ":", "self", ".", "edge_attr", "[", "edge", "]", "=", "self", ".", "edge_attributes", "(", "edge", ")", "+", "[", "attr", "]", "if", "(", "not", "self", ".", "DIRECTED", "and", ...
Add attribute to the given edge. @type edge: edge @param edge: One edge. @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value).
[ "Add", "attribute", "to", "the", "given", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L128-L141
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.add_node_attribute
def add_node_attribute(self, node, attr): """ Add attribute to the given node. @type node: node @param node: Node identifier @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value). """ self.node_attr[node] = s...
python
def add_node_attribute(self, node, attr): """ Add attribute to the given node. @type node: node @param node: Node identifier @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value). """ self.node_attr[node] = s...
[ "def", "add_node_attribute", "(", "self", ",", "node", ",", "attr", ")", ":", "self", ".", "node_attr", "[", "node", "]", "=", "self", ".", "node_attr", "[", "node", "]", "+", "[", "attr", "]" ]
Add attribute to the given node. @type node: node @param node: Node identifier @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value).
[ "Add", "attribute", "to", "the", "given", "node", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L157-L167
train
nerdvegas/rez
src/rez/suite.py
Suite.activation_shell_code
def activation_shell_code(self, shell=None): """Get shell code that should be run to activate this suite.""" from rez.shells import create_shell from rez.rex import RexExecutor executor = RexExecutor(interpreter=create_shell(shell), parent_variables=["PATH...
python
def activation_shell_code(self, shell=None): """Get shell code that should be run to activate this suite.""" from rez.shells import create_shell from rez.rex import RexExecutor executor = RexExecutor(interpreter=create_shell(shell), parent_variables=["PATH...
[ "def", "activation_shell_code", "(", "self", ",", "shell", "=", "None", ")", ":", "from", "rez", ".", "shells", "import", "create_shell", "from", "rez", ".", "rex", "import", "RexExecutor", "executor", "=", "RexExecutor", "(", "interpreter", "=", "create_shell...
Get shell code that should be run to activate this suite.
[ "Get", "shell", "code", "that", "should", "be", "run", "to", "activate", "this", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L68-L77
train
nerdvegas/rez
src/rez/suite.py
Suite.context
def context(self, name): """Get a context. Args: name (str): Name to store the context under. Returns: `ResolvedContext` object. """ data = self._context(name) context = data.get("context") if context: return context ...
python
def context(self, name): """Get a context. Args: name (str): Name to store the context under. Returns: `ResolvedContext` object. """ data = self._context(name) context = data.get("context") if context: return context ...
[ "def", "context", "(", "self", ",", "name", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "context", "=", "data", ".", "get", "(", "\"context\"", ")", "if", "context", ":", "return", "context", "assert", "self", ".", "load_path", ...
Get a context. Args: name (str): Name to store the context under. Returns: `ResolvedContext` object.
[ "Get", "a", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L82-L101
train
nerdvegas/rez
src/rez/suite.py
Suite.add_context
def add_context(self, name, context, prefix_char=None): """Add a context to the suite. Args: name (str): Name to store the context under. context (ResolvedContext): Context to add. """ if name in self.contexts: raise SuiteError("Context already in sui...
python
def add_context(self, name, context, prefix_char=None): """Add a context to the suite. Args: name (str): Name to store the context under. context (ResolvedContext): Context to add. """ if name in self.contexts: raise SuiteError("Context already in sui...
[ "def", "add_context", "(", "self", ",", "name", ",", "context", ",", "prefix_char", "=", "None", ")", ":", "if", "name", "in", "self", ".", "contexts", ":", "raise", "SuiteError", "(", "\"Context already in suite: %r\"", "%", "name", ")", "if", "not", "con...
Add a context to the suite. Args: name (str): Name to store the context under. context (ResolvedContext): Context to add.
[ "Add", "a", "context", "to", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L103-L121
train
nerdvegas/rez
src/rez/suite.py
Suite.find_contexts
def find_contexts(self, in_request=None, in_resolve=None): """Find contexts in the suite based on search criteria. Args: in_request (str): Match contexts that contain the given package in their request. in_resolve (str or `Requirement`): Match contexts that conta...
python
def find_contexts(self, in_request=None, in_resolve=None): """Find contexts in the suite based on search criteria. Args: in_request (str): Match contexts that contain the given package in their request. in_resolve (str or `Requirement`): Match contexts that conta...
[ "def", "find_contexts", "(", "self", ",", "in_request", "=", "None", ",", "in_resolve", "=", "None", ")", ":", "names", "=", "self", ".", "context_names", "if", "in_request", ":", "def", "_in_request", "(", "name", ")", ":", "context", "=", "self", ".", ...
Find contexts in the suite based on search criteria. Args: in_request (str): Match contexts that contain the given package in their request. in_resolve (str or `Requirement`): Match contexts that contain the given package in their resolve. You can also su...
[ "Find", "contexts", "in", "the", "suite", "based", "on", "search", "criteria", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L123-L161
train
nerdvegas/rez
src/rez/suite.py
Suite.remove_context
def remove_context(self, name): """Remove a context from the suite. Args: name (str): Name of the context to remove. """ self._context(name) del self.contexts[name] self._flush_tools()
python
def remove_context(self, name): """Remove a context from the suite. Args: name (str): Name of the context to remove. """ self._context(name) del self.contexts[name] self._flush_tools()
[ "def", "remove_context", "(", "self", ",", "name", ")", ":", "self", ".", "_context", "(", "name", ")", "del", "self", ".", "contexts", "[", "name", "]", "self", ".", "_flush_tools", "(", ")" ]
Remove a context from the suite. Args: name (str): Name of the context to remove.
[ "Remove", "a", "context", "from", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L163-L171
train
nerdvegas/rez
src/rez/suite.py
Suite.set_context_prefix
def set_context_prefix(self, name, prefix): """Set a context's prefix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as '<prefix>foo' in the suite's bin path. Args: name (str): Name of the context t...
python
def set_context_prefix(self, name, prefix): """Set a context's prefix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as '<prefix>foo' in the suite's bin path. Args: name (str): Name of the context t...
[ "def", "set_context_prefix", "(", "self", ",", "name", ",", "prefix", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "data", "[", "\"prefix\"", "]", "=", "prefix", "self", ".", "_flush_tools", "(", ")" ]
Set a context's prefix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as '<prefix>foo' in the suite's bin path. Args: name (str): Name of the context to prefix. prefix (str): Prefix to apply to ...
[ "Set", "a", "context", "s", "prefix", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L173-L186
train
nerdvegas/rez
src/rez/suite.py
Suite.set_context_suffix
def set_context_suffix(self, name, suffix): """Set a context's suffix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as 'foo<suffix>' in the suite's bin path. Args: name (str): Name of the context t...
python
def set_context_suffix(self, name, suffix): """Set a context's suffix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as 'foo<suffix>' in the suite's bin path. Args: name (str): Name of the context t...
[ "def", "set_context_suffix", "(", "self", ",", "name", ",", "suffix", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "data", "[", "\"suffix\"", "]", "=", "suffix", "self", ".", "_flush_tools", "(", ")" ]
Set a context's suffix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as 'foo<suffix>' in the suite's bin path. Args: name (str): Name of the context to suffix. suffix (str): Suffix to apply to ...
[ "Set", "a", "context", "s", "suffix", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L196-L209
train
nerdvegas/rez
src/rez/suite.py
Suite.bump_context
def bump_context(self, name): """Causes the context's tools to take priority over all others.""" data = self._context(name) data["priority"] = self._next_priority self._flush_tools()
python
def bump_context(self, name): """Causes the context's tools to take priority over all others.""" data = self._context(name) data["priority"] = self._next_priority self._flush_tools()
[ "def", "bump_context", "(", "self", ",", "name", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "data", "[", "\"priority\"", "]", "=", "self", ".", "_next_priority", "self", ".", "_flush_tools", "(", ")" ]
Causes the context's tools to take priority over all others.
[ "Causes", "the", "context", "s", "tools", "to", "take", "priority", "over", "all", "others", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L219-L223
train
nerdvegas/rez
src/rez/suite.py
Suite.hide_tool
def hide_tool(self, context_name, tool_name): """Hide a tool so that it is not exposed in the suite. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to hide. """ data = self._context(context_name) hidden_tools = data["...
python
def hide_tool(self, context_name, tool_name): """Hide a tool so that it is not exposed in the suite. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to hide. """ data = self._context(context_name) hidden_tools = data["...
[ "def", "hide_tool", "(", "self", ",", "context_name", ",", "tool_name", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "hidden_tools", "=", "data", "[", "\"hidden_tools\"", "]", "if", "tool_name", "not", "in", "hidden_tools", ":", ...
Hide a tool so that it is not exposed in the suite. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to hide.
[ "Hide", "a", "tool", "so", "that", "it", "is", "not", "exposed", "in", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L225-L237
train
nerdvegas/rez
src/rez/suite.py
Suite.unhide_tool
def unhide_tool(self, context_name, tool_name): """Unhide a tool so that it may be exposed in a suite. Note that unhiding a tool doesn't guarantee it can be seen - a tool of the same name from a different context may be overriding it. Args: context_name (str): Context conta...
python
def unhide_tool(self, context_name, tool_name): """Unhide a tool so that it may be exposed in a suite. Note that unhiding a tool doesn't guarantee it can be seen - a tool of the same name from a different context may be overriding it. Args: context_name (str): Context conta...
[ "def", "unhide_tool", "(", "self", ",", "context_name", ",", "tool_name", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "hidden_tools", "=", "data", "[", "\"hidden_tools\"", "]", "if", "tool_name", "in", "hidden_tools", ":", "hidd...
Unhide a tool so that it may be exposed in a suite. Note that unhiding a tool doesn't guarantee it can be seen - a tool of the same name from a different context may be overriding it. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool t...
[ "Unhide", "a", "tool", "so", "that", "it", "may", "be", "exposed", "in", "a", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L239-L253
train
nerdvegas/rez
src/rez/suite.py
Suite.alias_tool
def alias_tool(self, context_name, tool_name, tool_alias): """Register an alias for a specific tool. Note that a tool alias takes precedence over a context prefix/suffix. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to alias. ...
python
def alias_tool(self, context_name, tool_name, tool_alias): """Register an alias for a specific tool. Note that a tool alias takes precedence over a context prefix/suffix. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to alias. ...
[ "def", "alias_tool", "(", "self", ",", "context_name", ",", "tool_name", ",", "tool_alias", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "aliases", "=", "data", "[", "\"tool_aliases\"", "]", "if", "tool_name", "in", "aliases", ...
Register an alias for a specific tool. Note that a tool alias takes precedence over a context prefix/suffix. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to alias. tool_alias (str): Alias to give the tool.
[ "Register", "an", "alias", "for", "a", "specific", "tool", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L255-L272
train
nerdvegas/rez
src/rez/suite.py
Suite.unalias_tool
def unalias_tool(self, context_name, tool_name): """Deregister an alias for a specific tool. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to unalias. """ data = self._context(context_name) aliases = data["tool_alias...
python
def unalias_tool(self, context_name, tool_name): """Deregister an alias for a specific tool. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to unalias. """ data = self._context(context_name) aliases = data["tool_alias...
[ "def", "unalias_tool", "(", "self", ",", "context_name", ",", "tool_name", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "aliases", "=", "data", "[", "\"tool_aliases\"", "]", "if", "tool_name", "in", "aliases", ":", "del", "alia...
Deregister an alias for a specific tool. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to unalias.
[ "Deregister", "an", "alias", "for", "a", "specific", "tool", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L274-L285
train
nerdvegas/rez
src/rez/suite.py
Suite.get_tool_filepath
def get_tool_filepath(self, tool_alias): """Given a visible tool alias, return the full path to the executable. Args: tool_alias (str): Tool alias to search for. Returns: (str): Filepath of executable, or None if the tool is not in the suite. May also re...
python
def get_tool_filepath(self, tool_alias): """Given a visible tool alias, return the full path to the executable. Args: tool_alias (str): Tool alias to search for. Returns: (str): Filepath of executable, or None if the tool is not in the suite. May also re...
[ "def", "get_tool_filepath", "(", "self", ",", "tool_alias", ")", ":", "tools_dict", "=", "self", ".", "get_tools", "(", ")", "if", "tool_alias", "in", "tools_dict", ":", "if", "self", ".", "tools_path", "is", "None", ":", "return", "None", "else", ":", "...
Given a visible tool alias, return the full path to the executable. Args: tool_alias (str): Tool alias to search for. Returns: (str): Filepath of executable, or None if the tool is not in the suite. May also return None because this suite has not been saved ...
[ "Given", "a", "visible", "tool", "alias", "return", "the", "full", "path", "to", "the", "executable", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L302-L320
train
nerdvegas/rez
src/rez/suite.py
Suite.get_tool_context
def get_tool_context(self, tool_alias): """Given a visible tool alias, return the name of the context it belongs to. Args: tool_alias (str): Tool alias to search for. Returns: (str): Name of the context that exposes a visible instance of this tool al...
python
def get_tool_context(self, tool_alias): """Given a visible tool alias, return the name of the context it belongs to. Args: tool_alias (str): Tool alias to search for. Returns: (str): Name of the context that exposes a visible instance of this tool al...
[ "def", "get_tool_context", "(", "self", ",", "tool_alias", ")", ":", "tools_dict", "=", "self", ".", "get_tools", "(", ")", "data", "=", "tools_dict", ".", "get", "(", "tool_alias", ")", "if", "data", ":", "return", "data", "[", "\"context_name\"", "]", ...
Given a visible tool alias, return the name of the context it belongs to. Args: tool_alias (str): Tool alias to search for. Returns: (str): Name of the context that exposes a visible instance of this tool alias, or None if the alias is not available.
[ "Given", "a", "visible", "tool", "alias", "return", "the", "name", "of", "the", "context", "it", "belongs", "to", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L322-L337
train
nerdvegas/rez
src/rez/suite.py
Suite.validate
def validate(self): """Validate the suite.""" for context_name in self.context_names: context = self.context(context_name) try: context.validate() except ResolvedContextError as e: raise SuiteError("Error in context %r: %s" ...
python
def validate(self): """Validate the suite.""" for context_name in self.context_names: context = self.context(context_name) try: context.validate() except ResolvedContextError as e: raise SuiteError("Error in context %r: %s" ...
[ "def", "validate", "(", "self", ")", ":", "for", "context_name", "in", "self", ".", "context_names", ":", "context", "=", "self", ".", "context", "(", "context_name", ")", "try", ":", "context", ".", "validate", "(", ")", "except", "ResolvedContextError", ...
Validate the suite.
[ "Validate", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L379-L387
train
nerdvegas/rez
src/rez/suite.py
Suite.save
def save(self, path, verbose=False): """Save the suite to disk. Args: path (str): Path to save the suite to. If a suite is already saved at `path`, then it will be overwritten. Otherwise, if `path` exists, an error is raised. """ path = os.pat...
python
def save(self, path, verbose=False): """Save the suite to disk. Args: path (str): Path to save the suite to. If a suite is already saved at `path`, then it will be overwritten. Otherwise, if `path` exists, an error is raised. """ path = os.pat...
[ "def", "save", "(", "self", ",", "path", ",", "verbose", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "realpath", "(", "path", ")", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "if", "self", ".", "load_path", "...
Save the suite to disk. Args: path (str): Path to save the suite to. If a suite is already saved at `path`, then it will be overwritten. Otherwise, if `path` exists, an error is raised.
[ "Save", "the", "suite", "to", "disk", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L415-L476
train
nerdvegas/rez
src/rez/suite.py
Suite.print_info
def print_info(self, buf=sys.stdout, verbose=False): """Prints a message summarising the contents of the suite.""" _pr = Printer(buf) if not self.contexts: _pr("Suite is empty.") return context_names = sorted(self.contexts.iterkeys()) _pr("Suite contains...
python
def print_info(self, buf=sys.stdout, verbose=False): """Prints a message summarising the contents of the suite.""" _pr = Printer(buf) if not self.contexts: _pr("Suite is empty.") return context_names = sorted(self.contexts.iterkeys()) _pr("Suite contains...
[ "def", "print_info", "(", "self", ",", "buf", "=", "sys", ".", "stdout", ",", "verbose", "=", "False", ")", ":", "_pr", "=", "Printer", "(", "buf", ")", "if", "not", "self", ".", "contexts", ":", "_pr", "(", "\"Suite is empty.\"", ")", "return", "con...
Prints a message summarising the contents of the suite.
[ "Prints", "a", "message", "summarising", "the", "contents", "of", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L525-L562
train
nerdvegas/rez
src/rez/build_system.py
get_valid_build_systems
def get_valid_build_systems(working_dir, package=None): """Returns the build system classes that could build the source in given dir. Args: working_dir (str): Dir containing the package definition and potentially build files. package (`Package`): Package to be built. This may or may...
python
def get_valid_build_systems(working_dir, package=None): """Returns the build system classes that could build the source in given dir. Args: working_dir (str): Dir containing the package definition and potentially build files. package (`Package`): Package to be built. This may or may...
[ "def", "get_valid_build_systems", "(", "working_dir", ",", "package", "=", "None", ")", ":", "from", "rez", ".", "plugin_managers", "import", "plugin_manager", "from", "rez", ".", "exceptions", "import", "PackageMetadataError", "try", ":", "package", "=", "package...
Returns the build system classes that could build the source in given dir. Args: working_dir (str): Dir containing the package definition and potentially build files. package (`Package`): Package to be built. This may or may not be needed to determine the build system. For e...
[ "Returns", "the", "build", "system", "classes", "that", "could", "build", "the", "source", "in", "given", "dir", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L14-L62
train
nerdvegas/rez
src/rez/build_system.py
create_build_system
def create_build_system(working_dir, buildsys_type=None, package=None, opts=None, write_build_scripts=False, verbose=False, build_args=[], child_build_args=[]): """Return a new build system that can build the source in working_dir.""" from rez.plugin_managers impo...
python
def create_build_system(working_dir, buildsys_type=None, package=None, opts=None, write_build_scripts=False, verbose=False, build_args=[], child_build_args=[]): """Return a new build system that can build the source in working_dir.""" from rez.plugin_managers impo...
[ "def", "create_build_system", "(", "working_dir", ",", "buildsys_type", "=", "None", ",", "package", "=", "None", ",", "opts", "=", "None", ",", "write_build_scripts", "=", "False", ",", "verbose", "=", "False", ",", "build_args", "=", "[", "]", ",", "chil...
Return a new build system that can build the source in working_dir.
[ "Return", "a", "new", "build", "system", "that", "can", "build", "the", "source", "in", "working_dir", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L65-L95
train
nerdvegas/rez
src/rez/build_system.py
BuildSystem.build
def build(self, context, variant, build_path, install_path, install=False, build_type=BuildType.local): """Implement this method to perform the actual build. Args: context: A ResolvedContext object that the build process must be executed within. var...
python
def build(self, context, variant, build_path, install_path, install=False, build_type=BuildType.local): """Implement this method to perform the actual build. Args: context: A ResolvedContext object that the build process must be executed within. var...
[ "def", "build", "(", "self", ",", "context", ",", "variant", ",", "build_path", ",", "install_path", ",", "install", "=", "False", ",", "build_type", "=", "BuildType", ".", "local", ")", ":", "raise", "NotImplementedError" ]
Implement this method to perform the actual build. Args: context: A ResolvedContext object that the build process must be executed within. variant (`Variant`): The variant being built. build_path: Where to write temporary build files. May be relative ...
[ "Implement", "this", "method", "to", "perform", "the", "actual", "build", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L167-L195
train
nerdvegas/rez
src/rez/build_system.py
BuildSystem.get_standard_vars
def get_standard_vars(cls, context, variant, build_type, install, build_path, install_path=None): """Returns a standard set of environment variables that can be set for the build system to use """ from rez.config import config package = variant.parent ...
python
def get_standard_vars(cls, context, variant, build_type, install, build_path, install_path=None): """Returns a standard set of environment variables that can be set for the build system to use """ from rez.config import config package = variant.parent ...
[ "def", "get_standard_vars", "(", "cls", ",", "context", ",", "variant", ",", "build_type", ",", "install", ",", "build_path", ",", "install_path", "=", "None", ")", ":", "from", "rez", ".", "config", "import", "config", "package", "=", "variant", ".", "par...
Returns a standard set of environment variables that can be set for the build system to use
[ "Returns", "a", "standard", "set", "of", "environment", "variables", "that", "can", "be", "set", "for", "the", "build", "system", "to", "use" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L198-L243
train
nerdvegas/rez
src/rez/build_system.py
BuildSystem.set_standard_vars
def set_standard_vars(cls, executor, context, variant, build_type, install, build_path, install_path=None): """Sets a standard set of environment variables for the build system to use """ vars = cls.get_standard_vars(context=context, ...
python
def set_standard_vars(cls, executor, context, variant, build_type, install, build_path, install_path=None): """Sets a standard set of environment variables for the build system to use """ vars = cls.get_standard_vars(context=context, ...
[ "def", "set_standard_vars", "(", "cls", ",", "executor", ",", "context", ",", "variant", ",", "build_type", ",", "install", ",", "build_path", ",", "install_path", "=", "None", ")", ":", "vars", "=", "cls", ".", "get_standard_vars", "(", "context", "=", "c...
Sets a standard set of environment variables for the build system to use
[ "Sets", "a", "standard", "set", "of", "environment", "variables", "for", "the", "build", "system", "to", "use" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L246-L259
train
nerdvegas/rez
src/rez/pip.py
run_pip_command
def run_pip_command(command_args, pip_version=None, python_version=None): """Run a pip command. Args: command_args (list of str): Args to pip. Returns: `subprocess.Popen`: Pip process. """ pip_exe, context = find_pip(pip_version, python_version) command = [pip_exe] + list(comma...
python
def run_pip_command(command_args, pip_version=None, python_version=None): """Run a pip command. Args: command_args (list of str): Args to pip. Returns: `subprocess.Popen`: Pip process. """ pip_exe, context = find_pip(pip_version, python_version) command = [pip_exe] + list(comma...
[ "def", "run_pip_command", "(", "command_args", ",", "pip_version", "=", "None", ",", "python_version", "=", "None", ")", ":", "pip_exe", ",", "context", "=", "find_pip", "(", "pip_version", ",", "python_version", ")", "command", "=", "[", "pip_exe", "]", "+"...
Run a pip command. Args: command_args (list of str): Args to pip. Returns: `subprocess.Popen`: Pip process.
[ "Run", "a", "pip", "command", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/pip.py#L88-L103
train
nerdvegas/rez
src/rez/pip.py
find_pip
def find_pip(pip_version=None, python_version=None): """Find a pip exe using the given python version. Returns: 2-tuple: str: pip executable; `ResolvedContext`: Context containing pip, or None if we fell back to system pip. """ pip_exe = "pip" try: ...
python
def find_pip(pip_version=None, python_version=None): """Find a pip exe using the given python version. Returns: 2-tuple: str: pip executable; `ResolvedContext`: Context containing pip, or None if we fell back to system pip. """ pip_exe = "pip" try: ...
[ "def", "find_pip", "(", "pip_version", "=", "None", ",", "python_version", "=", "None", ")", ":", "pip_exe", "=", "\"pip\"", "try", ":", "context", "=", "create_context", "(", "pip_version", ",", "python_version", ")", "except", "BuildError", "as", "e", ":",...
Find a pip exe using the given python version. Returns: 2-tuple: str: pip executable; `ResolvedContext`: Context containing pip, or None if we fell back to system pip.
[ "Find", "a", "pip", "exe", "using", "the", "given", "python", "version", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/pip.py#L106-L133
train
nerdvegas/rez
src/rez/pip.py
create_context
def create_context(pip_version=None, python_version=None): """Create a context containing the specific pip and python. Args: pip_version (str or `Version`): Version of pip to use, or latest if None. python_version (str or `Version`): Python version to use, or latest if None. Re...
python
def create_context(pip_version=None, python_version=None): """Create a context containing the specific pip and python. Args: pip_version (str or `Version`): Version of pip to use, or latest if None. python_version (str or `Version`): Python version to use, or latest if None. Re...
[ "def", "create_context", "(", "pip_version", "=", "None", ",", "python_version", "=", "None", ")", ":", "if", "pip_version", ":", "pip_req", "=", "\"pip-%s\"", "%", "str", "(", "pip_version", ")", "else", ":", "pip_req", "=", "\"pip\"", "if", "python_version...
Create a context containing the specific pip and python. Args: pip_version (str or `Version`): Version of pip to use, or latest if None. python_version (str or `Version`): Python version to use, or latest if None. Returns: `ResolvedContext`: Context containing pip and pytho...
[ "Create", "a", "context", "containing", "the", "specific", "pip", "and", "python", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/pip.py#L136-L182
train
nerdvegas/rez
src/rez/utils/backcompat.py
convert_old_variant_handle
def convert_old_variant_handle(handle_dict): """Convert a variant handle from serialize_version < 4.0.""" old_variables = handle_dict.get("variables", {}) variables = dict(repository_type="filesystem") for old_key, key in variant_key_conversions.iteritems(): value = old_variables.get(old_key) ...
python
def convert_old_variant_handle(handle_dict): """Convert a variant handle from serialize_version < 4.0.""" old_variables = handle_dict.get("variables", {}) variables = dict(repository_type="filesystem") for old_key, key in variant_key_conversions.iteritems(): value = old_variables.get(old_key) ...
[ "def", "convert_old_variant_handle", "(", "handle_dict", ")", ":", "old_variables", "=", "handle_dict", ".", "get", "(", "\"variables\"", ",", "{", "}", ")", "variables", "=", "dict", "(", "repository_type", "=", "\"filesystem\"", ")", "for", "old_key", ",", "...
Convert a variant handle from serialize_version < 4.0.
[ "Convert", "a", "variant", "handle", "from", "serialize_version", "<", "4", ".", "0", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/backcompat.py#L20-L37
train
nerdvegas/rez
src/rez/utils/py_dist.py
convert_requirement
def convert_requirement(req): """ Converts a pkg_resources.Requirement object into a list of Rez package request strings. """ pkg_name = convert_name(req.project_name) if not req.specs: return [pkg_name] req_strs = [] for spec in req.specs: op, ver = spec ver = c...
python
def convert_requirement(req): """ Converts a pkg_resources.Requirement object into a list of Rez package request strings. """ pkg_name = convert_name(req.project_name) if not req.specs: return [pkg_name] req_strs = [] for spec in req.specs: op, ver = spec ver = c...
[ "def", "convert_requirement", "(", "req", ")", ":", "pkg_name", "=", "convert_name", "(", "req", ".", "project_name", ")", "if", "not", "req", ".", "specs", ":", "return", "[", "pkg_name", "]", "req_strs", "=", "[", "]", "for", "spec", "in", "req", "."...
Converts a pkg_resources.Requirement object into a list of Rez package request strings.
[ "Converts", "a", "pkg_resources", ".", "Requirement", "object", "into", "a", "list", "of", "Rez", "package", "request", "strings", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/py_dist.py#L42-L80
train
nerdvegas/rez
src/rez/utils/py_dist.py
get_dist_dependencies
def get_dist_dependencies(name, recurse=True): """ Get the dependencies of the given, already installed distribution. @param recurse If True, recursively find all dependencies. @returns A set of package names. @note The first entry in the list is always the top-level package itself. """ dist...
python
def get_dist_dependencies(name, recurse=True): """ Get the dependencies of the given, already installed distribution. @param recurse If True, recursively find all dependencies. @returns A set of package names. @note The first entry in the list is always the top-level package itself. """ dist...
[ "def", "get_dist_dependencies", "(", "name", ",", "recurse", "=", "True", ")", ":", "dist", "=", "pkg_resources", ".", "get_distribution", "(", "name", ")", "pkg_name", "=", "convert_name", "(", "dist", ".", "project_name", ")", "reqs", "=", "set", "(", ")...
Get the dependencies of the given, already installed distribution. @param recurse If True, recursively find all dependencies. @returns A set of package names. @note The first entry in the list is always the top-level package itself.
[ "Get", "the", "dependencies", "of", "the", "given", "already", "installed", "distribution", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/py_dist.py#L83-L114
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.add_graph
def add_graph(self, other): """ Add other graph to this graph. @attention: Attributes and labels are not preserved. @type other: graph @param other: Graph """ self.add_nodes( n for n in other.nodes() if not n in self.nodes() ) f...
python
def add_graph(self, other): """ Add other graph to this graph. @attention: Attributes and labels are not preserved. @type other: graph @param other: Graph """ self.add_nodes( n for n in other.nodes() if not n in self.nodes() ) f...
[ "def", "add_graph", "(", "self", ",", "other", ")", ":", "self", ".", "add_nodes", "(", "n", "for", "n", "in", "other", ".", "nodes", "(", ")", "if", "not", "n", "in", "self", ".", "nodes", "(", ")", ")", "for", "each_node", "in", "other", ".", ...
Add other graph to this graph. @attention: Attributes and labels are not preserved. @type other: graph @param other: Graph
[ "Add", "other", "graph", "to", "this", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L107-L121
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.add_spanning_tree
def add_spanning_tree(self, st): """ Add a spanning tree to the graph. @type st: dictionary @param st: Spanning tree. """ self.add_nodes(list(st.keys())) for each in st: if (st[each] is not None): self.add_edge((st[each], each...
python
def add_spanning_tree(self, st): """ Add a spanning tree to the graph. @type st: dictionary @param st: Spanning tree. """ self.add_nodes(list(st.keys())) for each in st: if (st[each] is not None): self.add_edge((st[each], each...
[ "def", "add_spanning_tree", "(", "self", ",", "st", ")", ":", "self", ".", "add_nodes", "(", "list", "(", "st", ".", "keys", "(", ")", ")", ")", "for", "each", "in", "st", ":", "if", "(", "st", "[", "each", "]", "is", "not", "None", ")", ":", ...
Add a spanning tree to the graph. @type st: dictionary @param st: Spanning tree.
[ "Add", "a", "spanning", "tree", "to", "the", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L124-L134
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.complete
def complete(self): """ Make the graph a complete graph. @attention: This will modify the current graph. """ for each in self.nodes(): for other in self.nodes(): if (each != other and not self.has_edge((each, other))): self...
python
def complete(self): """ Make the graph a complete graph. @attention: This will modify the current graph. """ for each in self.nodes(): for other in self.nodes(): if (each != other and not self.has_edge((each, other))): self...
[ "def", "complete", "(", "self", ")", ":", "for", "each", "in", "self", ".", "nodes", "(", ")", ":", "for", "other", "in", "self", ".", "nodes", "(", ")", ":", "if", "(", "each", "!=", "other", "and", "not", "self", ".", "has_edge", "(", "(", "e...
Make the graph a complete graph. @attention: This will modify the current graph.
[ "Make", "the", "graph", "a", "complete", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L137-L146
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.inverse
def inverse(self): """ Return the inverse of the graph. @rtype: graph @return: Complement graph for the graph. """ inv = self.__class__() inv.add_nodes(self.nodes()) inv.complete() for each in self.edges(): if (inv.has_edge(ea...
python
def inverse(self): """ Return the inverse of the graph. @rtype: graph @return: Complement graph for the graph. """ inv = self.__class__() inv.add_nodes(self.nodes()) inv.complete() for each in self.edges(): if (inv.has_edge(ea...
[ "def", "inverse", "(", "self", ")", ":", "inv", "=", "self", ".", "__class__", "(", ")", "inv", ".", "add_nodes", "(", "self", ".", "nodes", "(", ")", ")", "inv", ".", "complete", "(", ")", "for", "each", "in", "self", ".", "edges", "(", ")", "...
Return the inverse of the graph. @rtype: graph @return: Complement graph for the graph.
[ "Return", "the", "inverse", "of", "the", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L149-L162
train
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.reverse
def reverse(self): """ Generate the reverse of a directed graph, returns an identical graph if not directed. Attributes & weights are preserved. @rtype: digraph @return: The directed graph that should be reversed. """ assert self.DIRECTED, "Undirected gra...
python
def reverse(self): """ Generate the reverse of a directed graph, returns an identical graph if not directed. Attributes & weights are preserved. @rtype: digraph @return: The directed graph that should be reversed. """ assert self.DIRECTED, "Undirected gra...
[ "def", "reverse", "(", "self", ")", ":", "assert", "self", ".", "DIRECTED", ",", "\"Undirected graph types such as %s cannot be reversed\"", "%", "self", ".", "__class__", ".", "__name__", "N", "=", "self", ".", "__class__", "(", ")", "N", ".", "add_nodes", "(...
Generate the reverse of a directed graph, returns an identical graph if not directed. Attributes & weights are preserved. @rtype: digraph @return: The directed graph that should be reversed.
[ "Generate", "the", "reverse", "of", "a", "directed", "graph", "returns", "an", "identical", "graph", "if", "not", "directed", ".", "Attributes", "&", "weights", "are", "preserved", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L164-L185
train
nerdvegas/rez
src/rez/resolved_context.py
get_lock_request
def get_lock_request(name, version, patch_lock, weak=True): """Given a package and patch lock, return the equivalent request. For example, for object 'foo-1.2.1' and lock type 'lock_3', the equivalent request is '~foo-1.2'. This restricts updates to foo to patch-or-lower version changes only. For ...
python
def get_lock_request(name, version, patch_lock, weak=True): """Given a package and patch lock, return the equivalent request. For example, for object 'foo-1.2.1' and lock type 'lock_3', the equivalent request is '~foo-1.2'. This restricts updates to foo to patch-or-lower version changes only. For ...
[ "def", "get_lock_request", "(", "name", ",", "version", ",", "patch_lock", ",", "weak", "=", "True", ")", ":", "ch", "=", "'~'", "if", "weak", "else", "''", "if", "patch_lock", "==", "PatchLock", ".", "lock", ":", "s", "=", "\"%s%s==%s\"", "%", "(", ...
Given a package and patch lock, return the equivalent request. For example, for object 'foo-1.2.1' and lock type 'lock_3', the equivalent request is '~foo-1.2'. This restricts updates to foo to patch-or-lower version changes only. For objects not versioned down to a given lock level, the closest possi...
[ "Given", "a", "package", "and", "patch", "lock", "return", "the", "equivalent", "request", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L76-L102
train
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.requested_packages
def requested_packages(self, include_implicit=False): """Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects. """ if include_implicit...
python
def requested_packages(self, include_implicit=False): """Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects. """ if include_implicit...
[ "def", "requested_packages", "(", "self", ",", "include_implicit", "=", "False", ")", ":", "if", "include_implicit", ":", "return", "self", ".", "_package_requests", "+", "self", ".", "implicit_packages", "else", ":", "return", "self", ".", "_package_requests" ]
Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects.
[ "Get", "packages", "in", "the", "request", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L322-L335
train
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_resolved_package
def get_resolved_package(self, name): """Returns a `Variant` object or None if the package is not in the resolve. """ pkgs = [x for x in self._resolved_packages if x.name == name] return pkgs[0] if pkgs else None
python
def get_resolved_package(self, name): """Returns a `Variant` object or None if the package is not in the resolve. """ pkgs = [x for x in self._resolved_packages if x.name == name] return pkgs[0] if pkgs else None
[ "def", "get_resolved_package", "(", "self", ",", "name", ")", ":", "pkgs", "=", "[", "x", "for", "x", "in", "self", ".", "_resolved_packages", "if", "x", ".", "name", "==", "name", "]", "return", "pkgs", "[", "0", "]", "if", "pkgs", "else", "None" ]
Returns a `Variant` object or None if the package is not in the resolve.
[ "Returns", "a", "Variant", "object", "or", "None", "if", "the", "package", "is", "not", "in", "the", "resolve", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L384-L389
train
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_patched_request
def get_patched_request(self, package_requests=None, package_subtractions=None, strict=False, rank=0): """Get a 'patched' request. A patched request is a copy of this context's request, but with some changes applied. This can then be used to create a new, 'patched' ...
python
def get_patched_request(self, package_requests=None, package_subtractions=None, strict=False, rank=0): """Get a 'patched' request. A patched request is a copy of this context's request, but with some changes applied. This can then be used to create a new, 'patched' ...
[ "def", "get_patched_request", "(", "self", ",", "package_requests", "=", "None", ",", "package_subtractions", "=", "None", ",", "strict", "=", "False", ",", "rank", "=", "0", ")", ":", "if", "strict", ":", "request", "=", "[", "]", "for", "variant", "in"...
Get a 'patched' request. A patched request is a copy of this context's request, but with some changes applied. This can then be used to create a new, 'patched' context. New package requests override original requests based on the type - normal, conflict or weak. So 'foo-2' over...
[ "Get", "a", "patched", "request", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L397-L495
train
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.write_to_buffer
def write_to_buffer(self, buf): """Save the context to a buffer.""" doc = self.to_dict() if config.rxt_as_yaml: content = dump_yaml(doc) else: content = json.dumps(doc, indent=4, separators=(",", ": ")) buf.write(content)
python
def write_to_buffer(self, buf): """Save the context to a buffer.""" doc = self.to_dict() if config.rxt_as_yaml: content = dump_yaml(doc) else: content = json.dumps(doc, indent=4, separators=(",", ": ")) buf.write(content)
[ "def", "write_to_buffer", "(", "self", ",", "buf", ")", ":", "doc", "=", "self", ".", "to_dict", "(", ")", "if", "config", ".", "rxt_as_yaml", ":", "content", "=", "dump_yaml", "(", "doc", ")", "else", ":", "content", "=", "json", ".", "dumps", "(", ...
Save the context to a buffer.
[ "Save", "the", "context", "to", "a", "buffer", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L533-L542
train
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_current
def get_current(cls): """Get the context for the current env, if there is one. Returns: `ResolvedContext`: Current context, or None if not in a resolved env. """ filepath = os.getenv("REZ_RXT_FILE") if not filepath or not os.path.exists(filepath): return ...
python
def get_current(cls): """Get the context for the current env, if there is one. Returns: `ResolvedContext`: Current context, or None if not in a resolved env. """ filepath = os.getenv("REZ_RXT_FILE") if not filepath or not os.path.exists(filepath): return ...
[ "def", "get_current", "(", "cls", ")", ":", "filepath", "=", "os", ".", "getenv", "(", "\"REZ_RXT_FILE\"", ")", "if", "not", "filepath", "or", "not", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "return", "None", "return", "cls", ".", ...
Get the context for the current env, if there is one. Returns: `ResolvedContext`: Current context, or None if not in a resolved env.
[ "Get", "the", "context", "for", "the", "current", "env", "if", "there", "is", "one", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L545-L555
train
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.load
def load(cls, path): """Load a resolved context from file.""" with open(path) as f: context = cls.read_from_buffer(f, path) context.set_load_path(path) return context
python
def load(cls, path): """Load a resolved context from file.""" with open(path) as f: context = cls.read_from_buffer(f, path) context.set_load_path(path) return context
[ "def", "load", "(", "cls", ",", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "context", "=", "cls", ".", "read_from_buffer", "(", "f", ",", "path", ")", "context", ".", "set_load_path", "(", "path", ")", "return", "context" ]
Load a resolved context from file.
[ "Load", "a", "resolved", "context", "from", "file", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L558-L563
train