id
int32
0
252k
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
51
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
246,300
nerdvegas/rez
src/rez/wrapper.py
Wrapper.print_about
def print_about(self): """Print an info message about the tool.""" filepath = os.path.join(self.suite_path, "bin", self.tool_name) print "Tool: %s" % self.tool_name print "Path: %s" % filepath print "Suite: %s" % self.suite_path msg = "%s (%r)" % (self.context...
python
def print_about(self): filepath = os.path.join(self.suite_path, "bin", self.tool_name) print "Tool: %s" % self.tool_name print "Path: %s" % filepath print "Suite: %s" % self.suite_path msg = "%s (%r)" % (self.context.load_path, self.context_name) print "Contex...
[ "def", "print_about", "(", "self", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "self", ".", "suite_path", ",", "\"bin\"", ",", "self", ".", "tool_name", ")", "print", "\"Tool: %s\"", "%", "self", ".", "tool_name", "print", "\"Path...
Print an info message about the tool.
[ "Print", "an", "info", "message", "about", "the", "tool", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/wrapper.py#L202-L219
246,301
nerdvegas/rez
src/rez/wrapper.py
Wrapper.print_package_versions
def print_package_versions(self): """Print a list of versions of the package this tool comes from, and indicate which version this tool is from.""" variants = self.context.get_tool_variants(self.tool_name) if variants: if len(variants) > 1: self._print_conflic...
python
def print_package_versions(self): variants = self.context.get_tool_variants(self.tool_name) if variants: if len(variants) > 1: self._print_conflicting(variants) return 1 else: from rez.packages_ import iter_packages ...
[ "def", "print_package_versions", "(", "self", ")", ":", "variants", "=", "self", ".", "context", ".", "get_tool_variants", "(", "self", ".", "tool_name", ")", "if", "variants", ":", "if", "len", "(", "variants", ")", ">", "1", ":", "self", ".", "_print_c...
Print a list of versions of the package this tool comes from, and indicate which version this tool is from.
[ "Print", "a", "list", "of", "versions", "of", "the", "package", "this", "tool", "comes", "from", "and", "indicate", "which", "version", "this", "tool", "is", "from", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/wrapper.py#L221-L251
246,302
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/generators.py
generate_hypergraph
def generate_hypergraph(num_nodes, num_edges, r = 0): """ Create a random hyper graph. @type num_nodes: number @param num_nodes: Number of nodes. @type num_edges: number @param num_edges: Number of edges. @type r: number @param r: Uniform edges of size r. """ # ...
python
def generate_hypergraph(num_nodes, num_edges, r = 0): # Graph creation random_graph = hypergraph() # Nodes nodes = list(map(str, list(range(num_nodes)))) random_graph.add_nodes(nodes) # Base edges edges = list(map(str, list(range(num_nodes, num_nodes+num_edges)))) random_graph....
[ "def", "generate_hypergraph", "(", "num_nodes", ",", "num_edges", ",", "r", "=", "0", ")", ":", "# Graph creation", "random_graph", "=", "hypergraph", "(", ")", "# Nodes", "nodes", "=", "list", "(", "map", "(", "str", ",", "list", "(", "range", "(", "num...
Create a random hyper graph. @type num_nodes: number @param num_nodes: Number of nodes. @type num_edges: number @param num_edges: Number of edges. @type r: number @param r: Uniform edges of size r.
[ "Create", "a", "random", "hyper", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/generators.py#L90-L132
246,303
nerdvegas/rez
src/rez/bind/_utils.py
check_version
def check_version(version, range_=None): """Check that the found software version is within supplied range. Args: version: Version of the package as a Version object. range_: Allowable version range as a VersionRange object. """ if range_ and version not in range_: raise RezBind...
python
def check_version(version, range_=None): if range_ and version not in range_: raise RezBindError("found version %s is not within range %s" % (str(version), str(range_)))
[ "def", "check_version", "(", "version", ",", "range_", "=", "None", ")", ":", "if", "range_", "and", "version", "not", "in", "range_", ":", "raise", "RezBindError", "(", "\"found version %s is not within range %s\"", "%", "(", "str", "(", "version", ")", ",", ...
Check that the found software version is within supplied range. Args: version: Version of the package as a Version object. range_: Allowable version range as a VersionRange object.
[ "Check", "that", "the", "found", "software", "version", "is", "within", "supplied", "range", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/bind/_utils.py#L45-L54
246,304
nerdvegas/rez
src/rez/bind/_utils.py
extract_version
def extract_version(exepath, version_arg, word_index=-1, version_rank=3): """Run an executable and get the program version. Args: exepath: Filepath to executable. version_arg: Arg to pass to program, eg "-V". Can also be a list. word_index: Expect the Nth word of output to be the versio...
python
def extract_version(exepath, version_arg, word_index=-1, version_rank=3): if isinstance(version_arg, basestring): version_arg = [version_arg] args = [exepath] + version_arg stdout, stderr, returncode = _run_command(args) if returncode: raise RezBindError("failed to execute %s: %s\n(erro...
[ "def", "extract_version", "(", "exepath", ",", "version_arg", ",", "word_index", "=", "-", "1", ",", "version_rank", "=", "3", ")", ":", "if", "isinstance", "(", "version_arg", ",", "basestring", ")", ":", "version_arg", "=", "[", "version_arg", "]", "args...
Run an executable and get the program version. Args: exepath: Filepath to executable. version_arg: Arg to pass to program, eg "-V". Can also be a list. word_index: Expect the Nth word of output to be the version. version_rank: Cap the version to this many tokens. Returns: ...
[ "Run", "an", "executable", "and", "get", "the", "program", "version", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/bind/_utils.py#L80-L114
246,305
nerdvegas/rez
src/rez/vendor/version/requirement.py
VersionedObject.construct
def construct(cls, name, version=None): """Create a VersionedObject directly from an object name and version. Args: name: Object name string. version: Version object. """ other = VersionedObject(None) other.name_ = name other.version_ = Version() ...
python
def construct(cls, name, version=None): other = VersionedObject(None) other.name_ = name other.version_ = Version() if version is None else version return other
[ "def", "construct", "(", "cls", ",", "name", ",", "version", "=", "None", ")", ":", "other", "=", "VersionedObject", "(", "None", ")", "other", ".", "name_", "=", "name", "other", ".", "version_", "=", "Version", "(", ")", "if", "version", "is", "Non...
Create a VersionedObject directly from an object name and version. Args: name: Object name string. version: Version object.
[ "Create", "a", "VersionedObject", "directly", "from", "an", "object", "name", "and", "version", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L37-L47
246,306
nerdvegas/rez
src/rez/vendor/version/requirement.py
Requirement.construct
def construct(cls, name, range=None): """Create a requirement directly from an object name and VersionRange. Args: name: Object name string. range: VersionRange object. If None, an unversioned requirement is created. """ other = Requirement(None) ...
python
def construct(cls, name, range=None): other = Requirement(None) other.name_ = name other.range_ = VersionRange() if range is None else range return other
[ "def", "construct", "(", "cls", ",", "name", ",", "range", "=", "None", ")", ":", "other", "=", "Requirement", "(", "None", ")", "other", ".", "name_", "=", "name", "other", ".", "range_", "=", "VersionRange", "(", ")", "if", "range", "is", "None", ...
Create a requirement directly from an object name and VersionRange. Args: name: Object name string. range: VersionRange object. If None, an unversioned requirement is created.
[ "Create", "a", "requirement", "directly", "from", "an", "object", "name", "and", "VersionRange", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L152-L163
246,307
nerdvegas/rez
src/rez/vendor/version/requirement.py
Requirement.conflicts_with
def conflicts_with(self, other): """Returns True if this requirement conflicts with another `Requirement` or `VersionedObject`.""" if isinstance(other, Requirement): if (self.name_ != other.name_) or (self.range is None) \ or (other.range is None): ...
python
def conflicts_with(self, other): if isinstance(other, Requirement): if (self.name_ != other.name_) or (self.range is None) \ or (other.range is None): return False elif self.conflict: return False if other.conflict \ ...
[ "def", "conflicts_with", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "Requirement", ")", ":", "if", "(", "self", ".", "name_", "!=", "other", ".", "name_", ")", "or", "(", "self", ".", "range", "is", "None", ")", "or...
Returns True if this requirement conflicts with another `Requirement` or `VersionedObject`.
[ "Returns", "True", "if", "this", "requirement", "conflicts", "with", "another", "Requirement", "or", "VersionedObject", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L196-L216
246,308
nerdvegas/rez
src/rez/vendor/version/requirement.py
Requirement.merged
def merged(self, other): """Returns the merged result of two requirements. Two requirements can be in conflict and if so, this function returns None. For example, requests for "foo-4" and "foo-6" are in conflict, since both cannot be satisfied with a single version of foo. Some...
python
def merged(self, other): if self.name_ != other.name_: return None # cannot merge across object names def _r(r_): r = Requirement(None) r.name_ = r_.name_ r.negate_ = r_.negate_ r.conflict_ = r_.conflict_ r.sep_ = r_.sep_ ...
[ "def", "merged", "(", "self", ",", "other", ")", ":", "if", "self", ".", "name_", "!=", "other", ".", "name_", ":", "return", "None", "# cannot merge across object names", "def", "_r", "(", "r_", ")", ":", "r", "=", "Requirement", "(", "None", ")", "r"...
Returns the merged result of two requirements. Two requirements can be in conflict and if so, this function returns None. For example, requests for "foo-4" and "foo-6" are in conflict, since both cannot be satisfied with a single version of foo. Some example successful requirements mer...
[ "Returns", "the", "merged", "result", "of", "two", "requirements", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L218-L275
246,309
nerdvegas/rez
src/rez/utils/graph_utils.py
read_graph_from_string
def read_graph_from_string(txt): """Read a graph from a string, either in dot format, or our own compressed format. Returns: `pygraph.digraph`: Graph object. """ if not txt.startswith('{'): return read_dot(txt) # standard dot format def conv(value): if isinstance(value...
python
def read_graph_from_string(txt): if not txt.startswith('{'): return read_dot(txt) # standard dot format def conv(value): if isinstance(value, basestring): return '"' + value + '"' else: return value # our compacted format doc = literal_eval(txt) g =...
[ "def", "read_graph_from_string", "(", "txt", ")", ":", "if", "not", "txt", ".", "startswith", "(", "'{'", ")", ":", "return", "read_dot", "(", "txt", ")", "# standard dot format", "def", "conv", "(", "value", ")", ":", "if", "isinstance", "(", "value", "...
Read a graph from a string, either in dot format, or our own compressed format. Returns: `pygraph.digraph`: Graph object.
[ "Read", "a", "graph", "from", "a", "string", "either", "in", "dot", "format", "or", "our", "own", "compressed", "format", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L20-L66
246,310
nerdvegas/rez
src/rez/utils/graph_utils.py
write_compacted
def write_compacted(g): """Write a graph in our own compacted format. Returns: str. """ d_nodes = {} d_edges = {} def conv(value): if isinstance(value, basestring): return value.strip('"') else: return value for node in g.nodes(): la...
python
def write_compacted(g): d_nodes = {} d_edges = {} def conv(value): if isinstance(value, basestring): return value.strip('"') else: return value for node in g.nodes(): label = None attrs = [] for k, v in sorted(g.node_attributes(node)): ...
[ "def", "write_compacted", "(", "g", ")", ":", "d_nodes", "=", "{", "}", "d_edges", "=", "{", "}", "def", "conv", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "return", "value", ".", "strip", "(", "'\"'", ")...
Write a graph in our own compacted format. Returns: str.
[ "Write", "a", "graph", "in", "our", "own", "compacted", "format", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L69-L106
246,311
nerdvegas/rez
src/rez/utils/graph_utils.py
write_dot
def write_dot(g): """Replacement for pygraph.readwrite.dot.write, which is dog slow. Note: This isn't a general replacement. It will work for the graphs that Rez generates, but there are no guarantees beyond that. Args: g (`pygraph.digraph`): Input graph. Returns: str:...
python
def write_dot(g): lines = ["digraph g {"] def attrs_txt(items): if items: txt = ", ".join(('%s="%s"' % (k, str(v).strip('"'))) for k, v in items) return '[' + txt + ']' else: return '' for node in g.nodes(): atxt = att...
[ "def", "write_dot", "(", "g", ")", ":", "lines", "=", "[", "\"digraph g {\"", "]", "def", "attrs_txt", "(", "items", ")", ":", "if", "items", ":", "txt", "=", "\", \"", ".", "join", "(", "(", "'%s=\"%s\"'", "%", "(", "k", ",", "str", "(", "v", ")...
Replacement for pygraph.readwrite.dot.write, which is dog slow. Note: This isn't a general replacement. It will work for the graphs that Rez generates, but there are no guarantees beyond that. Args: g (`pygraph.digraph`): Input graph. Returns: str: Graph in dot format.
[ "Replacement", "for", "pygraph", ".", "readwrite", ".", "dot", ".", "write", "which", "is", "dog", "slow", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L109-L150
246,312
nerdvegas/rez
src/rez/utils/graph_utils.py
prune_graph
def prune_graph(graph_str, package_name): """Prune a package graph so it only contains nodes accessible from the given package. Args: graph_str (str): Dot-language graph string. package_name (str): Name of package of interest. Returns: Pruned graph, as a string. """ # f...
python
def prune_graph(graph_str, package_name): # find nodes of interest g = read_dot(graph_str) nodes = set() for node, attrs in g.node_attr.iteritems(): attr = [x for x in attrs if x[0] == "label"] if attr: label = attr[0][1] try: req_str = _request_f...
[ "def", "prune_graph", "(", "graph_str", ",", "package_name", ")", ":", "# find nodes of interest", "g", "=", "read_dot", "(", "graph_str", ")", "nodes", "=", "set", "(", ")", "for", "node", ",", "attrs", "in", "g", ".", "node_attr", ".", "iteritems", "(", ...
Prune a package graph so it only contains nodes accessible from the given package. Args: graph_str (str): Dot-language graph string. package_name (str): Name of package of interest. Returns: Pruned graph, as a string.
[ "Prune", "a", "package", "graph", "so", "it", "only", "contains", "nodes", "accessible", "from", "the", "given", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L153-L198
246,313
nerdvegas/rez
src/rez/utils/graph_utils.py
save_graph
def save_graph(graph_str, dest_file, fmt=None, image_ratio=None): """Render a graph to an image file. Args: graph_str (str): Dot-language graph string. dest_file (str): Filepath to save the graph to. fmt (str): Format, eg "png", "jpg". image_ratio (float): Image ratio. Retu...
python
def save_graph(graph_str, dest_file, fmt=None, image_ratio=None): g = pydot.graph_from_dot_data(graph_str) # determine the dest format if fmt is None: fmt = os.path.splitext(dest_file)[1].lower().strip('.') or "png" if hasattr(g, "write_" + fmt): write_fn = getattr(g, "write_" + fmt) ...
[ "def", "save_graph", "(", "graph_str", ",", "dest_file", ",", "fmt", "=", "None", ",", "image_ratio", "=", "None", ")", ":", "g", "=", "pydot", ".", "graph_from_dot_data", "(", "graph_str", ")", "# determine the dest format", "if", "fmt", "is", "None", ":", ...
Render a graph to an image file. Args: graph_str (str): Dot-language graph string. dest_file (str): Filepath to save the graph to. fmt (str): Format, eg "png", "jpg". image_ratio (float): Image ratio. Returns: String representing format that was written, such as 'png'.
[ "Render", "a", "graph", "to", "an", "image", "file", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L201-L226
246,314
nerdvegas/rez
src/rez/utils/graph_utils.py
view_graph
def view_graph(graph_str, dest_file=None): """View a dot graph in an image viewer.""" from rez.system import system from rez.config import config if (system.platform == "linux") and (not os.getenv("DISPLAY")): print >> sys.stderr, "Unable to open display." sys.exit(1) dest_file = _...
python
def view_graph(graph_str, dest_file=None): from rez.system import system from rez.config import config if (system.platform == "linux") and (not os.getenv("DISPLAY")): print >> sys.stderr, "Unable to open display." sys.exit(1) dest_file = _write_graph(graph_str, dest_file=dest_file) ...
[ "def", "view_graph", "(", "graph_str", ",", "dest_file", "=", "None", ")", ":", "from", "rez", ".", "system", "import", "system", "from", "rez", ".", "config", "import", "config", "if", "(", "system", ".", "platform", "==", "\"linux\"", ")", "and", "(", ...
View a dot graph in an image viewer.
[ "View", "a", "dot", "graph", "in", "an", "image", "viewer", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L229-L252
246,315
nerdvegas/rez
src/rez/utils/platform_.py
Platform.physical_cores
def physical_cores(self): """Return the number of physical cpu cores on the system.""" try: return self._physical_cores_base() except Exception as e: from rez.utils.logging_ import print_error print_error("Error detecting physical core count, defaulting to 1: ...
python
def physical_cores(self): try: return self._physical_cores_base() except Exception as e: from rez.utils.logging_ import print_error print_error("Error detecting physical core count, defaulting to 1: %s" % str(e)) return 1
[ "def", "physical_cores", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_physical_cores_base", "(", ")", "except", "Exception", "as", "e", ":", "from", "rez", ".", "utils", ".", "logging_", "import", "print_error", "print_error", "(", "\"Error de...
Return the number of physical cpu cores on the system.
[ "Return", "the", "number", "of", "physical", "cpu", "cores", "on", "the", "system", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/platform_.py#L82-L90
246,316
nerdvegas/rez
src/rez/utils/platform_.py
Platform.logical_cores
def logical_cores(self): """Return the number of cpu cores as reported to the os. May be different from physical_cores if, ie, intel's hyperthreading is enabled. """ try: return self._logical_cores() except Exception as e: from rez.utils.logging_ ...
python
def logical_cores(self): try: return self._logical_cores() except Exception as e: from rez.utils.logging_ import print_error print_error("Error detecting logical core count, defaulting to 1: %s" % str(e)) return 1
[ "def", "logical_cores", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_logical_cores", "(", ")", "except", "Exception", "as", "e", ":", "from", "rez", ".", "utils", ".", "logging_", "import", "print_error", "print_error", "(", "\"Error detecting...
Return the number of cpu cores as reported to the os. May be different from physical_cores if, ie, intel's hyperthreading is enabled.
[ "Return", "the", "number", "of", "cpu", "cores", "as", "reported", "to", "the", "os", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/platform_.py#L93-L105
246,317
nerdvegas/rez
src/rez/vendor/colorama/ansitowin32.py
AnsiToWin32.write_and_convert
def write_and_convert(self, text): ''' Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. ''' cursor = 0 for match in self.ANSI_RE.finditer(text): start, end = match....
python
def write_and_convert(self, text): ''' Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. ''' cursor = 0 for match in self.ANSI_RE.finditer(text): start, end = match....
[ "def", "write_and_convert", "(", "self", ",", "text", ")", ":", "cursor", "=", "0", "for", "match", "in", "self", ".", "ANSI_RE", ".", "finditer", "(", "text", ")", ":", "start", ",", "end", "=", "match", ".", "span", "(", ")", "self", ".", "write_...
Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls.
[ "Write", "the", "given", "text", "to", "our", "wrapped", "stream", "stripping", "any", "ANSI", "sequences", "from", "the", "text", "and", "optionally", "converting", "them", "into", "win32", "calls", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/colorama/ansitowin32.py#L131-L143
246,318
nerdvegas/rez
src/rezgui/models/ContextModel.py
ContextModel.copy
def copy(self): """Returns a copy of the context.""" other = ContextModel(self._context, self.parent()) other._stale = self._stale other._modified = self._modified other.request = self.request[:] other.packages_path = self.packages_path other.implicit_packages = s...
python
def copy(self): other = ContextModel(self._context, self.parent()) other._stale = self._stale other._modified = self._modified other.request = self.request[:] other.packages_path = self.packages_path other.implicit_packages = self.implicit_packages other.package_f...
[ "def", "copy", "(", "self", ")", ":", "other", "=", "ContextModel", "(", "self", ".", "_context", ",", "self", ".", "parent", "(", ")", ")", "other", ".", "_stale", "=", "self", ".", "_stale", "other", ".", "_modified", "=", "self", ".", "_modified",...
Returns a copy of the context.
[ "Returns", "a", "copy", "of", "the", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L51-L63
246,319
nerdvegas/rez
src/rezgui/models/ContextModel.py
ContextModel.get_lock_requests
def get_lock_requests(self): """Take the current context, and the current patch locks, and determine the effective requests that will be added to the main request. Returns: A dict of (PatchLock, [Requirement]) tuples. Each requirement will be a weak package reference. If...
python
def get_lock_requests(self): d = defaultdict(list) if self._context: for variant in self._context.resolved_packages: name = variant.name version = variant.version lock = self.patch_locks.get(name) if lock is None: ...
[ "def", "get_lock_requests", "(", "self", ")", ":", "d", "=", "defaultdict", "(", "list", ")", "if", "self", ".", "_context", ":", "for", "variant", "in", "self", ".", "_context", ".", "resolved_packages", ":", "name", "=", "variant", ".", "name", "versio...
Take the current context, and the current patch locks, and determine the effective requests that will be added to the main request. Returns: A dict of (PatchLock, [Requirement]) tuples. Each requirement will be a weak package reference. If there is no current context, an empty ...
[ "Take", "the", "current", "context", "and", "the", "current", "patch", "locks", "and", "determine", "the", "effective", "requests", "that", "will", "be", "added", "to", "the", "main", "request", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L113-L134
246,320
nerdvegas/rez
src/rezgui/models/ContextModel.py
ContextModel.resolve_context
def resolve_context(self, verbosity=0, max_fails=-1, timestamp=None, callback=None, buf=None, package_load_callback=None): """Update the current context by performing a re-resolve. The newly resolved context is only applied if it is a successful solve. Returns: ...
python
def resolve_context(self, verbosity=0, max_fails=-1, timestamp=None, callback=None, buf=None, package_load_callback=None): package_filter = PackageFilterList.from_pod(self.package_filter) context = ResolvedContext( self.request, package_paths=self.package...
[ "def", "resolve_context", "(", "self", ",", "verbosity", "=", "0", ",", "max_fails", "=", "-", "1", ",", "timestamp", "=", "None", ",", "callback", "=", "None", ",", "buf", "=", "None", ",", "package_load_callback", "=", "None", ")", ":", "package_filter...
Update the current context by performing a re-resolve. The newly resolved context is only applied if it is a successful solve. Returns: `ResolvedContext` object, which may be a successful or failed solve.
[ "Update", "the", "current", "context", "by", "performing", "a", "re", "-", "resolve", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L175-L203
246,321
nerdvegas/rez
src/rezgui/models/ContextModel.py
ContextModel.set_context
def set_context(self, context): """Replace the current context with another.""" self._set_context(context, emit=False) self._modified = (not context.load_path) self.dataChanged.emit(self.CONTEXT_CHANGED | self.REQUEST_CHANGED | ...
python
def set_context(self, context): self._set_context(context, emit=False) self._modified = (not context.load_path) self.dataChanged.emit(self.CONTEXT_CHANGED | self.REQUEST_CHANGED | self.PACKAGES_PATH_CHANGED | ...
[ "def", "set_context", "(", "self", ",", "context", ")", ":", "self", ".", "_set_context", "(", "context", ",", "emit", "=", "False", ")", "self", ".", "_modified", "=", "(", "not", "context", ".", "load_path", ")", "self", ".", "dataChanged", ".", "emi...
Replace the current context with another.
[ "Replace", "the", "current", "context", "with", "another", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L214-L224
246,322
nerdvegas/rez
src/rez/vendor/distlib/util.py
get_resources_dests
def get_resources_dests(resources_root, rules): """Find destinations for resources files""" def get_rel_path(base, path): # normalizes and returns a lstripped-/-separated path base = base.replace(os.path.sep, '/') path = path.replace(os.path.sep, '/') assert path.startswith(base...
python
def get_resources_dests(resources_root, rules): def get_rel_path(base, path): # normalizes and returns a lstripped-/-separated path base = base.replace(os.path.sep, '/') path = path.replace(os.path.sep, '/') assert path.startswith(base) return path[len(base):].lstrip('/') ...
[ "def", "get_resources_dests", "(", "resources_root", ",", "rules", ")", ":", "def", "get_rel_path", "(", "base", ",", "path", ")", ":", "# normalizes and returns a lstripped-/-separated path", "base", "=", "base", ".", "replace", "(", "os", ".", "path", ".", "se...
Find destinations for resources files
[ "Find", "destinations", "for", "resources", "files" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/util.py#L123-L147
246,323
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/cycles.py
find_cycle
def find_cycle(graph): """ Find a cycle in the given graph. This function will return a list of nodes which form a cycle in the graph or an empty list if no cycle exists. @type graph: graph, digraph @param graph: Graph. @rtype: list @return: List of nodes. """ ...
python
def find_cycle(graph): if (isinstance(graph, graph_class)): directed = False elif (isinstance(graph, digraph_class)): directed = True else: raise InvalidGraphType def find_cycle_to_ancestor(node, ancestor): """ Find a cycle containing both node and ancestor. ...
[ "def", "find_cycle", "(", "graph", ")", ":", "if", "(", "isinstance", "(", "graph", ",", "graph_class", ")", ")", ":", "directed", "=", "False", "elif", "(", "isinstance", "(", "graph", ",", "digraph_class", ")", ")", ":", "directed", "=", "True", "els...
Find a cycle in the given graph. This function will return a list of nodes which form a cycle in the graph or an empty list if no cycle exists. @type graph: graph, digraph @param graph: Graph. @rtype: list @return: List of nodes.
[ "Find", "a", "cycle", "in", "the", "given", "graph", ".", "This", "function", "will", "return", "a", "list", "of", "nodes", "which", "form", "a", "cycle", "in", "the", "graph", "or", "an", "empty", "list", "if", "no", "cycle", "exists", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/cycles.py#L38-L108
246,324
nerdvegas/rez
src/rez/release_vcs.py
create_release_vcs
def create_release_vcs(path, vcs_name=None): """Return a new release VCS that can release from this source path.""" from rez.plugin_managers import plugin_manager vcs_types = get_release_vcs_types() if vcs_name: if vcs_name not in vcs_types: raise ReleaseVCSError("Unknown version con...
python
def create_release_vcs(path, vcs_name=None): from rez.plugin_managers import plugin_manager vcs_types = get_release_vcs_types() if vcs_name: if vcs_name not in vcs_types: raise ReleaseVCSError("Unknown version control system: %r" % vcs_name) cls = plugin_manager.get_plugin_class(...
[ "def", "create_release_vcs", "(", "path", ",", "vcs_name", "=", "None", ")", ":", "from", "rez", ".", "plugin_managers", "import", "plugin_manager", "vcs_types", "=", "get_release_vcs_types", "(", ")", "if", "vcs_name", ":", "if", "vcs_name", "not", "in", "vcs...
Return a new release VCS that can release from this source path.
[ "Return", "a", "new", "release", "VCS", "that", "can", "release", "from", "this", "source", "path", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_vcs.py#L17-L61
246,325
nerdvegas/rez
src/rez/release_vcs.py
ReleaseVCS.find_vcs_root
def find_vcs_root(cls, path): """Try to find a version control root directory of this type for the given path. If successful, returns (vcs_root, levels_up), where vcs_root is the path to the version control root directory it found, and levels_up is an integer indicating how many...
python
def find_vcs_root(cls, path): if cls.search_parents_for_root(): valid_dirs = walk_up_dirs(path) else: valid_dirs = [path] for i, current_path in enumerate(valid_dirs): if cls.is_valid_root(current_path): return current_path, i return No...
[ "def", "find_vcs_root", "(", "cls", ",", "path", ")", ":", "if", "cls", ".", "search_parents_for_root", "(", ")", ":", "valid_dirs", "=", "walk_up_dirs", "(", "path", ")", "else", ":", "valid_dirs", "=", "[", "path", "]", "for", "i", ",", "current_path",...
Try to find a version control root directory of this type for the given path. If successful, returns (vcs_root, levels_up), where vcs_root is the path to the version control root directory it found, and levels_up is an integer indicating how many parent directories it had to search thro...
[ "Try", "to", "find", "a", "version", "control", "root", "directory", "of", "this", "type", "for", "the", "given", "path", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_vcs.py#L115-L132
246,326
nerdvegas/rez
src/rez/release_vcs.py
ReleaseVCS._cmd
def _cmd(self, *nargs): """Convenience function for executing a program such as 'git' etc.""" cmd_str = ' '.join(map(quote, nargs)) if self.package.config.debug("package_release"): print_debug("Running command: %s" % cmd_str) p = popen(nargs, stdout=subprocess.PIPE, stderr=...
python
def _cmd(self, *nargs): cmd_str = ' '.join(map(quote, nargs)) if self.package.config.debug("package_release"): print_debug("Running command: %s" % cmd_str) p = popen(nargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.pkg_root) out, err = p.com...
[ "def", "_cmd", "(", "self", ",", "*", "nargs", ")", ":", "cmd_str", "=", "' '", ".", "join", "(", "map", "(", "quote", ",", "nargs", ")", ")", "if", "self", ".", "package", ".", "config", ".", "debug", "(", "\"package_release\"", ")", ":", "print_d...
Convenience function for executing a program such as 'git' etc.
[ "Convenience", "function", "for", "executing", "a", "program", "such", "as", "git", "etc", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_vcs.py#L203-L224
246,327
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._close
def _close(self, args): """Request a channel close This method indicates that the sender wants to close the channel. This may be due to internal conditions (e.g. a forced shut-down) or due to an error handling a specific method, i.e. an exception. When a close is due to an exce...
python
def _close(self, args): reply_code = args.read_short() reply_text = args.read_shortstr() class_id = args.read_short() method_id = args.read_short() self._send_method((20, 41)) self._do_revive() raise error_for_code( reply_code, reply_text, (class_id,...
[ "def", "_close", "(", "self", ",", "args", ")", ":", "reply_code", "=", "args", ".", "read_short", "(", ")", "reply_text", "=", "args", ".", "read_shortstr", "(", ")", "class_id", "=", "args", ".", "read_short", "(", ")", "method_id", "=", "args", ".",...
Request a channel close This method indicates that the sender wants to close the channel. This may be due to internal conditions (e.g. a forced shut-down) or due to an error handling a specific method, i.e. an exception. When a close is due to an exception, the sender provides ...
[ "Request", "a", "channel", "close" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L186-L244
246,328
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._x_flow_ok
def _x_flow_ok(self, active): """Confirm a flow method Confirms to the peer that a flow command was received and processed. PARAMETERS: active: boolean current flow setting Confirms the setting of the processed flow method: ...
python
def _x_flow_ok(self, active): args = AMQPWriter() args.write_bit(active) self._send_method((20, 21), args)
[ "def", "_x_flow_ok", "(", "self", ",", "active", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_bit", "(", "active", ")", "self", ".", "_send_method", "(", "(", "20", ",", "21", ")", ",", "args", ")" ]
Confirm a flow method Confirms to the peer that a flow command was received and processed. PARAMETERS: active: boolean current flow setting Confirms the setting of the processed flow method: True means the peer will start sending or...
[ "Confirm", "a", "flow", "method" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L364-L382
246,329
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._x_open
def _x_open(self): """Open a channel for use This method opens a virtual connection (a channel). RULE: This method MUST NOT be called when the channel is already open. PARAMETERS: out_of_band: shortstr (DEPRECATED) out-of-band sett...
python
def _x_open(self): if self.is_open: return args = AMQPWriter() args.write_shortstr('') # out_of_band: deprecated self._send_method((20, 10), args) return self.wait(allowed_methods=[ (20, 11), # Channel.open_ok ])
[ "def", "_x_open", "(", "self", ")", ":", "if", "self", ".", "is_open", ":", "return", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_shortstr", "(", "''", ")", "# out_of_band: deprecated", "self", ".", "_send_method", "(", "(", "20", ",", "10",...
Open a channel for use This method opens a virtual connection (a channel). RULE: This method MUST NOT be called when the channel is already open. PARAMETERS: out_of_band: shortstr (DEPRECATED) out-of-band settings Configur...
[ "Open", "a", "channel", "for", "use" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L402-L430
246,330
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.exchange_declare
def exchange_declare(self, exchange, type, passive=False, durable=False, auto_delete=True, nowait=False, arguments=None): """Declare exchange, create if needed This method creates an exchange if it does not already exist, and if the exchange exists, verifies that it is ...
python
def exchange_declare(self, exchange, type, passive=False, durable=False, auto_delete=True, nowait=False, arguments=None): arguments = {} if arguments is None else arguments args = AMQPWriter() args.write_short(0) args.write_shortstr(exchange) args.write_s...
[ "def", "exchange_declare", "(", "self", ",", "exchange", ",", "type", ",", "passive", "=", "False", ",", "durable", "=", "False", ",", "auto_delete", "=", "True", ",", "nowait", "=", "False", ",", "arguments", "=", "None", ")", ":", "arguments", "=", "...
Declare exchange, create if needed This method creates an exchange if it does not already exist, and if the exchange exists, verifies that it is of the correct and expected class. RULE: The server SHOULD support a minimum of 16 exchanges per virtual host and id...
[ "Declare", "exchange", "create", "if", "needed" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L481-L623
246,331
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.exchange_bind
def exchange_bind(self, destination, source='', routing_key='', nowait=False, arguments=None): """This method binds an exchange to an exchange. RULE: A server MUST allow and ignore duplicate bindings - that is, two or more bind methods for a specific excha...
python
def exchange_bind(self, destination, source='', routing_key='', nowait=False, arguments=None): arguments = {} if arguments is None else arguments args = AMQPWriter() args.write_short(0) args.write_shortstr(destination) args.write_shortstr(source) arg...
[ "def", "exchange_bind", "(", "self", ",", "destination", ",", "source", "=", "''", ",", "routing_key", "=", "''", ",", "nowait", "=", "False", ",", "arguments", "=", "None", ")", ":", "arguments", "=", "{", "}", "if", "arguments", "is", "None", "else",...
This method binds an exchange to an exchange. RULE: A server MUST allow and ignore duplicate bindings - that is, two or more bind methods for a specific exchanges, with identical arguments - without treating these as an error. RULE: A serve...
[ "This", "method", "binds", "an", "exchange", "to", "an", "exchange", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L697-L783
246,332
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.queue_declare
def queue_declare(self, queue='', passive=False, durable=False, exclusive=False, auto_delete=True, nowait=False, arguments=None): """Declare queue, create if needed This method creates or checks a queue. When creating a new queue the client can speci...
python
def queue_declare(self, queue='', passive=False, durable=False, exclusive=False, auto_delete=True, nowait=False, arguments=None): arguments = {} if arguments is None else arguments args = AMQPWriter() args.write_short(0) args.write_shortstr(que...
[ "def", "queue_declare", "(", "self", ",", "queue", "=", "''", ",", "passive", "=", "False", ",", "durable", "=", "False", ",", "exclusive", "=", "False", ",", "auto_delete", "=", "True", ",", "nowait", "=", "False", ",", "arguments", "=", "None", ")", ...
Declare queue, create if needed This method creates or checks a queue. When creating a new queue the client can specify various properties that control the durability of the queue and its contents, and the level of sharing for the queue. RULE: The server MUST crea...
[ "Declare", "queue", "create", "if", "needed" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1090-L1260
246,333
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._queue_declare_ok
def _queue_declare_ok(self, args): """Confirms a queue definition This method confirms a Declare method and confirms the name of the queue, essential for automatically-named queues. PARAMETERS: queue: shortstr Reports the name of the queue. If the server ge...
python
def _queue_declare_ok(self, args): return queue_declare_ok_t( args.read_shortstr(), args.read_long(), args.read_long(), )
[ "def", "_queue_declare_ok", "(", "self", ",", "args", ")", ":", "return", "queue_declare_ok_t", "(", "args", ".", "read_shortstr", "(", ")", ",", "args", ".", "read_long", "(", ")", ",", "args", ".", "read_long", "(", ")", ",", ")" ]
Confirms a queue definition This method confirms a Declare method and confirms the name of the queue, essential for automatically-named queues. PARAMETERS: queue: shortstr Reports the name of the queue. If the server generated a queue name, this fie...
[ "Confirms", "a", "queue", "definition" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1262-L1295
246,334
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.queue_delete
def queue_delete(self, queue='', if_unused=False, if_empty=False, nowait=False): """Delete a queue This method deletes a queue. When a queue is deleted any pending messages are sent to a dead-letter queue if this is defined in the server configuration, and all cons...
python
def queue_delete(self, queue='', if_unused=False, if_empty=False, nowait=False): args = AMQPWriter() args.write_short(0) args.write_shortstr(queue) args.write_bit(if_unused) args.write_bit(if_empty) args.write_bit(nowait) self._send_method((50...
[ "def", "queue_delete", "(", "self", ",", "queue", "=", "''", ",", "if_unused", "=", "False", ",", "if_empty", "=", "False", ",", "nowait", "=", "False", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_short", "(", "0", ")", "args",...
Delete a queue This method deletes a queue. When a queue is deleted any pending messages are sent to a dead-letter queue if this is defined in the server configuration, and all consumers on the queue are cancelled. RULE: The server SHOULD use a dead-letter queue t...
[ "Delete", "a", "queue" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1297-L1375
246,335
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.queue_purge
def queue_purge(self, queue='', nowait=False): """Purge a queue This method removes all messages from a queue. It does not cancel consumers. Purged messages are deleted without any formal "undo" mechanism. RULE: A call to purge MUST result in an empty queue. ...
python
def queue_purge(self, queue='', nowait=False): args = AMQPWriter() args.write_short(0) args.write_shortstr(queue) args.write_bit(nowait) self._send_method((50, 30), args) if not nowait: return self.wait(allowed_methods=[ (50, 31), # Channel.q...
[ "def", "queue_purge", "(", "self", ",", "queue", "=", "''", ",", "nowait", "=", "False", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_short", "(", "0", ")", "args", ".", "write_shortstr", "(", "queue", ")", "args", ".", "write_b...
Purge a queue This method removes all messages from a queue. It does not cancel consumers. Purged messages are deleted without any formal "undo" mechanism. RULE: A call to purge MUST result in an empty queue. RULE: On transacted channels the server ...
[ "Purge", "a", "queue" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1392-L1457
246,336
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.basic_ack
def basic_ack(self, delivery_tag, multiple=False): """Acknowledge one or more messages This method acknowledges one or more messages delivered via the Deliver or Get-Ok methods. The client can ask to confirm a single message or a set of messages up to and including a specific m...
python
def basic_ack(self, delivery_tag, multiple=False): args = AMQPWriter() args.write_longlong(delivery_tag) args.write_bit(multiple) self._send_method((60, 80), args)
[ "def", "basic_ack", "(", "self", ",", "delivery_tag", ",", "multiple", "=", "False", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_longlong", "(", "delivery_tag", ")", "args", ".", "write_bit", "(", "multiple", ")", "self", ".", "_se...
Acknowledge one or more messages This method acknowledges one or more messages delivered via the Deliver or Get-Ok methods. The client can ask to confirm a single message or a set of messages up to and including a specific message. PARAMETERS: delivery_tag: longlon...
[ "Acknowledge", "one", "or", "more", "messages" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1534-L1584
246,337
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.basic_cancel
def basic_cancel(self, consumer_tag, nowait=False): """End a queue consumer This method cancels a consumer. This does not affect already delivered messages, but it does mean the server will not send any more messages for that consumer. The client may receive an abitrary number ...
python
def basic_cancel(self, consumer_tag, nowait=False): if self.connection is not None: self.no_ack_consumers.discard(consumer_tag) args = AMQPWriter() args.write_shortstr(consumer_tag) args.write_bit(nowait) self._send_method((60, 30), args) r...
[ "def", "basic_cancel", "(", "self", ",", "consumer_tag", ",", "nowait", "=", "False", ")", ":", "if", "self", ".", "connection", "is", "not", "None", ":", "self", ".", "no_ack_consumers", ".", "discard", "(", "consumer_tag", ")", "args", "=", "AMQPWriter",...
End a queue consumer This method cancels a consumer. This does not affect already delivered messages, but it does mean the server will not send any more messages for that consumer. The client may receive an abitrary number of messages in between sending the cancel method and re...
[ "End", "a", "queue", "consumer" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1586-L1634
246,338
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._basic_cancel_notify
def _basic_cancel_notify(self, args): """Consumer cancelled by server. Most likely the queue was deleted. """ consumer_tag = args.read_shortstr() callback = self._on_cancel(consumer_tag) if callback: callback(consumer_tag) else: raise Con...
python
def _basic_cancel_notify(self, args): consumer_tag = args.read_shortstr() callback = self._on_cancel(consumer_tag) if callback: callback(consumer_tag) else: raise ConsumerCancelled(consumer_tag, (60, 30))
[ "def", "_basic_cancel_notify", "(", "self", ",", "args", ")", ":", "consumer_tag", "=", "args", ".", "read_shortstr", "(", ")", "callback", "=", "self", ".", "_on_cancel", "(", "consumer_tag", ")", "if", "callback", ":", "callback", "(", "consumer_tag", ")",...
Consumer cancelled by server. Most likely the queue was deleted.
[ "Consumer", "cancelled", "by", "server", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1636-L1647
246,339
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.basic_consume
def basic_consume(self, queue='', consumer_tag='', no_local=False, no_ack=False, exclusive=False, nowait=False, callback=None, arguments=None, on_cancel=None): """Start a queue consumer This method asks the server to start a "consumer", which is a tra...
python
def basic_consume(self, queue='', consumer_tag='', no_local=False, no_ack=False, exclusive=False, nowait=False, callback=None, arguments=None, on_cancel=None): args = AMQPWriter() args.write_short(0) args.write_shortstr(queue) args.write_shorts...
[ "def", "basic_consume", "(", "self", ",", "queue", "=", "''", ",", "consumer_tag", "=", "''", ",", "no_local", "=", "False", ",", "no_ack", "=", "False", ",", "exclusive", "=", "False", ",", "nowait", "=", "False", ",", "callback", "=", "None", ",", ...
Start a queue consumer This method asks the server to start a "consumer", which is a transient request for messages from a specific queue. Consumers last as long as the channel they were created on, or until the client cancels them. RULE: The server SHOULD support ...
[ "Start", "a", "queue", "consumer" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1677-L1798
246,340
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._basic_deliver
def _basic_deliver(self, args, msg): """Notify the client of a consumer message This method delivers a message to the client, via a consumer. In the asynchronous message delivery model, the client starts a consumer using the Consume method, then the server responds with Deliver ...
python
def _basic_deliver(self, args, msg): consumer_tag = args.read_shortstr() delivery_tag = args.read_longlong() redelivered = args.read_bit() exchange = args.read_shortstr() routing_key = args.read_shortstr() msg.channel = self msg.delivery_info = { 'con...
[ "def", "_basic_deliver", "(", "self", ",", "args", ",", "msg", ")", ":", "consumer_tag", "=", "args", ".", "read_shortstr", "(", ")", "delivery_tag", "=", "args", ".", "read_longlong", "(", ")", "redelivered", "=", "args", ".", "read_bit", "(", ")", "exc...
Notify the client of a consumer message This method delivers a message to the client, via a consumer. In the asynchronous message delivery model, the client starts a consumer using the Consume method, then the server responds with Deliver methods as and when messages arrive for that ...
[ "Notify", "the", "client", "of", "a", "consumer", "message" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1816-L1909
246,341
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._basic_get_ok
def _basic_get_ok(self, args, msg): """Provide client with a message This method delivers a message to the client following a get method. A message delivered by 'get-ok' must be acknowledged unless the no-ack option was set in the get method. PARAMETERS: delivery_t...
python
def _basic_get_ok(self, args, msg): delivery_tag = args.read_longlong() redelivered = args.read_bit() exchange = args.read_shortstr() routing_key = args.read_shortstr() message_count = args.read_long() msg.channel = self msg.delivery_info = { 'deliver...
[ "def", "_basic_get_ok", "(", "self", ",", "args", ",", "msg", ")", ":", "delivery_tag", "=", "args", ".", "read_longlong", "(", ")", "redelivered", "=", "args", ".", "read_bit", "(", ")", "exchange", "=", "args", ".", "read_shortstr", "(", ")", "routing_...
Provide client with a message This method delivers a message to the client following a get method. A message delivered by 'get-ok' must be acknowledged unless the no-ack option was set in the get method. PARAMETERS: delivery_tag: longlong server-assigned d...
[ "Provide", "client", "with", "a", "message" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1975-L2047
246,342
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._basic_publish
def _basic_publish(self, msg, exchange='', routing_key='', mandatory=False, immediate=False): """Publish a message This method publishes a message to a specific exchange. The message will be routed to queues as defined by the exchange configuration and distributed...
python
def _basic_publish(self, msg, exchange='', routing_key='', mandatory=False, immediate=False): args = AMQPWriter() args.write_short(0) args.write_shortstr(exchange) args.write_shortstr(routing_key) args.write_bit(mandatory) args.write_bit(immediate) ...
[ "def", "_basic_publish", "(", "self", ",", "msg", ",", "exchange", "=", "''", ",", "routing_key", "=", "''", ",", "mandatory", "=", "False", ",", "immediate", "=", "False", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_short", "(",...
Publish a message This method publishes a message to a specific exchange. The message will be routed to queues as defined by the exchange configuration and distributed to any active consumers when the transaction, if any, is committed. PARAMETERS: exchange: shortstr...
[ "Publish", "a", "message" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2049-L2123
246,343
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.basic_qos
def basic_qos(self, prefetch_size, prefetch_count, a_global): """Specify quality of service This method requests a specific quality of service. The QoS can be specified for the current channel or for all channels on the connection. The particular properties and semantics of a ...
python
def basic_qos(self, prefetch_size, prefetch_count, a_global): args = AMQPWriter() args.write_long(prefetch_size) args.write_short(prefetch_count) args.write_bit(a_global) self._send_method((60, 10), args) return self.wait(allowed_methods=[ (60, 11), # Channel...
[ "def", "basic_qos", "(", "self", ",", "prefetch_size", ",", "prefetch_count", ",", "a_global", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_long", "(", "prefetch_size", ")", "args", ".", "write_short", "(", "prefetch_count", ")", "args"...
Specify quality of service This method requests a specific quality of service. The QoS can be specified for the current channel or for all channels on the connection. The particular properties and semantics of a qos method always depend on the content class semantics. Though t...
[ "Specify", "quality", "of", "service" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2135-L2206
246,344
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.basic_recover
def basic_recover(self, requeue=False): """Redeliver unacknowledged messages This method asks the broker to redeliver all unacknowledged messages on a specified channel. Zero or more messages may be redelivered. This method is only allowed on non-transacted channels. R...
python
def basic_recover(self, requeue=False): args = AMQPWriter() args.write_bit(requeue) self._send_method((60, 110), args)
[ "def", "basic_recover", "(", "self", ",", "requeue", "=", "False", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_bit", "(", "requeue", ")", "self", ".", "_send_method", "(", "(", "60", ",", "110", ")", ",", "args", ")" ]
Redeliver unacknowledged messages This method asks the broker to redeliver all unacknowledged messages on a specified channel. Zero or more messages may be redelivered. This method is only allowed on non-transacted channels. RULE: The server MUST set the redeliver...
[ "Redeliver", "unacknowledged", "messages" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2218-L2250
246,345
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel.basic_reject
def basic_reject(self, delivery_tag, requeue): """Reject an incoming message This method allows a client to reject a message. It can be used to interrupt and cancel large incoming messages, or return untreatable messages to their original queue. RULE: The server S...
python
def basic_reject(self, delivery_tag, requeue): args = AMQPWriter() args.write_longlong(delivery_tag) args.write_bit(requeue) self._send_method((60, 90), args)
[ "def", "basic_reject", "(", "self", ",", "delivery_tag", ",", "requeue", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_longlong", "(", "delivery_tag", ")", "args", ".", "write_bit", "(", "requeue", ")", "self", ".", "_send_method", "("...
Reject an incoming message This method allows a client to reject a message. It can be used to interrupt and cancel large incoming messages, or return untreatable messages to their original queue. RULE: The server SHOULD be capable of accepting and process the ...
[ "Reject", "an", "incoming", "message" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2261-L2334
246,346
nerdvegas/rez
src/rez/vendor/amqp/channel.py
Channel._basic_return
def _basic_return(self, args, msg): """Return a failed message This method returns an undeliverable message that was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information about the r...
python
def _basic_return(self, args, msg): self.returned_messages.put(basic_return_t( args.read_short(), args.read_shortstr(), args.read_shortstr(), args.read_shortstr(), msg, ))
[ "def", "_basic_return", "(", "self", ",", "args", ",", "msg", ")", ":", "self", ".", "returned_messages", ".", "put", "(", "basic_return_t", "(", "args", ".", "read_short", "(", ")", ",", "args", ".", "read_shortstr", "(", ")", ",", "args", ".", "read_...
Return a failed message This method returns an undeliverable message that was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information about the reason that the message was undeliverabl...
[ "Return", "a", "failed", "message" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2336-L2375
246,347
nerdvegas/rez
src/rez/build_process_.py
create_build_process
def create_build_process(process_type, working_dir, build_system, package=None, vcs=None, ensure_latest=True, skip_repo_errors=False, ignore_existing_tag=False, verbose=False, quiet=False): """Create a `BuildProcess` instance.""" from rez.plugin_managers import ...
python
def create_build_process(process_type, working_dir, build_system, package=None, vcs=None, ensure_latest=True, skip_repo_errors=False, ignore_existing_tag=False, verbose=False, quiet=False): from rez.plugin_managers import plugin_manager process_types = get_build...
[ "def", "create_build_process", "(", "process_type", ",", "working_dir", ",", "build_system", ",", "package", "=", "None", ",", "vcs", "=", "None", ",", "ensure_latest", "=", "True", ",", "skip_repo_errors", "=", "False", ",", "ignore_existing_tag", "=", "False",...
Create a `BuildProcess` instance.
[ "Create", "a", "BuildProcess", "instance", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L26-L45
246,348
nerdvegas/rez
src/rez/build_process_.py
BuildProcessHelper.visit_variants
def visit_variants(self, func, variants=None, **kwargs): """Iterate over variants and call a function on each.""" if variants: present_variants = range(self.package.num_variants) invalid_variants = set(variants) - set(present_variants) if invalid_variants: ...
python
def visit_variants(self, func, variants=None, **kwargs): if variants: present_variants = range(self.package.num_variants) invalid_variants = set(variants) - set(present_variants) if invalid_variants: raise BuildError( "The package does not ...
[ "def", "visit_variants", "(", "self", ",", "func", ",", "variants", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "variants", ":", "present_variants", "=", "range", "(", "self", ".", "package", ".", "num_variants", ")", "invalid_variants", "=", "...
Iterate over variants and call a function on each.
[ "Iterate", "over", "variants", "and", "call", "a", "function", "on", "each", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L175-L201
246,349
nerdvegas/rez
src/rez/build_process_.py
BuildProcessHelper.create_build_context
def create_build_context(self, variant, build_type, build_path): """Create a context to build the variant within.""" request = variant.get_requires(build_requires=True, private_build_requires=True) req_strs = map(str, request) quoted_req_strs = map...
python
def create_build_context(self, variant, build_type, build_path): request = variant.get_requires(build_requires=True, private_build_requires=True) req_strs = map(str, request) quoted_req_strs = map(quote, req_strs) self._print("Resolving build envir...
[ "def", "create_build_context", "(", "self", ",", "variant", ",", "build_type", ",", "build_path", ")", ":", "request", "=", "variant", ".", "get_requires", "(", "build_requires", "=", "True", ",", "private_build_requires", "=", "True", ")", "req_strs", "=", "m...
Create a context to build the variant within.
[ "Create", "a", "context", "to", "build", "the", "variant", "within", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L218-L253
246,350
nerdvegas/rez
src/rez/build_process_.py
BuildProcessHelper.get_release_data
def get_release_data(self): """Get release data for this release. Returns: dict. """ previous_package = self.get_previous_release() if previous_package: previous_version = previous_package.version previous_revision = previous_package.revision ...
python
def get_release_data(self): previous_package = self.get_previous_release() if previous_package: previous_version = previous_package.version previous_revision = previous_package.revision else: previous_version = None previous_revision = None ...
[ "def", "get_release_data", "(", "self", ")", ":", "previous_package", "=", "self", ".", "get_previous_release", "(", ")", "if", "previous_package", ":", "previous_version", "=", "previous_package", ".", "version", "previous_revision", "=", "previous_package", ".", "...
Get release data for this release. Returns: dict.
[ "Get", "release", "data", "for", "this", "release", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L368-L402
246,351
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/minmax.py
minimal_spanning_tree
def minimal_spanning_tree(graph, root=None): """ Minimal spanning tree. @attention: Minimal spanning tree is meaningful only for weighted graphs. @type graph: graph @param graph: Graph. @type root: node @param root: Optional root node (will explore only root's connected component) ...
python
def minimal_spanning_tree(graph, root=None): visited = [] # List for marking visited and non-visited nodes spanning_tree = {} # MInimal Spanning tree # Initialization if (root is not None): visited.append(root) nroot = root spanning_tree[root] = None else: ...
[ "def", "minimal_spanning_tree", "(", "graph", ",", "root", "=", "None", ")", ":", "visited", "=", "[", "]", "# List for marking visited and non-visited nodes", "spanning_tree", "=", "{", "}", "# MInimal Spanning tree", "# Initialization", "if", "(", "root", "is", "n...
Minimal spanning tree. @attention: Minimal spanning tree is meaningful only for weighted graphs. @type graph: graph @param graph: Graph. @type root: node @param root: Optional root node (will explore only root's connected component) @rtype: dictionary @return: Generated spanning t...
[ "Minimal", "spanning", "tree", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/minmax.py#L46-L86
246,352
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/minmax.py
cut_value
def cut_value(graph, flow, cut): """ Calculate the value of a cut. @type graph: digraph @param graph: Graph @type flow: dictionary @param flow: Dictionary containing a flow for each edge. @type cut: dictionary @param cut: Dictionary mapping each node to a subset index. The function on...
python
def cut_value(graph, flow, cut): #max flow/min cut value calculation S = [] T = [] for node in cut.keys(): if cut[node] == 0: S.append(node) elif cut[node] == 1: T.append(node) value = 0 for node in S: for neigh in graph.neighbors(node): ...
[ "def", "cut_value", "(", "graph", ",", "flow", ",", "cut", ")", ":", "#max flow/min cut value calculation", "S", "=", "[", "]", "T", "=", "[", "]", "for", "node", "in", "cut", ".", "keys", "(", ")", ":", "if", "cut", "[", "node", "]", "==", "0", ...
Calculate the value of a cut. @type graph: digraph @param graph: Graph @type flow: dictionary @param flow: Dictionary containing a flow for each edge. @type cut: dictionary @param cut: Dictionary mapping each node to a subset index. The function only considers the flow between nodes with ...
[ "Calculate", "the", "value", "of", "a", "cut", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/minmax.py#L412-L445
246,353
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/minmax.py
cut_tree
def cut_tree(igraph, caps = None): """ Construct a Gomory-Hu cut tree by applying the algorithm of Gusfield. @type igraph: graph @param igraph: Graph @type caps: dictionary @param caps: Dictionary specifying a maximum capacity for each edge. If not given, the weight of the edge will be use...
python
def cut_tree(igraph, caps = None): #maximum flow needs a digraph, we get a graph #I think this conversion relies on implementation details outside the api and may break in the future graph = digraph() graph.add_graph(igraph) #handle optional argument if not caps: caps = {} for e...
[ "def", "cut_tree", "(", "igraph", ",", "caps", "=", "None", ")", ":", "#maximum flow needs a digraph, we get a graph", "#I think this conversion relies on implementation details outside the api and may break in the future", "graph", "=", "digraph", "(", ")", "graph", ".", "add_...
Construct a Gomory-Hu cut tree by applying the algorithm of Gusfield. @type igraph: graph @param igraph: Graph @type caps: dictionary @param caps: Dictionary specifying a maximum capacity for each edge. If not given, the weight of the edge will be used as its capacity. Otherwise, for each edge (a,...
[ "Construct", "a", "Gomory", "-", "Hu", "cut", "tree", "by", "applying", "the", "algorithm", "of", "Gusfield", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/minmax.py#L447-L515
246,354
nerdvegas/rez
src/rez/vendor/distlib/locators.py
Locator.locate
def locate(self, requirement, prereleases=False): """ Find the most recent distribution which matches the given requirement. :param requirement: A requirement of the form 'foo (1.0)' or perhaps 'foo (>= 1.0, < 2.0, != 1.3)' :param prereleases: If ``Tr...
python
def locate(self, requirement, prereleases=False): result = None r = parse_requirement(requirement) if r is None: raise DistlibException('Not a valid requirement: %r' % requirement) scheme = get_scheme(self.scheme) self.matcher = matcher = scheme.matcher(r.requirement)...
[ "def", "locate", "(", "self", ",", "requirement", ",", "prereleases", "=", "False", ")", ":", "result", "=", "None", "r", "=", "parse_requirement", "(", "requirement", ")", "if", "r", "is", "None", ":", "raise", "DistlibException", "(", "'Not a valid require...
Find the most recent distribution which matches the given requirement. :param requirement: A requirement of the form 'foo (1.0)' or perhaps 'foo (>= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be loc...
[ "Find", "the", "most", "recent", "distribution", "which", "matches", "the", "given", "requirement", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/locators.py#L313-L370
246,355
nerdvegas/rez
src/rez/package_bind.py
get_bind_modules
def get_bind_modules(verbose=False): """Get available bind modules. Returns: dict: Map of (name, filepath) listing all bind modules. """ builtin_path = os.path.join(module_root_path, "bind") searchpaths = config.bind_module_path + [builtin_path] bindnames = {} for path in searchpat...
python
def get_bind_modules(verbose=False): builtin_path = os.path.join(module_root_path, "bind") searchpaths = config.bind_module_path + [builtin_path] bindnames = {} for path in searchpaths: if verbose: print "searching %s..." % path if not os.path.isdir(path): contin...
[ "def", "get_bind_modules", "(", "verbose", "=", "False", ")", ":", "builtin_path", "=", "os", ".", "path", ".", "join", "(", "module_root_path", ",", "\"bind\"", ")", "searchpaths", "=", "config", ".", "bind_module_path", "+", "[", "builtin_path", "]", "bind...
Get available bind modules. Returns: dict: Map of (name, filepath) listing all bind modules.
[ "Get", "available", "bind", "modules", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_bind.py#L13-L36
246,356
nerdvegas/rez
src/rez/package_bind.py
find_bind_module
def find_bind_module(name, verbose=False): """Find the bind module matching the given name. Args: name (str): Name of package to find bind module for. verbose (bool): If True, print extra output. Returns: str: Filepath to bind module .py file, or None if not found. """ bind...
python
def find_bind_module(name, verbose=False): bindnames = get_bind_modules(verbose=verbose) bindfile = bindnames.get(name) if bindfile: return bindfile if not verbose: return None # suggest close matches fuzzy_matches = get_close_pkgs(name, bindnames.keys()) if fuzzy_matches...
[ "def", "find_bind_module", "(", "name", ",", "verbose", "=", "False", ")", ":", "bindnames", "=", "get_bind_modules", "(", "verbose", "=", "verbose", ")", "bindfile", "=", "bindnames", ".", "get", "(", "name", ")", "if", "bindfile", ":", "return", "bindfil...
Find the bind module matching the given name. Args: name (str): Name of package to find bind module for. verbose (bool): If True, print extra output. Returns: str: Filepath to bind module .py file, or None if not found.
[ "Find", "the", "bind", "module", "matching", "the", "given", "name", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_bind.py#L39-L68
246,357
nerdvegas/rez
src/rez/package_bind.py
bind_package
def bind_package(name, path=None, version_range=None, no_deps=False, bind_args=None, quiet=False): """Bind software available on the current system, as a rez package. Note: `bind_args` is provided when software is bound via the 'rez-bind' command line tool. Bind modules can def...
python
def bind_package(name, path=None, version_range=None, no_deps=False, bind_args=None, quiet=False): pending = set([name]) installed_variants = [] installed_package_names = set() primary = True # bind package and possibly dependencies while pending: pending_ = pending ...
[ "def", "bind_package", "(", "name", ",", "path", "=", "None", ",", "version_range", "=", "None", ",", "no_deps", "=", "False", ",", "bind_args", "=", "None", ",", "quiet", "=", "False", ")", ":", "pending", "=", "set", "(", "[", "name", "]", ")", "...
Bind software available on the current system, as a rez package. Note: `bind_args` is provided when software is bound via the 'rez-bind' command line tool. Bind modules can define their own command line options, and they will be present in `bind_args` if applicable. Args: name ...
[ "Bind", "software", "available", "on", "the", "current", "system", "as", "a", "rez", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_bind.py#L71-L141
246,358
nerdvegas/rez
src/rez/release_hook.py
create_release_hook
def create_release_hook(name, source_path): """Return a new release hook of the given type.""" from rez.plugin_managers import plugin_manager return plugin_manager.create_instance('release_hook', name, source_path=source_pat...
python
def create_release_hook(name, source_path): from rez.plugin_managers import plugin_manager return plugin_manager.create_instance('release_hook', name, source_path=source_path)
[ "def", "create_release_hook", "(", "name", ",", "source_path", ")", ":", "from", "rez", ".", "plugin_managers", "import", "plugin_manager", "return", "plugin_manager", ".", "create_instance", "(", "'release_hook'", ",", "name", ",", "source_path", "=", "source_path"...
Return a new release hook of the given type.
[ "Return", "a", "new", "release", "hook", "of", "the", "given", "type", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_hook.py#L12-L17
246,359
nerdvegas/rez
src/rez/release_hook.py
ReleaseHook.pre_build
def pre_build(self, user, install_path, variants=None, release_message=None, changelog=None, previous_version=None, previous_revision=None, **kwargs): """Pre-build hook. Args: user: Name of person who did the release. install_path: Directory t...
python
def pre_build(self, user, install_path, variants=None, release_message=None, changelog=None, previous_version=None, previous_revision=None, **kwargs): pass
[ "def", "pre_build", "(", "self", ",", "user", ",", "install_path", ",", "variants", "=", "None", ",", "release_message", "=", "None", ",", "changelog", "=", "None", ",", "previous_version", "=", "None", ",", "previous_revision", "=", "None", ",", "*", "*",...
Pre-build hook. Args: user: Name of person who did the release. install_path: Directory the package was installed into. variants: List of variant indices we are attempting to build, or None release_message: User-supplied release message. ...
[ "Pre", "-", "build", "hook", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_hook.py#L56-L78
246,360
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/traversal.py
traversal
def traversal(graph, node, order): """ Graph traversal iterator. @type graph: graph, digraph @param graph: Graph. @type node: node @param node: Node. @type order: string @param order: traversal ordering. Possible values are: 2. 'pre' - Preordering (default) ...
python
def traversal(graph, node, order): visited = {} if (order == 'pre'): pre = 1 post = 0 elif (order == 'post'): pre = 0 post = 1 for each in _dfs(graph, visited, node, pre, post): yield each
[ "def", "traversal", "(", "graph", ",", "node", ",", "order", ")", ":", "visited", "=", "{", "}", "if", "(", "order", "==", "'pre'", ")", ":", "pre", "=", "1", "post", "=", "0", "elif", "(", "order", "==", "'post'", ")", ":", "pre", "=", "0", ...
Graph traversal iterator. @type graph: graph, digraph @param graph: Graph. @type node: node @param node: Node. @type order: string @param order: traversal ordering. Possible values are: 2. 'pre' - Preordering (default) 1. 'post' - Postordering @rtype: iter...
[ "Graph", "traversal", "iterator", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/traversal.py#L34-L61
246,361
nerdvegas/rez
src/rez/backport/zipfile.py
is_zipfile
def is_zipfile(filename): """Quickly see if file is a ZIP file by checking the magic number.""" try: fpin = open(filename, "rb") endrec = _EndRecData(fpin) fpin.close() if endrec: return True # file has correct magic number except IOError: ...
python
def is_zipfile(filename): try: fpin = open(filename, "rb") endrec = _EndRecData(fpin) fpin.close() if endrec: return True # file has correct magic number except IOError: pass return False
[ "def", "is_zipfile", "(", "filename", ")", ":", "try", ":", "fpin", "=", "open", "(", "filename", ",", "\"rb\"", ")", "endrec", "=", "_EndRecData", "(", "fpin", ")", "fpin", ".", "close", "(", ")", "if", "endrec", ":", "return", "True", "# file has cor...
Quickly see if file is a ZIP file by checking the magic number.
[ "Quickly", "see", "if", "file", "is", "a", "ZIP", "file", "by", "checking", "the", "magic", "number", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L133-L143
246,362
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): # Determine file size fpin.seek(0, 2) filesize = fpin.tell() # Check to see if this is ZIP file with no archive comment (the # "end of central directory" structure should be the last item in the # file if this is the case). try: fpin.seek(-sizeEndCentDir, 2) ...
[ "def", "_EndRecData", "(", "fpin", ")", ":", "# Determine file size", "fpin", ".", "seek", "(", "0", ",", "2", ")", "filesize", "=", "fpin", ".", "tell", "(", ")", "# Check to see if this is ZIP file with no archive comment (the", "# \"end of central directory\" structu...
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
246,363
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(): poly = 0xedb88320 table = [0] * 256 for i in range(256): crc = i for j in range(8): if crc & 1: crc = ((crc >> 1) & 0x7FFFFFFF) ^ poly else: crc = ((crc >> 1) & 0x7FFFFFFF) ...
[ "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
246,364
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): 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
246,365
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): if size < 0: size = sys.maxint elif size == 0: return '' # check for a newline already in buffer nl, nllen = self._checkfornewline() if nl >= 0: # the next line was already in the buffer nl = min(nl,...
[ "def", "readline", "(", "self", ",", "size", "=", "-", "1", ")", ":", "if", "size", "<", "0", ":", "size", "=", "sys", ".", "maxint", "elif", "size", "==", "0", ":", "return", "''", "# check for a newline already in buffer", "nl", ",", "nllen", "=", ...
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
246,366
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): 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
246,367
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): 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
246,368
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 "%-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, zinfo.file_size)
[ "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
246,369
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): 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
246,370
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): if not isinstance(member, ZipInfo): member = self.getinfo(member) if path is None: path = os.getcwd() return self._extract_member(member, path, pwd)
[ "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
246,371
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 = ""): dir, name = os.path.split(pathname) if os.path.isdir(pathname): initname = os.path.join(pathname, "__init__.py") if os.path.isfile(initname): # This is a package directory, add it if basename: ...
[ "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
246,372
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
246,373
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
246,374
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): pid = None try: pidfile = open(pidfile_path, 'r') except IOError: pass else: # According to the FHS 2.3 section on PID files in /var/run: # # The file must consist of the process identifier in # ASCII-encoded d...
[ "def", "read_pid_from_pidfile", "(", "pidfile_path", ")", ":", "pid", "=", "None", "try", ":", "pidfile", "=", "open", "(", "pidfile_path", ",", "'r'", ")", "except", "IOError", ":", "pass", "else", ":", "# According to the FHS 2.3 section on PID files in /var/run:"...
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
246,375
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): 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) size = self.config.get(key, int) si...
[ "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
246,376
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 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
246,377
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): def flatten(v): if isinstance(v, ModifyList): return v.apply([]) elif isinstance(v, dict): return dict((k, flatten(v_)) for k, v_ in v.iteritems()) else: return v def merge(v1, v2): if isinstance(v1, dict) and is...
[ "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
246,378
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): result = {} for k, v in data.iteritems(): if not fn(v): if isinstance(v, dict): result[k] = deep_del(v, fn) else: result[k] = v return result
[ "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
246,379
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): 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: lines.append("Removed attributes: %s" % ['.'.join(x) ...
[ "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
246,380
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): d_ = to_class() for key, value in d.iteritems(): if isinstance(value, from_class): d_[key] = convert_dicts(value, to_class=to_class, from_class=from_class) else: d_[key] =...
[ "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
246,381
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): 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
246,382
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): for family in self.iter_package_families(): for pkg in self.iter_packages(family): return False return True
[ "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
246,383
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): if variables.get("repository_type", self.name()) != self.name(): raise ResourceError("repository_type mismatch - requested %r, " "repository_type is %r" % (variables["repository...
[ "def", "make_resource_handle", "(", "self", ",", "resource_key", ",", "*", "*", "variables", ")", ":", "if", "variables", ".", "get", "(", "\"repository_type\"", ",", "self", ".", "name", "(", ")", ")", "!=", "self", ".", "name", "(", ")", ":", "raise"...
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
246,384
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): # normalise parts = path.split('@', 1) if len(parts) == 1: parts = ("filesystem", parts[0]) repo_type, location = parts if repo_type == "filesystem": # choice of abspath here vs realpath is deliberate. Realpath gives ...
[ "def", "get_repository", "(", "self", ",", "path", ")", ":", "# normalise", "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
246,385
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): if path_1 == path_2: return True repo_1 = self.get_repository(path_1) repo_2 = self.get_repository(path_2) return (repo_1.uid == repo_2.uid)
[ "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
246,386
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): 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
246,387
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): try: return self.plugin_classes[plugin_name] except KeyError: raise RezPluginError("Unrecognised %s plugin: '%s'" % (self.pretty_type_name, plugin_name))
[ "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
246,388
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): try: return self.plugin_modules[plugin_name] except KeyError: raise RezPluginError("Unrecognised %s plugin: '%s'" % (self.pretty_type_name, plugin_name))
[ "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
246,389
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): 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_class, "schema_dict") \ and plugin_class.schema_dict: ...
[ "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
246,390
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): 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
246,391
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): 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
246,392
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): 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...
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
246,393
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): rows = [["PLUGIN TYPE", "NAME", "DESCRIPTION", "STATUS"], ["-----------", "----", "-----------", "------"]] for plugin_type in sorted(self.get_plugin_types()): type_name = plugin_type.replace('_', ' ') for name in sorted(self.get_plug...
[ "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
246,394
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): 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
246,395
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): if isinstance(node, string_types): self.source = node kwargs = {'mode': 'eval'} if filename: kwargs['filename'] = filename try: node = ast.parse(node, **kwargs) except SyntaxError...
[ "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
246,396
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): 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_running.add(key) try: return func(self...
[ "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
246,397
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): values = reduce(iadd, self._lists, []) self._clear() self._load = load self._half = load >> 1 self._dual = load << 1 self._update(values)
[ "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
246,398
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): row0 = list(map(len, self._lists)) if len(row0) == 1: self._index[:] = row0 self._offset = 0 return head = iter(row0) tail = iter(head) row1 = list(starmap(add, zip(head, tail))) if len(row0) & 1: ...
[ "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
246,399
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): _maxes = self._maxes if not _maxes: return iter(()) _keys = self._keys # Calculate the minimum (pos, idx) pair. By default this location # will be inclusive ...
[ "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