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,400
nerdvegas/rez
src/rezgui/dialogs/WriteGraphDialog.py
view_graph
def view_graph(graph_str, parent=None, prune_to=None): """View a graph.""" from rezgui.dialogs.ImageViewerDialog import ImageViewerDialog from rez.config import config # check for already written tempfile h = hash((graph_str, prune_to)) filepath = graph_file_lookup.get(h) if filepath and no...
python
def view_graph(graph_str, parent=None, prune_to=None): from rezgui.dialogs.ImageViewerDialog import ImageViewerDialog from rez.config import config # check for already written tempfile h = hash((graph_str, prune_to)) filepath = graph_file_lookup.get(h) if filepath and not os.path.exists(filepat...
[ "def", "view_graph", "(", "graph_str", ",", "parent", "=", "None", ",", "prune_to", "=", "None", ")", ":", "from", "rezgui", ".", "dialogs", ".", "ImageViewerDialog", "import", "ImageViewerDialog", "from", "rez", ".", "config", "import", "config", "# check for...
View a graph.
[ "View", "a", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/dialogs/WriteGraphDialog.py#L109-L133
246,401
nerdvegas/rez
src/rezgui/widgets/PackageVersionsTable.py
PackageVersionsTable.select_version
def select_version(self, version_range): """Select the latest versioned package in the given range. If there are no packages in the range, the selection is cleared. """ row = -1 version = None for i, package in self.packages.iteritems(): if package.version in...
python
def select_version(self, version_range): row = -1 version = None for i, package in self.packages.iteritems(): if package.version in version_range \ and (version is None or version < package.version): version = package.version row = ...
[ "def", "select_version", "(", "self", ",", "version_range", ")", ":", "row", "=", "-", "1", "version", "=", "None", "for", "i", ",", "package", "in", "self", ".", "packages", ".", "iteritems", "(", ")", ":", "if", "package", ".", "version", "in", "ve...
Select the latest versioned package in the given range. If there are no packages in the range, the selection is cleared.
[ "Select", "the", "latest", "versioned", "package", "in", "the", "given", "range", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/widgets/PackageVersionsTable.py#L46-L62
246,402
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedset.py
SortedSet._fromset
def _fromset(cls, values, key=None): """Initialize sorted set from existing set.""" sorted_set = object.__new__(cls) sorted_set._set = values # pylint: disable=protected-access sorted_set.__init__(key=key) return sorted_set
python
def _fromset(cls, values, key=None): sorted_set = object.__new__(cls) sorted_set._set = values # pylint: disable=protected-access sorted_set.__init__(key=key) return sorted_set
[ "def", "_fromset", "(", "cls", ",", "values", ",", "key", "=", "None", ")", ":", "sorted_set", "=", "object", ".", "__new__", "(", "cls", ")", "sorted_set", ".", "_set", "=", "values", "# pylint: disable=protected-access", "sorted_set", ".", "__init__", "(",...
Initialize sorted set from existing set.
[ "Initialize", "sorted", "set", "from", "existing", "set", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedset.py#L73-L78
246,403
nerdvegas/rez
src/rez/cli/build.py
setup_parser_common
def setup_parser_common(parser): """Parser setup common to both rez-build and rez-release.""" from rez.build_process_ import get_build_process_types from rez.build_system import get_valid_build_systems process_types = get_build_process_types() parser.add_argument( "--process", type=str, cho...
python
def setup_parser_common(parser): from rez.build_process_ import get_build_process_types from rez.build_system import get_valid_build_systems process_types = get_build_process_types() parser.add_argument( "--process", type=str, choices=process_types, default="local", help="the build proc...
[ "def", "setup_parser_common", "(", "parser", ")", ":", "from", "rez", ".", "build_process_", "import", "get_build_process_types", "from", "rez", ".", "build_system", "import", "get_valid_build_systems", "process_types", "=", "get_build_process_types", "(", ")", "parser"...
Parser setup common to both rez-build and rez-release.
[ "Parser", "setup", "common", "to", "both", "rez", "-", "build", "and", "rez", "-", "release", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/cli/build.py#L30-L71
246,404
nerdvegas/rez
src/rez/utils/scope.py
scoped_format
def scoped_format(txt, **objects): """Format a string with respect to a set of objects' attributes. Example: >>> Class Foo(object): >>> def __init__(self): >>> self.name = "Dave" >>> print scoped_format("hello {foo.name}", foo=Foo()) hello Dave Args: ...
python
def scoped_format(txt, **objects): pretty = objects.pop("pretty", RecursiveAttribute.format_pretty) expand = objects.pop("expand", RecursiveAttribute.format_expand) attr = RecursiveAttribute(objects, read_only=True) formatter = scoped_formatter(**objects) return formatter.format(txt, pretty=pretty, ...
[ "def", "scoped_format", "(", "txt", ",", "*", "*", "objects", ")", ":", "pretty", "=", "objects", ".", "pop", "(", "\"pretty\"", ",", "RecursiveAttribute", ".", "format_pretty", ")", "expand", "=", "objects", ".", "pop", "(", "\"expand\"", ",", "RecursiveA...
Format a string with respect to a set of objects' attributes. Example: >>> Class Foo(object): >>> def __init__(self): >>> self.name = "Dave" >>> print scoped_format("hello {foo.name}", foo=Foo()) hello Dave Args: objects (dict): Dict of objects to f...
[ "Format", "a", "string", "with", "respect", "to", "a", "set", "of", "objects", "attributes", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/scope.py#L238-L260
246,405
nerdvegas/rez
src/rez/utils/scope.py
RecursiveAttribute.to_dict
def to_dict(self): """Get an equivalent dict representation.""" d = {} for k, v in self.__dict__["data"].iteritems(): if isinstance(v, RecursiveAttribute): d[k] = v.to_dict() else: d[k] = v return d
python
def to_dict(self): d = {} for k, v in self.__dict__["data"].iteritems(): if isinstance(v, RecursiveAttribute): d[k] = v.to_dict() else: d[k] = v return d
[ "def", "to_dict", "(", "self", ")", ":", "d", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "__dict__", "[", "\"data\"", "]", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", "RecursiveAttribute", ")", ":", "d", "[", ...
Get an equivalent dict representation.
[ "Get", "an", "equivalent", "dict", "representation", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/scope.py#L89-L97
246,406
nerdvegas/rez
src/rezgui/objects/Config.py
Config.value
def value(self, key, type_=None): """Get the value of a setting. If `type` is not provided, the key must be for a known setting, present in `self.default_settings`. Conversely if `type` IS provided, the key must be for an unknown setting. """ if type_ is None: ...
python
def value(self, key, type_=None): if type_ is None: default = self._default_value(key) val = self._value(key, default) if type(val) == type(default): return val else: return self._convert_value(val, type(default)) else: ...
[ "def", "value", "(", "self", ",", "key", ",", "type_", "=", "None", ")", ":", "if", "type_", "is", "None", ":", "default", "=", "self", ".", "_default_value", "(", "key", ")", "val", "=", "self", ".", "_value", "(", "key", ",", "default", ")", "i...
Get the value of a setting. If `type` is not provided, the key must be for a known setting, present in `self.default_settings`. Conversely if `type` IS provided, the key must be for an unknown setting.
[ "Get", "the", "value", "of", "a", "setting", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/Config.py#L15-L33
246,407
nerdvegas/rez
src/rezgui/objects/Config.py
Config.get_string_list
def get_string_list(self, key): """Get a list of strings.""" strings = [] size = self.beginReadArray(key) for i in range(size): self.setArrayIndex(i) entry = str(self._value("entry")) strings.append(entry) self.endArray() return strings
python
def get_string_list(self, key): strings = [] size = self.beginReadArray(key) for i in range(size): self.setArrayIndex(i) entry = str(self._value("entry")) strings.append(entry) self.endArray() return strings
[ "def", "get_string_list", "(", "self", ",", "key", ")", ":", "strings", "=", "[", "]", "size", "=", "self", ".", "beginReadArray", "(", "key", ")", "for", "i", "in", "range", "(", "size", ")", ":", "self", ".", "setArrayIndex", "(", "i", ")", "entr...
Get a list of strings.
[ "Get", "a", "list", "of", "strings", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/Config.py#L38-L47
246,408
nerdvegas/rez
src/rezgui/objects/Config.py
Config.prepend_string_list
def prepend_string_list(self, key, value, max_length_key): """Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' e...
python
def prepend_string_list(self, key, value, max_length_key): max_len = self.get(max_length_key) strings = self.get_string_list(key) strings = [value] + [x for x in strings if x != value] strings = strings[:max_len] self.beginWriteArray(key) for i in range(len(strings)): ...
[ "def", "prepend_string_list", "(", "self", ",", "key", ",", "value", ",", "max_length_key", ")", ":", "max_len", "=", "self", ".", "get", "(", "max_length_key", ")", "strings", "=", "self", ".", "get_string_list", "(", "key", ")", "strings", "=", "[", "v...
Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' entry.
[ "Prepend", "a", "fixed", "-", "length", "string", "list", "with", "a", "new", "string", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/Config.py#L49-L65
246,409
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/utils.py
priority_queue.insert
def insert(self, item, priority): """ Insert item into the queue, with the given priority. """ heappush(self.heap, HeapItem(item, priority))
python
def insert(self, item, priority): heappush(self.heap, HeapItem(item, priority))
[ "def", "insert", "(", "self", ",", "item", ",", "priority", ")", ":", "heappush", "(", "self", ".", "heap", ",", "HeapItem", "(", "item", ",", "priority", ")", ")" ]
Insert item into the queue, with the given priority.
[ "Insert", "item", "into", "the", "queue", "with", "the", "given", "priority", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/utils.py#L57-L61
246,410
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
connected_components
def connected_components(graph): """ Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component. """ recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes(...
python
def connected_components(graph): recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes())*2,recursionlimit)) visited = {} count = 1 # For 'each' node not found to belong to a connected component, find its connected # component. for each in graph: if (each n...
[ "def", "connected_components", "(", "graph", ")", ":", "recursionlimit", "=", "getrecursionlimit", "(", ")", "setrecursionlimit", "(", "max", "(", "len", "(", "graph", ".", "nodes", "(", ")", ")", "*", "2", ",", "recursionlimit", ")", ")", "visited", "=", ...
Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component.
[ "Connected", "components", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L114-L138
246,411
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
cut_edges
def cut_edges(graph): """ Return the cut-edges of the given graph. A cut edge, or bridge, is an edge of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @return: List of cut-...
python
def cut_edges(graph): recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes())*2,recursionlimit)) # Dispatch if we have a hypergraph if 'hypergraph' == graph.__class__.__name__: return _cut_hyperedges(graph) pre = {} # Pre-ordering low = {} # Lowest pre[] rea...
[ "def", "cut_edges", "(", "graph", ")", ":", "recursionlimit", "=", "getrecursionlimit", "(", ")", "setrecursionlimit", "(", "max", "(", "len", "(", "graph", ".", "nodes", "(", ")", ")", "*", "2", ",", "recursionlimit", ")", ")", "# Dispatch if we have a hype...
Return the cut-edges of the given graph. A cut edge, or bridge, is an edge of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @return: List of cut-edges.
[ "Return", "the", "cut", "-", "edges", "of", "the", "given", "graph", ".", "A", "cut", "edge", "or", "bridge", "is", "an", "edge", "of", "a", "graph", "whose", "removal", "increases", "the", "number", "of", "connected", "components", "in", "the", "graph",...
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L182-L214
246,412
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
_cut_hyperedges
def _cut_hyperedges(hypergraph): """ Return the cut-hyperedges of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes. """ edges_ = cut_nodes(hypergraph.graph) edges = [] for each in edges_: ...
python
def _cut_hyperedges(hypergraph): edges_ = cut_nodes(hypergraph.graph) edges = [] for each in edges_: if (each[1] == 'h'): edges.append(each[0]) return edges
[ "def", "_cut_hyperedges", "(", "hypergraph", ")", ":", "edges_", "=", "cut_nodes", "(", "hypergraph", ".", "graph", ")", "edges", "=", "[", "]", "for", "each", "in", "edges_", ":", "if", "(", "each", "[", "1", "]", "==", "'h'", ")", ":", "edges", "...
Return the cut-hyperedges of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes.
[ "Return", "the", "cut", "-", "hyperedges", "of", "the", "given", "hypergraph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L217-L234
246,413
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
cut_nodes
def cut_nodes(graph): """ Return the cut-nodes of the given graph. A cut node, or articulation point, is a node of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @retur...
python
def cut_nodes(graph): recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes())*2,recursionlimit)) # Dispatch if we have a hypergraph if 'hypergraph' == graph.__class__.__name__: return _cut_hypernodes(graph) pre = {} # Pre-ordering low = {} # Lowe...
[ "def", "cut_nodes", "(", "graph", ")", ":", "recursionlimit", "=", "getrecursionlimit", "(", ")", "setrecursionlimit", "(", "max", "(", "len", "(", "graph", ".", "nodes", "(", ")", ")", "*", "2", ",", "recursionlimit", ")", ")", "# Dispatch if we have a hype...
Return the cut-nodes of the given graph. A cut node, or articulation point, is a node of a graph whose removal increases the number of connected components in the graph. @type graph: graph, hypergraph @param graph: Graph. @rtype: list @return: List of cut-nodes.
[ "Return", "the", "cut", "-", "nodes", "of", "the", "given", "graph", ".", "A", "cut", "node", "or", "articulation", "point", "is", "a", "node", "of", "a", "graph", "whose", "removal", "increases", "the", "number", "of", "connected", "components", "in", "...
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L237-L288
246,414
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/accessibility.py
_cut_hypernodes
def _cut_hypernodes(hypergraph): """ Return the cut-nodes of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes. """ nodes_ = cut_nodes(hypergraph.graph) nodes = [] for each in nodes_: ...
python
def _cut_hypernodes(hypergraph): nodes_ = cut_nodes(hypergraph.graph) nodes = [] for each in nodes_: if (each[1] == 'n'): nodes.append(each[0]) return nodes
[ "def", "_cut_hypernodes", "(", "hypergraph", ")", ":", "nodes_", "=", "cut_nodes", "(", "hypergraph", ".", "graph", ")", "nodes", "=", "[", "]", "for", "each", "in", "nodes_", ":", "if", "(", "each", "[", "1", "]", "==", "'n'", ")", ":", "nodes", "...
Return the cut-nodes of the given hypergraph. @type hypergraph: hypergraph @param hypergraph: Hypergraph @rtype: list @return: List of cut-nodes.
[ "Return", "the", "cut", "-", "nodes", "of", "the", "given", "hypergraph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/accessibility.py#L291-L308
246,415
nerdvegas/rez
src/rez/vendor/pygraph/classes/graph.py
graph.del_edge
def del_edge(self, edge): """ Remove an edge from the graph. @type edge: tuple @param edge: Edge. """ u, v = edge self.node_neighbors[u].remove(v) self.del_edge_labeling((u, v)) if (u != v): self.node_neighbors[v].remove(u) ...
python
def del_edge(self, edge): u, v = edge self.node_neighbors[u].remove(v) self.del_edge_labeling((u, v)) if (u != v): self.node_neighbors[v].remove(u) self.del_edge_labeling((v, u))
[ "def", "del_edge", "(", "self", ",", "edge", ")", ":", "u", ",", "v", "=", "edge", "self", ".", "node_neighbors", "[", "u", "]", ".", "remove", "(", "v", ")", "self", ".", "del_edge_labeling", "(", "(", "u", ",", "v", ")", ")", "if", "(", "u", ...
Remove an edge from the graph. @type edge: tuple @param edge: Edge.
[ "Remove", "an", "edge", "from", "the", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/graph.py#L170-L182
246,416
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.edge_weight
def edge_weight(self, edge): """ Get the weight of an edge. @type edge: edge @param edge: One edge. @rtype: number @return: Edge weight. """ return self.get_edge_properties( edge ).setdefault( self.WEIGHT_ATTRIBUTE_NAME, self.DEFAULT_WEIGHT )
python
def edge_weight(self, edge): return self.get_edge_properties( edge ).setdefault( self.WEIGHT_ATTRIBUTE_NAME, self.DEFAULT_WEIGHT )
[ "def", "edge_weight", "(", "self", ",", "edge", ")", ":", "return", "self", ".", "get_edge_properties", "(", "edge", ")", ".", "setdefault", "(", "self", ".", "WEIGHT_ATTRIBUTE_NAME", ",", "self", ".", "DEFAULT_WEIGHT", ")" ]
Get the weight of an edge. @type edge: edge @param edge: One edge. @rtype: number @return: Edge weight.
[ "Get", "the", "weight", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L66-L76
246,417
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.set_edge_weight
def set_edge_weight(self, edge, wt): """ Set the weight of an edge. @type edge: edge @param edge: One edge. @type wt: number @param wt: Edge weight. """ self.set_edge_properties(edge, weight=wt ) if not self.DIRECTED: self.set_edge_...
python
def set_edge_weight(self, edge, wt): self.set_edge_properties(edge, weight=wt ) if not self.DIRECTED: self.set_edge_properties((edge[1], edge[0]) , weight=wt )
[ "def", "set_edge_weight", "(", "self", ",", "edge", ",", "wt", ")", ":", "self", ".", "set_edge_properties", "(", "edge", ",", "weight", "=", "wt", ")", "if", "not", "self", ".", "DIRECTED", ":", "self", ".", "set_edge_properties", "(", "(", "edge", "[...
Set the weight of an edge. @type edge: edge @param edge: One edge. @type wt: number @param wt: Edge weight.
[ "Set", "the", "weight", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L79-L91
246,418
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.edge_label
def edge_label(self, edge): """ Get the label of an edge. @type edge: edge @param edge: One edge. @rtype: string @return: Edge label """ return self.get_edge_properties( edge ).setdefault( self.LABEL_ATTRIBUTE_NAME, self.DEFAULT_LABEL )
python
def edge_label(self, edge): return self.get_edge_properties( edge ).setdefault( self.LABEL_ATTRIBUTE_NAME, self.DEFAULT_LABEL )
[ "def", "edge_label", "(", "self", ",", "edge", ")", ":", "return", "self", ".", "get_edge_properties", "(", "edge", ")", ".", "setdefault", "(", "self", ".", "LABEL_ATTRIBUTE_NAME", ",", "self", ".", "DEFAULT_LABEL", ")" ]
Get the label of an edge. @type edge: edge @param edge: One edge. @rtype: string @return: Edge label
[ "Get", "the", "label", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L94-L104
246,419
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.set_edge_label
def set_edge_label(self, edge, label): """ Set the label of an edge. @type edge: edge @param edge: One edge. @type label: string @param label: Edge label. """ self.set_edge_properties(edge, label=label ) if not self.DIRECTED: self.s...
python
def set_edge_label(self, edge, label): self.set_edge_properties(edge, label=label ) if not self.DIRECTED: self.set_edge_properties((edge[1], edge[0]) , label=label )
[ "def", "set_edge_label", "(", "self", ",", "edge", ",", "label", ")", ":", "self", ".", "set_edge_properties", "(", "edge", ",", "label", "=", "label", ")", "if", "not", "self", ".", "DIRECTED", ":", "self", ".", "set_edge_properties", "(", "(", "edge", ...
Set the label of an edge. @type edge: edge @param edge: One edge. @type label: string @param label: Edge label.
[ "Set", "the", "label", "of", "an", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L106-L118
246,420
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.add_edge_attribute
def add_edge_attribute(self, edge, attr): """ Add attribute to the given edge. @type edge: edge @param edge: One edge. @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value). """ self.edge_attr[edge] = self.ed...
python
def add_edge_attribute(self, edge, attr): self.edge_attr[edge] = self.edge_attributes(edge) + [attr] if (not self.DIRECTED and edge[0] != edge[1]): self.edge_attr[(edge[1],edge[0])] = self.edge_attributes((edge[1], edge[0])) + [attr]
[ "def", "add_edge_attribute", "(", "self", ",", "edge", ",", "attr", ")", ":", "self", ".", "edge_attr", "[", "edge", "]", "=", "self", ".", "edge_attributes", "(", "edge", ")", "+", "[", "attr", "]", "if", "(", "not", "self", ".", "DIRECTED", "and", ...
Add attribute to the given edge. @type edge: edge @param edge: One edge. @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value).
[ "Add", "attribute", "to", "the", "given", "edge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L128-L141
246,421
nerdvegas/rez
src/rez/vendor/pygraph/mixins/labeling.py
labeling.add_node_attribute
def add_node_attribute(self, node, attr): """ Add attribute to the given node. @type node: node @param node: Node identifier @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value). """ self.node_attr[node] = s...
python
def add_node_attribute(self, node, attr): self.node_attr[node] = self.node_attr[node] + [attr]
[ "def", "add_node_attribute", "(", "self", ",", "node", ",", "attr", ")", ":", "self", ".", "node_attr", "[", "node", "]", "=", "self", ".", "node_attr", "[", "node", "]", "+", "[", "attr", "]" ]
Add attribute to the given node. @type node: node @param node: Node identifier @type attr: tuple @param attr: Node attribute specified as a tuple in the form (attribute, value).
[ "Add", "attribute", "to", "the", "given", "node", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/labeling.py#L157-L167
246,422
nerdvegas/rez
src/rez/suite.py
Suite.activation_shell_code
def activation_shell_code(self, shell=None): """Get shell code that should be run to activate this suite.""" from rez.shells import create_shell from rez.rex import RexExecutor executor = RexExecutor(interpreter=create_shell(shell), parent_variables=["PATH...
python
def activation_shell_code(self, shell=None): from rez.shells import create_shell from rez.rex import RexExecutor executor = RexExecutor(interpreter=create_shell(shell), parent_variables=["PATH"], shebang=False) executor.env.P...
[ "def", "activation_shell_code", "(", "self", ",", "shell", "=", "None", ")", ":", "from", "rez", ".", "shells", "import", "create_shell", "from", "rez", ".", "rex", "import", "RexExecutor", "executor", "=", "RexExecutor", "(", "interpreter", "=", "create_shell...
Get shell code that should be run to activate this suite.
[ "Get", "shell", "code", "that", "should", "be", "run", "to", "activate", "this", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L68-L77
246,423
nerdvegas/rez
src/rez/suite.py
Suite.context
def context(self, name): """Get a context. Args: name (str): Name to store the context under. Returns: `ResolvedContext` object. """ data = self._context(name) context = data.get("context") if context: return context ...
python
def context(self, name): data = self._context(name) context = data.get("context") if context: return context assert self.load_path context_path = os.path.join(self.load_path, "contexts", "%s.rxt" % name) context = ResolvedContext.load(context_path) da...
[ "def", "context", "(", "self", ",", "name", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "context", "=", "data", ".", "get", "(", "\"context\"", ")", "if", "context", ":", "return", "context", "assert", "self", ".", "load_path", ...
Get a context. Args: name (str): Name to store the context under. Returns: `ResolvedContext` object.
[ "Get", "a", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L82-L101
246,424
nerdvegas/rez
src/rez/suite.py
Suite.add_context
def add_context(self, name, context, prefix_char=None): """Add a context to the suite. Args: name (str): Name to store the context under. context (ResolvedContext): Context to add. """ if name in self.contexts: raise SuiteError("Context already in sui...
python
def add_context(self, name, context, prefix_char=None): if name in self.contexts: raise SuiteError("Context already in suite: %r" % name) if not context.success: raise SuiteError("Context is not resolved: %r" % name) self.contexts[name] = dict(name=name, ...
[ "def", "add_context", "(", "self", ",", "name", ",", "context", ",", "prefix_char", "=", "None", ")", ":", "if", "name", "in", "self", ".", "contexts", ":", "raise", "SuiteError", "(", "\"Context already in suite: %r\"", "%", "name", ")", "if", "not", "con...
Add a context to the suite. Args: name (str): Name to store the context under. context (ResolvedContext): Context to add.
[ "Add", "a", "context", "to", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L103-L121
246,425
nerdvegas/rez
src/rez/suite.py
Suite.find_contexts
def find_contexts(self, in_request=None, in_resolve=None): """Find contexts in the suite based on search criteria. Args: in_request (str): Match contexts that contain the given package in their request. in_resolve (str or `Requirement`): Match contexts that conta...
python
def find_contexts(self, in_request=None, in_resolve=None): names = self.context_names if in_request: def _in_request(name): context = self.context(name) packages = set(x.name for x in context.requested_packages(True)) return (in_request in pack...
[ "def", "find_contexts", "(", "self", ",", "in_request", "=", "None", ",", "in_resolve", "=", "None", ")", ":", "names", "=", "self", ".", "context_names", "if", "in_request", ":", "def", "_in_request", "(", "name", ")", ":", "context", "=", "self", ".", ...
Find contexts in the suite based on search criteria. Args: in_request (str): Match contexts that contain the given package in their request. in_resolve (str or `Requirement`): Match contexts that contain the given package in their resolve. You can also su...
[ "Find", "contexts", "in", "the", "suite", "based", "on", "search", "criteria", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L123-L161
246,426
nerdvegas/rez
src/rez/suite.py
Suite.remove_context
def remove_context(self, name): """Remove a context from the suite. Args: name (str): Name of the context to remove. """ self._context(name) del self.contexts[name] self._flush_tools()
python
def remove_context(self, name): self._context(name) del self.contexts[name] self._flush_tools()
[ "def", "remove_context", "(", "self", ",", "name", ")", ":", "self", ".", "_context", "(", "name", ")", "del", "self", ".", "contexts", "[", "name", "]", "self", ".", "_flush_tools", "(", ")" ]
Remove a context from the suite. Args: name (str): Name of the context to remove.
[ "Remove", "a", "context", "from", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L163-L171
246,427
nerdvegas/rez
src/rez/suite.py
Suite.set_context_prefix
def set_context_prefix(self, name, prefix): """Set a context's prefix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as '<prefix>foo' in the suite's bin path. Args: name (str): Name of the context t...
python
def set_context_prefix(self, name, prefix): data = self._context(name) data["prefix"] = prefix self._flush_tools()
[ "def", "set_context_prefix", "(", "self", ",", "name", ",", "prefix", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "data", "[", "\"prefix\"", "]", "=", "prefix", "self", ".", "_flush_tools", "(", ")" ]
Set a context's prefix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as '<prefix>foo' in the suite's bin path. Args: name (str): Name of the context to prefix. prefix (str): Prefix to apply to ...
[ "Set", "a", "context", "s", "prefix", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L173-L186
246,428
nerdvegas/rez
src/rez/suite.py
Suite.set_context_suffix
def set_context_suffix(self, name, suffix): """Set a context's suffix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as 'foo<suffix>' in the suite's bin path. Args: name (str): Name of the context t...
python
def set_context_suffix(self, name, suffix): data = self._context(name) data["suffix"] = suffix self._flush_tools()
[ "def", "set_context_suffix", "(", "self", ",", "name", ",", "suffix", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "data", "[", "\"suffix\"", "]", "=", "suffix", "self", ".", "_flush_tools", "(", ")" ]
Set a context's suffix. This will be applied to all wrappers for the tools in this context. For example, a tool called 'foo' would appear as 'foo<suffix>' in the suite's bin path. Args: name (str): Name of the context to suffix. suffix (str): Suffix to apply to ...
[ "Set", "a", "context", "s", "suffix", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L196-L209
246,429
nerdvegas/rez
src/rez/suite.py
Suite.bump_context
def bump_context(self, name): """Causes the context's tools to take priority over all others.""" data = self._context(name) data["priority"] = self._next_priority self._flush_tools()
python
def bump_context(self, name): data = self._context(name) data["priority"] = self._next_priority self._flush_tools()
[ "def", "bump_context", "(", "self", ",", "name", ")", ":", "data", "=", "self", ".", "_context", "(", "name", ")", "data", "[", "\"priority\"", "]", "=", "self", ".", "_next_priority", "self", ".", "_flush_tools", "(", ")" ]
Causes the context's tools to take priority over all others.
[ "Causes", "the", "context", "s", "tools", "to", "take", "priority", "over", "all", "others", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L219-L223
246,430
nerdvegas/rez
src/rez/suite.py
Suite.hide_tool
def hide_tool(self, context_name, tool_name): """Hide a tool so that it is not exposed in the suite. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to hide. """ data = self._context(context_name) hidden_tools = data["...
python
def hide_tool(self, context_name, tool_name): data = self._context(context_name) hidden_tools = data["hidden_tools"] if tool_name not in hidden_tools: self._validate_tool(context_name, tool_name) hidden_tools.add(tool_name) self._flush_tools()
[ "def", "hide_tool", "(", "self", ",", "context_name", ",", "tool_name", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "hidden_tools", "=", "data", "[", "\"hidden_tools\"", "]", "if", "tool_name", "not", "in", "hidden_tools", ":", ...
Hide a tool so that it is not exposed in the suite. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to hide.
[ "Hide", "a", "tool", "so", "that", "it", "is", "not", "exposed", "in", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L225-L237
246,431
nerdvegas/rez
src/rez/suite.py
Suite.unhide_tool
def unhide_tool(self, context_name, tool_name): """Unhide a tool so that it may be exposed in a suite. Note that unhiding a tool doesn't guarantee it can be seen - a tool of the same name from a different context may be overriding it. Args: context_name (str): Context conta...
python
def unhide_tool(self, context_name, tool_name): data = self._context(context_name) hidden_tools = data["hidden_tools"] if tool_name in hidden_tools: hidden_tools.remove(tool_name) self._flush_tools()
[ "def", "unhide_tool", "(", "self", ",", "context_name", ",", "tool_name", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "hidden_tools", "=", "data", "[", "\"hidden_tools\"", "]", "if", "tool_name", "in", "hidden_tools", ":", "hidd...
Unhide a tool so that it may be exposed in a suite. Note that unhiding a tool doesn't guarantee it can be seen - a tool of the same name from a different context may be overriding it. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool t...
[ "Unhide", "a", "tool", "so", "that", "it", "may", "be", "exposed", "in", "a", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L239-L253
246,432
nerdvegas/rez
src/rez/suite.py
Suite.alias_tool
def alias_tool(self, context_name, tool_name, tool_alias): """Register an alias for a specific tool. Note that a tool alias takes precedence over a context prefix/suffix. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to alias. ...
python
def alias_tool(self, context_name, tool_name, tool_alias): data = self._context(context_name) aliases = data["tool_aliases"] if tool_name in aliases: raise SuiteError("Tool %r in context %r is already aliased to %r" % (tool_name, context_name, aliases[too...
[ "def", "alias_tool", "(", "self", ",", "context_name", ",", "tool_name", ",", "tool_alias", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "aliases", "=", "data", "[", "\"tool_aliases\"", "]", "if", "tool_name", "in", "aliases", ...
Register an alias for a specific tool. Note that a tool alias takes precedence over a context prefix/suffix. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to alias. tool_alias (str): Alias to give the tool.
[ "Register", "an", "alias", "for", "a", "specific", "tool", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L255-L272
246,433
nerdvegas/rez
src/rez/suite.py
Suite.unalias_tool
def unalias_tool(self, context_name, tool_name): """Deregister an alias for a specific tool. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to unalias. """ data = self._context(context_name) aliases = data["tool_alias...
python
def unalias_tool(self, context_name, tool_name): data = self._context(context_name) aliases = data["tool_aliases"] if tool_name in aliases: del aliases[tool_name] self._flush_tools()
[ "def", "unalias_tool", "(", "self", ",", "context_name", ",", "tool_name", ")", ":", "data", "=", "self", ".", "_context", "(", "context_name", ")", "aliases", "=", "data", "[", "\"tool_aliases\"", "]", "if", "tool_name", "in", "aliases", ":", "del", "alia...
Deregister an alias for a specific tool. Args: context_name (str): Context containing the tool. tool_name (str): Name of tool to unalias.
[ "Deregister", "an", "alias", "for", "a", "specific", "tool", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L274-L285
246,434
nerdvegas/rez
src/rez/suite.py
Suite.get_tool_filepath
def get_tool_filepath(self, tool_alias): """Given a visible tool alias, return the full path to the executable. Args: tool_alias (str): Tool alias to search for. Returns: (str): Filepath of executable, or None if the tool is not in the suite. May also re...
python
def get_tool_filepath(self, tool_alias): tools_dict = self.get_tools() if tool_alias in tools_dict: if self.tools_path is None: return None else: return os.path.join(self.tools_path, tool_alias) else: return None
[ "def", "get_tool_filepath", "(", "self", ",", "tool_alias", ")", ":", "tools_dict", "=", "self", ".", "get_tools", "(", ")", "if", "tool_alias", "in", "tools_dict", ":", "if", "self", ".", "tools_path", "is", "None", ":", "return", "None", "else", ":", "...
Given a visible tool alias, return the full path to the executable. Args: tool_alias (str): Tool alias to search for. Returns: (str): Filepath of executable, or None if the tool is not in the suite. May also return None because this suite has not been saved ...
[ "Given", "a", "visible", "tool", "alias", "return", "the", "full", "path", "to", "the", "executable", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L302-L320
246,435
nerdvegas/rez
src/rez/suite.py
Suite.get_tool_context
def get_tool_context(self, tool_alias): """Given a visible tool alias, return the name of the context it belongs to. Args: tool_alias (str): Tool alias to search for. Returns: (str): Name of the context that exposes a visible instance of this tool al...
python
def get_tool_context(self, tool_alias): tools_dict = self.get_tools() data = tools_dict.get(tool_alias) if data: return data["context_name"] return None
[ "def", "get_tool_context", "(", "self", ",", "tool_alias", ")", ":", "tools_dict", "=", "self", ".", "get_tools", "(", ")", "data", "=", "tools_dict", ".", "get", "(", "tool_alias", ")", "if", "data", ":", "return", "data", "[", "\"context_name\"", "]", ...
Given a visible tool alias, return the name of the context it belongs to. Args: tool_alias (str): Tool alias to search for. Returns: (str): Name of the context that exposes a visible instance of this tool alias, or None if the alias is not available.
[ "Given", "a", "visible", "tool", "alias", "return", "the", "name", "of", "the", "context", "it", "belongs", "to", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L322-L337
246,436
nerdvegas/rez
src/rez/suite.py
Suite.validate
def validate(self): """Validate the suite.""" for context_name in self.context_names: context = self.context(context_name) try: context.validate() except ResolvedContextError as e: raise SuiteError("Error in context %r: %s" ...
python
def validate(self): for context_name in self.context_names: context = self.context(context_name) try: context.validate() except ResolvedContextError as e: raise SuiteError("Error in context %r: %s" % (context_na...
[ "def", "validate", "(", "self", ")", ":", "for", "context_name", "in", "self", ".", "context_names", ":", "context", "=", "self", ".", "context", "(", "context_name", ")", "try", ":", "context", ".", "validate", "(", ")", "except", "ResolvedContextError", ...
Validate the suite.
[ "Validate", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L379-L387
246,437
nerdvegas/rez
src/rez/suite.py
Suite.save
def save(self, path, verbose=False): """Save the suite to disk. Args: path (str): Path to save the suite to. If a suite is already saved at `path`, then it will be overwritten. Otherwise, if `path` exists, an error is raised. """ path = os.pat...
python
def save(self, path, verbose=False): path = os.path.realpath(path) if os.path.exists(path): if self.load_path and self.load_path == path: if verbose: print "saving over previous suite..." for context_name in self.context_names: ...
[ "def", "save", "(", "self", ",", "path", ",", "verbose", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "realpath", "(", "path", ")", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "if", "self", ".", "load_path", "...
Save the suite to disk. Args: path (str): Path to save the suite to. If a suite is already saved at `path`, then it will be overwritten. Otherwise, if `path` exists, an error is raised.
[ "Save", "the", "suite", "to", "disk", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L415-L476
246,438
nerdvegas/rez
src/rez/suite.py
Suite.print_info
def print_info(self, buf=sys.stdout, verbose=False): """Prints a message summarising the contents of the suite.""" _pr = Printer(buf) if not self.contexts: _pr("Suite is empty.") return context_names = sorted(self.contexts.iterkeys()) _pr("Suite contains...
python
def print_info(self, buf=sys.stdout, verbose=False): _pr = Printer(buf) if not self.contexts: _pr("Suite is empty.") return context_names = sorted(self.contexts.iterkeys()) _pr("Suite contains %d contexts:" % len(context_names)) if not verbose: ...
[ "def", "print_info", "(", "self", ",", "buf", "=", "sys", ".", "stdout", ",", "verbose", "=", "False", ")", ":", "_pr", "=", "Printer", "(", "buf", ")", "if", "not", "self", ".", "contexts", ":", "_pr", "(", "\"Suite is empty.\"", ")", "return", "con...
Prints a message summarising the contents of the suite.
[ "Prints", "a", "message", "summarising", "the", "contents", "of", "the", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/suite.py#L525-L562
246,439
nerdvegas/rez
src/rez/build_system.py
get_valid_build_systems
def get_valid_build_systems(working_dir, package=None): """Returns the build system classes that could build the source in given dir. Args: working_dir (str): Dir containing the package definition and potentially build files. package (`Package`): Package to be built. This may or may...
python
def get_valid_build_systems(working_dir, package=None): from rez.plugin_managers import plugin_manager from rez.exceptions import PackageMetadataError try: package = package or get_developer_package(working_dir) except PackageMetadataError: # no package, or bad package pass ...
[ "def", "get_valid_build_systems", "(", "working_dir", ",", "package", "=", "None", ")", ":", "from", "rez", ".", "plugin_managers", "import", "plugin_manager", "from", "rez", ".", "exceptions", "import", "PackageMetadataError", "try", ":", "package", "=", "package...
Returns the build system classes that could build the source in given dir. Args: working_dir (str): Dir containing the package definition and potentially build files. package (`Package`): Package to be built. This may or may not be needed to determine the build system. For e...
[ "Returns", "the", "build", "system", "classes", "that", "could", "build", "the", "source", "in", "given", "dir", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L14-L62
246,440
nerdvegas/rez
src/rez/build_system.py
create_build_system
def create_build_system(working_dir, buildsys_type=None, package=None, opts=None, write_build_scripts=False, verbose=False, build_args=[], child_build_args=[]): """Return a new build system that can build the source in working_dir.""" from rez.plugin_managers impo...
python
def create_build_system(working_dir, buildsys_type=None, package=None, opts=None, write_build_scripts=False, verbose=False, build_args=[], child_build_args=[]): from rez.plugin_managers import plugin_manager # detect build system if necessary if not buildsys_...
[ "def", "create_build_system", "(", "working_dir", ",", "buildsys_type", "=", "None", ",", "package", "=", "None", ",", "opts", "=", "None", ",", "write_build_scripts", "=", "False", ",", "verbose", "=", "False", ",", "build_args", "=", "[", "]", ",", "chil...
Return a new build system that can build the source in working_dir.
[ "Return", "a", "new", "build", "system", "that", "can", "build", "the", "source", "in", "working_dir", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L65-L95
246,441
nerdvegas/rez
src/rez/build_system.py
BuildSystem.build
def build(self, context, variant, build_path, install_path, install=False, build_type=BuildType.local): """Implement this method to perform the actual build. Args: context: A ResolvedContext object that the build process must be executed within. var...
python
def build(self, context, variant, build_path, install_path, install=False, build_type=BuildType.local): raise NotImplementedError
[ "def", "build", "(", "self", ",", "context", ",", "variant", ",", "build_path", ",", "install_path", ",", "install", "=", "False", ",", "build_type", "=", "BuildType", ".", "local", ")", ":", "raise", "NotImplementedError" ]
Implement this method to perform the actual build. Args: context: A ResolvedContext object that the build process must be executed within. variant (`Variant`): The variant being built. build_path: Where to write temporary build files. May be relative ...
[ "Implement", "this", "method", "to", "perform", "the", "actual", "build", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L167-L195
246,442
nerdvegas/rez
src/rez/build_system.py
BuildSystem.get_standard_vars
def get_standard_vars(cls, context, variant, build_type, install, build_path, install_path=None): """Returns a standard set of environment variables that can be set for the build system to use """ from rez.config import config package = variant.parent ...
python
def get_standard_vars(cls, context, variant, build_type, install, build_path, install_path=None): from rez.config import config package = variant.parent variant_requires = map(str, variant.variant_requires) if variant.index is None: variant_subpath...
[ "def", "get_standard_vars", "(", "cls", ",", "context", ",", "variant", ",", "build_type", ",", "install", ",", "build_path", ",", "install_path", "=", "None", ")", ":", "from", "rez", ".", "config", "import", "config", "package", "=", "variant", ".", "par...
Returns a standard set of environment variables that can be set for the build system to use
[ "Returns", "a", "standard", "set", "of", "environment", "variables", "that", "can", "be", "set", "for", "the", "build", "system", "to", "use" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L198-L243
246,443
nerdvegas/rez
src/rez/build_system.py
BuildSystem.set_standard_vars
def set_standard_vars(cls, executor, context, variant, build_type, install, build_path, install_path=None): """Sets a standard set of environment variables for the build system to use """ vars = cls.get_standard_vars(context=context, ...
python
def set_standard_vars(cls, executor, context, variant, build_type, install, build_path, install_path=None): vars = cls.get_standard_vars(context=context, variant=variant, build_type=build_type, ...
[ "def", "set_standard_vars", "(", "cls", ",", "executor", ",", "context", ",", "variant", ",", "build_type", ",", "install", ",", "build_path", ",", "install_path", "=", "None", ")", ":", "vars", "=", "cls", ".", "get_standard_vars", "(", "context", "=", "c...
Sets a standard set of environment variables for the build system to use
[ "Sets", "a", "standard", "set", "of", "environment", "variables", "for", "the", "build", "system", "to", "use" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L246-L259
246,444
nerdvegas/rez
src/rez/pip.py
run_pip_command
def run_pip_command(command_args, pip_version=None, python_version=None): """Run a pip command. Args: command_args (list of str): Args to pip. Returns: `subprocess.Popen`: Pip process. """ pip_exe, context = find_pip(pip_version, python_version) command = [pip_exe] + list(comma...
python
def run_pip_command(command_args, pip_version=None, python_version=None): pip_exe, context = find_pip(pip_version, python_version) command = [pip_exe] + list(command_args) if context is None: return popen(command) else: return context.execute_shell(command=command, block=False)
[ "def", "run_pip_command", "(", "command_args", ",", "pip_version", "=", "None", ",", "python_version", "=", "None", ")", ":", "pip_exe", ",", "context", "=", "find_pip", "(", "pip_version", ",", "python_version", ")", "command", "=", "[", "pip_exe", "]", "+"...
Run a pip command. Args: command_args (list of str): Args to pip. Returns: `subprocess.Popen`: Pip process.
[ "Run", "a", "pip", "command", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/pip.py#L88-L103
246,445
nerdvegas/rez
src/rez/pip.py
find_pip
def find_pip(pip_version=None, python_version=None): """Find a pip exe using the given python version. Returns: 2-tuple: str: pip executable; `ResolvedContext`: Context containing pip, or None if we fell back to system pip. """ pip_exe = "pip" try: ...
python
def find_pip(pip_version=None, python_version=None): pip_exe = "pip" try: context = create_context(pip_version, python_version) except BuildError as e: # fall back on system pip. Not ideal but at least it's something from rez.backport.shutilwhich import which pip_exe = whic...
[ "def", "find_pip", "(", "pip_version", "=", "None", ",", "python_version", "=", "None", ")", ":", "pip_exe", "=", "\"pip\"", "try", ":", "context", "=", "create_context", "(", "pip_version", ",", "python_version", ")", "except", "BuildError", "as", "e", ":",...
Find a pip exe using the given python version. Returns: 2-tuple: str: pip executable; `ResolvedContext`: Context containing pip, or None if we fell back to system pip.
[ "Find", "a", "pip", "exe", "using", "the", "given", "python", "version", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/pip.py#L106-L133
246,446
nerdvegas/rez
src/rez/pip.py
create_context
def create_context(pip_version=None, python_version=None): """Create a context containing the specific pip and python. Args: pip_version (str or `Version`): Version of pip to use, or latest if None. python_version (str or `Version`): Python version to use, or latest if None. Re...
python
def create_context(pip_version=None, python_version=None): # determine pip pkg to use for install, and python variants to install on if pip_version: pip_req = "pip-%s" % str(pip_version) else: pip_req = "pip" if python_version: ver = Version(str(python_version)) major_mi...
[ "def", "create_context", "(", "pip_version", "=", "None", ",", "python_version", "=", "None", ")", ":", "# determine pip pkg to use for install, and python variants to install on", "if", "pip_version", ":", "pip_req", "=", "\"pip-%s\"", "%", "str", "(", "pip_version", "...
Create a context containing the specific pip and python. Args: pip_version (str or `Version`): Version of pip to use, or latest if None. python_version (str or `Version`): Python version to use, or latest if None. Returns: `ResolvedContext`: Context containing pip and pytho...
[ "Create", "a", "context", "containing", "the", "specific", "pip", "and", "python", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/pip.py#L136-L182
246,447
nerdvegas/rez
src/rez/utils/backcompat.py
convert_old_variant_handle
def convert_old_variant_handle(handle_dict): """Convert a variant handle from serialize_version < 4.0.""" old_variables = handle_dict.get("variables", {}) variables = dict(repository_type="filesystem") for old_key, key in variant_key_conversions.iteritems(): value = old_variables.get(old_key) ...
python
def convert_old_variant_handle(handle_dict): old_variables = handle_dict.get("variables", {}) variables = dict(repository_type="filesystem") for old_key, key in variant_key_conversions.iteritems(): value = old_variables.get(old_key) #if value is not None: variables[key] = value ...
[ "def", "convert_old_variant_handle", "(", "handle_dict", ")", ":", "old_variables", "=", "handle_dict", ".", "get", "(", "\"variables\"", ",", "{", "}", ")", "variables", "=", "dict", "(", "repository_type", "=", "\"filesystem\"", ")", "for", "old_key", ",", "...
Convert a variant handle from serialize_version < 4.0.
[ "Convert", "a", "variant", "handle", "from", "serialize_version", "<", "4", ".", "0", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/backcompat.py#L20-L37
246,448
nerdvegas/rez
src/rez/utils/py_dist.py
convert_requirement
def convert_requirement(req): """ Converts a pkg_resources.Requirement object into a list of Rez package request strings. """ pkg_name = convert_name(req.project_name) if not req.specs: return [pkg_name] req_strs = [] for spec in req.specs: op, ver = spec ver = c...
python
def convert_requirement(req): pkg_name = convert_name(req.project_name) if not req.specs: return [pkg_name] req_strs = [] for spec in req.specs: op, ver = spec ver = convert_version(ver) if op == "<": r = "%s-0+<%s" % (pkg_name, ver) req_strs.appe...
[ "def", "convert_requirement", "(", "req", ")", ":", "pkg_name", "=", "convert_name", "(", "req", ".", "project_name", ")", "if", "not", "req", ".", "specs", ":", "return", "[", "pkg_name", "]", "req_strs", "=", "[", "]", "for", "spec", "in", "req", "."...
Converts a pkg_resources.Requirement object into a list of Rez package request strings.
[ "Converts", "a", "pkg_resources", ".", "Requirement", "object", "into", "a", "list", "of", "Rez", "package", "request", "strings", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/py_dist.py#L42-L80
246,449
nerdvegas/rez
src/rez/utils/py_dist.py
get_dist_dependencies
def get_dist_dependencies(name, recurse=True): """ Get the dependencies of the given, already installed distribution. @param recurse If True, recursively find all dependencies. @returns A set of package names. @note The first entry in the list is always the top-level package itself. """ dist...
python
def get_dist_dependencies(name, recurse=True): dist = pkg_resources.get_distribution(name) pkg_name = convert_name(dist.project_name) reqs = set() working = set([dist]) depth = 0 while working: deps = set() for distname in working: dist = pkg_resources.get_distribut...
[ "def", "get_dist_dependencies", "(", "name", ",", "recurse", "=", "True", ")", ":", "dist", "=", "pkg_resources", ".", "get_distribution", "(", "name", ")", "pkg_name", "=", "convert_name", "(", "dist", ".", "project_name", ")", "reqs", "=", "set", "(", ")...
Get the dependencies of the given, already installed distribution. @param recurse If True, recursively find all dependencies. @returns A set of package names. @note The first entry in the list is always the top-level package itself.
[ "Get", "the", "dependencies", "of", "the", "given", "already", "installed", "distribution", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/py_dist.py#L83-L114
246,450
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.add_graph
def add_graph(self, other): """ Add other graph to this graph. @attention: Attributes and labels are not preserved. @type other: graph @param other: Graph """ self.add_nodes( n for n in other.nodes() if not n in self.nodes() ) f...
python
def add_graph(self, other): self.add_nodes( n for n in other.nodes() if not n in self.nodes() ) for each_node in other.nodes(): for each_edge in other.neighbors(each_node): if (not self.has_edge((each_node, each_edge))): self.add_edge((each_node, ...
[ "def", "add_graph", "(", "self", ",", "other", ")", ":", "self", ".", "add_nodes", "(", "n", "for", "n", "in", "other", ".", "nodes", "(", ")", "if", "not", "n", "in", "self", ".", "nodes", "(", ")", ")", "for", "each_node", "in", "other", ".", ...
Add other graph to this graph. @attention: Attributes and labels are not preserved. @type other: graph @param other: Graph
[ "Add", "other", "graph", "to", "this", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L107-L121
246,451
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.add_spanning_tree
def add_spanning_tree(self, st): """ Add a spanning tree to the graph. @type st: dictionary @param st: Spanning tree. """ self.add_nodes(list(st.keys())) for each in st: if (st[each] is not None): self.add_edge((st[each], each...
python
def add_spanning_tree(self, st): self.add_nodes(list(st.keys())) for each in st: if (st[each] is not None): self.add_edge((st[each], each))
[ "def", "add_spanning_tree", "(", "self", ",", "st", ")", ":", "self", ".", "add_nodes", "(", "list", "(", "st", ".", "keys", "(", ")", ")", ")", "for", "each", "in", "st", ":", "if", "(", "st", "[", "each", "]", "is", "not", "None", ")", ":", ...
Add a spanning tree to the graph. @type st: dictionary @param st: Spanning tree.
[ "Add", "a", "spanning", "tree", "to", "the", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L124-L134
246,452
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.complete
def complete(self): """ Make the graph a complete graph. @attention: This will modify the current graph. """ for each in self.nodes(): for other in self.nodes(): if (each != other and not self.has_edge((each, other))): self...
python
def complete(self): for each in self.nodes(): for other in self.nodes(): if (each != other and not self.has_edge((each, other))): self.add_edge((each, other))
[ "def", "complete", "(", "self", ")", ":", "for", "each", "in", "self", ".", "nodes", "(", ")", ":", "for", "other", "in", "self", ".", "nodes", "(", ")", ":", "if", "(", "each", "!=", "other", "and", "not", "self", ".", "has_edge", "(", "(", "e...
Make the graph a complete graph. @attention: This will modify the current graph.
[ "Make", "the", "graph", "a", "complete", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L137-L146
246,453
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.inverse
def inverse(self): """ Return the inverse of the graph. @rtype: graph @return: Complement graph for the graph. """ inv = self.__class__() inv.add_nodes(self.nodes()) inv.complete() for each in self.edges(): if (inv.has_edge(ea...
python
def inverse(self): inv = self.__class__() inv.add_nodes(self.nodes()) inv.complete() for each in self.edges(): if (inv.has_edge(each)): inv.del_edge(each) return inv
[ "def", "inverse", "(", "self", ")", ":", "inv", "=", "self", ".", "__class__", "(", ")", "inv", ".", "add_nodes", "(", "self", ".", "nodes", "(", ")", ")", "inv", ".", "complete", "(", ")", "for", "each", "in", "self", ".", "edges", "(", ")", "...
Return the inverse of the graph. @rtype: graph @return: Complement graph for the graph.
[ "Return", "the", "inverse", "of", "the", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L149-L162
246,454
nerdvegas/rez
src/rez/vendor/pygraph/mixins/common.py
common.reverse
def reverse(self): """ Generate the reverse of a directed graph, returns an identical graph if not directed. Attributes & weights are preserved. @rtype: digraph @return: The directed graph that should be reversed. """ assert self.DIRECTED, "Undirected gra...
python
def reverse(self): assert self.DIRECTED, "Undirected graph types such as %s cannot be reversed" % self.__class__.__name__ N = self.__class__() #- Add the nodes N.add_nodes( n for n in self.nodes() ) #- Add the reversed edges for (u, v) in self.edges(): ...
[ "def", "reverse", "(", "self", ")", ":", "assert", "self", ".", "DIRECTED", ",", "\"Undirected graph types such as %s cannot be reversed\"", "%", "self", ".", "__class__", ".", "__name__", "N", "=", "self", ".", "__class__", "(", ")", "#- Add the nodes", "N", "....
Generate the reverse of a directed graph, returns an identical graph if not directed. Attributes & weights are preserved. @rtype: digraph @return: The directed graph that should be reversed.
[ "Generate", "the", "reverse", "of", "a", "directed", "graph", "returns", "an", "identical", "graph", "if", "not", "directed", ".", "Attributes", "&", "weights", "are", "preserved", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/mixins/common.py#L164-L185
246,455
nerdvegas/rez
src/rez/resolved_context.py
get_lock_request
def get_lock_request(name, version, patch_lock, weak=True): """Given a package and patch lock, return the equivalent request. For example, for object 'foo-1.2.1' and lock type 'lock_3', the equivalent request is '~foo-1.2'. This restricts updates to foo to patch-or-lower version changes only. For ...
python
def get_lock_request(name, version, patch_lock, weak=True): ch = '~' if weak else '' if patch_lock == PatchLock.lock: s = "%s%s==%s" % (ch, name, str(version)) return PackageRequest(s) elif (patch_lock == PatchLock.no_lock) or (not version): return None version_ = version.trim(pa...
[ "def", "get_lock_request", "(", "name", ",", "version", ",", "patch_lock", ",", "weak", "=", "True", ")", ":", "ch", "=", "'~'", "if", "weak", "else", "''", "if", "patch_lock", "==", "PatchLock", ".", "lock", ":", "s", "=", "\"%s%s==%s\"", "%", "(", ...
Given a package and patch lock, return the equivalent request. For example, for object 'foo-1.2.1' and lock type 'lock_3', the equivalent request is '~foo-1.2'. This restricts updates to foo to patch-or-lower version changes only. For objects not versioned down to a given lock level, the closest possi...
[ "Given", "a", "package", "and", "patch", "lock", "return", "the", "equivalent", "request", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L76-L102
246,456
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.requested_packages
def requested_packages(self, include_implicit=False): """Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects. """ if include_implicit...
python
def requested_packages(self, include_implicit=False): if include_implicit: return self._package_requests + self.implicit_packages else: return self._package_requests
[ "def", "requested_packages", "(", "self", ",", "include_implicit", "=", "False", ")", ":", "if", "include_implicit", ":", "return", "self", ".", "_package_requests", "+", "self", ".", "implicit_packages", "else", ":", "return", "self", ".", "_package_requests" ]
Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects.
[ "Get", "packages", "in", "the", "request", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L322-L335
246,457
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_resolved_package
def get_resolved_package(self, name): """Returns a `Variant` object or None if the package is not in the resolve. """ pkgs = [x for x in self._resolved_packages if x.name == name] return pkgs[0] if pkgs else None
python
def get_resolved_package(self, name): pkgs = [x for x in self._resolved_packages if x.name == name] return pkgs[0] if pkgs else None
[ "def", "get_resolved_package", "(", "self", ",", "name", ")", ":", "pkgs", "=", "[", "x", "for", "x", "in", "self", ".", "_resolved_packages", "if", "x", ".", "name", "==", "name", "]", "return", "pkgs", "[", "0", "]", "if", "pkgs", "else", "None" ]
Returns a `Variant` object or None if the package is not in the resolve.
[ "Returns", "a", "Variant", "object", "or", "None", "if", "the", "package", "is", "not", "in", "the", "resolve", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L384-L389
246,458
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_patched_request
def get_patched_request(self, package_requests=None, package_subtractions=None, strict=False, rank=0): """Get a 'patched' request. A patched request is a copy of this context's request, but with some changes applied. This can then be used to create a new, 'patched' ...
python
def get_patched_request(self, package_requests=None, package_subtractions=None, strict=False, rank=0): # assemble source request if strict: request = [] for variant in self.resolved_packages: req = PackageRequest(variant.qualified_packa...
[ "def", "get_patched_request", "(", "self", ",", "package_requests", "=", "None", ",", "package_subtractions", "=", "None", ",", "strict", "=", "False", ",", "rank", "=", "0", ")", ":", "# assemble source request", "if", "strict", ":", "request", "=", "[", "]...
Get a 'patched' request. A patched request is a copy of this context's request, but with some changes applied. This can then be used to create a new, 'patched' context. New package requests override original requests based on the type - normal, conflict or weak. So 'foo-2' over...
[ "Get", "a", "patched", "request", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L397-L495
246,459
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.write_to_buffer
def write_to_buffer(self, buf): """Save the context to a buffer.""" doc = self.to_dict() if config.rxt_as_yaml: content = dump_yaml(doc) else: content = json.dumps(doc, indent=4, separators=(",", ": ")) buf.write(content)
python
def write_to_buffer(self, buf): doc = self.to_dict() if config.rxt_as_yaml: content = dump_yaml(doc) else: content = json.dumps(doc, indent=4, separators=(",", ": ")) buf.write(content)
[ "def", "write_to_buffer", "(", "self", ",", "buf", ")", ":", "doc", "=", "self", ".", "to_dict", "(", ")", "if", "config", ".", "rxt_as_yaml", ":", "content", "=", "dump_yaml", "(", "doc", ")", "else", ":", "content", "=", "json", ".", "dumps", "(", ...
Save the context to a buffer.
[ "Save", "the", "context", "to", "a", "buffer", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L533-L542
246,460
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_current
def get_current(cls): """Get the context for the current env, if there is one. Returns: `ResolvedContext`: Current context, or None if not in a resolved env. """ filepath = os.getenv("REZ_RXT_FILE") if not filepath or not os.path.exists(filepath): return ...
python
def get_current(cls): filepath = os.getenv("REZ_RXT_FILE") if not filepath or not os.path.exists(filepath): return None return cls.load(filepath)
[ "def", "get_current", "(", "cls", ")", ":", "filepath", "=", "os", ".", "getenv", "(", "\"REZ_RXT_FILE\"", ")", "if", "not", "filepath", "or", "not", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "return", "None", "return", "cls", ".", ...
Get the context for the current env, if there is one. Returns: `ResolvedContext`: Current context, or None if not in a resolved env.
[ "Get", "the", "context", "for", "the", "current", "env", "if", "there", "is", "one", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L545-L555
246,461
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.load
def load(cls, path): """Load a resolved context from file.""" with open(path) as f: context = cls.read_from_buffer(f, path) context.set_load_path(path) return context
python
def load(cls, path): with open(path) as f: context = cls.read_from_buffer(f, path) context.set_load_path(path) return context
[ "def", "load", "(", "cls", ",", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "context", "=", "cls", ".", "read_from_buffer", "(", "f", ",", "path", ")", "context", ".", "set_load_path", "(", "path", ")", "return", "context" ]
Load a resolved context from file.
[ "Load", "a", "resolved", "context", "from", "file", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L558-L563
246,462
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.read_from_buffer
def read_from_buffer(cls, buf, identifier_str=None): """Load the context from a buffer.""" try: return cls._read_from_buffer(buf, identifier_str) except Exception as e: cls._load_error(e, identifier_str)
python
def read_from_buffer(cls, buf, identifier_str=None): try: return cls._read_from_buffer(buf, identifier_str) except Exception as e: cls._load_error(e, identifier_str)
[ "def", "read_from_buffer", "(", "cls", ",", "buf", ",", "identifier_str", "=", "None", ")", ":", "try", ":", "return", "cls", ".", "_read_from_buffer", "(", "buf", ",", "identifier_str", ")", "except", "Exception", "as", "e", ":", "cls", ".", "_load_error"...
Load the context from a buffer.
[ "Load", "the", "context", "from", "a", "buffer", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L566-L571
246,463
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_resolve_diff
def get_resolve_diff(self, other): """Get the difference between the resolve in this context and another. The difference is described from the point of view of the current context - a newer package means that the package in `other` is newer than the package in `self`. Diffs can...
python
def get_resolve_diff(self, other): if self.package_paths != other.package_paths: from difflib import ndiff diff = ndiff(self.package_paths, other.package_paths) raise ResolvedContextError("Cannot diff resolves, package search " "paths di...
[ "def", "get_resolve_diff", "(", "self", ",", "other", ")", ":", "if", "self", ".", "package_paths", "!=", "other", ".", "package_paths", ":", "from", "difflib", "import", "ndiff", "diff", "=", "ndiff", "(", "self", ".", "package_paths", ",", "other", ".", ...
Get the difference between the resolve in this context and another. The difference is described from the point of view of the current context - a newer package means that the package in `other` is newer than the package in `self`. Diffs can only be compared if their package search path...
[ "Get", "the", "difference", "between", "the", "resolve", "in", "this", "context", "and", "another", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L573-L657
246,464
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.print_resolve_diff
def print_resolve_diff(self, other, heading=None): """Print the difference between the resolve of two contexts. Args: other (`ResolvedContext`): Context to compare to. heading: One of: - None: Do not display a heading; - True: Display the filename...
python
def print_resolve_diff(self, other, heading=None): d = self.get_resolve_diff(other) if not d: return rows = [] if heading is True and self.load_path and other.load_path: a = os.path.basename(self.load_path) b = os.path.basename(other.load_path) ...
[ "def", "print_resolve_diff", "(", "self", ",", "other", ",", "heading", "=", "None", ")", ":", "d", "=", "self", ".", "get_resolve_diff", "(", "other", ")", "if", "not", "d", ":", "return", "rows", "=", "[", "]", "if", "heading", "is", "True", "and",...
Print the difference between the resolve of two contexts. Args: other (`ResolvedContext`): Context to compare to. heading: One of: - None: Do not display a heading; - True: Display the filename of each context as a heading, if both conte...
[ "Print", "the", "difference", "between", "the", "resolve", "of", "two", "contexts", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L809-L865
246,465
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_dependency_graph
def get_dependency_graph(self): """Generate the dependency graph. The dependency graph is a simpler subset of the resolve graph. It contains package name nodes connected directly to their dependencies. Weak references and conflict requests are not included in the graph. The depe...
python
def get_dependency_graph(self): from rez.vendor.pygraph.classes.digraph import digraph nodes = {} edges = set() for variant in self._resolved_packages: nodes[variant.name] = variant.qualified_package_name for request in variant.get_requires(): if ...
[ "def", "get_dependency_graph", "(", "self", ")", ":", "from", "rez", ".", "vendor", ".", "pygraph", ".", "classes", ".", "digraph", "import", "digraph", "nodes", "=", "{", "}", "edges", "=", "set", "(", ")", "for", "variant", "in", "self", ".", "_resol...
Generate the dependency graph. The dependency graph is a simpler subset of the resolve graph. It contains package name nodes connected directly to their dependencies. Weak references and conflict requests are not included in the graph. The dependency graph does not show conflicts. ...
[ "Generate", "the", "dependency", "graph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L878-L910
246,466
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.validate
def validate(self): """Validate the context.""" try: for pkg in self.resolved_packages: pkg.validate_data() except RezError as e: raise ResolvedContextError("%s: %s" % (e.__class__.__name__, str(e)))
python
def validate(self): try: for pkg in self.resolved_packages: pkg.validate_data() except RezError as e: raise ResolvedContextError("%s: %s" % (e.__class__.__name__, str(e)))
[ "def", "validate", "(", "self", ")", ":", "try", ":", "for", "pkg", "in", "self", ".", "resolved_packages", ":", "pkg", ".", "validate_data", "(", ")", "except", "RezError", "as", "e", ":", "raise", "ResolvedContextError", "(", "\"%s: %s\"", "%", "(", "e...
Validate the context.
[ "Validate", "the", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L913-L919
246,467
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_environ
def get_environ(self, parent_environ=None): """Get the environ dict resulting from interpreting this context. @param parent_environ Environment to interpret the context within, defaults to os.environ if None. @returns The environment dict generated by this context, when ...
python
def get_environ(self, parent_environ=None): interp = Python(target_environ={}, passive=True) executor = self._create_executor(interp, parent_environ) self._execute(executor) return executor.get_output()
[ "def", "get_environ", "(", "self", ",", "parent_environ", "=", "None", ")", ":", "interp", "=", "Python", "(", "target_environ", "=", "{", "}", ",", "passive", "=", "True", ")", "executor", "=", "self", ".", "_create_executor", "(", "interp", ",", "paren...
Get the environ dict resulting from interpreting this context. @param parent_environ Environment to interpret the context within, defaults to os.environ if None. @returns The environment dict generated by this context, when interpreted in a python rex interpreter.
[ "Get", "the", "environ", "dict", "resulting", "from", "interpreting", "this", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L922-L933
246,468
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_key
def get_key(self, key, request_only=False): """Get a data key value for each resolved package. Args: key (str): String key of property, eg 'tools'. request_only (bool): If True, only return the key from resolved packages that were also present in the request. ...
python
def get_key(self, key, request_only=False): values = {} requested_names = [x.name for x in self._package_requests if not x.conflict] for pkg in self.resolved_packages: if (not request_only) or (pkg.name in requested_names): value = getattr(...
[ "def", "get_key", "(", "self", ",", "key", ",", "request_only", "=", "False", ")", ":", "values", "=", "{", "}", "requested_names", "=", "[", "x", ".", "name", "for", "x", "in", "self", ".", "_package_requests", "if", "not", "x", ".", "conflict", "]"...
Get a data key value for each resolved package. Args: key (str): String key of property, eg 'tools'. request_only (bool): If True, only return the key from resolved packages that were also present in the request. Returns: Dict of {pkg-name: (variant,...
[ "Get", "a", "data", "key", "value", "for", "each", "resolved", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L936-L957
246,469
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_conflicting_tools
def get_conflicting_tools(self, request_only=False): """Returns tools of the same name provided by more than one package. Args: request_only: If True, only return the key from resolved packages that were also present in the request. Returns: Dict of {too...
python
def get_conflicting_tools(self, request_only=False): from collections import defaultdict tool_sets = defaultdict(set) tools_dict = self.get_tools(request_only=request_only) for variant, tools in tools_dict.itervalues(): for tool in tools: tool_sets[tool].add(...
[ "def", "get_conflicting_tools", "(", "self", ",", "request_only", "=", "False", ")", ":", "from", "collections", "import", "defaultdict", "tool_sets", "=", "defaultdict", "(", "set", ")", "tools_dict", "=", "self", ".", "get_tools", "(", "request_only", "=", "...
Returns tools of the same name provided by more than one package. Args: request_only: If True, only return the key from resolved packages that were also present in the request. Returns: Dict of {tool-name: set([Variant])}.
[ "Returns", "tools", "of", "the", "same", "name", "provided", "by", "more", "than", "one", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L994-L1013
246,470
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_shell_code
def get_shell_code(self, shell=None, parent_environ=None, style=OutputStyle.file): """Get the shell code resulting from intepreting this context. Args: shell (str): Shell type, for eg 'bash'. If None, the current shell type is used. parent_environ (dict): Environ...
python
def get_shell_code(self, shell=None, parent_environ=None, style=OutputStyle.file): executor = self._create_executor(interpreter=create_shell(shell), parent_environ=parent_environ) if self.load_path and os.path.isfile(self.load_path): executor.env.REZ...
[ "def", "get_shell_code", "(", "self", ",", "shell", "=", "None", ",", "parent_environ", "=", "None", ",", "style", "=", "OutputStyle", ".", "file", ")", ":", "executor", "=", "self", ".", "_create_executor", "(", "interpreter", "=", "create_shell", "(", "s...
Get the shell code resulting from intepreting this context. Args: shell (str): Shell type, for eg 'bash'. If None, the current shell type is used. parent_environ (dict): Environment to interpret the context within, defaults to os.environ if None. ...
[ "Get", "the", "shell", "code", "resulting", "from", "intepreting", "this", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1016-L1033
246,471
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.get_actions
def get_actions(self, parent_environ=None): """Get the list of rex.Action objects resulting from interpreting this context. This is provided mainly for testing purposes. Args: parent_environ Environment to interpret the context within, defaults to os.environ if None....
python
def get_actions(self, parent_environ=None): interp = Python(target_environ={}, passive=True) executor = self._create_executor(interp, parent_environ) self._execute(executor) return executor.actions
[ "def", "get_actions", "(", "self", ",", "parent_environ", "=", "None", ")", ":", "interp", "=", "Python", "(", "target_environ", "=", "{", "}", ",", "passive", "=", "True", ")", "executor", "=", "self", ".", "_create_executor", "(", "interp", ",", "paren...
Get the list of rex.Action objects resulting from interpreting this context. This is provided mainly for testing purposes. Args: parent_environ Environment to interpret the context within, defaults to os.environ if None. Returns: A list of rex.Action sub...
[ "Get", "the", "list", "of", "rex", ".", "Action", "objects", "resulting", "from", "interpreting", "this", "context", ".", "This", "is", "provided", "mainly", "for", "testing", "purposes", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1036-L1050
246,472
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.apply
def apply(self, parent_environ=None): """Apply the context to the current python session. Note that this updates os.environ and possibly sys.path, if `parent_environ` is not provided. Args: parent_environ: Environment to interpret the context within, default...
python
def apply(self, parent_environ=None): interpreter = Python(target_environ=os.environ) executor = self._create_executor(interpreter, parent_environ) self._execute(executor) interpreter.apply_environ()
[ "def", "apply", "(", "self", ",", "parent_environ", "=", "None", ")", ":", "interpreter", "=", "Python", "(", "target_environ", "=", "os", ".", "environ", ")", "executor", "=", "self", ".", "_create_executor", "(", "interpreter", ",", "parent_environ", ")", ...
Apply the context to the current python session. Note that this updates os.environ and possibly sys.path, if `parent_environ` is not provided. Args: parent_environ: Environment to interpret the context within, defaults to os.environ if None.
[ "Apply", "the", "context", "to", "the", "current", "python", "session", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1053-L1066
246,473
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.which
def which(self, cmd, parent_environ=None, fallback=False): """Find a program in the resolved environment. Args: cmd: String name of the program to find. parent_environ: Environment to interpret the context within, defaults to os.environ if None. fallb...
python
def which(self, cmd, parent_environ=None, fallback=False): env = self.get_environ(parent_environ=parent_environ) path = which(cmd, env=env) if fallback and path is None: path = which(cmd) return path
[ "def", "which", "(", "self", ",", "cmd", ",", "parent_environ", "=", "None", ",", "fallback", "=", "False", ")", ":", "env", "=", "self", ".", "get_environ", "(", "parent_environ", "=", "parent_environ", ")", "path", "=", "which", "(", "cmd", ",", "env...
Find a program in the resolved environment. Args: cmd: String name of the program to find. parent_environ: Environment to interpret the context within, defaults to os.environ if None. fallback: If True, and the program is not found in the context, ...
[ "Find", "a", "program", "in", "the", "resolved", "environment", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1069-L1086
246,474
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.execute_command
def execute_command(self, args, parent_environ=None, **subprocess_kwargs): """Run a command within a resolved context. This applies the context to a python environ dict, then runs a subprocess in that namespace. This is not a fully configured subshell - shell-specific commands such as a...
python
def execute_command(self, args, parent_environ=None, **subprocess_kwargs): if parent_environ in (None, os.environ): target_environ = {} else: target_environ = parent_environ.copy() interpreter = Python(target_environ=target_environ) executor = self._create_execu...
[ "def", "execute_command", "(", "self", ",", "args", ",", "parent_environ", "=", "None", ",", "*", "*", "subprocess_kwargs", ")", ":", "if", "parent_environ", "in", "(", "None", ",", "os", ".", "environ", ")", ":", "target_environ", "=", "{", "}", "else",...
Run a command within a resolved context. This applies the context to a python environ dict, then runs a subprocess in that namespace. This is not a fully configured subshell - shell-specific commands such as aliases will not be applied. To execute a command within a subshell instead, us...
[ "Run", "a", "command", "within", "a", "resolved", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1089-L1123
246,475
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.execute_rex_code
def execute_rex_code(self, code, filename=None, shell=None, parent_environ=None, **Popen_args): """Run some rex code in the context. Note: This is just a convenience form of `execute_shell`. Args: code (str): Rex code to execute. fil...
python
def execute_rex_code(self, code, filename=None, shell=None, parent_environ=None, **Popen_args): def _actions_callback(executor): executor.execute_code(code, filename=filename) return self.execute_shell(shell=shell, parent_environ=pa...
[ "def", "execute_rex_code", "(", "self", ",", "code", ",", "filename", "=", "None", ",", "shell", "=", "None", ",", "parent_environ", "=", "None", ",", "*", "*", "Popen_args", ")", ":", "def", "_actions_callback", "(", "executor", ")", ":", "executor", "....
Run some rex code in the context. Note: This is just a convenience form of `execute_shell`. Args: code (str): Rex code to execute. filename (str): Filename to report if there are syntax errors. shell: Shell type, for eg 'bash'. If None, the current shell...
[ "Run", "some", "rex", "code", "in", "the", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1126-L1153
246,476
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.execute_shell
def execute_shell(self, shell=None, parent_environ=None, rcfile=None, norc=False, stdin=False, command=None, quiet=False, block=None, actions_callback=None, post_actions_callback=None, context_filepath=None, start_new_session=False, detached=False, ...
python
def execute_shell(self, shell=None, parent_environ=None, rcfile=None, norc=False, stdin=False, command=None, quiet=False, block=None, actions_callback=None, post_actions_callback=None, context_filepath=None, start_new_session=False, detached=False, ...
[ "def", "execute_shell", "(", "self", ",", "shell", "=", "None", ",", "parent_environ", "=", "None", ",", "rcfile", "=", "None", ",", "norc", "=", "False", ",", "stdin", "=", "False", ",", "command", "=", "None", ",", "quiet", "=", "False", ",", "bloc...
Spawn a possibly-interactive shell. Args: shell: Shell type, for eg 'bash'. If None, the current shell type is used. parent_environ: Environment to run the shell process in, if None then the current environment is used. rcfile: Specify a file ...
[ "Spawn", "a", "possibly", "-", "interactive", "shell", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1156-L1272
246,477
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.to_dict
def to_dict(self, fields=None): """Convert context to dict containing only builtin types. Args: fields (list of str): If present, only write these fields into the dict. This can be used to avoid constructing expensive fields (such as 'graph') for some cases. ...
python
def to_dict(self, fields=None): data = {} def _add(field): return (fields is None or field in fields) if _add("resolved_packages"): resolved_packages = [] for pkg in (self._resolved_packages or []): resolved_packages.append(pkg.handle.to_dict...
[ "def", "to_dict", "(", "self", ",", "fields", "=", "None", ")", ":", "data", "=", "{", "}", "def", "_add", "(", "field", ")", ":", "return", "(", "fields", "is", "None", "or", "field", "in", "fields", ")", "if", "_add", "(", "\"resolved_packages\"", ...
Convert context to dict containing only builtin types. Args: fields (list of str): If present, only write these fields into the dict. This can be used to avoid constructing expensive fields (such as 'graph') for some cases. Returns: dict: Dictifi...
[ "Convert", "context", "to", "dict", "containing", "only", "builtin", "types", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L1274-L1355
246,478
nerdvegas/rez
src/rez/utils/system.py
add_sys_paths
def add_sys_paths(paths): """Add to sys.path, and revert on scope exit. """ original_syspath = sys.path[:] sys.path.extend(paths) try: yield finally: sys.path = original_syspath
python
def add_sys_paths(paths): original_syspath = sys.path[:] sys.path.extend(paths) try: yield finally: sys.path = original_syspath
[ "def", "add_sys_paths", "(", "paths", ")", ":", "original_syspath", "=", "sys", ".", "path", "[", ":", "]", "sys", ".", "path", ".", "extend", "(", "paths", ")", "try", ":", "yield", "finally", ":", "sys", ".", "path", "=", "original_syspath" ]
Add to sys.path, and revert on scope exit.
[ "Add", "to", "sys", ".", "path", "and", "revert", "on", "scope", "exit", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/system.py#L7-L16
246,479
nerdvegas/rez
src/rez/utils/system.py
popen
def popen(args, **kwargs): """Wrapper for `subprocess.Popen`. Avoids python bug described here: https://bugs.python.org/issue3905. This can arise when apps (maya) install a non-standard stdin handler. In newer version of maya and katana, the sys.stdin object can also become replaced by an object w...
python
def popen(args, **kwargs): if "stdin" not in kwargs: try: file_no = sys.stdin.fileno() except AttributeError: file_no = sys.__stdin__.fileno() if file_no not in (0, 1, 2): kwargs["stdin"] = subprocess.PIPE return subprocess.Popen(args, **kwargs)
[ "def", "popen", "(", "args", ",", "*", "*", "kwargs", ")", ":", "if", "\"stdin\"", "not", "in", "kwargs", ":", "try", ":", "file_no", "=", "sys", ".", "stdin", ".", "fileno", "(", ")", "except", "AttributeError", ":", "file_no", "=", "sys", ".", "_...
Wrapper for `subprocess.Popen`. Avoids python bug described here: https://bugs.python.org/issue3905. This can arise when apps (maya) install a non-standard stdin handler. In newer version of maya and katana, the sys.stdin object can also become replaced by an object with no 'fileno' attribute, this is...
[ "Wrapper", "for", "subprocess", ".", "Popen", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/system.py#L19-L38
246,480
nerdvegas/rez
src/rezplugins/release_vcs/git.py
GitReleaseVCS.get_relative_to_remote
def get_relative_to_remote(self): """Return the number of commits we are relative to the remote. Negative is behind, positive in front, zero means we are matched to remote. """ s = self.git("status", "--short", "-b")[0] r = re.compile("\[([^\]]+)\]") toks = r.findall(s) ...
python
def get_relative_to_remote(self): s = self.git("status", "--short", "-b")[0] r = re.compile("\[([^\]]+)\]") toks = r.findall(s) if toks: try: s2 = toks[-1] adj, n = s2.split() assert(adj in ("ahead", "behind")) n...
[ "def", "get_relative_to_remote", "(", "self", ")", ":", "s", "=", "self", ".", "git", "(", "\"status\"", ",", "\"--short\"", ",", "\"-b\"", ")", "[", "0", "]", "r", "=", "re", ".", "compile", "(", "\"\\[([^\\]]+)\\]\"", ")", "toks", "=", "r", ".", "f...
Return the number of commits we are relative to the remote. Negative is behind, positive in front, zero means we are matched to remote.
[ "Return", "the", "number", "of", "commits", "we", "are", "relative", "to", "the", "remote", ".", "Negative", "is", "behind", "positive", "in", "front", "zero", "means", "we", "are", "matched", "to", "remote", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezplugins/release_vcs/git.py#L47-L66
246,481
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.links
def links(self, obj): """ Return all nodes connected by the given hyperedge or all hyperedges connected to the given hypernode. @type obj: hyperedge @param obj: Object identifier. @rtype: list @return: List of node objects linked to the given h...
python
def links(self, obj): if obj in self.edge_links: return self.edge_links[obj] else: return self.node_links[obj]
[ "def", "links", "(", "self", ",", "obj", ")", ":", "if", "obj", "in", "self", ".", "edge_links", ":", "return", "self", ".", "edge_links", "[", "obj", "]", "else", ":", "return", "self", ".", "node_links", "[", "obj", "]" ]
Return all nodes connected by the given hyperedge or all hyperedges connected to the given hypernode. @type obj: hyperedge @param obj: Object identifier. @rtype: list @return: List of node objects linked to the given hyperedge.
[ "Return", "all", "nodes", "connected", "by", "the", "given", "hyperedge", "or", "all", "hyperedges", "connected", "to", "the", "given", "hypernode", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L122-L136
246,482
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.neighbors
def neighbors(self, obj): """ Return all neighbors adjacent to the given node. @type obj: node @param obj: Object identifier. @rtype: list @return: List of all node objects adjacent to the given node. """ neighbors = set([]) ...
python
def neighbors(self, obj): neighbors = set([]) for e in self.node_links[obj]: neighbors.update(set(self.edge_links[e])) return list(neighbors - set([obj]))
[ "def", "neighbors", "(", "self", ",", "obj", ")", ":", "neighbors", "=", "set", "(", "[", "]", ")", "for", "e", "in", "self", ".", "node_links", "[", "obj", "]", ":", "neighbors", ".", "update", "(", "set", "(", "self", ".", "edge_links", "[", "e...
Return all neighbors adjacent to the given node. @type obj: node @param obj: Object identifier. @rtype: list @return: List of all node objects adjacent to the given node.
[ "Return", "all", "neighbors", "adjacent", "to", "the", "given", "node", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L139-L154
246,483
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.del_node
def del_node(self, node): """ Delete a given node from the hypergraph. @type node: node @param node: Node identifier. """ if self.has_node(node): for e in self.node_links[node]: self.edge_links[e].remove(node) self.node_l...
python
def del_node(self, node): if self.has_node(node): for e in self.node_links[node]: self.edge_links[e].remove(node) self.node_links.pop(node) self.graph.del_node((node,'n'))
[ "def", "del_node", "(", "self", ",", "node", ")", ":", "if", "self", ".", "has_node", "(", "node", ")", ":", "for", "e", "in", "self", ".", "node_links", "[", "node", "]", ":", "self", ".", "edge_links", "[", "e", "]", ".", "remove", "(", "node",...
Delete a given node from the hypergraph. @type node: node @param node: Node identifier.
[ "Delete", "a", "given", "node", "from", "the", "hypergraph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L188-L200
246,484
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.add_hyperedge
def add_hyperedge(self, hyperedge): """ Add given hyperedge to the hypergraph. @attention: While hyperedge-nodes can be of any type, it's strongly recommended to use only numbers and single-line strings as node identifiers if you intend to use write(). @type hyperedge:...
python
def add_hyperedge(self, hyperedge): if (not hyperedge in self.edge_links): self.edge_links[hyperedge] = [] self.graph.add_node((hyperedge,'h'))
[ "def", "add_hyperedge", "(", "self", ",", "hyperedge", ")", ":", "if", "(", "not", "hyperedge", "in", "self", ".", "edge_links", ")", ":", "self", ".", "edge_links", "[", "hyperedge", "]", "=", "[", "]", "self", ".", "graph", ".", "add_node", "(", "(...
Add given hyperedge to the hypergraph. @attention: While hyperedge-nodes can be of any type, it's strongly recommended to use only numbers and single-line strings as node identifiers if you intend to use write(). @type hyperedge: hyperedge @param hyperedge: Hyperedge identifie...
[ "Add", "given", "hyperedge", "to", "the", "hypergraph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L216-L228
246,485
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.del_hyperedge
def del_hyperedge(self, hyperedge): """ Delete the given hyperedge. @type hyperedge: hyperedge @param hyperedge: Hyperedge identifier. """ if (hyperedge in self.hyperedges()): for n in self.edge_links[hyperedge]: self.node_links[n].re...
python
def del_hyperedge(self, hyperedge): if (hyperedge in self.hyperedges()): for n in self.edge_links[hyperedge]: self.node_links[n].remove(hyperedge) del(self.edge_links[hyperedge]) self.del_edge_labeling(hyperedge) self.graph.del_node((hyperedge,'h'...
[ "def", "del_hyperedge", "(", "self", ",", "hyperedge", ")", ":", "if", "(", "hyperedge", "in", "self", ".", "hyperedges", "(", ")", ")", ":", "for", "n", "in", "self", ".", "edge_links", "[", "hyperedge", "]", ":", "self", ".", "node_links", "[", "n"...
Delete the given hyperedge. @type hyperedge: hyperedge @param hyperedge: Hyperedge identifier.
[ "Delete", "the", "given", "hyperedge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L268-L281
246,486
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.link
def link(self, node, hyperedge): """ Link given node and hyperedge. @type node: node @param node: Node. @type hyperedge: node @param hyperedge: Hyperedge. """ if (hyperedge not in self.node_links[node]): self.edge_links[hyperedge].append(no...
python
def link(self, node, hyperedge): if (hyperedge not in self.node_links[node]): self.edge_links[hyperedge].append(node) self.node_links[node].append(hyperedge) self.graph.add_edge(((node,'n'), (hyperedge,'h'))) else: raise AdditionError("Link (%s, %s) alread...
[ "def", "link", "(", "self", ",", "node", ",", "hyperedge", ")", ":", "if", "(", "hyperedge", "not", "in", "self", ".", "node_links", "[", "node", "]", ")", ":", "self", ".", "edge_links", "[", "hyperedge", "]", ".", "append", "(", "node", ")", "sel...
Link given node and hyperedge. @type node: node @param node: Node. @type hyperedge: node @param hyperedge: Hyperedge.
[ "Link", "given", "node", "and", "hyperedge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L284-L299
246,487
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.unlink
def unlink(self, node, hyperedge): """ Unlink given node and hyperedge. @type node: node @param node: Node. @type hyperedge: hyperedge @param hyperedge: Hyperedge. """ self.node_links[node].remove(hyperedge) self.edge_links[hyperedge].remove(no...
python
def unlink(self, node, hyperedge): self.node_links[node].remove(hyperedge) self.edge_links[hyperedge].remove(node) self.graph.del_edge(((node,'n'), (hyperedge,'h')))
[ "def", "unlink", "(", "self", ",", "node", ",", "hyperedge", ")", ":", "self", ".", "node_links", "[", "node", "]", ".", "remove", "(", "hyperedge", ")", "self", ".", "edge_links", "[", "hyperedge", "]", ".", "remove", "(", "node", ")", "self", ".", ...
Unlink given node and hyperedge. @type node: node @param node: Node. @type hyperedge: hyperedge @param hyperedge: Hyperedge.
[ "Unlink", "given", "node", "and", "hyperedge", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L302-L314
246,488
nerdvegas/rez
src/rez/vendor/pygraph/classes/hypergraph.py
hypergraph.rank
def rank(self): """ Return the rank of the given hypergraph. @rtype: int @return: Rank of graph. """ max_rank = 0 for each in self.hyperedges(): if len(self.edge_links[each]) > max_rank: max_rank = len(self.edge_links...
python
def rank(self): max_rank = 0 for each in self.hyperedges(): if len(self.edge_links[each]) > max_rank: max_rank = len(self.edge_links[each]) return max_rank
[ "def", "rank", "(", "self", ")", ":", "max_rank", "=", "0", "for", "each", "in", "self", ".", "hyperedges", "(", ")", ":", "if", "len", "(", "self", ".", "edge_links", "[", "each", "]", ")", ">", "max_rank", ":", "max_rank", "=", "len", "(", "sel...
Return the rank of the given hypergraph. @rtype: int @return: Rank of graph.
[ "Return", "the", "rank", "of", "the", "given", "hypergraph", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/hypergraph.py#L317-L330
246,489
nerdvegas/rez
src/rez/utils/base26.py
get_next_base26
def get_next_base26(prev=None): """Increment letter-based IDs. Generates IDs like ['a', 'b', ..., 'z', 'aa', ab', ..., 'az', 'ba', ...] Returns: str: Next base-26 ID. """ if not prev: return 'a' r = re.compile("^[a-z]*$") if not r.match(prev): raise ValueError("Inv...
python
def get_next_base26(prev=None): if not prev: return 'a' r = re.compile("^[a-z]*$") if not r.match(prev): raise ValueError("Invalid base26") if not prev.endswith('z'): return prev[:-1] + chr(ord(prev[-1]) + 1) return get_next_base26(prev[:-1]) + 'a'
[ "def", "get_next_base26", "(", "prev", "=", "None", ")", ":", "if", "not", "prev", ":", "return", "'a'", "r", "=", "re", ".", "compile", "(", "\"^[a-z]*$\"", ")", "if", "not", "r", ".", "match", "(", "prev", ")", ":", "raise", "ValueError", "(", "\...
Increment letter-based IDs. Generates IDs like ['a', 'b', ..., 'z', 'aa', ab', ..., 'az', 'ba', ...] Returns: str: Next base-26 ID.
[ "Increment", "letter", "-", "based", "IDs", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/base26.py#L9-L27
246,490
nerdvegas/rez
src/rez/utils/base26.py
create_unique_base26_symlink
def create_unique_base26_symlink(path, source): """Create a base-26 symlink in `path` pointing to `source`. If such a symlink already exists, it is returned. Note that there is a small chance that this function may create a new symlink when there is already one pointed at `source`. Assumes `path` ...
python
def create_unique_base26_symlink(path, source): retries = 0 while True: # if a link already exists that points at `source`, return it name = find_matching_symlink(path, source) if name: return os.path.join(path, name) # get highest current symlink in path na...
[ "def", "create_unique_base26_symlink", "(", "path", ",", "source", ")", ":", "retries", "=", "0", "while", "True", ":", "# if a link already exists that points at `source`, return it", "name", "=", "find_matching_symlink", "(", "path", ",", "source", ")", "if", "name"...
Create a base-26 symlink in `path` pointing to `source`. If such a symlink already exists, it is returned. Note that there is a small chance that this function may create a new symlink when there is already one pointed at `source`. Assumes `path` only contains base26 symlinks. Returns: st...
[ "Create", "a", "base", "-", "26", "symlink", "in", "path", "pointing", "to", "source", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/base26.py#L30-L79
246,491
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
find_wheels
def find_wheels(projects, search_dirs): """Find wheels from which we can import PROJECTS. Scan through SEARCH_DIRS for a wheel for each PROJECT in turn. Return a list of the first wheel found for each PROJECT """ wheels = [] # Look through SEARCH_DIRS for the first suitable wheel. Don't bothe...
python
def find_wheels(projects, search_dirs): wheels = [] # Look through SEARCH_DIRS for the first suitable wheel. Don't bother # about version checking here, as this is simply to get something we can # then use to install the correct version. for project in projects: for dirname in search_dirs: ...
[ "def", "find_wheels", "(", "projects", ",", "search_dirs", ")", ":", "wheels", "=", "[", "]", "# Look through SEARCH_DIRS for the first suitable wheel. Don't bother", "# about version checking here, as this is simply to get something we can", "# then use to install the correct version.",...
Find wheels from which we can import PROJECTS. Scan through SEARCH_DIRS for a wheel for each PROJECT in turn. Return a list of the first wheel found for each PROJECT
[ "Find", "wheels", "from", "which", "we", "can", "import", "PROJECTS", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L913-L937
246,492
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
relative_script
def relative_script(lines): "Return a script that'll work in a relocatable environment." activate = "import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); exec(compile(open(activate_this).read(), activate_this, 'exec'), dict(__file__=activate_this)); del os, act...
python
def relative_script(lines): "Return a script that'll work in a relocatable environment." activate = "import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); exec(compile(open(activate_this).read(), activate_this, 'exec'), dict(__file__=activate_this)); del os, act...
[ "def", "relative_script", "(", "lines", ")", ":", "activate", "=", "\"import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); exec(compile(open(activate_this).read(), activate_this, 'exec'), dict(__file__=activate_this)); del os, activate_this\"", "#...
Return a script that'll work in a relocatable environment.
[ "Return", "a", "script", "that", "ll", "work", "in", "a", "relocatable", "environment", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L1670-L1683
246,493
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
fixup_pth_and_egg_link
def fixup_pth_and_egg_link(home_dir, sys_path=None): """Makes .pth and .egg-link files use relative paths""" home_dir = os.path.normcase(os.path.abspath(home_dir)) if sys_path is None: sys_path = sys.path for path in sys_path: if not path: path = '.' if not os.path.is...
python
def fixup_pth_and_egg_link(home_dir, sys_path=None): home_dir = os.path.normcase(os.path.abspath(home_dir)) if sys_path is None: sys_path = sys.path for path in sys_path: if not path: path = '.' if not os.path.isdir(path): continue path = os.path.normc...
[ "def", "fixup_pth_and_egg_link", "(", "home_dir", ",", "sys_path", "=", "None", ")", ":", "home_dir", "=", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "abspath", "(", "home_dir", ")", ")", "if", "sys_path", "is", "None", ":", "sys_...
Makes .pth and .egg-link files use relative paths
[ "Makes", ".", "pth", "and", ".", "egg", "-", "link", "files", "use", "relative", "paths" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L1685-L1710
246,494
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
make_relative_path
def make_relative_path(source, dest, dest_is_directory=True): """ Make a filename relative, where the filename is dest, and it is being referred to from the filename source. >>> make_relative_path('/usr/share/something/a-file.pth', ... '/usr/share/another-place/src/Direct...
python
def make_relative_path(source, dest, dest_is_directory=True): source = os.path.dirname(source) if not dest_is_directory: dest_filename = os.path.basename(dest) dest = os.path.dirname(dest) dest = os.path.normpath(os.path.abspath(dest)) source = os.path.normpath(os.path.abspath(source)) ...
[ "def", "make_relative_path", "(", "source", ",", "dest", ",", "dest_is_directory", "=", "True", ")", ":", "source", "=", "os", ".", "path", ".", "dirname", "(", "source", ")", "if", "not", "dest_is_directory", ":", "dest_filename", "=", "os", ".", "path", ...
Make a filename relative, where the filename is dest, and it is being referred to from the filename source. >>> make_relative_path('/usr/share/something/a-file.pth', ... '/usr/share/another-place/src/Directory') '../another-place/src/Directory' >>> make_relative_p...
[ "Make", "a", "filename", "relative", "where", "the", "filename", "is", "dest", "and", "it", "is", "being", "referred", "to", "from", "the", "filename", "source", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L1749-L1780
246,495
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
create_bootstrap_script
def create_bootstrap_script(extra_text, python_version=''): """ Creates a bootstrap script, which is like this script but with extend_parser, adjust_options, and after_install hooks. This returns a string that (written to disk of course) can be used as a bootstrap script with your own customization...
python
def create_bootstrap_script(extra_text, python_version=''): filename = __file__ if filename.endswith('.pyc'): filename = filename[:-1] f = codecs.open(filename, 'r', encoding='utf-8') content = f.read() f.close() py_exe = 'python%s' % python_version content = (('#!/usr/bin/env %s\n' ...
[ "def", "create_bootstrap_script", "(", "extra_text", ",", "python_version", "=", "''", ")", ":", "filename", "=", "__file__", "if", "filename", ".", "endswith", "(", "'.pyc'", ")", ":", "filename", "=", "filename", "[", ":", "-", "1", "]", "f", "=", "cod...
Creates a bootstrap script, which is like this script but with extend_parser, adjust_options, and after_install hooks. This returns a string that (written to disk of course) can be used as a bootstrap script with your own customizations. The script will be the standard virtualenv.py script, with your ...
[ "Creates", "a", "bootstrap", "script", "which", "is", "like", "this", "script", "but", "with", "extend_parser", "adjust_options", "and", "after_install", "hooks", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L1787-L1837
246,496
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
read_data
def read_data(file, endian, num=1): """ Read a given number of 32-bits unsigned integers from the given file with the given endianness. """ res = struct.unpack(endian + 'L' * num, file.read(num * 4)) if len(res) == 1: return res[0] return res
python
def read_data(file, endian, num=1): res = struct.unpack(endian + 'L' * num, file.read(num * 4)) if len(res) == 1: return res[0] return res
[ "def", "read_data", "(", "file", ",", "endian", ",", "num", "=", "1", ")", ":", "res", "=", "struct", ".", "unpack", "(", "endian", "+", "'L'", "*", "num", ",", "file", ".", "read", "(", "num", "*", "4", ")", ")", "if", "len", "(", "res", ")"...
Read a given number of 32-bits unsigned integers from the given file with the given endianness.
[ "Read", "a", "given", "number", "of", "32", "-", "bits", "unsigned", "integers", "from", "the", "given", "file", "with", "the", "given", "endianness", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L2269-L2277
246,497
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
Logger._stdout_level
def _stdout_level(self): """Returns the level that stdout runs at""" for level, consumer in self.consumers: if consumer is sys.stdout: return level return self.FATAL
python
def _stdout_level(self): for level, consumer in self.consumers: if consumer is sys.stdout: return level return self.FATAL
[ "def", "_stdout_level", "(", "self", ")", ":", "for", "level", ",", "consumer", "in", "self", ".", "consumers", ":", "if", "consumer", "is", "sys", ".", "stdout", ":", "return", "level", "return", "self", ".", "FATAL" ]
Returns the level that stdout runs at
[ "Returns", "the", "level", "that", "stdout", "runs", "at" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L396-L401
246,498
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
ConfigOptionParser.get_config_section
def get_config_section(self, name): """ Get a section of a configuration """ if self.config.has_section(name): return self.config.items(name) return []
python
def get_config_section(self, name): if self.config.has_section(name): return self.config.items(name) return []
[ "def", "get_config_section", "(", "self", ",", "name", ")", ":", "if", "self", ".", "config", ".", "has_section", "(", "name", ")", ":", "return", "self", ".", "config", ".", "items", "(", "name", ")", "return", "[", "]" ]
Get a section of a configuration
[ "Get", "a", "section", "of", "a", "configuration" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L610-L616
246,499
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
ConfigOptionParser.get_environ_vars
def get_environ_vars(self, prefix='VIRTUALENV_'): """ Returns a generator with all environmental vars with prefix VIRTUALENV """ for key, val in os.environ.items(): if key.startswith(prefix): yield (key.replace(prefix, '').lower(), val)
python
def get_environ_vars(self, prefix='VIRTUALENV_'): for key, val in os.environ.items(): if key.startswith(prefix): yield (key.replace(prefix, '').lower(), val)
[ "def", "get_environ_vars", "(", "self", ",", "prefix", "=", "'VIRTUALENV_'", ")", ":", "for", "key", ",", "val", "in", "os", ".", "environ", ".", "items", "(", ")", ":", "if", "key", ".", "startswith", "(", "prefix", ")", ":", "yield", "(", "key", ...
Returns a generator with all environmental vars with prefix VIRTUALENV
[ "Returns", "a", "generator", "with", "all", "environmental", "vars", "with", "prefix", "VIRTUALENV" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L618-L624