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 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
232,400 | nerdvegas/rez | src/rezgui/util.py | create_pane | def create_pane(widgets, horizontal, parent_widget=None, compact=False,
compact_spacing=2):
"""Create a widget containing an aligned set of widgets.
Args:
widgets (list of `QWidget`).
horizontal (bool).
align (str): One of:
- 'left', 'right' (horizontal);
... | python | def create_pane(widgets, horizontal, parent_widget=None, compact=False,
compact_spacing=2):
"""Create a widget containing an aligned set of widgets.
Args:
widgets (list of `QWidget`).
horizontal (bool).
align (str): One of:
- 'left', 'right' (horizontal);
... | [
"def",
"create_pane",
"(",
"widgets",
",",
"horizontal",
",",
"parent_widget",
"=",
"None",
",",
"compact",
"=",
"False",
",",
"compact_spacing",
"=",
"2",
")",
":",
"pane",
"=",
"parent_widget",
"or",
"QtGui",
".",
"QWidget",
"(",
")",
"type_",
"=",
"Qt... | Create a widget containing an aligned set of widgets.
Args:
widgets (list of `QWidget`).
horizontal (bool).
align (str): One of:
- 'left', 'right' (horizontal);
- 'top', 'bottom' (vertical)
parent_widget (`QWidget`): Owner widget, QWidget is created if this
... | [
"Create",
"a",
"widget",
"containing",
"an",
"aligned",
"set",
"of",
"widgets",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L7-L44 |
232,401 | nerdvegas/rez | src/rezgui/util.py | get_icon | def get_icon(name, as_qicon=False):
"""Returns a `QPixmap` containing the given image, or a QIcon if `as_qicon`
is True"""
filename = name + ".png"
icon = icons.get(filename)
if not icon:
path = os.path.dirname(__file__)
path = os.path.join(path, "icons")
filepath = os.path.j... | python | def get_icon(name, as_qicon=False):
"""Returns a `QPixmap` containing the given image, or a QIcon if `as_qicon`
is True"""
filename = name + ".png"
icon = icons.get(filename)
if not icon:
path = os.path.dirname(__file__)
path = os.path.join(path, "icons")
filepath = os.path.j... | [
"def",
"get_icon",
"(",
"name",
",",
"as_qicon",
"=",
"False",
")",
":",
"filename",
"=",
"name",
"+",
"\".png\"",
"icon",
"=",
"icons",
".",
"get",
"(",
"filename",
")",
"if",
"not",
"icon",
":",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"("... | Returns a `QPixmap` containing the given image, or a QIcon if `as_qicon`
is True | [
"Returns",
"a",
"QPixmap",
"containing",
"the",
"given",
"image",
"or",
"a",
"QIcon",
"if",
"as_qicon",
"is",
"True"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L50-L65 |
232,402 | nerdvegas/rez | src/rezgui/util.py | interp_color | def interp_color(a, b, f):
"""Interpolate between two colors.
Returns:
`QColor` object.
"""
a_ = (a.redF(), a.greenF(), a.blueF())
b_ = (b.redF(), b.greenF(), b.blueF())
a_ = [x * (1 - f) for x in a_]
b_ = [x * f for x in b_]
c = [x + y for x, y in zip(a_, b_)]
return QtGui.... | python | def interp_color(a, b, f):
"""Interpolate between two colors.
Returns:
`QColor` object.
"""
a_ = (a.redF(), a.greenF(), a.blueF())
b_ = (b.redF(), b.greenF(), b.blueF())
a_ = [x * (1 - f) for x in a_]
b_ = [x * f for x in b_]
c = [x + y for x, y in zip(a_, b_)]
return QtGui.... | [
"def",
"interp_color",
"(",
"a",
",",
"b",
",",
"f",
")",
":",
"a_",
"=",
"(",
"a",
".",
"redF",
"(",
")",
",",
"a",
".",
"greenF",
"(",
")",
",",
"a",
".",
"blueF",
"(",
")",
")",
"b_",
"=",
"(",
"b",
".",
"redF",
"(",
")",
",",
"b",
... | Interpolate between two colors.
Returns:
`QColor` object. | [
"Interpolate",
"between",
"two",
"colors",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L105-L116 |
232,403 | nerdvegas/rez | src/rezgui/util.py | create_toolbutton | def create_toolbutton(entries, parent=None):
"""Create a toolbutton.
Args:
entries: List of (label, slot) tuples.
Returns:
`QtGui.QToolBar`.
"""
btn = QtGui.QToolButton(parent)
menu = QtGui.QMenu()
actions = []
for label, slot in entries:
action = add_menu_acti... | python | def create_toolbutton(entries, parent=None):
"""Create a toolbutton.
Args:
entries: List of (label, slot) tuples.
Returns:
`QtGui.QToolBar`.
"""
btn = QtGui.QToolButton(parent)
menu = QtGui.QMenu()
actions = []
for label, slot in entries:
action = add_menu_acti... | [
"def",
"create_toolbutton",
"(",
"entries",
",",
"parent",
"=",
"None",
")",
":",
"btn",
"=",
"QtGui",
".",
"QToolButton",
"(",
"parent",
")",
"menu",
"=",
"QtGui",
".",
"QMenu",
"(",
")",
"actions",
"=",
"[",
"]",
"for",
"label",
",",
"slot",
"in",
... | Create a toolbutton.
Args:
entries: List of (label, slot) tuples.
Returns:
`QtGui.QToolBar`. | [
"Create",
"a",
"toolbutton",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L119-L139 |
232,404 | nerdvegas/rez | src/build_utils/distlib/locators.py | SimpleScrapingLocator.get_page | def get_page(self, url):
"""
Get the HTML for an URL, possibly from an in-memory cache.
XXX TODO Note: this cache is never actually cleared. It's assumed that
the data won't get stale over the lifetime of a locator instance (not
necessarily true for the default_locator).
... | python | def get_page(self, url):
"""
Get the HTML for an URL, possibly from an in-memory cache.
XXX TODO Note: this cache is never actually cleared. It's assumed that
the data won't get stale over the lifetime of a locator instance (not
necessarily true for the default_locator).
... | [
"def",
"get_page",
"(",
"self",
",",
"url",
")",
":",
"# http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api",
"scheme",
",",
"netloc",
",",
"path",
",",
"_",
",",
"_",
",",
"_",
"=",
"urlparse",
"(",
"url",
")",
"if",
"scheme",
"==",
"'file'... | Get the HTML for an URL, possibly from an in-memory cache.
XXX TODO Note: this cache is never actually cleared. It's assumed that
the data won't get stale over the lifetime of a locator instance (not
necessarily true for the default_locator). | [
"Get",
"the",
"HTML",
"for",
"an",
"URL",
"possibly",
"from",
"an",
"in",
"-",
"memory",
"cache",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/distlib/locators.py#L673-L730 |
232,405 | nerdvegas/rez | src/rez/package_search.py | get_reverse_dependency_tree | def get_reverse_dependency_tree(package_name, depth=None, paths=None,
build_requires=False,
private_build_requires=False):
"""Find packages that depend on the given package.
This is a reverse dependency lookup. A tree is constructed, showing what
... | python | def get_reverse_dependency_tree(package_name, depth=None, paths=None,
build_requires=False,
private_build_requires=False):
"""Find packages that depend on the given package.
This is a reverse dependency lookup. A tree is constructed, showing what
... | [
"def",
"get_reverse_dependency_tree",
"(",
"package_name",
",",
"depth",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"build_requires",
"=",
"False",
",",
"private_build_requires",
"=",
"False",
")",
":",
"pkgs_list",
"=",
"[",
"[",
"package_name",
"]",
"]",
... | Find packages that depend on the given package.
This is a reverse dependency lookup. A tree is constructed, showing what
packages depend on the given package, with an optional depth limit. A
resolve does not occur. Only the latest version of each package is used,
and requirements from all variants of t... | [
"Find",
"packages",
"that",
"depend",
"on",
"the",
"given",
"package",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L25-L121 |
232,406 | nerdvegas/rez | src/rez/package_search.py | get_plugins | def get_plugins(package_name, paths=None):
"""Find packages that are plugins of the given package.
Args:
package_name (str): Name of the package.
paths (list of str): Paths to search for packages, defaults to
`config.packages_path`.
Returns:
list of str: The packages th... | python | def get_plugins(package_name, paths=None):
"""Find packages that are plugins of the given package.
Args:
package_name (str): Name of the package.
paths (list of str): Paths to search for packages, defaults to
`config.packages_path`.
Returns:
list of str: The packages th... | [
"def",
"get_plugins",
"(",
"package_name",
",",
"paths",
"=",
"None",
")",
":",
"pkg",
"=",
"get_latest_package",
"(",
"package_name",
",",
"paths",
"=",
"paths",
",",
"error",
"=",
"True",
")",
"if",
"not",
"pkg",
".",
"has_plugins",
":",
"return",
"[",... | Find packages that are plugins of the given package.
Args:
package_name (str): Name of the package.
paths (list of str): Paths to search for packages, defaults to
`config.packages_path`.
Returns:
list of str: The packages that are plugins of the given package. | [
"Find",
"packages",
"that",
"are",
"plugins",
"of",
"the",
"given",
"package",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L124-L157 |
232,407 | nerdvegas/rez | src/rez/package_search.py | ResourceSearcher.search | def search(self, resources_request=None):
"""Search for resources.
Args:
resources_request (str): Resource to search, glob-style patterns
are supported. If None, returns all matching resource types.
Returns:
2-tuple:
- str: resource type (fam... | python | def search(self, resources_request=None):
"""Search for resources.
Args:
resources_request (str): Resource to search, glob-style patterns
are supported. If None, returns all matching resource types.
Returns:
2-tuple:
- str: resource type (fam... | [
"def",
"search",
"(",
"self",
",",
"resources_request",
"=",
"None",
")",
":",
"# Find matching package families",
"name_pattern",
",",
"version_range",
"=",
"self",
".",
"_parse_request",
"(",
"resources_request",
")",
"family_names",
"=",
"set",
"(",
"x",
".",
... | Search for resources.
Args:
resources_request (str): Resource to search, glob-style patterns
are supported. If None, returns all matching resource types.
Returns:
2-tuple:
- str: resource type (family, package, variant);
- List of `Resour... | [
"Search",
"for",
"resources",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L210-L305 |
232,408 | nerdvegas/rez | src/rez/package_search.py | ResourceSearchResultFormatter.print_search_results | def print_search_results(self, search_results, buf=sys.stdout):
"""Print formatted search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
"""
formatted_lines = self.format_search_results(search_results)
pr = Printer(buf)
for... | python | def print_search_results(self, search_results, buf=sys.stdout):
"""Print formatted search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
"""
formatted_lines = self.format_search_results(search_results)
pr = Printer(buf)
for... | [
"def",
"print_search_results",
"(",
"self",
",",
"search_results",
",",
"buf",
"=",
"sys",
".",
"stdout",
")",
":",
"formatted_lines",
"=",
"self",
".",
"format_search_results",
"(",
"search_results",
")",
"pr",
"=",
"Printer",
"(",
"buf",
")",
"for",
"txt",... | Print formatted search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format. | [
"Print",
"formatted",
"search",
"results",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L347-L357 |
232,409 | nerdvegas/rez | src/rez/package_search.py | ResourceSearchResultFormatter.format_search_results | def format_search_results(self, search_results):
"""Format search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
Returns:
List of 2-tuple: Text and color to print in.
"""
formatted_lines = []
for search_result ... | python | def format_search_results(self, search_results):
"""Format search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
Returns:
List of 2-tuple: Text and color to print in.
"""
formatted_lines = []
for search_result ... | [
"def",
"format_search_results",
"(",
"self",
",",
"search_results",
")",
":",
"formatted_lines",
"=",
"[",
"]",
"for",
"search_result",
"in",
"search_results",
":",
"lines",
"=",
"self",
".",
"_format_search_result",
"(",
"search_result",
")",
"formatted_lines",
"... | Format search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
Returns:
List of 2-tuple: Text and color to print in. | [
"Format",
"search",
"results",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L359-L374 |
232,410 | nerdvegas/rez | src/rez/vendor/pygraph/readwrite/dot.py | read | def read(string):
"""
Read a graph from a string in Dot language and return it. Nodes and edges specified in the
input will be added to the current graph.
@type string: string
@param string: Input string in Dot format specifying a graph.
@rtype: graph
@return: Graph
"""
... | python | def read(string):
"""
Read a graph from a string in Dot language and return it. Nodes and edges specified in the
input will be added to the current graph.
@type string: string
@param string: Input string in Dot format specifying a graph.
@rtype: graph
@return: Graph
"""
... | [
"def",
"read",
"(",
"string",
")",
":",
"dotG",
"=",
"pydot",
".",
"graph_from_dot_data",
"(",
"string",
")",
"if",
"(",
"dotG",
".",
"get_type",
"(",
")",
"==",
"\"graph\"",
")",
":",
"G",
"=",
"graph",
"(",
")",
"elif",
"(",
"dotG",
".",
"get_typ... | Read a graph from a string in Dot language and return it. Nodes and edges specified in the
input will be added to the current graph.
@type string: string
@param string: Input string in Dot format specifying a graph.
@rtype: graph
@return: Graph | [
"Read",
"a",
"graph",
"from",
"a",
"string",
"in",
"Dot",
"language",
"and",
"return",
"it",
".",
"Nodes",
"and",
"edges",
"specified",
"in",
"the",
"input",
"will",
"be",
"added",
"to",
"the",
"current",
"graph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/readwrite/dot.py#L47-L104 |
232,411 | nerdvegas/rez | src/rez/vendor/pygraph/readwrite/dot.py | read_hypergraph | def read_hypergraph(string):
"""
Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
added to the current hypergraph.
@type string: string
@param string: Input string in dot format specifying a graph.
@rtype: hypergraph
@return: Hypergrap... | python | def read_hypergraph(string):
"""
Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
added to the current hypergraph.
@type string: string
@param string: Input string in dot format specifying a graph.
@rtype: hypergraph
@return: Hypergrap... | [
"def",
"read_hypergraph",
"(",
"string",
")",
":",
"hgr",
"=",
"hypergraph",
"(",
")",
"dotG",
"=",
"pydot",
".",
"graph_from_dot_data",
"(",
"string",
")",
"# Read the hypernode nodes...",
"# Note 1: We need to assume that all of the nodes are listed since we need to know if... | Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
added to the current hypergraph.
@type string: string
@param string: Input string in dot format specifying a graph.
@rtype: hypergraph
@return: Hypergraph | [
"Read",
"a",
"hypergraph",
"from",
"a",
"string",
"in",
"dot",
"format",
".",
"Nodes",
"and",
"edges",
"specified",
"in",
"the",
"input",
"will",
"be",
"added",
"to",
"the",
"current",
"hypergraph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/readwrite/dot.py#L179-L213 |
232,412 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | graph_from_dot_file | def graph_from_dot_file(path):
"""Load graph as defined by a DOT file.
The file is assumed to be in DOT format. It will
be loaded, parsed and a Dot class will be returned,
representing the graph.
"""
fd = file(path, 'rb')
data = fd.read()
fd.close()
return graph_from_... | python | def graph_from_dot_file(path):
"""Load graph as defined by a DOT file.
The file is assumed to be in DOT format. It will
be loaded, parsed and a Dot class will be returned,
representing the graph.
"""
fd = file(path, 'rb')
data = fd.read()
fd.close()
return graph_from_... | [
"def",
"graph_from_dot_file",
"(",
"path",
")",
":",
"fd",
"=",
"file",
"(",
"path",
",",
"'rb'",
")",
"data",
"=",
"fd",
".",
"read",
"(",
")",
"fd",
".",
"close",
"(",
")",
"return",
"graph_from_dot_data",
"(",
"data",
")"
] | Load graph as defined by a DOT file.
The file is assumed to be in DOT format. It will
be loaded, parsed and a Dot class will be returned,
representing the graph. | [
"Load",
"graph",
"as",
"defined",
"by",
"a",
"DOT",
"file",
".",
"The",
"file",
"is",
"assumed",
"to",
"be",
"in",
"DOT",
"format",
".",
"It",
"will",
"be",
"loaded",
"parsed",
"and",
"a",
"Dot",
"class",
"will",
"be",
"returned",
"representing",
"the"... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L220-L232 |
232,413 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | __find_executables | def __find_executables(path):
"""Used by find_graphviz
path - single directory as a string
If any of the executables are found, it will return a dictionary
containing the program names as keys and their paths as values.
Otherwise returns None
"""
success = False
progs... | python | def __find_executables(path):
"""Used by find_graphviz
path - single directory as a string
If any of the executables are found, it will return a dictionary
containing the program names as keys and their paths as values.
Otherwise returns None
"""
success = False
progs... | [
"def",
"__find_executables",
"(",
"path",
")",
":",
"success",
"=",
"False",
"progs",
"=",
"{",
"'dot'",
":",
"''",
",",
"'twopi'",
":",
"''",
",",
"'neato'",
":",
"''",
",",
"'circo'",
":",
"''",
",",
"'fdp'",
":",
"''",
",",
"'sfdp'",
":",
"''",
... | Used by find_graphviz
path - single directory as a string
If any of the executables are found, it will return a dictionary
containing the program names as keys and their paths as values.
Otherwise returns None | [
"Used",
"by",
"find_graphviz",
"path",
"-",
"single",
"directory",
"as",
"a",
"string",
"If",
"any",
"of",
"the",
"executables",
"are",
"found",
"it",
"will",
"return",
"a",
"dictionary",
"containing",
"the",
"program",
"names",
"as",
"keys",
"and",
"their",... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L347-L398 |
232,414 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Edge.to_string | def to_string(self):
"""Returns a string representation of the edge in dot language.
"""
src = self.parse_node_ref( self.get_source() )
dst = self.parse_node_ref( self.get_destination() )
if isinstance(src, frozendict):
edge = [ Subgraph(obj_dict=src).to_str... | python | def to_string(self):
"""Returns a string representation of the edge in dot language.
"""
src = self.parse_node_ref( self.get_source() )
dst = self.parse_node_ref( self.get_destination() )
if isinstance(src, frozendict):
edge = [ Subgraph(obj_dict=src).to_str... | [
"def",
"to_string",
"(",
"self",
")",
":",
"src",
"=",
"self",
".",
"parse_node_ref",
"(",
"self",
".",
"get_source",
"(",
")",
")",
"dst",
"=",
"self",
".",
"parse_node_ref",
"(",
"self",
".",
"get_destination",
"(",
")",
")",
"if",
"isinstance",
"(",... | Returns a string representation of the edge in dot language. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"edge",
"in",
"dot",
"language",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L974-L1019 |
232,415 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.get_node | def get_node(self, name):
"""Retrieve a node from the graph.
Given a node's name the corresponding Node
instance will be returned.
If one or more nodes exist with that name a list of
Node instances is returned.
An empty list is returned otherwise.
... | python | def get_node(self, name):
"""Retrieve a node from the graph.
Given a node's name the corresponding Node
instance will be returned.
If one or more nodes exist with that name a list of
Node instances is returned.
An empty list is returned otherwise.
... | [
"def",
"get_node",
"(",
"self",
",",
"name",
")",
":",
"match",
"=",
"list",
"(",
")",
"if",
"self",
".",
"obj_dict",
"[",
"'nodes'",
"]",
".",
"has_key",
"(",
"name",
")",
":",
"match",
".",
"extend",
"(",
"[",
"Node",
"(",
"obj_dict",
"=",
"obj... | Retrieve a node from the graph.
Given a node's name the corresponding Node
instance will be returned.
If one or more nodes exist with that name a list of
Node instances is returned.
An empty list is returned otherwise. | [
"Retrieve",
"a",
"node",
"from",
"the",
"graph",
".",
"Given",
"a",
"node",
"s",
"name",
"the",
"corresponding",
"Node",
"instance",
"will",
"be",
"returned",
".",
"If",
"one",
"or",
"more",
"nodes",
"exist",
"with",
"that",
"name",
"a",
"list",
"of",
... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1323-L1340 |
232,416 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.add_edge | def add_edge(self, graph_edge):
"""Adds an edge object to the graph.
It takes a edge object as its only argument and returns
None.
"""
if not isinstance(graph_edge, Edge):
raise TypeError('add_edge() received a non edge class object: ' + str(graph_edge))
... | python | def add_edge(self, graph_edge):
"""Adds an edge object to the graph.
It takes a edge object as its only argument and returns
None.
"""
if not isinstance(graph_edge, Edge):
raise TypeError('add_edge() received a non edge class object: ' + str(graph_edge))
... | [
"def",
"add_edge",
"(",
"self",
",",
"graph_edge",
")",
":",
"if",
"not",
"isinstance",
"(",
"graph_edge",
",",
"Edge",
")",
":",
"raise",
"TypeError",
"(",
"'add_edge() received a non edge class object: '",
"+",
"str",
"(",
"graph_edge",
")",
")",
"edge_points"... | Adds an edge object to the graph.
It takes a edge object as its only argument and returns
None. | [
"Adds",
"an",
"edge",
"object",
"to",
"the",
"graph",
".",
"It",
"takes",
"a",
"edge",
"object",
"as",
"its",
"only",
"argument",
"and",
"returns",
"None",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1365-L1389 |
232,417 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.add_subgraph | def add_subgraph(self, sgraph):
"""Adds an subgraph object to the graph.
It takes a subgraph object as its only argument and returns
None.
"""
if not isinstance(sgraph, Subgraph) and not isinstance(sgraph, Cluster):
raise TypeError('add_subgraph() received a... | python | def add_subgraph(self, sgraph):
"""Adds an subgraph object to the graph.
It takes a subgraph object as its only argument and returns
None.
"""
if not isinstance(sgraph, Subgraph) and not isinstance(sgraph, Cluster):
raise TypeError('add_subgraph() received a... | [
"def",
"add_subgraph",
"(",
"self",
",",
"sgraph",
")",
":",
"if",
"not",
"isinstance",
"(",
"sgraph",
",",
"Subgraph",
")",
"and",
"not",
"isinstance",
"(",
"sgraph",
",",
"Cluster",
")",
":",
"raise",
"TypeError",
"(",
"'add_subgraph() received a non subgrap... | Adds an subgraph object to the graph.
It takes a subgraph object as its only argument and returns
None. | [
"Adds",
"an",
"subgraph",
"object",
"to",
"the",
"graph",
".",
"It",
"takes",
"a",
"subgraph",
"object",
"as",
"its",
"only",
"argument",
"and",
"returns",
"None",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1488-L1508 |
232,418 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.to_string | def to_string(self):
"""Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string from.
"""
graph = list()
if self.obj_dict.get('strict', None) is not None:
if ... | python | def to_string(self):
"""Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string from.
"""
graph = list()
if self.obj_dict.get('strict', None) is not None:
if ... | [
"def",
"to_string",
"(",
"self",
")",
":",
"graph",
"=",
"list",
"(",
")",
"if",
"self",
".",
"obj_dict",
".",
"get",
"(",
"'strict'",
",",
"None",
")",
"is",
"not",
"None",
":",
"if",
"self",
"==",
"self",
".",
"get_parent_graph",
"(",
")",
"and",... | Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string from. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"graph",
"in",
"dot",
"language",
".",
"It",
"will",
"return",
"the",
"graph",
"and",
"all",
"its",
"subelements",
"in",
"string",
"from",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1576-L1670 |
232,419 | nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Dot.create | def create(self, prog=None, format='ps'):
"""Creates and returns a Postscript representation of the graph.
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
reading the Postscript output and returning it as a... | python | def create(self, prog=None, format='ps'):
"""Creates and returns a Postscript representation of the graph.
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
reading the Postscript output and returning it as a... | [
"def",
"create",
"(",
"self",
",",
"prog",
"=",
"None",
",",
"format",
"=",
"'ps'",
")",
":",
"if",
"prog",
"is",
"None",
":",
"prog",
"=",
"self",
".",
"prog",
"if",
"isinstance",
"(",
"prog",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"pr... | Creates and returns a Postscript representation of the graph.
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
reading the Postscript output and returning it as a string is the
operation is successful.
... | [
"Creates",
"and",
"returns",
"a",
"Postscript",
"representation",
"of",
"the",
"graph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1915-L2034 |
232,420 | nerdvegas/rez | src/rez/utils/yaml.py | dump_yaml | def dump_yaml(data, Dumper=_Dumper, default_flow_style=False):
"""Returns data as yaml-formatted string."""
content = yaml.dump(data,
default_flow_style=default_flow_style,
Dumper=Dumper)
return content.strip() | python | def dump_yaml(data, Dumper=_Dumper, default_flow_style=False):
"""Returns data as yaml-formatted string."""
content = yaml.dump(data,
default_flow_style=default_flow_style,
Dumper=Dumper)
return content.strip() | [
"def",
"dump_yaml",
"(",
"data",
",",
"Dumper",
"=",
"_Dumper",
",",
"default_flow_style",
"=",
"False",
")",
":",
"content",
"=",
"yaml",
".",
"dump",
"(",
"data",
",",
"default_flow_style",
"=",
"default_flow_style",
",",
"Dumper",
"=",
"Dumper",
")",
"r... | Returns data as yaml-formatted string. | [
"Returns",
"data",
"as",
"yaml",
"-",
"formatted",
"string",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/yaml.py#L64-L69 |
232,421 | nerdvegas/rez | src/rez/utils/yaml.py | load_yaml | def load_yaml(filepath):
"""Convenience function for loading yaml-encoded data from disk."""
with open(filepath) as f:
txt = f.read()
return yaml.load(txt) | python | def load_yaml(filepath):
"""Convenience function for loading yaml-encoded data from disk."""
with open(filepath) as f:
txt = f.read()
return yaml.load(txt) | [
"def",
"load_yaml",
"(",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"txt",
"=",
"f",
".",
"read",
"(",
")",
"return",
"yaml",
".",
"load",
"(",
"txt",
")"
] | Convenience function for loading yaml-encoded data from disk. | [
"Convenience",
"function",
"for",
"loading",
"yaml",
"-",
"encoded",
"data",
"from",
"disk",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/yaml.py#L72-L76 |
232,422 | nerdvegas/rez | src/rez/utils/memcached.py | memcached_client | def memcached_client(servers=config.memcached_uri, debug=config.debug_memcache):
"""Get a shared memcached instance.
This function shares the same memcached instance across nested invocations.
This is done so that memcached connections can be kept to a minimum, but at
the same time unnecessary extra re... | python | def memcached_client(servers=config.memcached_uri, debug=config.debug_memcache):
"""Get a shared memcached instance.
This function shares the same memcached instance across nested invocations.
This is done so that memcached connections can be kept to a minimum, but at
the same time unnecessary extra re... | [
"def",
"memcached_client",
"(",
"servers",
"=",
"config",
".",
"memcached_uri",
",",
"debug",
"=",
"config",
".",
"debug_memcache",
")",
":",
"key",
"=",
"None",
"try",
":",
"client",
",",
"key",
"=",
"scoped_instance_manager",
".",
"acquire",
"(",
"servers"... | Get a shared memcached instance.
This function shares the same memcached instance across nested invocations.
This is done so that memcached connections can be kept to a minimum, but at
the same time unnecessary extra reconnections are avoided. Typically an
initial scope (using 'with' construct) is made... | [
"Get",
"a",
"shared",
"memcached",
"instance",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L207-L226 |
232,423 | nerdvegas/rez | src/rez/utils/memcached.py | pool_memcached_connections | def pool_memcached_connections(func):
"""Function decorator to pool memcached connections.
Use this to wrap functions that might make multiple calls to memcached. This
will cause a single memcached client to be shared for all connections.
"""
if isgeneratorfunction(func):
def wrapper(*nargs... | python | def pool_memcached_connections(func):
"""Function decorator to pool memcached connections.
Use this to wrap functions that might make multiple calls to memcached. This
will cause a single memcached client to be shared for all connections.
"""
if isgeneratorfunction(func):
def wrapper(*nargs... | [
"def",
"pool_memcached_connections",
"(",
"func",
")",
":",
"if",
"isgeneratorfunction",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"nargs",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"memcached_client",
"(",
")",
":",
"for",
"result",
"in",
"fun... | Function decorator to pool memcached connections.
Use this to wrap functions that might make multiple calls to memcached. This
will cause a single memcached client to be shared for all connections. | [
"Function",
"decorator",
"to",
"pool",
"memcached",
"connections",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L229-L245 |
232,424 | nerdvegas/rez | src/rez/utils/memcached.py | memcached | def memcached(servers, key=None, from_cache=None, to_cache=None, time=0,
min_compress_len=0, debug=False):
"""memcached memoization function decorator.
The wrapped function is expected to return a value that is stored to a
memcached server, first translated by `to_cache` if provided. In the e... | python | def memcached(servers, key=None, from_cache=None, to_cache=None, time=0,
min_compress_len=0, debug=False):
"""memcached memoization function decorator.
The wrapped function is expected to return a value that is stored to a
memcached server, first translated by `to_cache` if provided. In the e... | [
"def",
"memcached",
"(",
"servers",
",",
"key",
"=",
"None",
",",
"from_cache",
"=",
"None",
",",
"to_cache",
"=",
"None",
",",
"time",
"=",
"0",
",",
"min_compress_len",
"=",
"0",
",",
"debug",
"=",
"False",
")",
":",
"def",
"default_key",
"(",
"fun... | memcached memoization function decorator.
The wrapped function is expected to return a value that is stored to a
memcached server, first translated by `to_cache` if provided. In the event
of a cache hit, the data is translated by `from_cache` if provided, before
being returned. If you do not want a res... | [
"memcached",
"memoization",
"function",
"decorator",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L248-L375 |
232,425 | nerdvegas/rez | src/rez/utils/memcached.py | Client.client | def client(self):
"""Get the native memcache client.
Returns:
`memcache.Client` instance.
"""
if self._client is None:
self._client = Client_(self.servers)
return self._client | python | def client(self):
"""Get the native memcache client.
Returns:
`memcache.Client` instance.
"""
if self._client is None:
self._client = Client_(self.servers)
return self._client | [
"def",
"client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_client",
"is",
"None",
":",
"self",
".",
"_client",
"=",
"Client_",
"(",
"self",
".",
"servers",
")",
"return",
"self",
".",
"_client"
] | Get the native memcache client.
Returns:
`memcache.Client` instance. | [
"Get",
"the",
"native",
"memcache",
"client",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L48-L56 |
232,426 | nerdvegas/rez | src/rez/utils/memcached.py | Client.flush | def flush(self, hard=False):
"""Drop existing entries from the cache.
Args:
hard (bool): If True, all current entries are flushed from the
server(s), which affects all users. If False, only the local
process is affected.
"""
if not self.server... | python | def flush(self, hard=False):
"""Drop existing entries from the cache.
Args:
hard (bool): If True, all current entries are flushed from the
server(s), which affects all users. If False, only the local
process is affected.
"""
if not self.server... | [
"def",
"flush",
"(",
"self",
",",
"hard",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"servers",
":",
"return",
"if",
"hard",
":",
"self",
".",
"client",
".",
"flush_all",
"(",
")",
"self",
".",
"reset_stats",
"(",
")",
"else",
":",
"from",
... | Drop existing entries from the cache.
Args:
hard (bool): If True, all current entries are flushed from the
server(s), which affects all users. If False, only the local
process is affected. | [
"Drop",
"existing",
"entries",
"from",
"the",
"cache",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L119-L137 |
232,427 | nerdvegas/rez | src/rez/vendor/pygraph/algorithms/searching.py | depth_first_search | def depth_first_search(graph, root=None, filter=null()):
"""
Depth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tupple containing a diction... | python | def depth_first_search(graph, root=None, filter=null()):
"""
Depth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tupple containing a diction... | [
"def",
"depth_first_search",
"(",
"graph",
",",
"root",
"=",
"None",
",",
"filter",
"=",
"null",
"(",
")",
")",
":",
"recursionlimit",
"=",
"getrecursionlimit",
"(",
")",
"setrecursionlimit",
"(",
"max",
"(",
"len",
"(",
"graph",
".",
"nodes",
"(",
")",
... | Depth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tupple containing a dictionary and two lists:
1. Generated spanning tree
2. Grap... | [
"Depth",
"-",
"first",
"search",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/searching.py#L39-L96 |
232,428 | nerdvegas/rez | src/rez/vendor/pygraph/algorithms/searching.py | breadth_first_search | def breadth_first_search(graph, root=None, filter=null()):
"""
Breadth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tuple containing a dictiona... | python | def breadth_first_search(graph, root=None, filter=null()):
"""
Breadth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tuple containing a dictiona... | [
"def",
"breadth_first_search",
"(",
"graph",
",",
"root",
"=",
"None",
",",
"filter",
"=",
"null",
"(",
")",
")",
":",
"def",
"bfs",
"(",
")",
":",
"\"\"\"\n Breadth-first search subfunction.\n \"\"\"",
"while",
"(",
"queue",
"!=",
"[",
"]",
")",... | Breadth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tuple containing a dictionary and a list.
1. Generated spanning tree
2. Graph's le... | [
"Breadth",
"-",
"first",
"search",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/searching.py#L101-L153 |
232,429 | nerdvegas/rez | src/rez/package_resources_.py | PackageResource.normalize_variables | def normalize_variables(cls, variables):
"""Make sure version is treated consistently
"""
# if the version is False, empty string, etc, throw it out
if variables.get('version', True) in ('', False, '_NO_VERSION', None):
del variables['version']
return super(PackageRes... | python | def normalize_variables(cls, variables):
"""Make sure version is treated consistently
"""
# if the version is False, empty string, etc, throw it out
if variables.get('version', True) in ('', False, '_NO_VERSION', None):
del variables['version']
return super(PackageRes... | [
"def",
"normalize_variables",
"(",
"cls",
",",
"variables",
")",
":",
"# if the version is False, empty string, etc, throw it out",
"if",
"variables",
".",
"get",
"(",
"'version'",
",",
"True",
")",
"in",
"(",
"''",
",",
"False",
",",
"'_NO_VERSION'",
",",
"None",... | Make sure version is treated consistently | [
"Make",
"sure",
"version",
"is",
"treated",
"consistently"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_resources_.py#L300-L306 |
232,430 | nerdvegas/rez | src/rez/vendor/argcomplete/my_shlex.py | shlex.push_source | def push_source(self, newstream, newfile=None):
"Push an input source onto the lexer's input source stack."
if isinstance(newstream, basestring):
newstream = StringIO(newstream)
self.filestack.appendleft((self.infile, self.instream, self.lineno))
self.infile = newfile
... | python | def push_source(self, newstream, newfile=None):
"Push an input source onto the lexer's input source stack."
if isinstance(newstream, basestring):
newstream = StringIO(newstream)
self.filestack.appendleft((self.infile, self.instream, self.lineno))
self.infile = newfile
... | [
"def",
"push_source",
"(",
"self",
",",
"newstream",
",",
"newfile",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"newstream",
",",
"basestring",
")",
":",
"newstream",
"=",
"StringIO",
"(",
"newstream",
")",
"self",
".",
"filestack",
".",
"appendleft",... | Push an input source onto the lexer's input source stack. | [
"Push",
"an",
"input",
"source",
"onto",
"the",
"lexer",
"s",
"input",
"source",
"stack",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/argcomplete/my_shlex.py#L100-L107 |
232,431 | nerdvegas/rez | src/rez/vendor/argcomplete/my_shlex.py | shlex.error_leader | def error_leader(self, infile=None, lineno=None):
"Emit a C-compiler-like, Emacs-friendly error-message leader."
if infile is None:
infile = self.infile
if lineno is None:
lineno = self.lineno
return "\"%s\", line %d: " % (infile, lineno) | python | def error_leader(self, infile=None, lineno=None):
"Emit a C-compiler-like, Emacs-friendly error-message leader."
if infile is None:
infile = self.infile
if lineno is None:
lineno = self.lineno
return "\"%s\", line %d: " % (infile, lineno) | [
"def",
"error_leader",
"(",
"self",
",",
"infile",
"=",
"None",
",",
"lineno",
"=",
"None",
")",
":",
"if",
"infile",
"is",
"None",
":",
"infile",
"=",
"self",
".",
"infile",
"if",
"lineno",
"is",
"None",
":",
"lineno",
"=",
"self",
".",
"lineno",
... | Emit a C-compiler-like, Emacs-friendly error-message leader. | [
"Emit",
"a",
"C",
"-",
"compiler",
"-",
"like",
"Emacs",
"-",
"friendly",
"error",
"-",
"message",
"leader",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/argcomplete/my_shlex.py#L278-L284 |
232,432 | nerdvegas/rez | src/rez/system.py | System.rez_bin_path | def rez_bin_path(self):
"""Get path containing rez binaries, or None if no binaries are
available, or Rez is not a production install.
"""
binpath = None
if sys.argv and sys.argv[0]:
executable = sys.argv[0]
path = which("rezolve", env={"PATH":os.path.dirn... | python | def rez_bin_path(self):
"""Get path containing rez binaries, or None if no binaries are
available, or Rez is not a production install.
"""
binpath = None
if sys.argv and sys.argv[0]:
executable = sys.argv[0]
path = which("rezolve", env={"PATH":os.path.dirn... | [
"def",
"rez_bin_path",
"(",
"self",
")",
":",
"binpath",
"=",
"None",
"if",
"sys",
".",
"argv",
"and",
"sys",
".",
"argv",
"[",
"0",
"]",
":",
"executable",
"=",
"sys",
".",
"argv",
"[",
"0",
"]",
"path",
"=",
"which",
"(",
"\"rezolve\"",
",",
"e... | Get path containing rez binaries, or None if no binaries are
available, or Rez is not a production install. | [
"Get",
"path",
"containing",
"rez",
"binaries",
"or",
"None",
"if",
"no",
"binaries",
"are",
"available",
"or",
"Rez",
"is",
"not",
"a",
"production",
"install",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/system.py#L191-L214 |
232,433 | nerdvegas/rez | src/rez/system.py | System.get_summary_string | def get_summary_string(self):
"""Get a string summarising the state of Rez as a whole.
Returns:
String.
"""
from rez.plugin_managers import plugin_manager
txt = "Rez %s" % __version__
txt += "\n\n%s" % plugin_manager.get_summary_string()
return txt | python | def get_summary_string(self):
"""Get a string summarising the state of Rez as a whole.
Returns:
String.
"""
from rez.plugin_managers import plugin_manager
txt = "Rez %s" % __version__
txt += "\n\n%s" % plugin_manager.get_summary_string()
return txt | [
"def",
"get_summary_string",
"(",
"self",
")",
":",
"from",
"rez",
".",
"plugin_managers",
"import",
"plugin_manager",
"txt",
"=",
"\"Rez %s\"",
"%",
"__version__",
"txt",
"+=",
"\"\\n\\n%s\"",
"%",
"plugin_manager",
".",
"get_summary_string",
"(",
")",
"return",
... | Get a string summarising the state of Rez as a whole.
Returns:
String. | [
"Get",
"a",
"string",
"summarising",
"the",
"state",
"of",
"Rez",
"as",
"a",
"whole",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/system.py#L221-L231 |
232,434 | nerdvegas/rez | src/rez/system.py | System.clear_caches | def clear_caches(self, hard=False):
"""Clear all caches in Rez.
Rez caches package contents and iteration during a python session. Thus
newly released packages, and changes to existing packages, may not be
picked up. You need to clear the cache for these changes to become
visibl... | python | def clear_caches(self, hard=False):
"""Clear all caches in Rez.
Rez caches package contents and iteration during a python session. Thus
newly released packages, and changes to existing packages, may not be
picked up. You need to clear the cache for these changes to become
visibl... | [
"def",
"clear_caches",
"(",
"self",
",",
"hard",
"=",
"False",
")",
":",
"from",
"rez",
".",
"package_repository",
"import",
"package_repository_manager",
"from",
"rez",
".",
"utils",
".",
"memcached",
"import",
"memcached_client",
"package_repository_manager",
".",... | Clear all caches in Rez.
Rez caches package contents and iteration during a python session. Thus
newly released packages, and changes to existing packages, may not be
picked up. You need to clear the cache for these changes to become
visible.
Args:
hard (bool): Perf... | [
"Clear",
"all",
"caches",
"in",
"Rez",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/system.py#L233-L252 |
232,435 | nerdvegas/rez | src/rez/resolver.py | Resolver.solve | def solve(self):
"""Perform the solve.
"""
with log_duration(self._print, "memcache get (resolve) took %s"):
solver_dict = self._get_cached_solve()
if solver_dict:
self.from_cache = True
self._set_result(solver_dict)
else:
self.fro... | python | def solve(self):
"""Perform the solve.
"""
with log_duration(self._print, "memcache get (resolve) took %s"):
solver_dict = self._get_cached_solve()
if solver_dict:
self.from_cache = True
self._set_result(solver_dict)
else:
self.fro... | [
"def",
"solve",
"(",
"self",
")",
":",
"with",
"log_duration",
"(",
"self",
".",
"_print",
",",
"\"memcache get (resolve) took %s\"",
")",
":",
"solver_dict",
"=",
"self",
".",
"_get_cached_solve",
"(",
")",
"if",
"solver_dict",
":",
"self",
".",
"from_cache",... | Perform the solve. | [
"Perform",
"the",
"solve",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolver.py#L107-L123 |
232,436 | nerdvegas/rez | src/rez/resolver.py | Resolver._set_cached_solve | def _set_cached_solve(self, solver_dict):
"""Store a solve to memcached.
If there is NOT a resolve timestamp:
- store the solve to a non-timestamped entry.
If there IS a resolve timestamp (let us call this T):
- if NO newer package in the solve has been released since T... | python | def _set_cached_solve(self, solver_dict):
"""Store a solve to memcached.
If there is NOT a resolve timestamp:
- store the solve to a non-timestamped entry.
If there IS a resolve timestamp (let us call this T):
- if NO newer package in the solve has been released since T... | [
"def",
"_set_cached_solve",
"(",
"self",
",",
"solver_dict",
")",
":",
"if",
"self",
".",
"status_",
"!=",
"ResolverStatus",
".",
"solved",
":",
"return",
"# don't cache failed solves",
"if",
"not",
"(",
"self",
".",
"caching",
"and",
"self",
".",
"memcached_s... | Store a solve to memcached.
If there is NOT a resolve timestamp:
- store the solve to a non-timestamped entry.
If there IS a resolve timestamp (let us call this T):
- if NO newer package in the solve has been released since T,
- then store the solve to a non-times... | [
"Store",
"a",
"solve",
"to",
"memcached",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolver.py#L310-L356 |
232,437 | nerdvegas/rez | src/rez/resolver.py | Resolver._memcache_key | def _memcache_key(self, timestamped=False):
"""Makes a key suitable as a memcache entry."""
request = tuple(map(str, self.package_requests))
repo_ids = []
for path in self.package_paths:
repo = package_repository_manager.get_repository(path)
repo_ids.append(repo.u... | python | def _memcache_key(self, timestamped=False):
"""Makes a key suitable as a memcache entry."""
request = tuple(map(str, self.package_requests))
repo_ids = []
for path in self.package_paths:
repo = package_repository_manager.get_repository(path)
repo_ids.append(repo.u... | [
"def",
"_memcache_key",
"(",
"self",
",",
"timestamped",
"=",
"False",
")",
":",
"request",
"=",
"tuple",
"(",
"map",
"(",
"str",
",",
"self",
".",
"package_requests",
")",
")",
"repo_ids",
"=",
"[",
"]",
"for",
"path",
"in",
"self",
".",
"package_path... | Makes a key suitable as a memcache entry. | [
"Makes",
"a",
"key",
"suitable",
"as",
"a",
"memcache",
"entry",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolver.py#L358-L377 |
232,438 | nerdvegas/rez | src/rez/shells.py | create_shell | def create_shell(shell=None, **kwargs):
"""Returns a Shell of the given type, or the current shell type if shell
is None."""
if not shell:
shell = config.default_shell
if not shell:
from rez.system import system
shell = system.shell
from rez.plugin_managers impor... | python | def create_shell(shell=None, **kwargs):
"""Returns a Shell of the given type, or the current shell type if shell
is None."""
if not shell:
shell = config.default_shell
if not shell:
from rez.system import system
shell = system.shell
from rez.plugin_managers impor... | [
"def",
"create_shell",
"(",
"shell",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"shell",
":",
"shell",
"=",
"config",
".",
"default_shell",
"if",
"not",
"shell",
":",
"from",
"rez",
".",
"system",
"import",
"system",
"shell",
"=",
"... | Returns a Shell of the given type, or the current shell type if shell
is None. | [
"Returns",
"a",
"Shell",
"of",
"the",
"given",
"type",
"or",
"the",
"current",
"shell",
"type",
"if",
"shell",
"is",
"None",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/shells.py#L25-L35 |
232,439 | nerdvegas/rez | src/rez/shells.py | Shell.startup_capabilities | def startup_capabilities(cls, rcfile=False, norc=False, stdin=False,
command=False):
"""
Given a set of options related to shell startup, return the actual
options that will be applied.
@returns 4-tuple representing applied value of each option.
"""
... | python | def startup_capabilities(cls, rcfile=False, norc=False, stdin=False,
command=False):
"""
Given a set of options related to shell startup, return the actual
options that will be applied.
@returns 4-tuple representing applied value of each option.
"""
... | [
"def",
"startup_capabilities",
"(",
"cls",
",",
"rcfile",
"=",
"False",
",",
"norc",
"=",
"False",
",",
"stdin",
"=",
"False",
",",
"command",
"=",
"False",
")",
":",
"raise",
"NotImplementedError"
] | Given a set of options related to shell startup, return the actual
options that will be applied.
@returns 4-tuple representing applied value of each option. | [
"Given",
"a",
"set",
"of",
"options",
"related",
"to",
"shell",
"startup",
"return",
"the",
"actual",
"options",
"that",
"will",
"be",
"applied",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/shells.py#L54-L61 |
232,440 | nerdvegas/rez | src/rez/vendor/distlib/index.py | PackageIndex.upload_file | def upload_file(self, metadata, filename, signer=None, sign_password=None,
filetype='sdist', pyversion='source', keystore=None):
"""
Upload a release file to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and versio... | python | def upload_file(self, metadata, filename, signer=None, sign_password=None,
filetype='sdist', pyversion='source', keystore=None):
"""
Upload a release file to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and versio... | [
"def",
"upload_file",
"(",
"self",
",",
"metadata",
",",
"filename",
",",
"signer",
"=",
"None",
",",
"sign_password",
"=",
"None",
",",
"filetype",
"=",
"'sdist'",
",",
"pyversion",
"=",
"'source'",
",",
"keystore",
"=",
"None",
")",
":",
"self",
".",
... | Upload a release file to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the file to be uploaded.
:param filename: The pathname of the file to be uploaded.
:param signer: The identifier of the signer of the file.
... | [
"Upload",
"a",
"release",
"file",
"to",
"the",
"index",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/index.py#L238-L293 |
232,441 | nerdvegas/rez | src/rez/solver.py | _get_dependency_order | def _get_dependency_order(g, node_list):
"""Return list of nodes as close as possible to the ordering in node_list,
but with child nodes earlier in the list than parents."""
access_ = accessibility(g)
deps = dict((k, set(v) - set([k])) for k, v in access_.iteritems())
nodes = node_list + list(set(g.... | python | def _get_dependency_order(g, node_list):
"""Return list of nodes as close as possible to the ordering in node_list,
but with child nodes earlier in the list than parents."""
access_ = accessibility(g)
deps = dict((k, set(v) - set([k])) for k, v in access_.iteritems())
nodes = node_list + list(set(g.... | [
"def",
"_get_dependency_order",
"(",
"g",
",",
"node_list",
")",
":",
"access_",
"=",
"accessibility",
"(",
"g",
")",
"deps",
"=",
"dict",
"(",
"(",
"k",
",",
"set",
"(",
"v",
")",
"-",
"set",
"(",
"[",
"k",
"]",
")",
")",
"for",
"k",
",",
"v",... | Return list of nodes as close as possible to the ordering in node_list,
but with child nodes earlier in the list than parents. | [
"Return",
"list",
"of",
"nodes",
"as",
"close",
"as",
"possible",
"to",
"the",
"ordering",
"in",
"node_list",
"but",
"with",
"child",
"nodes",
"earlier",
"in",
"the",
"list",
"than",
"parents",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1110-L1136 |
232,442 | nerdvegas/rez | src/rez/solver.py | _short_req_str | def _short_req_str(package_request):
"""print shortened version of '==X|==Y|==Z' ranged requests."""
if not package_request.conflict:
versions = package_request.range.to_versions()
if versions and len(versions) == len(package_request.range) \
and len(versions) > 1:
re... | python | def _short_req_str(package_request):
"""print shortened version of '==X|==Y|==Z' ranged requests."""
if not package_request.conflict:
versions = package_request.range.to_versions()
if versions and len(versions) == len(package_request.range) \
and len(versions) > 1:
re... | [
"def",
"_short_req_str",
"(",
"package_request",
")",
":",
"if",
"not",
"package_request",
".",
"conflict",
":",
"versions",
"=",
"package_request",
".",
"range",
".",
"to_versions",
"(",
")",
"if",
"versions",
"and",
"len",
"(",
"versions",
")",
"==",
"len"... | print shortened version of '==X|==Y|==Z' ranged requests. | [
"print",
"shortened",
"version",
"of",
"==",
"X|",
"==",
"Y|",
"==",
"Z",
"ranged",
"requests",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2275-L2284 |
232,443 | nerdvegas/rez | src/rez/solver.py | PackageVariant.requires_list | def requires_list(self):
"""
It is important that this property is calculated lazily. Getting the
'requires' attribute may trigger a package load, which may be avoided if
this variant is reduced away before that happens.
"""
requires = self.variant.get_requires(build_requ... | python | def requires_list(self):
"""
It is important that this property is calculated lazily. Getting the
'requires' attribute may trigger a package load, which may be avoided if
this variant is reduced away before that happens.
"""
requires = self.variant.get_requires(build_requ... | [
"def",
"requires_list",
"(",
"self",
")",
":",
"requires",
"=",
"self",
".",
"variant",
".",
"get_requires",
"(",
"build_requires",
"=",
"self",
".",
"building",
")",
"reqlist",
"=",
"RequirementList",
"(",
"requires",
")",
"if",
"reqlist",
".",
"conflict",
... | It is important that this property is calculated lazily. Getting the
'requires' attribute may trigger a package load, which may be avoided if
this variant is reduced away before that happens. | [
"It",
"is",
"important",
"that",
"this",
"property",
"is",
"calculated",
"lazily",
".",
"Getting",
"the",
"requires",
"attribute",
"may",
"trigger",
"a",
"package",
"load",
"which",
"may",
"be",
"avoided",
"if",
"this",
"variant",
"is",
"reduced",
"away",
"b... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L299-L313 |
232,444 | nerdvegas/rez | src/rez/solver.py | _PackageEntry.sort | def sort(self):
"""Sort variants from most correct to consume, to least.
Sort rules:
version_priority:
- sort by highest versions of packages shared with request;
- THEN least number of additional packages added to solve;
- THEN highest versions of additional packages;
... | python | def sort(self):
"""Sort variants from most correct to consume, to least.
Sort rules:
version_priority:
- sort by highest versions of packages shared with request;
- THEN least number of additional packages added to solve;
- THEN highest versions of additional packages;
... | [
"def",
"sort",
"(",
"self",
")",
":",
"if",
"self",
".",
"sorted",
":",
"return",
"def",
"key",
"(",
"variant",
")",
":",
"requested_key",
"=",
"[",
"]",
"names",
"=",
"set",
"(",
")",
"for",
"i",
",",
"request",
"in",
"enumerate",
"(",
"self",
"... | Sort variants from most correct to consume, to least.
Sort rules:
version_priority:
- sort by highest versions of packages shared with request;
- THEN least number of additional packages added to solve;
- THEN highest versions of additional packages;
- THEN alphabetical... | [
"Sort",
"variants",
"from",
"most",
"correct",
"to",
"consume",
"to",
"least",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L370-L427 |
232,445 | nerdvegas/rez | src/rez/solver.py | _PackageVariantList.get_intersection | def get_intersection(self, range_):
"""Get a list of variants that intersect with the given range.
Args:
range_ (`VersionRange`): Package version range.
Returns:
List of `_PackageEntry` objects.
"""
result = []
for entry in self.entries:
... | python | def get_intersection(self, range_):
"""Get a list of variants that intersect with the given range.
Args:
range_ (`VersionRange`): Package version range.
Returns:
List of `_PackageEntry` objects.
"""
result = []
for entry in self.entries:
... | [
"def",
"get_intersection",
"(",
"self",
",",
"range_",
")",
":",
"result",
"=",
"[",
"]",
"for",
"entry",
"in",
"self",
".",
"entries",
":",
"package",
",",
"value",
"=",
"entry",
"if",
"value",
"is",
"None",
":",
"continue",
"# package was blocked by pack... | Get a list of variants that intersect with the given range.
Args:
range_ (`VersionRange`): Package version range.
Returns:
List of `_PackageEntry` objects. | [
"Get",
"a",
"list",
"of",
"variants",
"that",
"intersect",
"with",
"the",
"given",
"range",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L453-L502 |
232,446 | nerdvegas/rez | src/rez/solver.py | _PackageVariantSlice.intersect | def intersect(self, range_):
self.solver.intersection_broad_tests_count += 1
"""Remove variants whose version fall outside of the given range."""
if range_.is_any():
return self
if self.solver.optimised:
if range_ in self.been_intersected_with:
r... | python | def intersect(self, range_):
self.solver.intersection_broad_tests_count += 1
"""Remove variants whose version fall outside of the given range."""
if range_.is_any():
return self
if self.solver.optimised:
if range_ in self.been_intersected_with:
r... | [
"def",
"intersect",
"(",
"self",
",",
"range_",
")",
":",
"self",
".",
"solver",
".",
"intersection_broad_tests_count",
"+=",
"1",
"if",
"range_",
".",
"is_any",
"(",
")",
":",
"return",
"self",
"if",
"self",
".",
"solver",
".",
"optimised",
":",
"if",
... | Remove variants whose version fall outside of the given range. | [
"Remove",
"variants",
"whose",
"version",
"fall",
"outside",
"of",
"the",
"given",
"range",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L594-L622 |
232,447 | nerdvegas/rez | src/rez/solver.py | _PackageVariantSlice.reduce_by | def reduce_by(self, package_request):
"""Remove variants whos dependencies conflict with the given package
request.
Returns:
(VariantSlice, [Reduction]) tuple, where slice may be None if all
variants were reduced.
"""
if self.pr:
reqstr = _sho... | python | def reduce_by(self, package_request):
"""Remove variants whos dependencies conflict with the given package
request.
Returns:
(VariantSlice, [Reduction]) tuple, where slice may be None if all
variants were reduced.
"""
if self.pr:
reqstr = _sho... | [
"def",
"reduce_by",
"(",
"self",
",",
"package_request",
")",
":",
"if",
"self",
".",
"pr",
":",
"reqstr",
"=",
"_short_req_str",
"(",
"package_request",
")",
"self",
".",
"pr",
".",
"passive",
"(",
"\"reducing %s wrt %s...\"",
",",
"self",
",",
"reqstr",
... | Remove variants whos dependencies conflict with the given package
request.
Returns:
(VariantSlice, [Reduction]) tuple, where slice may be None if all
variants were reduced. | [
"Remove",
"variants",
"whos",
"dependencies",
"conflict",
"with",
"the",
"given",
"package",
"request",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L624-L645 |
232,448 | nerdvegas/rez | src/rez/solver.py | _PackageVariantSlice.split | def split(self):
"""Split the slice.
Returns:
(`_PackageVariantSlice`, `_PackageVariantSlice`) tuple, where the
first is the preferred slice.
"""
# We sort here in the split in order to sort as late as possible.
# Because splits usually happen after inte... | python | def split(self):
"""Split the slice.
Returns:
(`_PackageVariantSlice`, `_PackageVariantSlice`) tuple, where the
first is the preferred slice.
"""
# We sort here in the split in order to sort as late as possible.
# Because splits usually happen after inte... | [
"def",
"split",
"(",
"self",
")",
":",
"# We sort here in the split in order to sort as late as possible.",
"# Because splits usually happen after intersections/reductions, this",
"# means there can be less entries to sort.",
"#",
"self",
".",
"sort_versions",
"(",
")",
"def",
"_spli... | Split the slice.
Returns:
(`_PackageVariantSlice`, `_PackageVariantSlice`) tuple, where the
first is the preferred slice. | [
"Split",
"the",
"slice",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L730-L801 |
232,449 | nerdvegas/rez | src/rez/solver.py | _PackageVariantSlice.sort_versions | def sort_versions(self):
"""Sort entries by version.
The order is typically descending, but package order functions can
change this.
"""
if self.sorted:
return
for orderer in (self.solver.package_orderers or []):
entries = orderer.reorder(self.en... | python | def sort_versions(self):
"""Sort entries by version.
The order is typically descending, but package order functions can
change this.
"""
if self.sorted:
return
for orderer in (self.solver.package_orderers or []):
entries = orderer.reorder(self.en... | [
"def",
"sort_versions",
"(",
"self",
")",
":",
"if",
"self",
".",
"sorted",
":",
"return",
"for",
"orderer",
"in",
"(",
"self",
".",
"solver",
".",
"package_orderers",
"or",
"[",
"]",
")",
":",
"entries",
"=",
"orderer",
".",
"reorder",
"(",
"self",
... | Sort entries by version.
The order is typically descending, but package order functions can
change this. | [
"Sort",
"entries",
"by",
"version",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L803-L827 |
232,450 | nerdvegas/rez | src/rez/solver.py | PackageVariantCache.get_variant_slice | def get_variant_slice(self, package_name, range_):
"""Get a list of variants from the cache.
Args:
package_name (str): Name of package.
range_ (`VersionRange`): Package version range.
Returns:
`_PackageVariantSlice` object.
"""
variant_list =... | python | def get_variant_slice(self, package_name, range_):
"""Get a list of variants from the cache.
Args:
package_name (str): Name of package.
range_ (`VersionRange`): Package version range.
Returns:
`_PackageVariantSlice` object.
"""
variant_list =... | [
"def",
"get_variant_slice",
"(",
"self",
",",
"package_name",
",",
"range_",
")",
":",
"variant_list",
"=",
"self",
".",
"variant_lists",
".",
"get",
"(",
"package_name",
")",
"if",
"variant_list",
"is",
"None",
":",
"variant_list",
"=",
"_PackageVariantList",
... | Get a list of variants from the cache.
Args:
package_name (str): Name of package.
range_ (`VersionRange`): Package version range.
Returns:
`_PackageVariantSlice` object. | [
"Get",
"a",
"list",
"of",
"variants",
"from",
"the",
"cache",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L902-L925 |
232,451 | nerdvegas/rez | src/rez/solver.py | _PackageScope.intersect | def intersect(self, range_):
"""Intersect this scope with a package range.
Returns:
A new copy of this scope, with variants whos version fall outside
of the given range removed. If there were no removals, self is
returned. If all variants were removed, None is return... | python | def intersect(self, range_):
"""Intersect this scope with a package range.
Returns:
A new copy of this scope, with variants whos version fall outside
of the given range removed. If there were no removals, self is
returned. If all variants were removed, None is return... | [
"def",
"intersect",
"(",
"self",
",",
"range_",
")",
":",
"new_slice",
"=",
"None",
"if",
"self",
".",
"package_request",
".",
"conflict",
":",
"if",
"self",
".",
"package_request",
".",
"range",
"is",
"None",
":",
"new_slice",
"=",
"self",
".",
"solver"... | Intersect this scope with a package range.
Returns:
A new copy of this scope, with variants whos version fall outside
of the given range removed. If there were no removals, self is
returned. If all variants were removed, None is returned. | [
"Intersect",
"this",
"scope",
"with",
"a",
"package",
"range",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L956-L994 |
232,452 | nerdvegas/rez | src/rez/solver.py | _PackageScope.reduce_by | def reduce_by(self, package_request):
"""Reduce this scope wrt a package request.
Returns:
A (_PackageScope, [Reduction]) tuple, where the scope is a new
scope copy with reductions applied, or self if there were no
reductions, or None if the scope was completely redu... | python | def reduce_by(self, package_request):
"""Reduce this scope wrt a package request.
Returns:
A (_PackageScope, [Reduction]) tuple, where the scope is a new
scope copy with reductions applied, or self if there were no
reductions, or None if the scope was completely redu... | [
"def",
"reduce_by",
"(",
"self",
",",
"package_request",
")",
":",
"self",
".",
"solver",
".",
"reduction_broad_tests_count",
"+=",
"1",
"if",
"self",
".",
"package_request",
".",
"conflict",
":",
"# conflict scopes don't reduce. Instead, other scopes will be",
"# reduc... | Reduce this scope wrt a package request.
Returns:
A (_PackageScope, [Reduction]) tuple, where the scope is a new
scope copy with reductions applied, or self if there were no
reductions, or None if the scope was completely reduced. | [
"Reduce",
"this",
"scope",
"wrt",
"a",
"package",
"request",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L996-L1037 |
232,453 | nerdvegas/rez | src/rez/solver.py | _PackageScope.split | def split(self):
"""Split the scope.
Returns:
A (_PackageScope, _PackageScope) tuple, where the first scope is
guaranteed to have a common dependency. Or None, if splitting is
not applicable to this scope.
"""
if self.package_request.conflict or (len(... | python | def split(self):
"""Split the scope.
Returns:
A (_PackageScope, _PackageScope) tuple, where the first scope is
guaranteed to have a common dependency. Or None, if splitting is
not applicable to this scope.
"""
if self.package_request.conflict or (len(... | [
"def",
"split",
"(",
"self",
")",
":",
"if",
"self",
".",
"package_request",
".",
"conflict",
"or",
"(",
"len",
"(",
"self",
".",
"variant_slice",
")",
"==",
"1",
")",
":",
"return",
"None",
"else",
":",
"r",
"=",
"self",
".",
"variant_slice",
".",
... | Split the scope.
Returns:
A (_PackageScope, _PackageScope) tuple, where the first scope is
guaranteed to have a common dependency. Or None, if splitting is
not applicable to this scope. | [
"Split",
"the",
"scope",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1059-L1077 |
232,454 | nerdvegas/rez | src/rez/solver.py | _ResolvePhase.finalise | def finalise(self):
"""Remove conflict requests, detect cyclic dependencies, and reorder
packages wrt dependency and then request order.
Returns:
A new copy of the phase with conflict requests removed and packages
correctly ordered; or, if cyclic dependencies were detect... | python | def finalise(self):
"""Remove conflict requests, detect cyclic dependencies, and reorder
packages wrt dependency and then request order.
Returns:
A new copy of the phase with conflict requests removed and packages
correctly ordered; or, if cyclic dependencies were detect... | [
"def",
"finalise",
"(",
"self",
")",
":",
"assert",
"(",
"self",
".",
"_is_solved",
"(",
")",
")",
"g",
"=",
"self",
".",
"_get_minimal_graph",
"(",
")",
"scopes",
"=",
"dict",
"(",
"(",
"x",
".",
"package_name",
",",
"x",
")",
"for",
"x",
"in",
... | Remove conflict requests, detect cyclic dependencies, and reorder
packages wrt dependency and then request order.
Returns:
A new copy of the phase with conflict requests removed and packages
correctly ordered; or, if cyclic dependencies were detected, a new
phase mar... | [
"Remove",
"conflict",
"requests",
"detect",
"cyclic",
"dependencies",
"and",
"reorder",
"packages",
"wrt",
"dependency",
"and",
"then",
"request",
"order",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1368-L1410 |
232,455 | nerdvegas/rez | src/rez/solver.py | _ResolvePhase.split | def split(self):
"""Split the phase.
When a phase is exhausted, it gets split into a pair of phases to be
further solved. The split happens like so:
1) Select the first unsolved package scope.
2) Find some common dependency in the first N variants of the scope.
3) Split ... | python | def split(self):
"""Split the phase.
When a phase is exhausted, it gets split into a pair of phases to be
further solved. The split happens like so:
1) Select the first unsolved package scope.
2) Find some common dependency in the first N variants of the scope.
3) Split ... | [
"def",
"split",
"(",
"self",
")",
":",
"assert",
"(",
"self",
".",
"status",
"==",
"SolverStatus",
".",
"exhausted",
")",
"scopes",
"=",
"[",
"]",
"next_scopes",
"=",
"[",
"]",
"split_i",
"=",
"None",
"for",
"i",
",",
"scope",
"in",
"enumerate",
"(",... | Split the phase.
When a phase is exhausted, it gets split into a pair of phases to be
further solved. The split happens like so:
1) Select the first unsolved package scope.
2) Find some common dependency in the first N variants of the scope.
3) Split the scope into two: [:N] and... | [
"Split",
"the",
"phase",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1412-L1466 |
232,456 | nerdvegas/rez | src/rez/solver.py | Solver.status | def status(self):
"""Return the current status of the solve.
Returns:
SolverStatus: Enum representation of the state of the solver.
"""
if self.request_list.conflict:
return SolverStatus.failed
if self.callback_return == SolverCallbackReturn.fail:
... | python | def status(self):
"""Return the current status of the solve.
Returns:
SolverStatus: Enum representation of the state of the solver.
"""
if self.request_list.conflict:
return SolverStatus.failed
if self.callback_return == SolverCallbackReturn.fail:
... | [
"def",
"status",
"(",
"self",
")",
":",
"if",
"self",
".",
"request_list",
".",
"conflict",
":",
"return",
"SolverStatus",
".",
"failed",
"if",
"self",
".",
"callback_return",
"==",
"SolverCallbackReturn",
".",
"fail",
":",
"# the solve has failed because a callba... | Return the current status of the solve.
Returns:
SolverStatus: Enum representation of the state of the solver. | [
"Return",
"the",
"current",
"status",
"of",
"the",
"solve",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1881-L1906 |
232,457 | nerdvegas/rez | src/rez/solver.py | Solver.num_fails | def num_fails(self):
"""Return the number of failed solve steps that have been executed.
Note that num_solves is inclusive of failures."""
n = len(self.failed_phase_list)
if self.phase_stack[-1].status in (SolverStatus.failed, SolverStatus.cyclic):
n += 1
return n | python | def num_fails(self):
"""Return the number of failed solve steps that have been executed.
Note that num_solves is inclusive of failures."""
n = len(self.failed_phase_list)
if self.phase_stack[-1].status in (SolverStatus.failed, SolverStatus.cyclic):
n += 1
return n | [
"def",
"num_fails",
"(",
"self",
")",
":",
"n",
"=",
"len",
"(",
"self",
".",
"failed_phase_list",
")",
"if",
"self",
".",
"phase_stack",
"[",
"-",
"1",
"]",
".",
"status",
"in",
"(",
"SolverStatus",
".",
"failed",
",",
"SolverStatus",
".",
"cyclic",
... | Return the number of failed solve steps that have been executed.
Note that num_solves is inclusive of failures. | [
"Return",
"the",
"number",
"of",
"failed",
"solve",
"steps",
"that",
"have",
"been",
"executed",
".",
"Note",
"that",
"num_solves",
"is",
"inclusive",
"of",
"failures",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1914-L1920 |
232,458 | nerdvegas/rez | src/rez/solver.py | Solver.resolved_packages | def resolved_packages(self):
"""Return a list of PackageVariant objects, or None if the resolve did
not complete or was unsuccessful.
"""
if (self.status != SolverStatus.solved):
return None
final_phase = self.phase_stack[-1]
return final_phase._get_solved_va... | python | def resolved_packages(self):
"""Return a list of PackageVariant objects, or None if the resolve did
not complete or was unsuccessful.
"""
if (self.status != SolverStatus.solved):
return None
final_phase = self.phase_stack[-1]
return final_phase._get_solved_va... | [
"def",
"resolved_packages",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"status",
"!=",
"SolverStatus",
".",
"solved",
")",
":",
"return",
"None",
"final_phase",
"=",
"self",
".",
"phase_stack",
"[",
"-",
"1",
"]",
"return",
"final_phase",
".",
"_get_... | Return a list of PackageVariant objects, or None if the resolve did
not complete or was unsuccessful. | [
"Return",
"a",
"list",
"of",
"PackageVariant",
"objects",
"or",
"None",
"if",
"the",
"resolve",
"did",
"not",
"complete",
"or",
"was",
"unsuccessful",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1928-L1936 |
232,459 | nerdvegas/rez | src/rez/solver.py | Solver.reset | def reset(self):
"""Reset the solver, removing any current solve."""
if not self.request_list.conflict:
phase = _ResolvePhase(self.request_list.requirements, solver=self)
self.pr("resetting...")
self._init()
self._push_phase(phase) | python | def reset(self):
"""Reset the solver, removing any current solve."""
if not self.request_list.conflict:
phase = _ResolvePhase(self.request_list.requirements, solver=self)
self.pr("resetting...")
self._init()
self._push_phase(phase) | [
"def",
"reset",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"request_list",
".",
"conflict",
":",
"phase",
"=",
"_ResolvePhase",
"(",
"self",
".",
"request_list",
".",
"requirements",
",",
"solver",
"=",
"self",
")",
"self",
".",
"pr",
"(",
"\"res... | Reset the solver, removing any current solve. | [
"Reset",
"the",
"solver",
"removing",
"any",
"current",
"solve",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1938-L1944 |
232,460 | nerdvegas/rez | src/rez/solver.py | Solver.solve | def solve(self):
"""Attempt to solve the request.
"""
if self.solve_begun:
raise ResolveError("cannot run solve() on a solve that has "
"already been started")
t1 = time.time()
pt1 = package_repo_stats.package_load_time
# itera... | python | def solve(self):
"""Attempt to solve the request.
"""
if self.solve_begun:
raise ResolveError("cannot run solve() on a solve that has "
"already been started")
t1 = time.time()
pt1 = package_repo_stats.package_load_time
# itera... | [
"def",
"solve",
"(",
"self",
")",
":",
"if",
"self",
".",
"solve_begun",
":",
"raise",
"ResolveError",
"(",
"\"cannot run solve() on a solve that has \"",
"\"already been started\"",
")",
"t1",
"=",
"time",
".",
"time",
"(",
")",
"pt1",
"=",
"package_repo_stats",
... | Attempt to solve the request. | [
"Attempt",
"to",
"solve",
"the",
"request",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1946-L1974 |
232,461 | nerdvegas/rez | src/rez/solver.py | Solver.solve_step | def solve_step(self):
"""Perform a single solve step.
"""
self.solve_begun = True
if self.status != SolverStatus.unsolved:
return
if self.pr:
self.pr.header("SOLVE #%d (%d fails so far)...",
self.solve_count + 1, self.num_fails)... | python | def solve_step(self):
"""Perform a single solve step.
"""
self.solve_begun = True
if self.status != SolverStatus.unsolved:
return
if self.pr:
self.pr.header("SOLVE #%d (%d fails so far)...",
self.solve_count + 1, self.num_fails)... | [
"def",
"solve_step",
"(",
"self",
")",
":",
"self",
".",
"solve_begun",
"=",
"True",
"if",
"self",
".",
"status",
"!=",
"SolverStatus",
".",
"unsolved",
":",
"return",
"if",
"self",
".",
"pr",
":",
"self",
".",
"pr",
".",
"header",
"(",
"\"SOLVE #%d (%... | Perform a single solve step. | [
"Perform",
"a",
"single",
"solve",
"step",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2013-L2062 |
232,462 | nerdvegas/rez | src/rez/solver.py | Solver.failure_reason | def failure_reason(self, failure_index=None):
"""Get the reason for a failure.
Args:
failure_index: Index of the fail to return the graph for (can be
negative). If None, the most appropriate failure is chosen
according to these rules:
- If the... | python | def failure_reason(self, failure_index=None):
"""Get the reason for a failure.
Args:
failure_index: Index of the fail to return the graph for (can be
negative). If None, the most appropriate failure is chosen
according to these rules:
- If the... | [
"def",
"failure_reason",
"(",
"self",
",",
"failure_index",
"=",
"None",
")",
":",
"phase",
",",
"_",
"=",
"self",
".",
"_get_failed_phase",
"(",
"failure_index",
")",
"return",
"phase",
".",
"failure_reason"
] | Get the reason for a failure.
Args:
failure_index: Index of the fail to return the graph for (can be
negative). If None, the most appropriate failure is chosen
according to these rules:
- If the fail is cyclic, the most recent fail (the one containing... | [
"Get",
"the",
"reason",
"for",
"a",
"failure",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2064-L2080 |
232,463 | nerdvegas/rez | src/rez/solver.py | Solver.failure_packages | def failure_packages(self, failure_index=None):
"""Get packages involved in a failure.
Args:
failure_index: See `failure_reason`.
Returns:
A list of Requirement objects.
"""
phase, _ = self._get_failed_phase(failure_index)
fr = phase.failure_reas... | python | def failure_packages(self, failure_index=None):
"""Get packages involved in a failure.
Args:
failure_index: See `failure_reason`.
Returns:
A list of Requirement objects.
"""
phase, _ = self._get_failed_phase(failure_index)
fr = phase.failure_reas... | [
"def",
"failure_packages",
"(",
"self",
",",
"failure_index",
"=",
"None",
")",
":",
"phase",
",",
"_",
"=",
"self",
".",
"_get_failed_phase",
"(",
"failure_index",
")",
"fr",
"=",
"phase",
".",
"failure_reason",
"return",
"fr",
".",
"involved_requirements",
... | Get packages involved in a failure.
Args:
failure_index: See `failure_reason`.
Returns:
A list of Requirement objects. | [
"Get",
"packages",
"involved",
"in",
"a",
"failure",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2092-L2103 |
232,464 | nerdvegas/rez | src/rez/solver.py | Solver.get_graph | def get_graph(self):
"""Returns the most recent solve graph.
This gives a graph showing the latest state of the solve. The specific
graph returned depends on the solve status. When status is:
unsolved: latest unsolved graph is returned;
solved: final solved graph is returned;
... | python | def get_graph(self):
"""Returns the most recent solve graph.
This gives a graph showing the latest state of the solve. The specific
graph returned depends on the solve status. When status is:
unsolved: latest unsolved graph is returned;
solved: final solved graph is returned;
... | [
"def",
"get_graph",
"(",
"self",
")",
":",
"st",
"=",
"self",
".",
"status",
"if",
"st",
"in",
"(",
"SolverStatus",
".",
"solved",
",",
"SolverStatus",
".",
"unsolved",
")",
":",
"phase",
"=",
"self",
".",
"_latest_nonfailed_phase",
"(",
")",
"return",
... | Returns the most recent solve graph.
This gives a graph showing the latest state of the solve. The specific
graph returned depends on the solve status. When status is:
unsolved: latest unsolved graph is returned;
solved: final solved graph is returned;
failed: most appropria... | [
"Returns",
"the",
"most",
"recent",
"solve",
"graph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2105-L2123 |
232,465 | nerdvegas/rez | src/rez/solver.py | Solver.get_fail_graph | def get_fail_graph(self, failure_index=None):
"""Returns a graph showing a solve failure.
Args:
failure_index: See `failure_reason`
Returns:
A pygraph.digraph object.
"""
phase, _ = self._get_failed_phase(failure_index)
return phase.get_graph() | python | def get_fail_graph(self, failure_index=None):
"""Returns a graph showing a solve failure.
Args:
failure_index: See `failure_reason`
Returns:
A pygraph.digraph object.
"""
phase, _ = self._get_failed_phase(failure_index)
return phase.get_graph() | [
"def",
"get_fail_graph",
"(",
"self",
",",
"failure_index",
"=",
"None",
")",
":",
"phase",
",",
"_",
"=",
"self",
".",
"_get_failed_phase",
"(",
"failure_index",
")",
"return",
"phase",
".",
"get_graph",
"(",
")"
] | Returns a graph showing a solve failure.
Args:
failure_index: See `failure_reason`
Returns:
A pygraph.digraph object. | [
"Returns",
"a",
"graph",
"showing",
"a",
"solve",
"failure",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2125-L2135 |
232,466 | nerdvegas/rez | src/rez/solver.py | Solver.dump | def dump(self):
"""Print a formatted summary of the current solve state."""
from rez.utils.formatting import columnise
rows = []
for i, phase in enumerate(self.phase_stack):
rows.append((self._depth_label(i), phase.status, str(phase)))
print "status: %s (%s)" % (sel... | python | def dump(self):
"""Print a formatted summary of the current solve state."""
from rez.utils.formatting import columnise
rows = []
for i, phase in enumerate(self.phase_stack):
rows.append((self._depth_label(i), phase.status, str(phase)))
print "status: %s (%s)" % (sel... | [
"def",
"dump",
"(",
"self",
")",
":",
"from",
"rez",
".",
"utils",
".",
"formatting",
"import",
"columnise",
"rows",
"=",
"[",
"]",
"for",
"i",
",",
"phase",
"in",
"enumerate",
"(",
"self",
".",
"phase_stack",
")",
":",
"rows",
".",
"append",
"(",
... | Print a formatted summary of the current solve state. | [
"Print",
"a",
"formatted",
"summary",
"of",
"the",
"current",
"solve",
"state",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2137-L2157 |
232,467 | nerdvegas/rez | src/rez/utils/filesystem.py | make_path_writable | def make_path_writable(path):
"""Temporarily make `path` writable, if possible.
Does nothing if:
- config setting 'make_package_temporarily_writable' is False;
- this can't be done (eg we don't own `path`).
Args:
path (str): Path to make temporarily writable
"""
from rez.co... | python | def make_path_writable(path):
"""Temporarily make `path` writable, if possible.
Does nothing if:
- config setting 'make_package_temporarily_writable' is False;
- this can't be done (eg we don't own `path`).
Args:
path (str): Path to make temporarily writable
"""
from rez.co... | [
"def",
"make_path_writable",
"(",
"path",
")",
":",
"from",
"rez",
".",
"config",
"import",
"config",
"try",
":",
"orig_mode",
"=",
"os",
".",
"stat",
"(",
"path",
")",
".",
"st_mode",
"new_mode",
"=",
"orig_mode",
"if",
"config",
".",
"make_package_tempor... | Temporarily make `path` writable, if possible.
Does nothing if:
- config setting 'make_package_temporarily_writable' is False;
- this can't be done (eg we don't own `path`).
Args:
path (str): Path to make temporarily writable | [
"Temporarily",
"make",
"path",
"writable",
"if",
"possible",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L76-L112 |
232,468 | nerdvegas/rez | src/rez/utils/filesystem.py | get_existing_path | def get_existing_path(path, topmost_path=None):
"""Get the longest parent path in `path` that exists.
If `path` exists, it is returned.
Args:
path (str): Path to test
topmost_path (str): Do not test this path or above
Returns:
str: Existing path, or None if no path was found.
... | python | def get_existing_path(path, topmost_path=None):
"""Get the longest parent path in `path` that exists.
If `path` exists, it is returned.
Args:
path (str): Path to test
topmost_path (str): Do not test this path or above
Returns:
str: Existing path, or None if no path was found.
... | [
"def",
"get_existing_path",
"(",
"path",
",",
"topmost_path",
"=",
"None",
")",
":",
"prev_path",
"=",
"None",
"if",
"topmost_path",
":",
"topmost_path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"topmost_path",
")",
"while",
"True",
":",
"if",
"os",
... | Get the longest parent path in `path` that exists.
If `path` exists, it is returned.
Args:
path (str): Path to test
topmost_path (str): Do not test this path or above
Returns:
str: Existing path, or None if no path was found. | [
"Get",
"the",
"longest",
"parent",
"path",
"in",
"path",
"that",
"exists",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L126-L154 |
232,469 | nerdvegas/rez | src/rez/utils/filesystem.py | safe_makedirs | def safe_makedirs(path):
"""Safe makedirs.
Works in a multithreaded scenario.
"""
if not os.path.exists(path):
try:
os.makedirs(path)
except OSError:
if not os.path.exists(path):
raise | python | def safe_makedirs(path):
"""Safe makedirs.
Works in a multithreaded scenario.
"""
if not os.path.exists(path):
try:
os.makedirs(path)
except OSError:
if not os.path.exists(path):
raise | [
"def",
"safe_makedirs",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"("... | Safe makedirs.
Works in a multithreaded scenario. | [
"Safe",
"makedirs",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L157-L167 |
232,470 | nerdvegas/rez | src/rez/utils/filesystem.py | safe_remove | def safe_remove(path):
"""Safely remove the given file or directory.
Works in a multithreaded scenario.
"""
if not os.path.exists(path):
return
try:
if os.path.isdir(path) and not os.path.islink(path):
shutil.rmtree(path)
else:
os.remove(path)
ex... | python | def safe_remove(path):
"""Safely remove the given file or directory.
Works in a multithreaded scenario.
"""
if not os.path.exists(path):
return
try:
if os.path.isdir(path) and not os.path.islink(path):
shutil.rmtree(path)
else:
os.remove(path)
ex... | [
"def",
"safe_remove",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"try",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
"and",
"not",
"os",
".",
"path",
".",
"islink",
"(... | Safely remove the given file or directory.
Works in a multithreaded scenario. | [
"Safely",
"remove",
"the",
"given",
"file",
"or",
"directory",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L170-L185 |
232,471 | nerdvegas/rez | src/rez/utils/filesystem.py | replacing_symlink | def replacing_symlink(source, link_name):
"""Create symlink that overwrites any existing target.
"""
with make_tmp_name(link_name) as tmp_link_name:
os.symlink(source, tmp_link_name)
replace_file_or_dir(link_name, tmp_link_name) | python | def replacing_symlink(source, link_name):
"""Create symlink that overwrites any existing target.
"""
with make_tmp_name(link_name) as tmp_link_name:
os.symlink(source, tmp_link_name)
replace_file_or_dir(link_name, tmp_link_name) | [
"def",
"replacing_symlink",
"(",
"source",
",",
"link_name",
")",
":",
"with",
"make_tmp_name",
"(",
"link_name",
")",
"as",
"tmp_link_name",
":",
"os",
".",
"symlink",
"(",
"source",
",",
"tmp_link_name",
")",
"replace_file_or_dir",
"(",
"link_name",
",",
"tm... | Create symlink that overwrites any existing target. | [
"Create",
"symlink",
"that",
"overwrites",
"any",
"existing",
"target",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L188-L193 |
232,472 | nerdvegas/rez | src/rez/utils/filesystem.py | replacing_copy | def replacing_copy(src, dest, follow_symlinks=False):
"""Perform copy that overwrites any existing target.
Will copy/copytree `src` to `dest`, and will remove `dest` if it exists,
regardless of what it is.
If `follow_symlinks` is False, symlinks are preserved, otherwise their
contents are copied.
... | python | def replacing_copy(src, dest, follow_symlinks=False):
"""Perform copy that overwrites any existing target.
Will copy/copytree `src` to `dest`, and will remove `dest` if it exists,
regardless of what it is.
If `follow_symlinks` is False, symlinks are preserved, otherwise their
contents are copied.
... | [
"def",
"replacing_copy",
"(",
"src",
",",
"dest",
",",
"follow_symlinks",
"=",
"False",
")",
":",
"with",
"make_tmp_name",
"(",
"dest",
")",
"as",
"tmp_dest",
":",
"if",
"os",
".",
"path",
".",
"islink",
"(",
"src",
")",
"and",
"not",
"follow_symlinks",
... | Perform copy that overwrites any existing target.
Will copy/copytree `src` to `dest`, and will remove `dest` if it exists,
regardless of what it is.
If `follow_symlinks` is False, symlinks are preserved, otherwise their
contents are copied.
Note that this behavior is different to `shutil.copy`, w... | [
"Perform",
"copy",
"that",
"overwrites",
"any",
"existing",
"target",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L196-L220 |
232,473 | nerdvegas/rez | src/rez/utils/filesystem.py | replace_file_or_dir | def replace_file_or_dir(dest, source):
"""Replace `dest` with `source`.
Acts like an `os.rename` if `dest` does not exist. Otherwise, `dest` is
deleted and `src` is renamed to `dest`.
"""
from rez.vendor.atomicwrites import replace_atomic
if not os.path.exists(dest):
try:
o... | python | def replace_file_or_dir(dest, source):
"""Replace `dest` with `source`.
Acts like an `os.rename` if `dest` does not exist. Otherwise, `dest` is
deleted and `src` is renamed to `dest`.
"""
from rez.vendor.atomicwrites import replace_atomic
if not os.path.exists(dest):
try:
o... | [
"def",
"replace_file_or_dir",
"(",
"dest",
",",
"source",
")",
":",
"from",
"rez",
".",
"vendor",
".",
"atomicwrites",
"import",
"replace_atomic",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":",
"try",
":",
"os",
".",
"rename",
"(... | Replace `dest` with `source`.
Acts like an `os.rename` if `dest` does not exist. Otherwise, `dest` is
deleted and `src` is renamed to `dest`. | [
"Replace",
"dest",
"with",
"source",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L223-L247 |
232,474 | nerdvegas/rez | src/rez/utils/filesystem.py | make_tmp_name | def make_tmp_name(name):
"""Generates a tmp name for a file or dir.
This is a tempname that sits in the same dir as `name`. If it exists on
disk at context exit time, it is deleted.
"""
path, base = os.path.split(name)
tmp_base = ".tmp-%s-%s" % (base, uuid4().hex)
tmp_name = os.path.join(pa... | python | def make_tmp_name(name):
"""Generates a tmp name for a file or dir.
This is a tempname that sits in the same dir as `name`. If it exists on
disk at context exit time, it is deleted.
"""
path, base = os.path.split(name)
tmp_base = ".tmp-%s-%s" % (base, uuid4().hex)
tmp_name = os.path.join(pa... | [
"def",
"make_tmp_name",
"(",
"name",
")",
":",
"path",
",",
"base",
"=",
"os",
".",
"path",
".",
"split",
"(",
"name",
")",
"tmp_base",
"=",
"\".tmp-%s-%s\"",
"%",
"(",
"base",
",",
"uuid4",
"(",
")",
".",
"hex",
")",
"tmp_name",
"=",
"os",
".",
... | Generates a tmp name for a file or dir.
This is a tempname that sits in the same dir as `name`. If it exists on
disk at context exit time, it is deleted. | [
"Generates",
"a",
"tmp",
"name",
"for",
"a",
"file",
"or",
"dir",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L267-L280 |
232,475 | nerdvegas/rez | src/rez/utils/filesystem.py | is_subdirectory | def is_subdirectory(path_a, path_b):
"""Returns True if `path_a` is a subdirectory of `path_b`."""
path_a = os.path.realpath(path_a)
path_b = os.path.realpath(path_b)
relative = os.path.relpath(path_a, path_b)
return (not relative.startswith(os.pardir + os.sep)) | python | def is_subdirectory(path_a, path_b):
"""Returns True if `path_a` is a subdirectory of `path_b`."""
path_a = os.path.realpath(path_a)
path_b = os.path.realpath(path_b)
relative = os.path.relpath(path_a, path_b)
return (not relative.startswith(os.pardir + os.sep)) | [
"def",
"is_subdirectory",
"(",
"path_a",
",",
"path_b",
")",
":",
"path_a",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path_a",
")",
"path_b",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path_b",
")",
"relative",
"=",
"os",
".",
"path",
".",
... | Returns True if `path_a` is a subdirectory of `path_b`. | [
"Returns",
"True",
"if",
"path_a",
"is",
"a",
"subdirectory",
"of",
"path_b",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L283-L288 |
232,476 | nerdvegas/rez | src/rez/utils/filesystem.py | find_matching_symlink | def find_matching_symlink(path, source):
"""Find a symlink under `path` that points at `source`.
If source is relative, it is considered relative to `path`.
Returns:
str: Name of symlink found, or None.
"""
def to_abs(target):
if os.path.isabs(target):
return target
... | python | def find_matching_symlink(path, source):
"""Find a symlink under `path` that points at `source`.
If source is relative, it is considered relative to `path`.
Returns:
str: Name of symlink found, or None.
"""
def to_abs(target):
if os.path.isabs(target):
return target
... | [
"def",
"find_matching_symlink",
"(",
"path",
",",
"source",
")",
":",
"def",
"to_abs",
"(",
"target",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"target",
")",
":",
"return",
"target",
"else",
":",
"return",
"os",
".",
"path",
".",
"normpa... | Find a symlink under `path` that points at `source`.
If source is relative, it is considered relative to `path`.
Returns:
str: Name of symlink found, or None. | [
"Find",
"a",
"symlink",
"under",
"path",
"that",
"points",
"at",
"source",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L291-L314 |
232,477 | nerdvegas/rez | src/rez/utils/filesystem.py | copy_or_replace | def copy_or_replace(src, dst):
'''try to copy with mode, and if it fails, try replacing
'''
try:
shutil.copy(src, dst)
except (OSError, IOError), e:
# It's possible that the file existed, but was owned by someone
# else - in that situation, shutil.copy might then fail when it
... | python | def copy_or_replace(src, dst):
'''try to copy with mode, and if it fails, try replacing
'''
try:
shutil.copy(src, dst)
except (OSError, IOError), e:
# It's possible that the file existed, but was owned by someone
# else - in that situation, shutil.copy might then fail when it
... | [
"def",
"copy_or_replace",
"(",
"src",
",",
"dst",
")",
":",
"try",
":",
"shutil",
".",
"copy",
"(",
"src",
",",
"dst",
")",
"except",
"(",
"OSError",
",",
"IOError",
")",
",",
"e",
":",
"# It's possible that the file existed, but was owned by someone",
"# else... | try to copy with mode, and if it fails, try replacing | [
"try",
"to",
"copy",
"with",
"mode",
"and",
"if",
"it",
"fails",
"try",
"replacing"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L317-L347 |
232,478 | nerdvegas/rez | src/rez/utils/filesystem.py | movetree | def movetree(src, dst):
"""Attempts a move, and falls back to a copy+delete if this fails
"""
try:
shutil.move(src, dst)
except:
copytree(src, dst, symlinks=True, hardlinks=True)
shutil.rmtree(src) | python | def movetree(src, dst):
"""Attempts a move, and falls back to a copy+delete if this fails
"""
try:
shutil.move(src, dst)
except:
copytree(src, dst, symlinks=True, hardlinks=True)
shutil.rmtree(src) | [
"def",
"movetree",
"(",
"src",
",",
"dst",
")",
":",
"try",
":",
"shutil",
".",
"move",
"(",
"src",
",",
"dst",
")",
"except",
":",
"copytree",
"(",
"src",
",",
"dst",
",",
"symlinks",
"=",
"True",
",",
"hardlinks",
"=",
"True",
")",
"shutil",
".... | Attempts a move, and falls back to a copy+delete if this fails | [
"Attempts",
"a",
"move",
"and",
"falls",
"back",
"to",
"a",
"copy",
"+",
"delete",
"if",
"this",
"fails"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L404-L411 |
232,479 | nerdvegas/rez | src/rez/utils/filesystem.py | safe_chmod | def safe_chmod(path, mode):
"""Set the permissions mode on path, but only if it differs from the current mode.
"""
if stat.S_IMODE(os.stat(path).st_mode) != mode:
os.chmod(path, mode) | python | def safe_chmod(path, mode):
"""Set the permissions mode on path, but only if it differs from the current mode.
"""
if stat.S_IMODE(os.stat(path).st_mode) != mode:
os.chmod(path, mode) | [
"def",
"safe_chmod",
"(",
"path",
",",
"mode",
")",
":",
"if",
"stat",
".",
"S_IMODE",
"(",
"os",
".",
"stat",
"(",
"path",
")",
".",
"st_mode",
")",
"!=",
"mode",
":",
"os",
".",
"chmod",
"(",
"path",
",",
"mode",
")"
] | Set the permissions mode on path, but only if it differs from the current mode. | [
"Set",
"the",
"permissions",
"mode",
"on",
"path",
"but",
"only",
"if",
"it",
"differs",
"from",
"the",
"current",
"mode",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L414-L418 |
232,480 | nerdvegas/rez | src/rez/utils/filesystem.py | encode_filesystem_name | def encode_filesystem_name(input_str):
"""Encodes an arbitrary unicode string to a generic filesystem-compatible
non-unicode filename.
The result after encoding will only contain the standard ascii lowercase
letters (a-z), the digits (0-9), or periods, underscores, or dashes
(".", "_", or "-"). No... | python | def encode_filesystem_name(input_str):
"""Encodes an arbitrary unicode string to a generic filesystem-compatible
non-unicode filename.
The result after encoding will only contain the standard ascii lowercase
letters (a-z), the digits (0-9), or periods, underscores, or dashes
(".", "_", or "-"). No... | [
"def",
"encode_filesystem_name",
"(",
"input_str",
")",
":",
"if",
"isinstance",
"(",
"input_str",
",",
"str",
")",
":",
"input_str",
"=",
"unicode",
"(",
"input_str",
")",
"elif",
"not",
"isinstance",
"(",
"input_str",
",",
"unicode",
")",
":",
"raise",
"... | Encodes an arbitrary unicode string to a generic filesystem-compatible
non-unicode filename.
The result after encoding will only contain the standard ascii lowercase
letters (a-z), the digits (0-9), or periods, underscores, or dashes
(".", "_", or "-"). No uppercase letters will be used, for
comap... | [
"Encodes",
"an",
"arbitrary",
"unicode",
"string",
"to",
"a",
"generic",
"filesystem",
"-",
"compatible",
"non",
"-",
"unicode",
"filename",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L433-L499 |
232,481 | nerdvegas/rez | src/rez/utils/filesystem.py | decode_filesystem_name | def decode_filesystem_name(filename):
"""Decodes a filename encoded using the rules given in encode_filesystem_name
to a unicode string.
"""
result = []
remain = filename
i = 0
while remain:
# use match, to ensure it matches from the start of the string...
match = _FILESYSTEM... | python | def decode_filesystem_name(filename):
"""Decodes a filename encoded using the rules given in encode_filesystem_name
to a unicode string.
"""
result = []
remain = filename
i = 0
while remain:
# use match, to ensure it matches from the start of the string...
match = _FILESYSTEM... | [
"def",
"decode_filesystem_name",
"(",
"filename",
")",
":",
"result",
"=",
"[",
"]",
"remain",
"=",
"filename",
"i",
"=",
"0",
"while",
"remain",
":",
"# use match, to ensure it matches from the start of the string...",
"match",
"=",
"_FILESYSTEM_TOKEN_RE",
".",
"matc... | Decodes a filename encoded using the rules given in encode_filesystem_name
to a unicode string. | [
"Decodes",
"a",
"filename",
"encoded",
"using",
"the",
"rules",
"given",
"in",
"encode_filesystem_name",
"to",
"a",
"unicode",
"string",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L506-L555 |
232,482 | nerdvegas/rez | src/rez/utils/filesystem.py | walk_up_dirs | def walk_up_dirs(path):
"""Yields absolute directories starting with the given path, and iterating
up through all it's parents, until it reaches a root directory"""
prev_path = None
current_path = os.path.abspath(path)
while current_path != prev_path:
yield current_path
prev_path = c... | python | def walk_up_dirs(path):
"""Yields absolute directories starting with the given path, and iterating
up through all it's parents, until it reaches a root directory"""
prev_path = None
current_path = os.path.abspath(path)
while current_path != prev_path:
yield current_path
prev_path = c... | [
"def",
"walk_up_dirs",
"(",
"path",
")",
":",
"prev_path",
"=",
"None",
"current_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"while",
"current_path",
"!=",
"prev_path",
":",
"yield",
"current_path",
"prev_path",
"=",
"current_path",
"cur... | Yields absolute directories starting with the given path, and iterating
up through all it's parents, until it reaches a root directory | [
"Yields",
"absolute",
"directories",
"starting",
"with",
"the",
"given",
"path",
"and",
"iterating",
"up",
"through",
"all",
"it",
"s",
"parents",
"until",
"it",
"reaches",
"a",
"root",
"directory"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L575-L583 |
232,483 | nerdvegas/rez | src/rez/wrapper.py | Wrapper.run | def run(self, *args):
"""Invoke the wrapped script.
Returns:
Return code of the command, or 0 if the command is not run.
"""
if self.prefix_char is None:
prefix_char = config.suite_alias_prefix_char
else:
prefix_char = self.prefix_char
... | python | def run(self, *args):
"""Invoke the wrapped script.
Returns:
Return code of the command, or 0 if the command is not run.
"""
if self.prefix_char is None:
prefix_char = config.suite_alias_prefix_char
else:
prefix_char = self.prefix_char
... | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"prefix_char",
"is",
"None",
":",
"prefix_char",
"=",
"config",
".",
"suite_alias_prefix_char",
"else",
":",
"prefix_char",
"=",
"self",
".",
"prefix_char",
"if",
"prefix_char",
"=="... | Invoke the wrapped script.
Returns:
Return code of the command, or 0 if the command is not run. | [
"Invoke",
"the",
"wrapped",
"script",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/wrapper.py#L66-L81 |
232,484 | nerdvegas/rez | src/rez/wrapper.py | Wrapper.print_about | def print_about(self):
"""Print an info message about the tool."""
filepath = os.path.join(self.suite_path, "bin", self.tool_name)
print "Tool: %s" % self.tool_name
print "Path: %s" % filepath
print "Suite: %s" % self.suite_path
msg = "%s (%r)" % (self.context... | python | def print_about(self):
"""Print an info message about the tool."""
filepath = os.path.join(self.suite_path, "bin", self.tool_name)
print "Tool: %s" % self.tool_name
print "Path: %s" % filepath
print "Suite: %s" % self.suite_path
msg = "%s (%r)" % (self.context... | [
"def",
"print_about",
"(",
"self",
")",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"suite_path",
",",
"\"bin\"",
",",
"self",
".",
"tool_name",
")",
"print",
"\"Tool: %s\"",
"%",
"self",
".",
"tool_name",
"print",
"\"Path... | Print an info message about the tool. | [
"Print",
"an",
"info",
"message",
"about",
"the",
"tool",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/wrapper.py#L202-L219 |
232,485 | nerdvegas/rez | src/rez/wrapper.py | Wrapper.print_package_versions | def print_package_versions(self):
"""Print a list of versions of the package this tool comes from, and
indicate which version this tool is from."""
variants = self.context.get_tool_variants(self.tool_name)
if variants:
if len(variants) > 1:
self._print_conflic... | python | def print_package_versions(self):
"""Print a list of versions of the package this tool comes from, and
indicate which version this tool is from."""
variants = self.context.get_tool_variants(self.tool_name)
if variants:
if len(variants) > 1:
self._print_conflic... | [
"def",
"print_package_versions",
"(",
"self",
")",
":",
"variants",
"=",
"self",
".",
"context",
".",
"get_tool_variants",
"(",
"self",
".",
"tool_name",
")",
"if",
"variants",
":",
"if",
"len",
"(",
"variants",
")",
">",
"1",
":",
"self",
".",
"_print_c... | Print a list of versions of the package this tool comes from, and
indicate which version this tool is from. | [
"Print",
"a",
"list",
"of",
"versions",
"of",
"the",
"package",
"this",
"tool",
"comes",
"from",
"and",
"indicate",
"which",
"version",
"this",
"tool",
"is",
"from",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/wrapper.py#L221-L251 |
232,486 | nerdvegas/rez | src/rez/vendor/pygraph/algorithms/generators.py | generate_hypergraph | def generate_hypergraph(num_nodes, num_edges, r = 0):
"""
Create a random hyper graph.
@type num_nodes: number
@param num_nodes: Number of nodes.
@type num_edges: number
@param num_edges: Number of edges.
@type r: number
@param r: Uniform edges of size r.
"""
# ... | python | def generate_hypergraph(num_nodes, num_edges, r = 0):
"""
Create a random hyper graph.
@type num_nodes: number
@param num_nodes: Number of nodes.
@type num_edges: number
@param num_edges: Number of edges.
@type r: number
@param r: Uniform edges of size r.
"""
# ... | [
"def",
"generate_hypergraph",
"(",
"num_nodes",
",",
"num_edges",
",",
"r",
"=",
"0",
")",
":",
"# Graph creation",
"random_graph",
"=",
"hypergraph",
"(",
")",
"# Nodes",
"nodes",
"=",
"list",
"(",
"map",
"(",
"str",
",",
"list",
"(",
"range",
"(",
"num... | Create a random hyper graph.
@type num_nodes: number
@param num_nodes: Number of nodes.
@type num_edges: number
@param num_edges: Number of edges.
@type r: number
@param r: Uniform edges of size r. | [
"Create",
"a",
"random",
"hyper",
"graph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/generators.py#L90-L132 |
232,487 | nerdvegas/rez | src/rez/bind/_utils.py | check_version | def check_version(version, range_=None):
"""Check that the found software version is within supplied range.
Args:
version: Version of the package as a Version object.
range_: Allowable version range as a VersionRange object.
"""
if range_ and version not in range_:
raise RezBind... | python | def check_version(version, range_=None):
"""Check that the found software version is within supplied range.
Args:
version: Version of the package as a Version object.
range_: Allowable version range as a VersionRange object.
"""
if range_ and version not in range_:
raise RezBind... | [
"def",
"check_version",
"(",
"version",
",",
"range_",
"=",
"None",
")",
":",
"if",
"range_",
"and",
"version",
"not",
"in",
"range_",
":",
"raise",
"RezBindError",
"(",
"\"found version %s is not within range %s\"",
"%",
"(",
"str",
"(",
"version",
")",
",",
... | Check that the found software version is within supplied range.
Args:
version: Version of the package as a Version object.
range_: Allowable version range as a VersionRange object. | [
"Check",
"that",
"the",
"found",
"software",
"version",
"is",
"within",
"supplied",
"range",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/bind/_utils.py#L45-L54 |
232,488 | nerdvegas/rez | src/rez/bind/_utils.py | extract_version | def extract_version(exepath, version_arg, word_index=-1, version_rank=3):
"""Run an executable and get the program version.
Args:
exepath: Filepath to executable.
version_arg: Arg to pass to program, eg "-V". Can also be a list.
word_index: Expect the Nth word of output to be the versio... | python | def extract_version(exepath, version_arg, word_index=-1, version_rank=3):
"""Run an executable and get the program version.
Args:
exepath: Filepath to executable.
version_arg: Arg to pass to program, eg "-V". Can also be a list.
word_index: Expect the Nth word of output to be the versio... | [
"def",
"extract_version",
"(",
"exepath",
",",
"version_arg",
",",
"word_index",
"=",
"-",
"1",
",",
"version_rank",
"=",
"3",
")",
":",
"if",
"isinstance",
"(",
"version_arg",
",",
"basestring",
")",
":",
"version_arg",
"=",
"[",
"version_arg",
"]",
"args... | Run an executable and get the program version.
Args:
exepath: Filepath to executable.
version_arg: Arg to pass to program, eg "-V". Can also be a list.
word_index: Expect the Nth word of output to be the version.
version_rank: Cap the version to this many tokens.
Returns:
... | [
"Run",
"an",
"executable",
"and",
"get",
"the",
"program",
"version",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/bind/_utils.py#L80-L114 |
232,489 | nerdvegas/rez | src/rez/vendor/version/requirement.py | VersionedObject.construct | def construct(cls, name, version=None):
"""Create a VersionedObject directly from an object name and version.
Args:
name: Object name string.
version: Version object.
"""
other = VersionedObject(None)
other.name_ = name
other.version_ = Version() ... | python | def construct(cls, name, version=None):
"""Create a VersionedObject directly from an object name and version.
Args:
name: Object name string.
version: Version object.
"""
other = VersionedObject(None)
other.name_ = name
other.version_ = Version() ... | [
"def",
"construct",
"(",
"cls",
",",
"name",
",",
"version",
"=",
"None",
")",
":",
"other",
"=",
"VersionedObject",
"(",
"None",
")",
"other",
".",
"name_",
"=",
"name",
"other",
".",
"version_",
"=",
"Version",
"(",
")",
"if",
"version",
"is",
"Non... | Create a VersionedObject directly from an object name and version.
Args:
name: Object name string.
version: Version object. | [
"Create",
"a",
"VersionedObject",
"directly",
"from",
"an",
"object",
"name",
"and",
"version",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L37-L47 |
232,490 | nerdvegas/rez | src/rez/vendor/version/requirement.py | Requirement.construct | def construct(cls, name, range=None):
"""Create a requirement directly from an object name and VersionRange.
Args:
name: Object name string.
range: VersionRange object. If None, an unversioned requirement is
created.
"""
other = Requirement(None)
... | python | def construct(cls, name, range=None):
"""Create a requirement directly from an object name and VersionRange.
Args:
name: Object name string.
range: VersionRange object. If None, an unversioned requirement is
created.
"""
other = Requirement(None)
... | [
"def",
"construct",
"(",
"cls",
",",
"name",
",",
"range",
"=",
"None",
")",
":",
"other",
"=",
"Requirement",
"(",
"None",
")",
"other",
".",
"name_",
"=",
"name",
"other",
".",
"range_",
"=",
"VersionRange",
"(",
")",
"if",
"range",
"is",
"None",
... | Create a requirement directly from an object name and VersionRange.
Args:
name: Object name string.
range: VersionRange object. If None, an unversioned requirement is
created. | [
"Create",
"a",
"requirement",
"directly",
"from",
"an",
"object",
"name",
"and",
"VersionRange",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L152-L163 |
232,491 | nerdvegas/rez | src/rez/vendor/version/requirement.py | Requirement.conflicts_with | def conflicts_with(self, other):
"""Returns True if this requirement conflicts with another `Requirement`
or `VersionedObject`."""
if isinstance(other, Requirement):
if (self.name_ != other.name_) or (self.range is None) \
or (other.range is None):
... | python | def conflicts_with(self, other):
"""Returns True if this requirement conflicts with another `Requirement`
or `VersionedObject`."""
if isinstance(other, Requirement):
if (self.name_ != other.name_) or (self.range is None) \
or (other.range is None):
... | [
"def",
"conflicts_with",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"Requirement",
")",
":",
"if",
"(",
"self",
".",
"name_",
"!=",
"other",
".",
"name_",
")",
"or",
"(",
"self",
".",
"range",
"is",
"None",
")",
"or... | Returns True if this requirement conflicts with another `Requirement`
or `VersionedObject`. | [
"Returns",
"True",
"if",
"this",
"requirement",
"conflicts",
"with",
"another",
"Requirement",
"or",
"VersionedObject",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L196-L216 |
232,492 | nerdvegas/rez | src/rez/vendor/version/requirement.py | Requirement.merged | def merged(self, other):
"""Returns the merged result of two requirements.
Two requirements can be in conflict and if so, this function returns
None. For example, requests for "foo-4" and "foo-6" are in conflict,
since both cannot be satisfied with a single version of foo.
Some... | python | def merged(self, other):
"""Returns the merged result of two requirements.
Two requirements can be in conflict and if so, this function returns
None. For example, requests for "foo-4" and "foo-6" are in conflict,
since both cannot be satisfied with a single version of foo.
Some... | [
"def",
"merged",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"name_",
"!=",
"other",
".",
"name_",
":",
"return",
"None",
"# cannot merge across object names",
"def",
"_r",
"(",
"r_",
")",
":",
"r",
"=",
"Requirement",
"(",
"None",
")",
"r"... | Returns the merged result of two requirements.
Two requirements can be in conflict and if so, this function returns
None. For example, requests for "foo-4" and "foo-6" are in conflict,
since both cannot be satisfied with a single version of foo.
Some example successful requirements mer... | [
"Returns",
"the",
"merged",
"result",
"of",
"two",
"requirements",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/version/requirement.py#L218-L275 |
232,493 | nerdvegas/rez | src/rez/utils/graph_utils.py | read_graph_from_string | def read_graph_from_string(txt):
"""Read a graph from a string, either in dot format, or our own
compressed format.
Returns:
`pygraph.digraph`: Graph object.
"""
if not txt.startswith('{'):
return read_dot(txt) # standard dot format
def conv(value):
if isinstance(value... | python | def read_graph_from_string(txt):
"""Read a graph from a string, either in dot format, or our own
compressed format.
Returns:
`pygraph.digraph`: Graph object.
"""
if not txt.startswith('{'):
return read_dot(txt) # standard dot format
def conv(value):
if isinstance(value... | [
"def",
"read_graph_from_string",
"(",
"txt",
")",
":",
"if",
"not",
"txt",
".",
"startswith",
"(",
"'{'",
")",
":",
"return",
"read_dot",
"(",
"txt",
")",
"# standard dot format",
"def",
"conv",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
"... | Read a graph from a string, either in dot format, or our own
compressed format.
Returns:
`pygraph.digraph`: Graph object. | [
"Read",
"a",
"graph",
"from",
"a",
"string",
"either",
"in",
"dot",
"format",
"or",
"our",
"own",
"compressed",
"format",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L20-L66 |
232,494 | nerdvegas/rez | src/rez/utils/graph_utils.py | write_compacted | def write_compacted(g):
"""Write a graph in our own compacted format.
Returns:
str.
"""
d_nodes = {}
d_edges = {}
def conv(value):
if isinstance(value, basestring):
return value.strip('"')
else:
return value
for node in g.nodes():
la... | python | def write_compacted(g):
"""Write a graph in our own compacted format.
Returns:
str.
"""
d_nodes = {}
d_edges = {}
def conv(value):
if isinstance(value, basestring):
return value.strip('"')
else:
return value
for node in g.nodes():
la... | [
"def",
"write_compacted",
"(",
"g",
")",
":",
"d_nodes",
"=",
"{",
"}",
"d_edges",
"=",
"{",
"}",
"def",
"conv",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"basestring",
")",
":",
"return",
"value",
".",
"strip",
"(",
"'\"'",
")... | Write a graph in our own compacted format.
Returns:
str. | [
"Write",
"a",
"graph",
"in",
"our",
"own",
"compacted",
"format",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L69-L106 |
232,495 | nerdvegas/rez | src/rez/utils/graph_utils.py | write_dot | def write_dot(g):
"""Replacement for pygraph.readwrite.dot.write, which is dog slow.
Note:
This isn't a general replacement. It will work for the graphs that
Rez generates, but there are no guarantees beyond that.
Args:
g (`pygraph.digraph`): Input graph.
Returns:
str:... | python | def write_dot(g):
"""Replacement for pygraph.readwrite.dot.write, which is dog slow.
Note:
This isn't a general replacement. It will work for the graphs that
Rez generates, but there are no guarantees beyond that.
Args:
g (`pygraph.digraph`): Input graph.
Returns:
str:... | [
"def",
"write_dot",
"(",
"g",
")",
":",
"lines",
"=",
"[",
"\"digraph g {\"",
"]",
"def",
"attrs_txt",
"(",
"items",
")",
":",
"if",
"items",
":",
"txt",
"=",
"\", \"",
".",
"join",
"(",
"(",
"'%s=\"%s\"'",
"%",
"(",
"k",
",",
"str",
"(",
"v",
")... | Replacement for pygraph.readwrite.dot.write, which is dog slow.
Note:
This isn't a general replacement. It will work for the graphs that
Rez generates, but there are no guarantees beyond that.
Args:
g (`pygraph.digraph`): Input graph.
Returns:
str: Graph in dot format. | [
"Replacement",
"for",
"pygraph",
".",
"readwrite",
".",
"dot",
".",
"write",
"which",
"is",
"dog",
"slow",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L109-L150 |
232,496 | nerdvegas/rez | src/rez/utils/graph_utils.py | prune_graph | def prune_graph(graph_str, package_name):
"""Prune a package graph so it only contains nodes accessible from the
given package.
Args:
graph_str (str): Dot-language graph string.
package_name (str): Name of package of interest.
Returns:
Pruned graph, as a string.
"""
# f... | python | def prune_graph(graph_str, package_name):
"""Prune a package graph so it only contains nodes accessible from the
given package.
Args:
graph_str (str): Dot-language graph string.
package_name (str): Name of package of interest.
Returns:
Pruned graph, as a string.
"""
# f... | [
"def",
"prune_graph",
"(",
"graph_str",
",",
"package_name",
")",
":",
"# find nodes of interest",
"g",
"=",
"read_dot",
"(",
"graph_str",
")",
"nodes",
"=",
"set",
"(",
")",
"for",
"node",
",",
"attrs",
"in",
"g",
".",
"node_attr",
".",
"iteritems",
"(",
... | Prune a package graph so it only contains nodes accessible from the
given package.
Args:
graph_str (str): Dot-language graph string.
package_name (str): Name of package of interest.
Returns:
Pruned graph, as a string. | [
"Prune",
"a",
"package",
"graph",
"so",
"it",
"only",
"contains",
"nodes",
"accessible",
"from",
"the",
"given",
"package",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L153-L198 |
232,497 | nerdvegas/rez | src/rez/utils/graph_utils.py | save_graph | def save_graph(graph_str, dest_file, fmt=None, image_ratio=None):
"""Render a graph to an image file.
Args:
graph_str (str): Dot-language graph string.
dest_file (str): Filepath to save the graph to.
fmt (str): Format, eg "png", "jpg".
image_ratio (float): Image ratio.
Retu... | python | def save_graph(graph_str, dest_file, fmt=None, image_ratio=None):
"""Render a graph to an image file.
Args:
graph_str (str): Dot-language graph string.
dest_file (str): Filepath to save the graph to.
fmt (str): Format, eg "png", "jpg".
image_ratio (float): Image ratio.
Retu... | [
"def",
"save_graph",
"(",
"graph_str",
",",
"dest_file",
",",
"fmt",
"=",
"None",
",",
"image_ratio",
"=",
"None",
")",
":",
"g",
"=",
"pydot",
".",
"graph_from_dot_data",
"(",
"graph_str",
")",
"# determine the dest format",
"if",
"fmt",
"is",
"None",
":",
... | Render a graph to an image file.
Args:
graph_str (str): Dot-language graph string.
dest_file (str): Filepath to save the graph to.
fmt (str): Format, eg "png", "jpg".
image_ratio (float): Image ratio.
Returns:
String representing format that was written, such as 'png'. | [
"Render",
"a",
"graph",
"to",
"an",
"image",
"file",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L201-L226 |
232,498 | nerdvegas/rez | src/rez/utils/graph_utils.py | view_graph | def view_graph(graph_str, dest_file=None):
"""View a dot graph in an image viewer."""
from rez.system import system
from rez.config import config
if (system.platform == "linux") and (not os.getenv("DISPLAY")):
print >> sys.stderr, "Unable to open display."
sys.exit(1)
dest_file = _... | python | def view_graph(graph_str, dest_file=None):
"""View a dot graph in an image viewer."""
from rez.system import system
from rez.config import config
if (system.platform == "linux") and (not os.getenv("DISPLAY")):
print >> sys.stderr, "Unable to open display."
sys.exit(1)
dest_file = _... | [
"def",
"view_graph",
"(",
"graph_str",
",",
"dest_file",
"=",
"None",
")",
":",
"from",
"rez",
".",
"system",
"import",
"system",
"from",
"rez",
".",
"config",
"import",
"config",
"if",
"(",
"system",
".",
"platform",
"==",
"\"linux\"",
")",
"and",
"(",
... | View a dot graph in an image viewer. | [
"View",
"a",
"dot",
"graph",
"in",
"an",
"image",
"viewer",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L229-L252 |
232,499 | nerdvegas/rez | src/rez/utils/platform_.py | Platform.physical_cores | def physical_cores(self):
"""Return the number of physical cpu cores on the system."""
try:
return self._physical_cores_base()
except Exception as e:
from rez.utils.logging_ import print_error
print_error("Error detecting physical core count, defaulting to 1: ... | python | def physical_cores(self):
"""Return the number of physical cpu cores on the system."""
try:
return self._physical_cores_base()
except Exception as e:
from rez.utils.logging_ import print_error
print_error("Error detecting physical core count, defaulting to 1: ... | [
"def",
"physical_cores",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_physical_cores_base",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"from",
"rez",
".",
"utils",
".",
"logging_",
"import",
"print_error",
"print_error",
"(",
"\"Error de... | Return the number of physical cpu cores on the system. | [
"Return",
"the",
"number",
"of",
"physical",
"cpu",
"cores",
"on",
"the",
"system",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/platform_.py#L82-L90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.