repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
nerdvegas/rez | src/rez/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 | train |
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 | train |
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",
")",
":",
"self",
".",
"sort_versions",
"(",
")",
"def",
"_split",
"(",
"i_entry",
",",
"n_variants",
",",
"common_fams",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"entries",
"[",
"i_entry",
"]",
".",
"split",
"(... | 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 | train |
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 | train |
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 | train |
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 | train |
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",
":",
"return",
"(",
"self",
",",
"[",
"]",
")",
"new_slice",
","... | 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 | train |
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 | train |
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 | train |
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 | train |
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",
":",
"return",
"SolverStatus",
".",
"fa... | 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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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",
":",
"import",
"errno",
"if",
"e",
".",
"errno",
"==",
"errno",
"... | 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 | train |
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 | train |
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 | train |
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 | train |
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",
":",
"match",
"=",
"_FILESYSTEM_TOKEN_RE",
".",
"match",
"(",
"remain",
")",
"if",
"not",
"match",
":",
"rai... | 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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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",
")",
":",
"random_graph",
"=",
"hypergraph",
"(",
")",
"nodes",
"=",
"list",
"(",
"map",
"(",
"str",
",",
"list",
"(",
"range",
"(",
"num_nodes",
")",
")",
")",
")"... | 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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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",
"def",
"_r",
"(",
"r_",
")",
":",
"r",
"=",
"Requirement",
"(",
"None",
")",
"r",
".",
"name_",
"=",
"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 | train |
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",
")",
"def",
"conv",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"basestring",
")",
... | 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 | train |
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 | train |
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 | train |
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",
")",
":",
"g",
"=",
"read_dot",
"(",
"graph_str",
")",
"nodes",
"=",
"set",
"(",
")",
"for",
"node",
",",
"attrs",
"in",
"g",
".",
"node_attr",
".",
"iteritems",
"(",
")",
":",
"attr",
"=",... | 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 | train |
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",
")",
"if",
"fmt",
"is",
"None",
":",
"fmt",
"=",
"os",
".",
... | 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 | train |
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 | train |
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 | train |
nerdvegas/rez | src/rez/utils/platform_.py | Platform.logical_cores | def logical_cores(self):
"""Return the number of cpu cores as reported to the os.
May be different from physical_cores if, ie, intel's hyperthreading is
enabled.
"""
try:
return self._logical_cores()
except Exception as e:
from rez.utils.logging_ ... | python | def logical_cores(self):
"""Return the number of cpu cores as reported to the os.
May be different from physical_cores if, ie, intel's hyperthreading is
enabled.
"""
try:
return self._logical_cores()
except Exception as e:
from rez.utils.logging_ ... | [
"def",
"logical_cores",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_logical_cores",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"from",
"rez",
".",
"utils",
".",
"logging_",
"import",
"print_error",
"print_error",
"(",
"\"Error detecting... | Return the number of cpu cores as reported to the os.
May be different from physical_cores if, ie, intel's hyperthreading is
enabled. | [
"Return",
"the",
"number",
"of",
"cpu",
"cores",
"as",
"reported",
"to",
"the",
"os",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/platform_.py#L93-L105 | train |
nerdvegas/rez | src/rez/vendor/colorama/ansitowin32.py | AnsiToWin32.write_and_convert | def write_and_convert(self, text):
'''
Write the given text to our wrapped stream, stripping any ANSI
sequences from the text, and optionally converting them into win32
calls.
'''
cursor = 0
for match in self.ANSI_RE.finditer(text):
start, end = match.... | python | def write_and_convert(self, text):
'''
Write the given text to our wrapped stream, stripping any ANSI
sequences from the text, and optionally converting them into win32
calls.
'''
cursor = 0
for match in self.ANSI_RE.finditer(text):
start, end = match.... | [
"def",
"write_and_convert",
"(",
"self",
",",
"text",
")",
":",
"cursor",
"=",
"0",
"for",
"match",
"in",
"self",
".",
"ANSI_RE",
".",
"finditer",
"(",
"text",
")",
":",
"start",
",",
"end",
"=",
"match",
".",
"span",
"(",
")",
"self",
".",
"write_... | Write the given text to our wrapped stream, stripping any ANSI
sequences from the text, and optionally converting them into win32
calls. | [
"Write",
"the",
"given",
"text",
"to",
"our",
"wrapped",
"stream",
"stripping",
"any",
"ANSI",
"sequences",
"from",
"the",
"text",
"and",
"optionally",
"converting",
"them",
"into",
"win32",
"calls",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/colorama/ansitowin32.py#L131-L143 | train |
nerdvegas/rez | src/rezgui/models/ContextModel.py | ContextModel.copy | def copy(self):
"""Returns a copy of the context."""
other = ContextModel(self._context, self.parent())
other._stale = self._stale
other._modified = self._modified
other.request = self.request[:]
other.packages_path = self.packages_path
other.implicit_packages = s... | python | def copy(self):
"""Returns a copy of the context."""
other = ContextModel(self._context, self.parent())
other._stale = self._stale
other._modified = self._modified
other.request = self.request[:]
other.packages_path = self.packages_path
other.implicit_packages = s... | [
"def",
"copy",
"(",
"self",
")",
":",
"other",
"=",
"ContextModel",
"(",
"self",
".",
"_context",
",",
"self",
".",
"parent",
"(",
")",
")",
"other",
".",
"_stale",
"=",
"self",
".",
"_stale",
"other",
".",
"_modified",
"=",
"self",
".",
"_modified",... | Returns a copy of the context. | [
"Returns",
"a",
"copy",
"of",
"the",
"context",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L51-L63 | train |
nerdvegas/rez | src/rezgui/models/ContextModel.py | ContextModel.get_lock_requests | def get_lock_requests(self):
"""Take the current context, and the current patch locks, and determine
the effective requests that will be added to the main request.
Returns:
A dict of (PatchLock, [Requirement]) tuples. Each requirement will be
a weak package reference. If... | python | def get_lock_requests(self):
"""Take the current context, and the current patch locks, and determine
the effective requests that will be added to the main request.
Returns:
A dict of (PatchLock, [Requirement]) tuples. Each requirement will be
a weak package reference. If... | [
"def",
"get_lock_requests",
"(",
"self",
")",
":",
"d",
"=",
"defaultdict",
"(",
"list",
")",
"if",
"self",
".",
"_context",
":",
"for",
"variant",
"in",
"self",
".",
"_context",
".",
"resolved_packages",
":",
"name",
"=",
"variant",
".",
"name",
"versio... | Take the current context, and the current patch locks, and determine
the effective requests that will be added to the main request.
Returns:
A dict of (PatchLock, [Requirement]) tuples. Each requirement will be
a weak package reference. If there is no current context, an empty
... | [
"Take",
"the",
"current",
"context",
"and",
"the",
"current",
"patch",
"locks",
"and",
"determine",
"the",
"effective",
"requests",
"that",
"will",
"be",
"added",
"to",
"the",
"main",
"request",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L113-L134 | train |
nerdvegas/rez | src/rezgui/models/ContextModel.py | ContextModel.resolve_context | def resolve_context(self, verbosity=0, max_fails=-1, timestamp=None,
callback=None, buf=None, package_load_callback=None):
"""Update the current context by performing a re-resolve.
The newly resolved context is only applied if it is a successful solve.
Returns:
... | python | def resolve_context(self, verbosity=0, max_fails=-1, timestamp=None,
callback=None, buf=None, package_load_callback=None):
"""Update the current context by performing a re-resolve.
The newly resolved context is only applied if it is a successful solve.
Returns:
... | [
"def",
"resolve_context",
"(",
"self",
",",
"verbosity",
"=",
"0",
",",
"max_fails",
"=",
"-",
"1",
",",
"timestamp",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"buf",
"=",
"None",
",",
"package_load_callback",
"=",
"None",
")",
":",
"package_filter... | Update the current context by performing a re-resolve.
The newly resolved context is only applied if it is a successful solve.
Returns:
`ResolvedContext` object, which may be a successful or failed solve. | [
"Update",
"the",
"current",
"context",
"by",
"performing",
"a",
"re",
"-",
"resolve",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L175-L203 | train |
nerdvegas/rez | src/rezgui/models/ContextModel.py | ContextModel.set_context | def set_context(self, context):
"""Replace the current context with another."""
self._set_context(context, emit=False)
self._modified = (not context.load_path)
self.dataChanged.emit(self.CONTEXT_CHANGED |
self.REQUEST_CHANGED |
... | python | def set_context(self, context):
"""Replace the current context with another."""
self._set_context(context, emit=False)
self._modified = (not context.load_path)
self.dataChanged.emit(self.CONTEXT_CHANGED |
self.REQUEST_CHANGED |
... | [
"def",
"set_context",
"(",
"self",
",",
"context",
")",
":",
"self",
".",
"_set_context",
"(",
"context",
",",
"emit",
"=",
"False",
")",
"self",
".",
"_modified",
"=",
"(",
"not",
"context",
".",
"load_path",
")",
"self",
".",
"dataChanged",
".",
"emi... | Replace the current context with another. | [
"Replace",
"the",
"current",
"context",
"with",
"another",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L214-L224 | train |
nerdvegas/rez | src/rez/vendor/distlib/util.py | get_resources_dests | def get_resources_dests(resources_root, rules):
"""Find destinations for resources files"""
def get_rel_path(base, path):
# normalizes and returns a lstripped-/-separated path
base = base.replace(os.path.sep, '/')
path = path.replace(os.path.sep, '/')
assert path.startswith(base... | python | def get_resources_dests(resources_root, rules):
"""Find destinations for resources files"""
def get_rel_path(base, path):
# normalizes and returns a lstripped-/-separated path
base = base.replace(os.path.sep, '/')
path = path.replace(os.path.sep, '/')
assert path.startswith(base... | [
"def",
"get_resources_dests",
"(",
"resources_root",
",",
"rules",
")",
":",
"def",
"get_rel_path",
"(",
"base",
",",
"path",
")",
":",
"base",
"=",
"base",
".",
"replace",
"(",
"os",
".",
"path",
".",
"sep",
",",
"'/'",
")",
"path",
"=",
"path",
"."... | Find destinations for resources files | [
"Find",
"destinations",
"for",
"resources",
"files"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/util.py#L123-L147 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/cycles.py | find_cycle | def find_cycle(graph):
"""
Find a cycle in the given graph.
This function will return a list of nodes which form a cycle in the graph or an empty list if
no cycle exists.
@type graph: graph, digraph
@param graph: Graph.
@rtype: list
@return: List of nodes.
"""
... | python | def find_cycle(graph):
"""
Find a cycle in the given graph.
This function will return a list of nodes which form a cycle in the graph or an empty list if
no cycle exists.
@type graph: graph, digraph
@param graph: Graph.
@rtype: list
@return: List of nodes.
"""
... | [
"def",
"find_cycle",
"(",
"graph",
")",
":",
"if",
"(",
"isinstance",
"(",
"graph",
",",
"graph_class",
")",
")",
":",
"directed",
"=",
"False",
"elif",
"(",
"isinstance",
"(",
"graph",
",",
"digraph_class",
")",
")",
":",
"directed",
"=",
"True",
"els... | Find a cycle in the given graph.
This function will return a list of nodes which form a cycle in the graph or an empty list if
no cycle exists.
@type graph: graph, digraph
@param graph: Graph.
@rtype: list
@return: List of nodes. | [
"Find",
"a",
"cycle",
"in",
"the",
"given",
"graph",
".",
"This",
"function",
"will",
"return",
"a",
"list",
"of",
"nodes",
"which",
"form",
"a",
"cycle",
"in",
"the",
"graph",
"or",
"an",
"empty",
"list",
"if",
"no",
"cycle",
"exists",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/cycles.py#L38-L108 | train |
nerdvegas/rez | src/rez/release_vcs.py | create_release_vcs | def create_release_vcs(path, vcs_name=None):
"""Return a new release VCS that can release from this source path."""
from rez.plugin_managers import plugin_manager
vcs_types = get_release_vcs_types()
if vcs_name:
if vcs_name not in vcs_types:
raise ReleaseVCSError("Unknown version con... | python | def create_release_vcs(path, vcs_name=None):
"""Return a new release VCS that can release from this source path."""
from rez.plugin_managers import plugin_manager
vcs_types = get_release_vcs_types()
if vcs_name:
if vcs_name not in vcs_types:
raise ReleaseVCSError("Unknown version con... | [
"def",
"create_release_vcs",
"(",
"path",
",",
"vcs_name",
"=",
"None",
")",
":",
"from",
"rez",
".",
"plugin_managers",
"import",
"plugin_manager",
"vcs_types",
"=",
"get_release_vcs_types",
"(",
")",
"if",
"vcs_name",
":",
"if",
"vcs_name",
"not",
"in",
"vcs... | Return a new release VCS that can release from this source path. | [
"Return",
"a",
"new",
"release",
"VCS",
"that",
"can",
"release",
"from",
"this",
"source",
"path",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_vcs.py#L17-L61 | train |
nerdvegas/rez | src/rez/release_vcs.py | ReleaseVCS.find_vcs_root | def find_vcs_root(cls, path):
"""Try to find a version control root directory of this type for the
given path.
If successful, returns (vcs_root, levels_up), where vcs_root is the
path to the version control root directory it found, and levels_up is an
integer indicating how many... | python | def find_vcs_root(cls, path):
"""Try to find a version control root directory of this type for the
given path.
If successful, returns (vcs_root, levels_up), where vcs_root is the
path to the version control root directory it found, and levels_up is an
integer indicating how many... | [
"def",
"find_vcs_root",
"(",
"cls",
",",
"path",
")",
":",
"if",
"cls",
".",
"search_parents_for_root",
"(",
")",
":",
"valid_dirs",
"=",
"walk_up_dirs",
"(",
"path",
")",
"else",
":",
"valid_dirs",
"=",
"[",
"path",
"]",
"for",
"i",
",",
"current_path",... | Try to find a version control root directory of this type for the
given path.
If successful, returns (vcs_root, levels_up), where vcs_root is the
path to the version control root directory it found, and levels_up is an
integer indicating how many parent directories it had to search thro... | [
"Try",
"to",
"find",
"a",
"version",
"control",
"root",
"directory",
"of",
"this",
"type",
"for",
"the",
"given",
"path",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_vcs.py#L115-L132 | train |
nerdvegas/rez | src/rez/release_vcs.py | ReleaseVCS._cmd | def _cmd(self, *nargs):
"""Convenience function for executing a program such as 'git' etc."""
cmd_str = ' '.join(map(quote, nargs))
if self.package.config.debug("package_release"):
print_debug("Running command: %s" % cmd_str)
p = popen(nargs, stdout=subprocess.PIPE, stderr=... | python | def _cmd(self, *nargs):
"""Convenience function for executing a program such as 'git' etc."""
cmd_str = ' '.join(map(quote, nargs))
if self.package.config.debug("package_release"):
print_debug("Running command: %s" % cmd_str)
p = popen(nargs, stdout=subprocess.PIPE, stderr=... | [
"def",
"_cmd",
"(",
"self",
",",
"*",
"nargs",
")",
":",
"cmd_str",
"=",
"' '",
".",
"join",
"(",
"map",
"(",
"quote",
",",
"nargs",
")",
")",
"if",
"self",
".",
"package",
".",
"config",
".",
"debug",
"(",
"\"package_release\"",
")",
":",
"print_d... | Convenience function for executing a program such as 'git' etc. | [
"Convenience",
"function",
"for",
"executing",
"a",
"program",
"such",
"as",
"git",
"etc",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_vcs.py#L203-L224 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._close | def _close(self, args):
"""Request a channel close
This method indicates that the sender wants to close the
channel. This may be due to internal conditions (e.g. a forced
shut-down) or due to an error handling a specific method, i.e.
an exception. When a close is due to an exce... | python | def _close(self, args):
"""Request a channel close
This method indicates that the sender wants to close the
channel. This may be due to internal conditions (e.g. a forced
shut-down) or due to an error handling a specific method, i.e.
an exception. When a close is due to an exce... | [
"def",
"_close",
"(",
"self",
",",
"args",
")",
":",
"reply_code",
"=",
"args",
".",
"read_short",
"(",
")",
"reply_text",
"=",
"args",
".",
"read_shortstr",
"(",
")",
"class_id",
"=",
"args",
".",
"read_short",
"(",
")",
"method_id",
"=",
"args",
".",... | Request a channel close
This method indicates that the sender wants to close the
channel. This may be due to internal conditions (e.g. a forced
shut-down) or due to an error handling a specific method, i.e.
an exception. When a close is due to an exception, the sender
provides ... | [
"Request",
"a",
"channel",
"close"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L186-L244 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._x_flow_ok | def _x_flow_ok(self, active):
"""Confirm a flow method
Confirms to the peer that a flow command was received and
processed.
PARAMETERS:
active: boolean
current flow setting
Confirms the setting of the processed flow method:
... | python | def _x_flow_ok(self, active):
"""Confirm a flow method
Confirms to the peer that a flow command was received and
processed.
PARAMETERS:
active: boolean
current flow setting
Confirms the setting of the processed flow method:
... | [
"def",
"_x_flow_ok",
"(",
"self",
",",
"active",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_bit",
"(",
"active",
")",
"self",
".",
"_send_method",
"(",
"(",
"20",
",",
"21",
")",
",",
"args",
")"
] | Confirm a flow method
Confirms to the peer that a flow command was received and
processed.
PARAMETERS:
active: boolean
current flow setting
Confirms the setting of the processed flow method:
True means the peer will start sending or... | [
"Confirm",
"a",
"flow",
"method"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L364-L382 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._x_open | def _x_open(self):
"""Open a channel for use
This method opens a virtual connection (a channel).
RULE:
This method MUST NOT be called when the channel is already
open.
PARAMETERS:
out_of_band: shortstr (DEPRECATED)
out-of-band sett... | python | def _x_open(self):
"""Open a channel for use
This method opens a virtual connection (a channel).
RULE:
This method MUST NOT be called when the channel is already
open.
PARAMETERS:
out_of_band: shortstr (DEPRECATED)
out-of-band sett... | [
"def",
"_x_open",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_open",
":",
"return",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_shortstr",
"(",
"''",
")",
"self",
".",
"_send_method",
"(",
"(",
"20",
",",
"10",
")",
",",
"args",
")",... | Open a channel for use
This method opens a virtual connection (a channel).
RULE:
This method MUST NOT be called when the channel is already
open.
PARAMETERS:
out_of_band: shortstr (DEPRECATED)
out-of-band settings
Configur... | [
"Open",
"a",
"channel",
"for",
"use"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L402-L430 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.exchange_declare | def exchange_declare(self, exchange, type, passive=False, durable=False,
auto_delete=True, nowait=False, arguments=None):
"""Declare exchange, create if needed
This method creates an exchange if it does not already exist,
and if the exchange exists, verifies that it is ... | python | def exchange_declare(self, exchange, type, passive=False, durable=False,
auto_delete=True, nowait=False, arguments=None):
"""Declare exchange, create if needed
This method creates an exchange if it does not already exist,
and if the exchange exists, verifies that it is ... | [
"def",
"exchange_declare",
"(",
"self",
",",
"exchange",
",",
"type",
",",
"passive",
"=",
"False",
",",
"durable",
"=",
"False",
",",
"auto_delete",
"=",
"True",
",",
"nowait",
"=",
"False",
",",
"arguments",
"=",
"None",
")",
":",
"arguments",
"=",
"... | Declare exchange, create if needed
This method creates an exchange if it does not already exist,
and if the exchange exists, verifies that it is of the correct
and expected class.
RULE:
The server SHOULD support a minimum of 16 exchanges per
virtual host and id... | [
"Declare",
"exchange",
"create",
"if",
"needed"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L481-L623 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.exchange_bind | def exchange_bind(self, destination, source='', routing_key='',
nowait=False, arguments=None):
"""This method binds an exchange to an exchange.
RULE:
A server MUST allow and ignore duplicate bindings - that
is, two or more bind methods for a specific excha... | python | def exchange_bind(self, destination, source='', routing_key='',
nowait=False, arguments=None):
"""This method binds an exchange to an exchange.
RULE:
A server MUST allow and ignore duplicate bindings - that
is, two or more bind methods for a specific excha... | [
"def",
"exchange_bind",
"(",
"self",
",",
"destination",
",",
"source",
"=",
"''",
",",
"routing_key",
"=",
"''",
",",
"nowait",
"=",
"False",
",",
"arguments",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"}",
"if",
"arguments",
"is",
"None",
"else",... | This method binds an exchange to an exchange.
RULE:
A server MUST allow and ignore duplicate bindings - that
is, two or more bind methods for a specific exchanges,
with identical arguments - without treating these as an
error.
RULE:
A serve... | [
"This",
"method",
"binds",
"an",
"exchange",
"to",
"an",
"exchange",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L697-L783 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.queue_declare | def queue_declare(self, queue='', passive=False, durable=False,
exclusive=False, auto_delete=True, nowait=False,
arguments=None):
"""Declare queue, create if needed
This method creates or checks a queue. When creating a new
queue the client can speci... | python | def queue_declare(self, queue='', passive=False, durable=False,
exclusive=False, auto_delete=True, nowait=False,
arguments=None):
"""Declare queue, create if needed
This method creates or checks a queue. When creating a new
queue the client can speci... | [
"def",
"queue_declare",
"(",
"self",
",",
"queue",
"=",
"''",
",",
"passive",
"=",
"False",
",",
"durable",
"=",
"False",
",",
"exclusive",
"=",
"False",
",",
"auto_delete",
"=",
"True",
",",
"nowait",
"=",
"False",
",",
"arguments",
"=",
"None",
")",
... | Declare queue, create if needed
This method creates or checks a queue. When creating a new
queue the client can specify various properties that control
the durability of the queue and its contents, and the level of
sharing for the queue.
RULE:
The server MUST crea... | [
"Declare",
"queue",
"create",
"if",
"needed"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1090-L1260 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._queue_declare_ok | def _queue_declare_ok(self, args):
"""Confirms a queue definition
This method confirms a Declare method and confirms the name of
the queue, essential for automatically-named queues.
PARAMETERS:
queue: shortstr
Reports the name of the queue. If the server ge... | python | def _queue_declare_ok(self, args):
"""Confirms a queue definition
This method confirms a Declare method and confirms the name of
the queue, essential for automatically-named queues.
PARAMETERS:
queue: shortstr
Reports the name of the queue. If the server ge... | [
"def",
"_queue_declare_ok",
"(",
"self",
",",
"args",
")",
":",
"return",
"queue_declare_ok_t",
"(",
"args",
".",
"read_shortstr",
"(",
")",
",",
"args",
".",
"read_long",
"(",
")",
",",
"args",
".",
"read_long",
"(",
")",
",",
")"
] | Confirms a queue definition
This method confirms a Declare method and confirms the name of
the queue, essential for automatically-named queues.
PARAMETERS:
queue: shortstr
Reports the name of the queue. If the server generated
a queue name, this fie... | [
"Confirms",
"a",
"queue",
"definition"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1262-L1295 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.queue_delete | def queue_delete(self, queue='',
if_unused=False, if_empty=False, nowait=False):
"""Delete a queue
This method deletes a queue. When a queue is deleted any
pending messages are sent to a dead-letter queue if this is
defined in the server configuration, and all cons... | python | def queue_delete(self, queue='',
if_unused=False, if_empty=False, nowait=False):
"""Delete a queue
This method deletes a queue. When a queue is deleted any
pending messages are sent to a dead-letter queue if this is
defined in the server configuration, and all cons... | [
"def",
"queue_delete",
"(",
"self",
",",
"queue",
"=",
"''",
",",
"if_unused",
"=",
"False",
",",
"if_empty",
"=",
"False",
",",
"nowait",
"=",
"False",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_short",
"(",
"0",
")",
"args",... | Delete a queue
This method deletes a queue. When a queue is deleted any
pending messages are sent to a dead-letter queue if this is
defined in the server configuration, and all consumers on the
queue are cancelled.
RULE:
The server SHOULD use a dead-letter queue t... | [
"Delete",
"a",
"queue"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1297-L1375 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.queue_purge | def queue_purge(self, queue='', nowait=False):
"""Purge a queue
This method removes all messages from a queue. It does not
cancel consumers. Purged messages are deleted without any
formal "undo" mechanism.
RULE:
A call to purge MUST result in an empty queue.
... | python | def queue_purge(self, queue='', nowait=False):
"""Purge a queue
This method removes all messages from a queue. It does not
cancel consumers. Purged messages are deleted without any
formal "undo" mechanism.
RULE:
A call to purge MUST result in an empty queue.
... | [
"def",
"queue_purge",
"(",
"self",
",",
"queue",
"=",
"''",
",",
"nowait",
"=",
"False",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_short",
"(",
"0",
")",
"args",
".",
"write_shortstr",
"(",
"queue",
")",
"args",
".",
"write_b... | Purge a queue
This method removes all messages from a queue. It does not
cancel consumers. Purged messages are deleted without any
formal "undo" mechanism.
RULE:
A call to purge MUST result in an empty queue.
RULE:
On transacted channels the server ... | [
"Purge",
"a",
"queue"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1392-L1457 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.basic_ack | def basic_ack(self, delivery_tag, multiple=False):
"""Acknowledge one or more messages
This method acknowledges one or more messages delivered via
the Deliver or Get-Ok methods. The client can ask to confirm
a single message or a set of messages up to and including a
specific m... | python | def basic_ack(self, delivery_tag, multiple=False):
"""Acknowledge one or more messages
This method acknowledges one or more messages delivered via
the Deliver or Get-Ok methods. The client can ask to confirm
a single message or a set of messages up to and including a
specific m... | [
"def",
"basic_ack",
"(",
"self",
",",
"delivery_tag",
",",
"multiple",
"=",
"False",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_longlong",
"(",
"delivery_tag",
")",
"args",
".",
"write_bit",
"(",
"multiple",
")",
"self",
".",
"_se... | Acknowledge one or more messages
This method acknowledges one or more messages delivered via
the Deliver or Get-Ok methods. The client can ask to confirm
a single message or a set of messages up to and including a
specific message.
PARAMETERS:
delivery_tag: longlon... | [
"Acknowledge",
"one",
"or",
"more",
"messages"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1534-L1584 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.basic_cancel | def basic_cancel(self, consumer_tag, nowait=False):
"""End a queue consumer
This method cancels a consumer. This does not affect already
delivered messages, but it does mean the server will not send
any more messages for that consumer. The client may receive
an abitrary number ... | python | def basic_cancel(self, consumer_tag, nowait=False):
"""End a queue consumer
This method cancels a consumer. This does not affect already
delivered messages, but it does mean the server will not send
any more messages for that consumer. The client may receive
an abitrary number ... | [
"def",
"basic_cancel",
"(",
"self",
",",
"consumer_tag",
",",
"nowait",
"=",
"False",
")",
":",
"if",
"self",
".",
"connection",
"is",
"not",
"None",
":",
"self",
".",
"no_ack_consumers",
".",
"discard",
"(",
"consumer_tag",
")",
"args",
"=",
"AMQPWriter",... | End a queue consumer
This method cancels a consumer. This does not affect already
delivered messages, but it does mean the server will not send
any more messages for that consumer. The client may receive
an abitrary number of messages in between sending the cancel
method and re... | [
"End",
"a",
"queue",
"consumer"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1586-L1634 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._basic_cancel_notify | def _basic_cancel_notify(self, args):
"""Consumer cancelled by server.
Most likely the queue was deleted.
"""
consumer_tag = args.read_shortstr()
callback = self._on_cancel(consumer_tag)
if callback:
callback(consumer_tag)
else:
raise Con... | python | def _basic_cancel_notify(self, args):
"""Consumer cancelled by server.
Most likely the queue was deleted.
"""
consumer_tag = args.read_shortstr()
callback = self._on_cancel(consumer_tag)
if callback:
callback(consumer_tag)
else:
raise Con... | [
"def",
"_basic_cancel_notify",
"(",
"self",
",",
"args",
")",
":",
"consumer_tag",
"=",
"args",
".",
"read_shortstr",
"(",
")",
"callback",
"=",
"self",
".",
"_on_cancel",
"(",
"consumer_tag",
")",
"if",
"callback",
":",
"callback",
"(",
"consumer_tag",
")",... | Consumer cancelled by server.
Most likely the queue was deleted. | [
"Consumer",
"cancelled",
"by",
"server",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1636-L1647 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.basic_consume | def basic_consume(self, queue='', consumer_tag='', no_local=False,
no_ack=False, exclusive=False, nowait=False,
callback=None, arguments=None, on_cancel=None):
"""Start a queue consumer
This method asks the server to start a "consumer", which is a
tra... | python | def basic_consume(self, queue='', consumer_tag='', no_local=False,
no_ack=False, exclusive=False, nowait=False,
callback=None, arguments=None, on_cancel=None):
"""Start a queue consumer
This method asks the server to start a "consumer", which is a
tra... | [
"def",
"basic_consume",
"(",
"self",
",",
"queue",
"=",
"''",
",",
"consumer_tag",
"=",
"''",
",",
"no_local",
"=",
"False",
",",
"no_ack",
"=",
"False",
",",
"exclusive",
"=",
"False",
",",
"nowait",
"=",
"False",
",",
"callback",
"=",
"None",
",",
... | Start a queue consumer
This method asks the server to start a "consumer", which is a
transient request for messages from a specific queue.
Consumers last as long as the channel they were created on, or
until the client cancels them.
RULE:
The server SHOULD support ... | [
"Start",
"a",
"queue",
"consumer"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1677-L1798 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._basic_deliver | def _basic_deliver(self, args, msg):
"""Notify the client of a consumer message
This method delivers a message to the client, via a consumer.
In the asynchronous message delivery model, the client starts
a consumer using the Consume method, then the server responds
with Deliver ... | python | def _basic_deliver(self, args, msg):
"""Notify the client of a consumer message
This method delivers a message to the client, via a consumer.
In the asynchronous message delivery model, the client starts
a consumer using the Consume method, then the server responds
with Deliver ... | [
"def",
"_basic_deliver",
"(",
"self",
",",
"args",
",",
"msg",
")",
":",
"consumer_tag",
"=",
"args",
".",
"read_shortstr",
"(",
")",
"delivery_tag",
"=",
"args",
".",
"read_longlong",
"(",
")",
"redelivered",
"=",
"args",
".",
"read_bit",
"(",
")",
"exc... | Notify the client of a consumer message
This method delivers a message to the client, via a consumer.
In the asynchronous message delivery model, the client starts
a consumer using the Consume method, then the server responds
with Deliver methods as and when messages arrive for that
... | [
"Notify",
"the",
"client",
"of",
"a",
"consumer",
"message"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1816-L1909 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._basic_get_ok | def _basic_get_ok(self, args, msg):
"""Provide client with a message
This method delivers a message to the client following a get
method. A message delivered by 'get-ok' must be acknowledged
unless the no-ack option was set in the get method.
PARAMETERS:
delivery_t... | python | def _basic_get_ok(self, args, msg):
"""Provide client with a message
This method delivers a message to the client following a get
method. A message delivered by 'get-ok' must be acknowledged
unless the no-ack option was set in the get method.
PARAMETERS:
delivery_t... | [
"def",
"_basic_get_ok",
"(",
"self",
",",
"args",
",",
"msg",
")",
":",
"delivery_tag",
"=",
"args",
".",
"read_longlong",
"(",
")",
"redelivered",
"=",
"args",
".",
"read_bit",
"(",
")",
"exchange",
"=",
"args",
".",
"read_shortstr",
"(",
")",
"routing_... | Provide client with a message
This method delivers a message to the client following a get
method. A message delivered by 'get-ok' must be acknowledged
unless the no-ack option was set in the get method.
PARAMETERS:
delivery_tag: longlong
server-assigned d... | [
"Provide",
"client",
"with",
"a",
"message"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L1975-L2047 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._basic_publish | def _basic_publish(self, msg, exchange='', routing_key='',
mandatory=False, immediate=False):
"""Publish a message
This method publishes a message to a specific exchange. The
message will be routed to queues as defined by the exchange
configuration and distributed... | python | def _basic_publish(self, msg, exchange='', routing_key='',
mandatory=False, immediate=False):
"""Publish a message
This method publishes a message to a specific exchange. The
message will be routed to queues as defined by the exchange
configuration and distributed... | [
"def",
"_basic_publish",
"(",
"self",
",",
"msg",
",",
"exchange",
"=",
"''",
",",
"routing_key",
"=",
"''",
",",
"mandatory",
"=",
"False",
",",
"immediate",
"=",
"False",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_short",
"(",... | Publish a message
This method publishes a message to a specific exchange. The
message will be routed to queues as defined by the exchange
configuration and distributed to any active consumers when the
transaction, if any, is committed.
PARAMETERS:
exchange: shortstr... | [
"Publish",
"a",
"message"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2049-L2123 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.basic_qos | def basic_qos(self, prefetch_size, prefetch_count, a_global):
"""Specify quality of service
This method requests a specific quality of service. The QoS
can be specified for the current channel or for all channels
on the connection. The particular properties and semantics of
a ... | python | def basic_qos(self, prefetch_size, prefetch_count, a_global):
"""Specify quality of service
This method requests a specific quality of service. The QoS
can be specified for the current channel or for all channels
on the connection. The particular properties and semantics of
a ... | [
"def",
"basic_qos",
"(",
"self",
",",
"prefetch_size",
",",
"prefetch_count",
",",
"a_global",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_long",
"(",
"prefetch_size",
")",
"args",
".",
"write_short",
"(",
"prefetch_count",
")",
"args"... | Specify quality of service
This method requests a specific quality of service. The QoS
can be specified for the current channel or for all channels
on the connection. The particular properties and semantics of
a qos method always depend on the content class semantics.
Though t... | [
"Specify",
"quality",
"of",
"service"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2135-L2206 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.basic_recover | def basic_recover(self, requeue=False):
"""Redeliver unacknowledged messages
This method asks the broker to redeliver all unacknowledged
messages on a specified channel. Zero or more messages may be
redelivered. This method is only allowed on non-transacted
channels.
R... | python | def basic_recover(self, requeue=False):
"""Redeliver unacknowledged messages
This method asks the broker to redeliver all unacknowledged
messages on a specified channel. Zero or more messages may be
redelivered. This method is only allowed on non-transacted
channels.
R... | [
"def",
"basic_recover",
"(",
"self",
",",
"requeue",
"=",
"False",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_bit",
"(",
"requeue",
")",
"self",
".",
"_send_method",
"(",
"(",
"60",
",",
"110",
")",
",",
"args",
")"
] | Redeliver unacknowledged messages
This method asks the broker to redeliver all unacknowledged
messages on a specified channel. Zero or more messages may be
redelivered. This method is only allowed on non-transacted
channels.
RULE:
The server MUST set the redeliver... | [
"Redeliver",
"unacknowledged",
"messages"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2218-L2250 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel.basic_reject | def basic_reject(self, delivery_tag, requeue):
"""Reject an incoming message
This method allows a client to reject a message. It can be
used to interrupt and cancel large incoming messages, or
return untreatable messages to their original queue.
RULE:
The server S... | python | def basic_reject(self, delivery_tag, requeue):
"""Reject an incoming message
This method allows a client to reject a message. It can be
used to interrupt and cancel large incoming messages, or
return untreatable messages to their original queue.
RULE:
The server S... | [
"def",
"basic_reject",
"(",
"self",
",",
"delivery_tag",
",",
"requeue",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_longlong",
"(",
"delivery_tag",
")",
"args",
".",
"write_bit",
"(",
"requeue",
")",
"self",
".",
"_send_method",
"("... | Reject an incoming message
This method allows a client to reject a message. It can be
used to interrupt and cancel large incoming messages, or
return untreatable messages to their original queue.
RULE:
The server SHOULD be capable of accepting and process the
... | [
"Reject",
"an",
"incoming",
"message"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2261-L2334 | train |
nerdvegas/rez | src/rez/vendor/amqp/channel.py | Channel._basic_return | def _basic_return(self, args, msg):
"""Return a failed message
This method returns an undeliverable message that was
published with the "immediate" flag set, or an unroutable
message published with the "mandatory" flag set. The reply
code and text provide information about the r... | python | def _basic_return(self, args, msg):
"""Return a failed message
This method returns an undeliverable message that was
published with the "immediate" flag set, or an unroutable
message published with the "mandatory" flag set. The reply
code and text provide information about the r... | [
"def",
"_basic_return",
"(",
"self",
",",
"args",
",",
"msg",
")",
":",
"self",
".",
"returned_messages",
".",
"put",
"(",
"basic_return_t",
"(",
"args",
".",
"read_short",
"(",
")",
",",
"args",
".",
"read_shortstr",
"(",
")",
",",
"args",
".",
"read_... | Return a failed message
This method returns an undeliverable message that was
published with the "immediate" flag set, or an unroutable
message published with the "mandatory" flag set. The reply
code and text provide information about the reason that the
message was undeliverabl... | [
"Return",
"a",
"failed",
"message"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/channel.py#L2336-L2375 | train |
nerdvegas/rez | src/rez/build_process_.py | create_build_process | def create_build_process(process_type, working_dir, build_system, package=None,
vcs=None, ensure_latest=True, skip_repo_errors=False,
ignore_existing_tag=False, verbose=False, quiet=False):
"""Create a `BuildProcess` instance."""
from rez.plugin_managers import ... | python | def create_build_process(process_type, working_dir, build_system, package=None,
vcs=None, ensure_latest=True, skip_repo_errors=False,
ignore_existing_tag=False, verbose=False, quiet=False):
"""Create a `BuildProcess` instance."""
from rez.plugin_managers import ... | [
"def",
"create_build_process",
"(",
"process_type",
",",
"working_dir",
",",
"build_system",
",",
"package",
"=",
"None",
",",
"vcs",
"=",
"None",
",",
"ensure_latest",
"=",
"True",
",",
"skip_repo_errors",
"=",
"False",
",",
"ignore_existing_tag",
"=",
"False",... | Create a `BuildProcess` instance. | [
"Create",
"a",
"BuildProcess",
"instance",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L26-L45 | train |
nerdvegas/rez | src/rez/build_process_.py | BuildProcessHelper.visit_variants | def visit_variants(self, func, variants=None, **kwargs):
"""Iterate over variants and call a function on each."""
if variants:
present_variants = range(self.package.num_variants)
invalid_variants = set(variants) - set(present_variants)
if invalid_variants:
... | python | def visit_variants(self, func, variants=None, **kwargs):
"""Iterate over variants and call a function on each."""
if variants:
present_variants = range(self.package.num_variants)
invalid_variants = set(variants) - set(present_variants)
if invalid_variants:
... | [
"def",
"visit_variants",
"(",
"self",
",",
"func",
",",
"variants",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"variants",
":",
"present_variants",
"=",
"range",
"(",
"self",
".",
"package",
".",
"num_variants",
")",
"invalid_variants",
"=",
"set",
... | Iterate over variants and call a function on each. | [
"Iterate",
"over",
"variants",
"and",
"call",
"a",
"function",
"on",
"each",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L175-L201 | train |
nerdvegas/rez | src/rez/build_process_.py | BuildProcessHelper.create_build_context | def create_build_context(self, variant, build_type, build_path):
"""Create a context to build the variant within."""
request = variant.get_requires(build_requires=True,
private_build_requires=True)
req_strs = map(str, request)
quoted_req_strs = map... | python | def create_build_context(self, variant, build_type, build_path):
"""Create a context to build the variant within."""
request = variant.get_requires(build_requires=True,
private_build_requires=True)
req_strs = map(str, request)
quoted_req_strs = map... | [
"def",
"create_build_context",
"(",
"self",
",",
"variant",
",",
"build_type",
",",
"build_path",
")",
":",
"request",
"=",
"variant",
".",
"get_requires",
"(",
"build_requires",
"=",
"True",
",",
"private_build_requires",
"=",
"True",
")",
"req_strs",
"=",
"m... | Create a context to build the variant within. | [
"Create",
"a",
"context",
"to",
"build",
"the",
"variant",
"within",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L218-L253 | train |
nerdvegas/rez | src/rez/build_process_.py | BuildProcessHelper.get_release_data | def get_release_data(self):
"""Get release data for this release.
Returns:
dict.
"""
previous_package = self.get_previous_release()
if previous_package:
previous_version = previous_package.version
previous_revision = previous_package.revision
... | python | def get_release_data(self):
"""Get release data for this release.
Returns:
dict.
"""
previous_package = self.get_previous_release()
if previous_package:
previous_version = previous_package.version
previous_revision = previous_package.revision
... | [
"def",
"get_release_data",
"(",
"self",
")",
":",
"previous_package",
"=",
"self",
".",
"get_previous_release",
"(",
")",
"if",
"previous_package",
":",
"previous_version",
"=",
"previous_package",
".",
"version",
"previous_revision",
"=",
"previous_package",
".",
"... | Get release data for this release.
Returns:
dict. | [
"Get",
"release",
"data",
"for",
"this",
"release",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_process_.py#L368-L402 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/minmax.py | minimal_spanning_tree | def minimal_spanning_tree(graph, root=None):
"""
Minimal spanning tree.
@attention: Minimal spanning tree is meaningful only for weighted graphs.
@type graph: graph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
... | python | def minimal_spanning_tree(graph, root=None):
"""
Minimal spanning tree.
@attention: Minimal spanning tree is meaningful only for weighted graphs.
@type graph: graph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
... | [
"def",
"minimal_spanning_tree",
"(",
"graph",
",",
"root",
"=",
"None",
")",
":",
"visited",
"=",
"[",
"]",
"spanning_tree",
"=",
"{",
"}",
"if",
"(",
"root",
"is",
"not",
"None",
")",
":",
"visited",
".",
"append",
"(",
"root",
")",
"nroot",
"=",
... | Minimal spanning tree.
@attention: Minimal spanning tree is meaningful only for weighted graphs.
@type graph: graph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: dictionary
@return: Generated spanning t... | [
"Minimal",
"spanning",
"tree",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/minmax.py#L46-L86 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/minmax.py | cut_value | def cut_value(graph, flow, cut):
"""
Calculate the value of a cut.
@type graph: digraph
@param graph: Graph
@type flow: dictionary
@param flow: Dictionary containing a flow for each edge.
@type cut: dictionary
@param cut: Dictionary mapping each node to a subset index. The function on... | python | def cut_value(graph, flow, cut):
"""
Calculate the value of a cut.
@type graph: digraph
@param graph: Graph
@type flow: dictionary
@param flow: Dictionary containing a flow for each edge.
@type cut: dictionary
@param cut: Dictionary mapping each node to a subset index. The function on... | [
"def",
"cut_value",
"(",
"graph",
",",
"flow",
",",
"cut",
")",
":",
"S",
"=",
"[",
"]",
"T",
"=",
"[",
"]",
"for",
"node",
"in",
"cut",
".",
"keys",
"(",
")",
":",
"if",
"cut",
"[",
"node",
"]",
"==",
"0",
":",
"S",
".",
"append",
"(",
"... | Calculate the value of a cut.
@type graph: digraph
@param graph: Graph
@type flow: dictionary
@param flow: Dictionary containing a flow for each edge.
@type cut: dictionary
@param cut: Dictionary mapping each node to a subset index. The function only considers the flow between
nodes with ... | [
"Calculate",
"the",
"value",
"of",
"a",
"cut",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/minmax.py#L412-L445 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/minmax.py | cut_tree | def cut_tree(igraph, caps = None):
"""
Construct a Gomory-Hu cut tree by applying the algorithm of Gusfield.
@type igraph: graph
@param igraph: Graph
@type caps: dictionary
@param caps: Dictionary specifying a maximum capacity for each edge. If not given, the weight of the edge
will be use... | python | def cut_tree(igraph, caps = None):
"""
Construct a Gomory-Hu cut tree by applying the algorithm of Gusfield.
@type igraph: graph
@param igraph: Graph
@type caps: dictionary
@param caps: Dictionary specifying a maximum capacity for each edge. If not given, the weight of the edge
will be use... | [
"def",
"cut_tree",
"(",
"igraph",
",",
"caps",
"=",
"None",
")",
":",
"graph",
"=",
"digraph",
"(",
")",
"graph",
".",
"add_graph",
"(",
"igraph",
")",
"if",
"not",
"caps",
":",
"caps",
"=",
"{",
"}",
"for",
"edge",
"in",
"graph",
".",
"edges",
"... | Construct a Gomory-Hu cut tree by applying the algorithm of Gusfield.
@type igraph: graph
@param igraph: Graph
@type caps: dictionary
@param caps: Dictionary specifying a maximum capacity for each edge. If not given, the weight of the edge
will be used as its capacity. Otherwise, for each edge (a,... | [
"Construct",
"a",
"Gomory",
"-",
"Hu",
"cut",
"tree",
"by",
"applying",
"the",
"algorithm",
"of",
"Gusfield",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/minmax.py#L447-L515 | train |
nerdvegas/rez | src/rez/vendor/distlib/locators.py | Locator.locate | def locate(self, requirement, prereleases=False):
"""
Find the most recent distribution which matches the given
requirement.
:param requirement: A requirement of the form 'foo (1.0)' or perhaps
'foo (>= 1.0, < 2.0, != 1.3)'
:param prereleases: If ``Tr... | python | def locate(self, requirement, prereleases=False):
"""
Find the most recent distribution which matches the given
requirement.
:param requirement: A requirement of the form 'foo (1.0)' or perhaps
'foo (>= 1.0, < 2.0, != 1.3)'
:param prereleases: If ``Tr... | [
"def",
"locate",
"(",
"self",
",",
"requirement",
",",
"prereleases",
"=",
"False",
")",
":",
"result",
"=",
"None",
"r",
"=",
"parse_requirement",
"(",
"requirement",
")",
"if",
"r",
"is",
"None",
":",
"raise",
"DistlibException",
"(",
"'Not a valid require... | Find the most recent distribution which matches the given
requirement.
:param requirement: A requirement of the form 'foo (1.0)' or perhaps
'foo (>= 1.0, < 2.0, != 1.3)'
:param prereleases: If ``True``, allow pre-release versions
to be loc... | [
"Find",
"the",
"most",
"recent",
"distribution",
"which",
"matches",
"the",
"given",
"requirement",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/locators.py#L313-L370 | train |
nerdvegas/rez | src/rez/package_bind.py | get_bind_modules | def get_bind_modules(verbose=False):
"""Get available bind modules.
Returns:
dict: Map of (name, filepath) listing all bind modules.
"""
builtin_path = os.path.join(module_root_path, "bind")
searchpaths = config.bind_module_path + [builtin_path]
bindnames = {}
for path in searchpat... | python | def get_bind_modules(verbose=False):
"""Get available bind modules.
Returns:
dict: Map of (name, filepath) listing all bind modules.
"""
builtin_path = os.path.join(module_root_path, "bind")
searchpaths = config.bind_module_path + [builtin_path]
bindnames = {}
for path in searchpat... | [
"def",
"get_bind_modules",
"(",
"verbose",
"=",
"False",
")",
":",
"builtin_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"module_root_path",
",",
"\"bind\"",
")",
"searchpaths",
"=",
"config",
".",
"bind_module_path",
"+",
"[",
"builtin_path",
"]",
"bind... | Get available bind modules.
Returns:
dict: Map of (name, filepath) listing all bind modules. | [
"Get",
"available",
"bind",
"modules",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_bind.py#L13-L36 | train |
nerdvegas/rez | src/rez/package_bind.py | find_bind_module | def find_bind_module(name, verbose=False):
"""Find the bind module matching the given name.
Args:
name (str): Name of package to find bind module for.
verbose (bool): If True, print extra output.
Returns:
str: Filepath to bind module .py file, or None if not found.
"""
bind... | python | def find_bind_module(name, verbose=False):
"""Find the bind module matching the given name.
Args:
name (str): Name of package to find bind module for.
verbose (bool): If True, print extra output.
Returns:
str: Filepath to bind module .py file, or None if not found.
"""
bind... | [
"def",
"find_bind_module",
"(",
"name",
",",
"verbose",
"=",
"False",
")",
":",
"bindnames",
"=",
"get_bind_modules",
"(",
"verbose",
"=",
"verbose",
")",
"bindfile",
"=",
"bindnames",
".",
"get",
"(",
"name",
")",
"if",
"bindfile",
":",
"return",
"bindfil... | Find the bind module matching the given name.
Args:
name (str): Name of package to find bind module for.
verbose (bool): If True, print extra output.
Returns:
str: Filepath to bind module .py file, or None if not found. | [
"Find",
"the",
"bind",
"module",
"matching",
"the",
"given",
"name",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_bind.py#L39-L68 | train |
nerdvegas/rez | src/rez/package_bind.py | bind_package | def bind_package(name, path=None, version_range=None, no_deps=False,
bind_args=None, quiet=False):
"""Bind software available on the current system, as a rez package.
Note:
`bind_args` is provided when software is bound via the 'rez-bind'
command line tool. Bind modules can def... | python | def bind_package(name, path=None, version_range=None, no_deps=False,
bind_args=None, quiet=False):
"""Bind software available on the current system, as a rez package.
Note:
`bind_args` is provided when software is bound via the 'rez-bind'
command line tool. Bind modules can def... | [
"def",
"bind_package",
"(",
"name",
",",
"path",
"=",
"None",
",",
"version_range",
"=",
"None",
",",
"no_deps",
"=",
"False",
",",
"bind_args",
"=",
"None",
",",
"quiet",
"=",
"False",
")",
":",
"pending",
"=",
"set",
"(",
"[",
"name",
"]",
")",
"... | Bind software available on the current system, as a rez package.
Note:
`bind_args` is provided when software is bound via the 'rez-bind'
command line tool. Bind modules can define their own command line
options, and they will be present in `bind_args` if applicable.
Args:
name ... | [
"Bind",
"software",
"available",
"on",
"the",
"current",
"system",
"as",
"a",
"rez",
"package",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_bind.py#L71-L141 | train |
nerdvegas/rez | src/rez/release_hook.py | create_release_hook | def create_release_hook(name, source_path):
"""Return a new release hook of the given type."""
from rez.plugin_managers import plugin_manager
return plugin_manager.create_instance('release_hook',
name,
source_path=source_pat... | python | def create_release_hook(name, source_path):
"""Return a new release hook of the given type."""
from rez.plugin_managers import plugin_manager
return plugin_manager.create_instance('release_hook',
name,
source_path=source_pat... | [
"def",
"create_release_hook",
"(",
"name",
",",
"source_path",
")",
":",
"from",
"rez",
".",
"plugin_managers",
"import",
"plugin_manager",
"return",
"plugin_manager",
".",
"create_instance",
"(",
"'release_hook'",
",",
"name",
",",
"source_path",
"=",
"source_path"... | Return a new release hook of the given type. | [
"Return",
"a",
"new",
"release",
"hook",
"of",
"the",
"given",
"type",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_hook.py#L12-L17 | train |
nerdvegas/rez | src/rez/release_hook.py | ReleaseHook.pre_build | def pre_build(self, user, install_path, variants=None, release_message=None,
changelog=None, previous_version=None,
previous_revision=None, **kwargs):
"""Pre-build hook.
Args:
user: Name of person who did the release.
install_path: Directory t... | python | def pre_build(self, user, install_path, variants=None, release_message=None,
changelog=None, previous_version=None,
previous_revision=None, **kwargs):
"""Pre-build hook.
Args:
user: Name of person who did the release.
install_path: Directory t... | [
"def",
"pre_build",
"(",
"self",
",",
"user",
",",
"install_path",
",",
"variants",
"=",
"None",
",",
"release_message",
"=",
"None",
",",
"changelog",
"=",
"None",
",",
"previous_version",
"=",
"None",
",",
"previous_revision",
"=",
"None",
",",
"**",
"kw... | Pre-build hook.
Args:
user: Name of person who did the release.
install_path: Directory the package was installed into.
variants: List of variant indices we are attempting to build, or
None
release_message: User-supplied release message.
... | [
"Pre",
"-",
"build",
"hook",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/release_hook.py#L56-L78 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/traversal.py | traversal | def traversal(graph, node, order):
"""
Graph traversal iterator.
@type graph: graph, digraph
@param graph: Graph.
@type node: node
@param node: Node.
@type order: string
@param order: traversal ordering. Possible values are:
2. 'pre' - Preordering (default)
... | python | def traversal(graph, node, order):
"""
Graph traversal iterator.
@type graph: graph, digraph
@param graph: Graph.
@type node: node
@param node: Node.
@type order: string
@param order: traversal ordering. Possible values are:
2. 'pre' - Preordering (default)
... | [
"def",
"traversal",
"(",
"graph",
",",
"node",
",",
"order",
")",
":",
"visited",
"=",
"{",
"}",
"if",
"(",
"order",
"==",
"'pre'",
")",
":",
"pre",
"=",
"1",
"post",
"=",
"0",
"elif",
"(",
"order",
"==",
"'post'",
")",
":",
"pre",
"=",
"0",
... | Graph traversal iterator.
@type graph: graph, digraph
@param graph: Graph.
@type node: node
@param node: Node.
@type order: string
@param order: traversal ordering. Possible values are:
2. 'pre' - Preordering (default)
1. 'post' - Postordering
@rtype: iter... | [
"Graph",
"traversal",
"iterator",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/traversal.py#L34-L61 | train |
nerdvegas/rez | src/rez/backport/zipfile.py | is_zipfile | def is_zipfile(filename):
"""Quickly see if file is a ZIP file by checking the magic number."""
try:
fpin = open(filename, "rb")
endrec = _EndRecData(fpin)
fpin.close()
if endrec:
return True # file has correct magic number
except IOError:
... | python | def is_zipfile(filename):
"""Quickly see if file is a ZIP file by checking the magic number."""
try:
fpin = open(filename, "rb")
endrec = _EndRecData(fpin)
fpin.close()
if endrec:
return True # file has correct magic number
except IOError:
... | [
"def",
"is_zipfile",
"(",
"filename",
")",
":",
"try",
":",
"fpin",
"=",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"endrec",
"=",
"_EndRecData",
"(",
"fpin",
")",
"fpin",
".",
"close",
"(",
")",
"if",
"endrec",
":",
"return",
"True",
"except",
"IO... | Quickly see if file is a ZIP file by checking the magic number. | [
"Quickly",
"see",
"if",
"file",
"is",
"a",
"ZIP",
"file",
"by",
"checking",
"the",
"magic",
"number",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/backport/zipfile.py#L133-L143 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.