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/serialise.py | process_python_objects | def process_python_objects(data, filepath=None):
"""Replace certain values in the given package data dict.
Does things like:
* evaluates @early decorated functions, and replaces with return value;
* converts functions into `SourceCode` instances so they can be serialized
out to installed packages... | python | def process_python_objects(data, filepath=None):
"""Replace certain values in the given package data dict.
Does things like:
* evaluates @early decorated functions, and replaces with return value;
* converts functions into `SourceCode` instances so they can be serialized
out to installed packages... | [
"def",
"process_python_objects",
"(",
"data",
",",
"filepath",
"=",
"None",
")",
":",
"def",
"_process",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"for",
"k",
",",
"v",
"in",
"value",
".",
"items",
"(",
")",
"... | Replace certain values in the given package data dict.
Does things like:
* evaluates @early decorated functions, and replaces with return value;
* converts functions into `SourceCode` instances so they can be serialized
out to installed packages, and evaluated later;
* strips some values (modules... | [
"Replace",
"certain",
"values",
"in",
"the",
"given",
"package",
"data",
"dict",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/serialise.py#L266-L366 | train |
nerdvegas/rez | src/rez/serialise.py | load_yaml | def load_yaml(stream, **kwargs):
"""Load yaml-formatted data from a stream.
Args:
stream (file-like object).
Returns:
dict.
"""
# if there's an error parsing the yaml, and you pass yaml.load a string,
# it will print lines of context, but will print "<string>" instead of a
... | python | def load_yaml(stream, **kwargs):
"""Load yaml-formatted data from a stream.
Args:
stream (file-like object).
Returns:
dict.
"""
# if there's an error parsing the yaml, and you pass yaml.load a string,
# it will print lines of context, but will print "<string>" instead of a
... | [
"def",
"load_yaml",
"(",
"stream",
",",
"**",
"kwargs",
")",
":",
"content",
"=",
"stream",
".",
"read",
"(",
")",
"try",
":",
"return",
"yaml",
".",
"load",
"(",
"content",
")",
"or",
"{",
"}",
"except",
"Exception",
",",
"e",
":",
"if",
"stream",... | Load yaml-formatted data from a stream.
Args:
stream (file-like object).
Returns:
dict. | [
"Load",
"yaml",
"-",
"formatted",
"data",
"from",
"a",
"stream",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/serialise.py#L369-L395 | train |
nerdvegas/rez | src/rez/vendor/amqp/connection.py | Connection._blocked | def _blocked(self, args):
"""RabbitMQ Extension."""
reason = args.read_shortstr()
if self.on_blocked:
return self.on_blocked(reason) | python | def _blocked(self, args):
"""RabbitMQ Extension."""
reason = args.read_shortstr()
if self.on_blocked:
return self.on_blocked(reason) | [
"def",
"_blocked",
"(",
"self",
",",
"args",
")",
":",
"reason",
"=",
"args",
".",
"read_shortstr",
"(",
")",
"if",
"self",
".",
"on_blocked",
":",
"return",
"self",
".",
"on_blocked",
"(",
"reason",
")"
] | RabbitMQ Extension. | [
"RabbitMQ",
"Extension",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L532-L536 | train |
nerdvegas/rez | src/rez/vendor/amqp/connection.py | Connection._x_secure_ok | def _x_secure_ok(self, response):
"""Security mechanism response
This method attempts to authenticate, passing a block of SASL
data for the security mechanism at the server side.
PARAMETERS:
response: longstr
security response data
A block ... | python | def _x_secure_ok(self, response):
"""Security mechanism response
This method attempts to authenticate, passing a block of SASL
data for the security mechanism at the server side.
PARAMETERS:
response: longstr
security response data
A block ... | [
"def",
"_x_secure_ok",
"(",
"self",
",",
"response",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_longstr",
"(",
"response",
")",
"self",
".",
"_send_method",
"(",
"(",
"10",
",",
"21",
")",
",",
"args",
")"
] | Security mechanism response
This method attempts to authenticate, passing a block of SASL
data for the security mechanism at the server side.
PARAMETERS:
response: longstr
security response data
A block of opaque data passed to the security
... | [
"Security",
"mechanism",
"response"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L662-L680 | train |
nerdvegas/rez | src/rez/vendor/amqp/connection.py | Connection._x_start_ok | def _x_start_ok(self, client_properties, mechanism, response, locale):
"""Select security mechanism and locale
This method selects a SASL security mechanism. ASL uses SASL
(RFC2222) to negotiate authentication and encryption.
PARAMETERS:
client_properties: table
... | python | def _x_start_ok(self, client_properties, mechanism, response, locale):
"""Select security mechanism and locale
This method selects a SASL security mechanism. ASL uses SASL
(RFC2222) to negotiate authentication and encryption.
PARAMETERS:
client_properties: table
... | [
"def",
"_x_start_ok",
"(",
"self",
",",
"client_properties",
",",
"mechanism",
",",
"response",
",",
"locale",
")",
":",
"if",
"self",
".",
"server_capabilities",
".",
"get",
"(",
"'consumer_cancel_notify'",
")",
":",
"if",
"'capabilities'",
"not",
"in",
"clie... | Select security mechanism and locale
This method selects a SASL security mechanism. ASL uses SASL
(RFC2222) to negotiate authentication and encryption.
PARAMETERS:
client_properties: table
client properties
mechanism: shortstr
selected... | [
"Select",
"security",
"mechanism",
"and",
"locale"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L758-L820 | train |
nerdvegas/rez | src/rez/vendor/amqp/connection.py | Connection._tune | def _tune(self, args):
"""Propose connection tuning parameters
This method proposes a set of connection configuration values
to the client. The client can accept and/or adjust these.
PARAMETERS:
channel_max: short
proposed maximum channels
... | python | def _tune(self, args):
"""Propose connection tuning parameters
This method proposes a set of connection configuration values
to the client. The client can accept and/or adjust these.
PARAMETERS:
channel_max: short
proposed maximum channels
... | [
"def",
"_tune",
"(",
"self",
",",
"args",
")",
":",
"client_heartbeat",
"=",
"self",
".",
"client_heartbeat",
"or",
"0",
"self",
".",
"channel_max",
"=",
"args",
".",
"read_short",
"(",
")",
"or",
"self",
".",
"channel_max",
"self",
".",
"frame_max",
"="... | Propose connection tuning parameters
This method proposes a set of connection configuration values
to the client. The client can accept and/or adjust these.
PARAMETERS:
channel_max: short
proposed maximum channels
The maximum total number of chann... | [
"Propose",
"connection",
"tuning",
"parameters"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L822-L881 | train |
nerdvegas/rez | src/rez/vendor/amqp/connection.py | Connection.heartbeat_tick | def heartbeat_tick(self, rate=2):
"""Send heartbeat packets, if necessary, and fail if none have been
received recently. This should be called frequently, on the order of
once per second.
:keyword rate: Ignored
"""
if not self.heartbeat:
return
# tr... | python | def heartbeat_tick(self, rate=2):
"""Send heartbeat packets, if necessary, and fail if none have been
received recently. This should be called frequently, on the order of
once per second.
:keyword rate: Ignored
"""
if not self.heartbeat:
return
# tr... | [
"def",
"heartbeat_tick",
"(",
"self",
",",
"rate",
"=",
"2",
")",
":",
"if",
"not",
"self",
".",
"heartbeat",
":",
"return",
"sent_now",
"=",
"self",
".",
"method_writer",
".",
"bytes_sent",
"recv_now",
"=",
"self",
".",
"method_reader",
".",
"bytes_recv",... | Send heartbeat packets, if necessary, and fail if none have been
received recently. This should be called frequently, on the order of
once per second.
:keyword rate: Ignored | [
"Send",
"heartbeat",
"packets",
"if",
"necessary",
"and",
"fail",
"if",
"none",
"have",
"been",
"received",
"recently",
".",
"This",
"should",
"be",
"called",
"frequently",
"on",
"the",
"order",
"of",
"once",
"per",
"second",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L886-L915 | train |
nerdvegas/rez | src/rez/vendor/amqp/connection.py | Connection._x_tune_ok | def _x_tune_ok(self, channel_max, frame_max, heartbeat):
"""Negotiate connection tuning parameters
This method sends the client's connection tuning parameters to
the server. Certain fields are negotiated, others provide
capability information.
PARAMETERS:
channel_ma... | python | def _x_tune_ok(self, channel_max, frame_max, heartbeat):
"""Negotiate connection tuning parameters
This method sends the client's connection tuning parameters to
the server. Certain fields are negotiated, others provide
capability information.
PARAMETERS:
channel_ma... | [
"def",
"_x_tune_ok",
"(",
"self",
",",
"channel_max",
",",
"frame_max",
",",
"heartbeat",
")",
":",
"args",
"=",
"AMQPWriter",
"(",
")",
"args",
".",
"write_short",
"(",
"channel_max",
")",
"args",
".",
"write_long",
"(",
"frame_max",
")",
"args",
".",
"... | Negotiate connection tuning parameters
This method sends the client's connection tuning parameters to
the server. Certain fields are negotiated, others provide
capability information.
PARAMETERS:
channel_max: short
negotiated maximum channels
... | [
"Negotiate",
"connection",
"tuning",
"parameters"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L917-L971 | train |
nerdvegas/rez | src/rez/status.py | Status.parent_suite | def parent_suite(self):
"""Get the current parent suite.
A parent suite exists when a context within a suite is active. That is,
during execution of a tool within a suite, or after a user has entered
an interactive shell in a suite context, for example via the command-
line synt... | python | def parent_suite(self):
"""Get the current parent suite.
A parent suite exists when a context within a suite is active. That is,
during execution of a tool within a suite, or after a user has entered
an interactive shell in a suite context, for example via the command-
line synt... | [
"def",
"parent_suite",
"(",
"self",
")",
":",
"if",
"self",
".",
"context",
"and",
"self",
".",
"context",
".",
"parent_suite_path",
":",
"return",
"Suite",
".",
"load",
"(",
"self",
".",
"context",
".",
"parent_suite_path",
")",
"return",
"None"
] | Get the current parent suite.
A parent suite exists when a context within a suite is active. That is,
during execution of a tool within a suite, or after a user has entered
an interactive shell in a suite context, for example via the command-
line syntax 'tool +i', where 'tool' is an al... | [
"Get",
"the",
"current",
"parent",
"suite",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L56-L69 | train |
nerdvegas/rez | src/rez/status.py | Status.print_info | def print_info(self, obj=None, buf=sys.stdout):
"""Print a status message about the given object.
If an object is not provided, status info is shown about the current
environment - what the active context is if any, and what suites are
visible.
Args:
obj (str): Stri... | python | def print_info(self, obj=None, buf=sys.stdout):
"""Print a status message about the given object.
If an object is not provided, status info is shown about the current
environment - what the active context is if any, and what suites are
visible.
Args:
obj (str): Stri... | [
"def",
"print_info",
"(",
"self",
",",
"obj",
"=",
"None",
",",
"buf",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"not",
"obj",
":",
"self",
".",
"_print_info",
"(",
"buf",
")",
"return",
"True",
"b",
"=",
"False",
"for",
"fn",
"in",
"(",
"self",... | Print a status message about the given object.
If an object is not provided, status info is shown about the current
environment - what the active context is if any, and what suites are
visible.
Args:
obj (str): String which may be one of the following:
- A t... | [
"Print",
"a",
"status",
"message",
"about",
"the",
"given",
"object",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L87-L118 | train |
nerdvegas/rez | src/rez/status.py | Status.print_tools | def print_tools(self, pattern=None, buf=sys.stdout):
"""Print a list of visible tools.
Args:
pattern (str): Only list tools that match this glob pattern.
"""
seen = set()
rows = []
context = self.context
if context:
data = context.get_too... | python | def print_tools(self, pattern=None, buf=sys.stdout):
"""Print a list of visible tools.
Args:
pattern (str): Only list tools that match this glob pattern.
"""
seen = set()
rows = []
context = self.context
if context:
data = context.get_too... | [
"def",
"print_tools",
"(",
"self",
",",
"pattern",
"=",
"None",
",",
"buf",
"=",
"sys",
".",
"stdout",
")",
":",
"seen",
"=",
"set",
"(",
")",
"rows",
"=",
"[",
"]",
"context",
"=",
"self",
".",
"context",
"if",
"context",
":",
"data",
"=",
"cont... | Print a list of visible tools.
Args:
pattern (str): Only list tools that match this glob pattern. | [
"Print",
"a",
"list",
"of",
"visible",
"tools",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L120-L193 | train |
nerdvegas/rez | src/rez/developer_package.py | DeveloperPackage.from_path | def from_path(cls, path, format=None):
"""Load a developer package.
A developer package may for example be a package.yaml or package.py in a
user's source directory.
Args:
path: Directory containing the package definition file, or file
path for the package f... | python | def from_path(cls, path, format=None):
"""Load a developer package.
A developer package may for example be a package.yaml or package.py in a
user's source directory.
Args:
path: Directory containing the package definition file, or file
path for the package f... | [
"def",
"from_path",
"(",
"cls",
",",
"path",
",",
"format",
"=",
"None",
")",
":",
"name",
"=",
"None",
"data",
"=",
"None",
"if",
"format",
"is",
"None",
":",
"formats",
"=",
"(",
"FileFormat",
".",
"py",
",",
"FileFormat",
".",
"yaml",
")",
"else... | Load a developer package.
A developer package may for example be a package.yaml or package.py in a
user's source directory.
Args:
path: Directory containing the package definition file, or file
path for the package file itself
format: which FileFormat to... | [
"Load",
"a",
"developer",
"package",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/developer_package.py#L35-L119 | train |
nerdvegas/rez | src/rez/vendor/yaml/__init__.py | dump_all | def dump_all(documents, stream=None, Dumper=Dumper,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding='utf-8', explicit_start=None, explicit_end=None,
version=None, tags=None):
"""
Serialize... | python | def dump_all(documents, stream=None, Dumper=Dumper,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding='utf-8', explicit_start=None, explicit_end=None,
version=None, tags=None):
"""
Serialize... | [
"def",
"dump_all",
"(",
"documents",
",",
"stream",
"=",
"None",
",",
"Dumper",
"=",
"Dumper",
",",
"default_style",
"=",
"None",
",",
"default_flow_style",
"=",
"None",
",",
"canonical",
"=",
"None",
",",
"indent",
"=",
"None",
",",
"width",
"=",
"None"... | Serialize a sequence of Python objects into a YAML stream.
If stream is None, return the produced string instead. | [
"Serialize",
"a",
"sequence",
"of",
"Python",
"objects",
"into",
"a",
"YAML",
"stream",
".",
"If",
"stream",
"is",
"None",
"return",
"the",
"produced",
"string",
"instead",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/yaml/__init__.py#L163-L195 | train |
nerdvegas/rez | src/rezgui/objects/ProcessTrackerThread.py | ProcessTrackerThread.running_instances | def running_instances(self, context, process_name):
"""Get a list of running instances.
Args:
context (`ResolvedContext`): Context the process is running in.
process_name (str): Name of the process.
Returns:
List of (`subprocess.Popen`, start-time) 2-tuples,... | python | def running_instances(self, context, process_name):
"""Get a list of running instances.
Args:
context (`ResolvedContext`): Context the process is running in.
process_name (str): Name of the process.
Returns:
List of (`subprocess.Popen`, start-time) 2-tuples,... | [
"def",
"running_instances",
"(",
"self",
",",
"context",
",",
"process_name",
")",
":",
"handle",
"=",
"(",
"id",
"(",
"context",
")",
",",
"process_name",
")",
"it",
"=",
"self",
".",
"processes",
".",
"get",
"(",
"handle",
",",
"{",
"}",
")",
".",
... | Get a list of running instances.
Args:
context (`ResolvedContext`): Context the process is running in.
process_name (str): Name of the process.
Returns:
List of (`subprocess.Popen`, start-time) 2-tuples, where start_time
is the epoch time the process was... | [
"Get",
"a",
"list",
"of",
"running",
"instances",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/ProcessTrackerThread.py#L24-L38 | train |
nerdvegas/rez | src/rez/rex.py | ActionManager.get_public_methods | def get_public_methods(self):
"""
return a list of methods on this class which should be exposed in the rex
API.
"""
return self.get_action_methods() + [
('getenv', self.getenv),
('expandvars', self.expandvars),
('defined', self.defined),
... | python | def get_public_methods(self):
"""
return a list of methods on this class which should be exposed in the rex
API.
"""
return self.get_action_methods() + [
('getenv', self.getenv),
('expandvars', self.expandvars),
('defined', self.defined),
... | [
"def",
"get_public_methods",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_action_methods",
"(",
")",
"+",
"[",
"(",
"'getenv'",
",",
"self",
".",
"getenv",
")",
",",
"(",
"'expandvars'",
",",
"self",
".",
"expandvars",
")",
",",
"(",
"'defined'",
... | return a list of methods on this class which should be exposed in the rex
API. | [
"return",
"a",
"list",
"of",
"methods",
"on",
"this",
"class",
"which",
"should",
"be",
"exposed",
"in",
"the",
"rex",
"API",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L205-L214 | train |
nerdvegas/rez | src/rez/rex.py | Python.apply_environ | def apply_environ(self):
"""Apply changes to target environ.
"""
if self.manager is None:
raise RezSystemError("You must call 'set_manager' on a Python rex "
"interpreter before using it.")
self.target_environ.update(self.manager.environ) | python | def apply_environ(self):
"""Apply changes to target environ.
"""
if self.manager is None:
raise RezSystemError("You must call 'set_manager' on a Python rex "
"interpreter before using it.")
self.target_environ.update(self.manager.environ) | [
"def",
"apply_environ",
"(",
"self",
")",
":",
"if",
"self",
".",
"manager",
"is",
"None",
":",
"raise",
"RezSystemError",
"(",
"\"You must call 'set_manager' on a Python rex \"",
"\"interpreter before using it.\"",
")",
"self",
".",
"target_environ",
".",
"update",
"... | Apply changes to target environ. | [
"Apply",
"changes",
"to",
"target",
"environ",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L564-L571 | train |
nerdvegas/rez | src/rez/rex.py | EscapedString.formatted | def formatted(self, func):
"""Return the string with non-literal parts formatted.
Args:
func (callable): Callable that translates a string into a
formatted string.
Returns:
`EscapedString` object.
"""
other = EscapedString.__new__(Escaped... | python | def formatted(self, func):
"""Return the string with non-literal parts formatted.
Args:
func (callable): Callable that translates a string into a
formatted string.
Returns:
`EscapedString` object.
"""
other = EscapedString.__new__(Escaped... | [
"def",
"formatted",
"(",
"self",
",",
"func",
")",
":",
"other",
"=",
"EscapedString",
".",
"__new__",
"(",
"EscapedString",
")",
"other",
".",
"strings",
"=",
"[",
"]",
"for",
"is_literal",
",",
"value",
"in",
"self",
".",
"strings",
":",
"if",
"not",... | Return the string with non-literal parts formatted.
Args:
func (callable): Callable that translates a string into a
formatted string.
Returns:
`EscapedString` object. | [
"Return",
"the",
"string",
"with",
"non",
"-",
"literal",
"parts",
"formatted",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L764-L781 | train |
nerdvegas/rez | src/rez/rex.py | RexExecutor.execute_code | def execute_code(self, code, filename=None, isolate=False):
"""Execute code within the execution context.
Args:
code (str or SourceCode): Rex code to execute.
filename (str): Filename to report if there are syntax errors.
isolate (bool): If True, do not affect `self.... | python | def execute_code(self, code, filename=None, isolate=False):
"""Execute code within the execution context.
Args:
code (str or SourceCode): Rex code to execute.
filename (str): Filename to report if there are syntax errors.
isolate (bool): If True, do not affect `self.... | [
"def",
"execute_code",
"(",
"self",
",",
"code",
",",
"filename",
"=",
"None",
",",
"isolate",
"=",
"False",
")",
":",
"def",
"_apply",
"(",
")",
":",
"self",
".",
"compile_code",
"(",
"code",
"=",
"code",
",",
"filename",
"=",
"filename",
",",
"exec... | Execute code within the execution context.
Args:
code (str or SourceCode): Rex code to execute.
filename (str): Filename to report if there are syntax errors.
isolate (bool): If True, do not affect `self.globals` by executing
this code. | [
"Execute",
"code",
"within",
"the",
"execution",
"context",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L1187-L1217 | train |
nerdvegas/rez | src/rez/rex.py | RexExecutor.execute_function | def execute_function(self, func, *nargs, **kwargs):
"""
Execute a function object within the execution context.
@returns The result of the function call.
"""
# makes a copy of the func
import types
fn = types.FunctionType(func.func_code,
... | python | def execute_function(self, func, *nargs, **kwargs):
"""
Execute a function object within the execution context.
@returns The result of the function call.
"""
# makes a copy of the func
import types
fn = types.FunctionType(func.func_code,
... | [
"def",
"execute_function",
"(",
"self",
",",
"func",
",",
"*",
"nargs",
",",
"**",
"kwargs",
")",
":",
"import",
"types",
"fn",
"=",
"types",
".",
"FunctionType",
"(",
"func",
".",
"func_code",
",",
"func",
".",
"func_globals",
".",
"copy",
"(",
")",
... | Execute a function object within the execution context.
@returns The result of the function call. | [
"Execute",
"a",
"function",
"object",
"within",
"the",
"execution",
"context",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L1219-L1245 | train |
nerdvegas/rez | src/rez/rex.py | RexExecutor.get_output | def get_output(self, style=OutputStyle.file):
"""Returns the result of all previous calls to execute_code."""
return self.manager.get_output(style=style) | python | def get_output(self, style=OutputStyle.file):
"""Returns the result of all previous calls to execute_code."""
return self.manager.get_output(style=style) | [
"def",
"get_output",
"(",
"self",
",",
"style",
"=",
"OutputStyle",
".",
"file",
")",
":",
"return",
"self",
".",
"manager",
".",
"get_output",
"(",
"style",
"=",
"style",
")"
] | Returns the result of all previous calls to execute_code. | [
"Returns",
"the",
"result",
"of",
"all",
"previous",
"calls",
"to",
"execute_code",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L1247-L1249 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/filters/find.py | find.configure | def configure(self, graph, spanning_tree):
"""
Configure the filter.
@type graph: graph
@param graph: Graph.
@type spanning_tree: dictionary
@param spanning_tree: Spanning tree.
"""
self.graph = graph
self.spanning_tree = spanni... | python | def configure(self, graph, spanning_tree):
"""
Configure the filter.
@type graph: graph
@param graph: Graph.
@type spanning_tree: dictionary
@param spanning_tree: Spanning tree.
"""
self.graph = graph
self.spanning_tree = spanni... | [
"def",
"configure",
"(",
"self",
",",
"graph",
",",
"spanning_tree",
")",
":",
"self",
".",
"graph",
"=",
"graph",
"self",
".",
"spanning_tree",
"=",
"spanning_tree"
] | Configure the filter.
@type graph: graph
@param graph: Graph.
@type spanning_tree: dictionary
@param spanning_tree: Spanning tree. | [
"Configure",
"the",
"filter",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/filters/find.py#L47-L58 | train |
nerdvegas/rez | src/rez/package_filter.py | PackageFilterBase.iter_packages | def iter_packages(self, name, range_=None, paths=None):
"""Same as iter_packages in packages.py, but also applies this filter.
Args:
name (str): Name of the package, eg 'maya'.
range_ (VersionRange or str): If provided, limits the versions returned
to those in `r... | python | def iter_packages(self, name, range_=None, paths=None):
"""Same as iter_packages in packages.py, but also applies this filter.
Args:
name (str): Name of the package, eg 'maya'.
range_ (VersionRange or str): If provided, limits the versions returned
to those in `r... | [
"def",
"iter_packages",
"(",
"self",
",",
"name",
",",
"range_",
"=",
"None",
",",
"paths",
"=",
"None",
")",
":",
"for",
"package",
"in",
"iter_packages",
"(",
"name",
",",
"range_",
",",
"paths",
")",
":",
"if",
"not",
"self",
".",
"excludes",
"(",... | Same as iter_packages in packages.py, but also applies this filter.
Args:
name (str): Name of the package, eg 'maya'.
range_ (VersionRange or str): If provided, limits the versions returned
to those in `range_`.
paths (list of str, optional): paths to search ... | [
"Same",
"as",
"iter_packages",
"in",
"packages",
".",
"py",
"but",
"also",
"applies",
"this",
"filter",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L49-L64 | train |
nerdvegas/rez | src/rez/package_filter.py | PackageFilter.copy | def copy(self):
"""Return a shallow copy of the filter.
Adding rules to the copy will not alter the source.
"""
other = PackageFilter.__new__(PackageFilter)
other._excludes = self._excludes.copy()
other._includes = self._includes.copy()
return other | python | def copy(self):
"""Return a shallow copy of the filter.
Adding rules to the copy will not alter the source.
"""
other = PackageFilter.__new__(PackageFilter)
other._excludes = self._excludes.copy()
other._includes = self._includes.copy()
return other | [
"def",
"copy",
"(",
"self",
")",
":",
"other",
"=",
"PackageFilter",
".",
"__new__",
"(",
"PackageFilter",
")",
"other",
".",
"_excludes",
"=",
"self",
".",
"_excludes",
".",
"copy",
"(",
")",
"other",
".",
"_includes",
"=",
"self",
".",
"_includes",
"... | Return a shallow copy of the filter.
Adding rules to the copy will not alter the source. | [
"Return",
"a",
"shallow",
"copy",
"of",
"the",
"filter",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L126-L134 | train |
nerdvegas/rez | src/rez/package_filter.py | PackageFilter.cost | def cost(self):
"""Get the approximate cost of this filter.
Cost is the total cost of the exclusion rules in this filter. The cost
of family-specific filters is divided by 10.
Returns:
float: The approximate cost of the filter.
"""
total = 0.0
for fa... | python | def cost(self):
"""Get the approximate cost of this filter.
Cost is the total cost of the exclusion rules in this filter. The cost
of family-specific filters is divided by 10.
Returns:
float: The approximate cost of the filter.
"""
total = 0.0
for fa... | [
"def",
"cost",
"(",
"self",
")",
":",
"total",
"=",
"0.0",
"for",
"family",
",",
"rules",
"in",
"self",
".",
"_excludes",
".",
"iteritems",
"(",
")",
":",
"cost",
"=",
"sum",
"(",
"x",
".",
"cost",
"(",
")",
"for",
"x",
"in",
"rules",
")",
"if"... | Get the approximate cost of this filter.
Cost is the total cost of the exclusion rules in this filter. The cost
of family-specific filters is divided by 10.
Returns:
float: The approximate cost of the filter. | [
"Get",
"the",
"approximate",
"cost",
"of",
"this",
"filter",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L149-L164 | train |
nerdvegas/rez | src/rez/package_filter.py | PackageFilterList.add_filter | def add_filter(self, package_filter):
"""Add a filter to the list.
Args:
package_filter (`PackageFilter`): Filter to add.
"""
filters = self.filters + [package_filter]
self.filters = sorted(filters, key=lambda x: x.cost) | python | def add_filter(self, package_filter):
"""Add a filter to the list.
Args:
package_filter (`PackageFilter`): Filter to add.
"""
filters = self.filters + [package_filter]
self.filters = sorted(filters, key=lambda x: x.cost) | [
"def",
"add_filter",
"(",
"self",
",",
"package_filter",
")",
":",
"filters",
"=",
"self",
".",
"filters",
"+",
"[",
"package_filter",
"]",
"self",
".",
"filters",
"=",
"sorted",
"(",
"filters",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
".",
"cost",
... | Add a filter to the list.
Args:
package_filter (`PackageFilter`): Filter to add. | [
"Add",
"a",
"filter",
"to",
"the",
"list",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L210-L217 | train |
nerdvegas/rez | src/rez/package_filter.py | PackageFilterList.copy | def copy(self):
"""Return a copy of the filter list.
Adding rules to the copy will not alter the source.
"""
other = PackageFilterList.__new__(PackageFilterList)
other.filters = [x.copy() for x in self.filters]
return other | python | def copy(self):
"""Return a copy of the filter list.
Adding rules to the copy will not alter the source.
"""
other = PackageFilterList.__new__(PackageFilterList)
other.filters = [x.copy() for x in self.filters]
return other | [
"def",
"copy",
"(",
"self",
")",
":",
"other",
"=",
"PackageFilterList",
".",
"__new__",
"(",
"PackageFilterList",
")",
"other",
".",
"filters",
"=",
"[",
"x",
".",
"copy",
"(",
")",
"for",
"x",
"in",
"self",
".",
"filters",
"]",
"return",
"other"
] | Return a copy of the filter list.
Adding rules to the copy will not alter the source. | [
"Return",
"a",
"copy",
"of",
"the",
"filter",
"list",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L244-L251 | train |
nerdvegas/rez | src/rez/package_filter.py | Rule.parse_rule | def parse_rule(cls, txt):
"""Parse a rule from a string.
See rezconfig.package_filter for an overview of valid strings.
Args:
txt (str): String to parse.
Returns:
`Rule` instance.
"""
types = {"glob": GlobRule,
"regex": RegexRul... | python | def parse_rule(cls, txt):
"""Parse a rule from a string.
See rezconfig.package_filter for an overview of valid strings.
Args:
txt (str): String to parse.
Returns:
`Rule` instance.
"""
types = {"glob": GlobRule,
"regex": RegexRul... | [
"def",
"parse_rule",
"(",
"cls",
",",
"txt",
")",
":",
"types",
"=",
"{",
"\"glob\"",
":",
"GlobRule",
",",
"\"regex\"",
":",
"RegexRule",
",",
"\"range\"",
":",
"RangeRule",
",",
"\"before\"",
":",
"TimestampRule",
",",
"\"after\"",
":",
"TimestampRule",
... | Parse a rule from a string.
See rezconfig.package_filter for an overview of valid strings.
Args:
txt (str): String to parse.
Returns:
`Rule` instance. | [
"Parse",
"a",
"rule",
"from",
"a",
"string",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L309-L345 | train |
nerdvegas/rez | src/rez/vendor/amqp/serialization.py | AMQPReader.read_bit | def read_bit(self):
"""Read a single boolean value."""
if not self.bitcount:
self.bits = ord(self.input.read(1))
self.bitcount = 8
result = (self.bits & 1) == 1
self.bits >>= 1
self.bitcount -= 1
return result | python | def read_bit(self):
"""Read a single boolean value."""
if not self.bitcount:
self.bits = ord(self.input.read(1))
self.bitcount = 8
result = (self.bits & 1) == 1
self.bits >>= 1
self.bitcount -= 1
return result | [
"def",
"read_bit",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"bitcount",
":",
"self",
".",
"bits",
"=",
"ord",
"(",
"self",
".",
"input",
".",
"read",
"(",
"1",
")",
")",
"self",
".",
"bitcount",
"=",
"8",
"result",
"=",
"(",
"self",
"."... | Read a single boolean value. | [
"Read",
"a",
"single",
"boolean",
"value",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L76-L84 | train |
nerdvegas/rez | src/rez/vendor/amqp/serialization.py | AMQPReader.read_long | def read_long(self):
"""Read an unsigned 32-bit integer"""
self.bitcount = self.bits = 0
return unpack('>I', self.input.read(4))[0] | python | def read_long(self):
"""Read an unsigned 32-bit integer"""
self.bitcount = self.bits = 0
return unpack('>I', self.input.read(4))[0] | [
"def",
"read_long",
"(",
"self",
")",
":",
"self",
".",
"bitcount",
"=",
"self",
".",
"bits",
"=",
"0",
"return",
"unpack",
"(",
"'>I'",
",",
"self",
".",
"input",
".",
"read",
"(",
"4",
")",
")",
"[",
"0",
"]"
] | Read an unsigned 32-bit integer | [
"Read",
"an",
"unsigned",
"32",
"-",
"bit",
"integer"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L96-L99 | train |
nerdvegas/rez | src/rez/vendor/amqp/serialization.py | AMQPReader.read_longlong | def read_longlong(self):
"""Read an unsigned 64-bit integer"""
self.bitcount = self.bits = 0
return unpack('>Q', self.input.read(8))[0] | python | def read_longlong(self):
"""Read an unsigned 64-bit integer"""
self.bitcount = self.bits = 0
return unpack('>Q', self.input.read(8))[0] | [
"def",
"read_longlong",
"(",
"self",
")",
":",
"self",
".",
"bitcount",
"=",
"self",
".",
"bits",
"=",
"0",
"return",
"unpack",
"(",
"'>Q'",
",",
"self",
".",
"input",
".",
"read",
"(",
"8",
")",
")",
"[",
"0",
"]"
] | Read an unsigned 64-bit integer | [
"Read",
"an",
"unsigned",
"64",
"-",
"bit",
"integer"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L101-L104 | train |
nerdvegas/rez | src/rez/vendor/amqp/serialization.py | AMQPReader.read_float | def read_float(self):
"""Read float value."""
self.bitcount = self.bits = 0
return unpack('>d', self.input.read(8))[0] | python | def read_float(self):
"""Read float value."""
self.bitcount = self.bits = 0
return unpack('>d', self.input.read(8))[0] | [
"def",
"read_float",
"(",
"self",
")",
":",
"self",
".",
"bitcount",
"=",
"self",
".",
"bits",
"=",
"0",
"return",
"unpack",
"(",
"'>d'",
",",
"self",
".",
"input",
".",
"read",
"(",
"8",
")",
")",
"[",
"0",
"]"
] | Read float value. | [
"Read",
"float",
"value",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L106-L109 | train |
nerdvegas/rez | src/rez/vendor/amqp/serialization.py | AMQPReader.read_shortstr | def read_shortstr(self):
"""Read a short string that's stored in up to 255 bytes.
The encoding isn't specified in the AMQP spec, so
assume it's utf-8
"""
self.bitcount = self.bits = 0
slen = unpack('B', self.input.read(1))[0]
return self.input.read(slen).decode(... | python | def read_shortstr(self):
"""Read a short string that's stored in up to 255 bytes.
The encoding isn't specified in the AMQP spec, so
assume it's utf-8
"""
self.bitcount = self.bits = 0
slen = unpack('B', self.input.read(1))[0]
return self.input.read(slen).decode(... | [
"def",
"read_shortstr",
"(",
"self",
")",
":",
"self",
".",
"bitcount",
"=",
"self",
".",
"bits",
"=",
"0",
"slen",
"=",
"unpack",
"(",
"'B'",
",",
"self",
".",
"input",
".",
"read",
"(",
"1",
")",
")",
"[",
"0",
"]",
"return",
"self",
".",
"in... | Read a short string that's stored in up to 255 bytes.
The encoding isn't specified in the AMQP spec, so
assume it's utf-8 | [
"Read",
"a",
"short",
"string",
"that",
"s",
"stored",
"in",
"up",
"to",
"255",
"bytes",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L111-L120 | train |
nerdvegas/rez | src/rez/vendor/amqp/serialization.py | GenericContent._load_properties | def _load_properties(self, raw_bytes):
"""Given the raw bytes containing the property-flags and property-list
from a content-frame-header, parse and insert into a dictionary
stored in this object as an attribute named 'properties'."""
r = AMQPReader(raw_bytes)
#
# Read 1... | python | def _load_properties(self, raw_bytes):
"""Given the raw bytes containing the property-flags and property-list
from a content-frame-header, parse and insert into a dictionary
stored in this object as an attribute named 'properties'."""
r = AMQPReader(raw_bytes)
#
# Read 1... | [
"def",
"_load_properties",
"(",
"self",
",",
"raw_bytes",
")",
":",
"r",
"=",
"AMQPReader",
"(",
"raw_bytes",
")",
"flags",
"=",
"[",
"]",
"while",
"1",
":",
"flag_bits",
"=",
"r",
".",
"read_short",
"(",
")",
"flags",
".",
"append",
"(",
"flag_bits",
... | Given the raw bytes containing the property-flags and property-list
from a content-frame-header, parse and insert into a dictionary
stored in this object as an attribute named 'properties'. | [
"Given",
"the",
"raw",
"bytes",
"containing",
"the",
"property",
"-",
"flags",
"and",
"property",
"-",
"list",
"from",
"a",
"content",
"-",
"frame",
"-",
"header",
"parse",
"and",
"insert",
"into",
"a",
"dictionary",
"stored",
"in",
"this",
"object",
"as",... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L451-L479 | train |
nerdvegas/rez | src/rez/util.py | create_executable_script | def create_executable_script(filepath, body, program=None):
"""Create an executable script.
Args:
filepath (str): File to create.
body (str or callable): Contents of the script. If a callable, its code
is used as the script body.
program (str): Name of program to launch the ... | python | def create_executable_script(filepath, body, program=None):
"""Create an executable script.
Args:
filepath (str): File to create.
body (str or callable): Contents of the script. If a callable, its code
is used as the script body.
program (str): Name of program to launch the ... | [
"def",
"create_executable_script",
"(",
"filepath",
",",
"body",
",",
"program",
"=",
"None",
")",
":",
"program",
"=",
"program",
"or",
"\"python\"",
"if",
"callable",
"(",
"body",
")",
":",
"from",
"rez",
".",
"utils",
".",
"sourcecode",
"import",
"Sourc... | Create an executable script.
Args:
filepath (str): File to create.
body (str or callable): Contents of the script. If a callable, its code
is used as the script body.
program (str): Name of program to launch the script, 'python' if None | [
"Create",
"an",
"executable",
"script",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L31-L60 | train |
nerdvegas/rez | src/rez/util.py | create_forwarding_script | def create_forwarding_script(filepath, module, func_name, *nargs, **kwargs):
"""Create a 'forwarding' script.
A forwarding script is one that executes some arbitrary Rez function. This
is used internally by Rez to dynamically create a script that uses Rez,
even though the parent environment may not be ... | python | def create_forwarding_script(filepath, module, func_name, *nargs, **kwargs):
"""Create a 'forwarding' script.
A forwarding script is one that executes some arbitrary Rez function. This
is used internally by Rez to dynamically create a script that uses Rez,
even though the parent environment may not be ... | [
"def",
"create_forwarding_script",
"(",
"filepath",
",",
"module",
",",
"func_name",
",",
"*",
"nargs",
",",
"**",
"kwargs",
")",
":",
"doc",
"=",
"dict",
"(",
"module",
"=",
"module",
",",
"func_name",
"=",
"func_name",
")",
"if",
"nargs",
":",
"doc",
... | Create a 'forwarding' script.
A forwarding script is one that executes some arbitrary Rez function. This
is used internally by Rez to dynamically create a script that uses Rez,
even though the parent environment may not be configured to do so. | [
"Create",
"a",
"forwarding",
"script",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L63-L80 | train |
nerdvegas/rez | src/rez/util.py | dedup | def dedup(seq):
"""Remove duplicates from a list while keeping order."""
seen = set()
for item in seq:
if item not in seen:
seen.add(item)
yield item | python | def dedup(seq):
"""Remove duplicates from a list while keeping order."""
seen = set()
for item in seq:
if item not in seen:
seen.add(item)
yield item | [
"def",
"dedup",
"(",
"seq",
")",
":",
"seen",
"=",
"set",
"(",
")",
"for",
"item",
"in",
"seq",
":",
"if",
"item",
"not",
"in",
"seen",
":",
"seen",
".",
"add",
"(",
"item",
")",
"yield",
"item"
] | Remove duplicates from a list while keeping order. | [
"Remove",
"duplicates",
"from",
"a",
"list",
"while",
"keeping",
"order",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L83-L89 | train |
nerdvegas/rez | src/rez/util.py | find_last_sublist | def find_last_sublist(list_, sublist):
"""Given a list, find the last occurance of a sublist within it.
Returns:
Index where the sublist starts, or None if there is no match.
"""
for i in reversed(range(len(list_) - len(sublist) + 1)):
if list_[i] == sublist[0] and list_[i:i + len(subli... | python | def find_last_sublist(list_, sublist):
"""Given a list, find the last occurance of a sublist within it.
Returns:
Index where the sublist starts, or None if there is no match.
"""
for i in reversed(range(len(list_) - len(sublist) + 1)):
if list_[i] == sublist[0] and list_[i:i + len(subli... | [
"def",
"find_last_sublist",
"(",
"list_",
",",
"sublist",
")",
":",
"for",
"i",
"in",
"reversed",
"(",
"range",
"(",
"len",
"(",
"list_",
")",
"-",
"len",
"(",
"sublist",
")",
"+",
"1",
")",
")",
":",
"if",
"list_",
"[",
"i",
"]",
"==",
"sublist"... | Given a list, find the last occurance of a sublist within it.
Returns:
Index where the sublist starts, or None if there is no match. | [
"Given",
"a",
"list",
"find",
"the",
"last",
"occurance",
"of",
"a",
"sublist",
"within",
"it",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L157-L166 | train |
nerdvegas/rez | src/rez/package_help.py | PackageHelp.open | def open(self, section_index=0):
"""Launch a help section."""
uri = self._sections[section_index][1]
if len(uri.split()) == 1:
self._open_url(uri)
else:
if self._verbose:
print "running command: %s" % uri
p = popen(uri, shell=True)
... | python | def open(self, section_index=0):
"""Launch a help section."""
uri = self._sections[section_index][1]
if len(uri.split()) == 1:
self._open_url(uri)
else:
if self._verbose:
print "running command: %s" % uri
p = popen(uri, shell=True)
... | [
"def",
"open",
"(",
"self",
",",
"section_index",
"=",
"0",
")",
":",
"uri",
"=",
"self",
".",
"_sections",
"[",
"section_index",
"]",
"[",
"1",
"]",
"if",
"len",
"(",
"uri",
".",
"split",
"(",
")",
")",
"==",
"1",
":",
"self",
".",
"_open_url",
... | Launch a help section. | [
"Launch",
"a",
"help",
"section",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_help.py#L88-L97 | train |
nerdvegas/rez | src/rez/package_help.py | PackageHelp.print_info | def print_info(self, buf=None):
"""Print help sections."""
buf = buf or sys.stdout
print >> buf, "Sections:"
for i, section in enumerate(self._sections):
print >> buf, " %s:\t%s (%s)" % (i + 1, section[0], section[1]) | python | def print_info(self, buf=None):
"""Print help sections."""
buf = buf or sys.stdout
print >> buf, "Sections:"
for i, section in enumerate(self._sections):
print >> buf, " %s:\t%s (%s)" % (i + 1, section[0], section[1]) | [
"def",
"print_info",
"(",
"self",
",",
"buf",
"=",
"None",
")",
":",
"buf",
"=",
"buf",
"or",
"sys",
".",
"stdout",
"print",
">>",
"buf",
",",
"\"Sections:\"",
"for",
"i",
",",
"section",
"in",
"enumerate",
"(",
"self",
".",
"_sections",
")",
":",
... | Print help sections. | [
"Print",
"help",
"sections",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_help.py#L99-L104 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.set_servers | def set_servers(self, servers):
"""
Set the pool of servers used by this client.
@param servers: an array of servers.
Servers can be passed in two forms:
1. Strings of the form C{"host:port"}, which implies a default weight of 1.
2. Tuples of the form C{("host:po... | python | def set_servers(self, servers):
"""
Set the pool of servers used by this client.
@param servers: an array of servers.
Servers can be passed in two forms:
1. Strings of the form C{"host:port"}, which implies a default weight of 1.
2. Tuples of the form C{("host:po... | [
"def",
"set_servers",
"(",
"self",
",",
"servers",
")",
":",
"self",
".",
"servers",
"=",
"[",
"_Host",
"(",
"s",
",",
"self",
".",
"debug",
",",
"dead_retry",
"=",
"self",
".",
"dead_retry",
",",
"socket_timeout",
"=",
"self",
".",
"socket_timeout",
"... | Set the pool of servers used by this client.
@param servers: an array of servers.
Servers can be passed in two forms:
1. Strings of the form C{"host:port"}, which implies a default weight of 1.
2. Tuples of the form C{("host:port", weight)}, where C{weight} is
an int... | [
"Set",
"the",
"pool",
"of",
"servers",
"used",
"by",
"this",
"client",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L240-L254 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.get_stats | def get_stats(self, stat_args = None):
'''Get statistics from each of the servers.
@param stat_args: Additional arguments to pass to the memcache
"stats" command.
@return: A list of tuples ( server_identifier, stats_dictionary ).
The dictionary contains a number of name... | python | def get_stats(self, stat_args = None):
'''Get statistics from each of the servers.
@param stat_args: Additional arguments to pass to the memcache
"stats" command.
@return: A list of tuples ( server_identifier, stats_dictionary ).
The dictionary contains a number of name... | [
"def",
"get_stats",
"(",
"self",
",",
"stat_args",
"=",
"None",
")",
":",
"data",
"=",
"[",
"]",
"for",
"s",
"in",
"self",
".",
"servers",
":",
"if",
"not",
"s",
".",
"connect",
"(",
")",
":",
"continue",
"if",
"s",
".",
"family",
"==",
"socket",... | Get statistics from each of the servers.
@param stat_args: Additional arguments to pass to the memcache
"stats" command.
@return: A list of tuples ( server_identifier, stats_dictionary ).
The dictionary contains a number of name/value pairs specifying
the name of th... | [
"Get",
"statistics",
"from",
"each",
"of",
"the",
"servers",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L256-L290 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.delete_multi | def delete_multi(self, keys, time=0, key_prefix=''):
'''
Delete multiple keys in the memcache doing just one query.
>>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'})
>>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'}
1
>>> mc.delete... | python | def delete_multi(self, keys, time=0, key_prefix=''):
'''
Delete multiple keys in the memcache doing just one query.
>>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'})
>>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'}
1
>>> mc.delete... | [
"def",
"delete_multi",
"(",
"self",
",",
"keys",
",",
"time",
"=",
"0",
",",
"key_prefix",
"=",
"''",
")",
":",
"self",
".",
"_statlog",
"(",
"'delete_multi'",
")",
"server_keys",
",",
"prefixed_to_orig_key",
"=",
"self",
".",
"_map_and_prefix_keys",
"(",
... | Delete multiple keys in the memcache doing just one query.
>>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'})
>>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'}
1
>>> mc.delete_multi(['key1', 'key2'])
1
>>> mc.get_multi(['key1', 'key... | [
"Delete",
"multiple",
"keys",
"in",
"the",
"memcache",
"doing",
"just",
"one",
"query",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L365-L429 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.delete | def delete(self, key, time=0):
'''Deletes a key from the memcache.
@return: Nonzero on success.
@param time: number of seconds any subsequent set / update commands
should fail. Defaults to None for no delay.
@rtype: int
'''
if self.do_check_key:
self.... | python | def delete(self, key, time=0):
'''Deletes a key from the memcache.
@return: Nonzero on success.
@param time: number of seconds any subsequent set / update commands
should fail. Defaults to None for no delay.
@rtype: int
'''
if self.do_check_key:
self.... | [
"def",
"delete",
"(",
"self",
",",
"key",
",",
"time",
"=",
"0",
")",
":",
"if",
"self",
".",
"do_check_key",
":",
"self",
".",
"check_key",
"(",
"key",
")",
"server",
",",
"key",
"=",
"self",
".",
"_get_server",
"(",
"key",
")",
"if",
"not",
"se... | Deletes a key from the memcache.
@return: Nonzero on success.
@param time: number of seconds any subsequent set / update commands
should fail. Defaults to None for no delay.
@rtype: int | [
"Deletes",
"a",
"key",
"from",
"the",
"memcache",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L431-L459 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.add | def add(self, key, val, time = 0, min_compress_len = 0):
'''
Add new key with value.
Like L{set}, but only stores in memcache if the key doesn't already exist.
@return: Nonzero on success.
@rtype: int
'''
return self._set("add", key, val, time, min_compress_len) | python | def add(self, key, val, time = 0, min_compress_len = 0):
'''
Add new key with value.
Like L{set}, but only stores in memcache if the key doesn't already exist.
@return: Nonzero on success.
@rtype: int
'''
return self._set("add", key, val, time, min_compress_len) | [
"def",
"add",
"(",
"self",
",",
"key",
",",
"val",
",",
"time",
"=",
"0",
",",
"min_compress_len",
"=",
"0",
")",
":",
"return",
"self",
".",
"_set",
"(",
"\"add\"",
",",
"key",
",",
"val",
",",
"time",
",",
"min_compress_len",
")"
] | Add new key with value.
Like L{set}, but only stores in memcache if the key doesn't already exist.
@return: Nonzero on success.
@rtype: int | [
"Add",
"new",
"key",
"with",
"value",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L517-L526 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.append | def append(self, key, val, time=0, min_compress_len=0):
'''Append the value to the end of the existing key's value.
Only stores in memcache if key already exists.
Also see L{prepend}.
@return: Nonzero on success.
@rtype: int
'''
return self._set("append", key, v... | python | def append(self, key, val, time=0, min_compress_len=0):
'''Append the value to the end of the existing key's value.
Only stores in memcache if key already exists.
Also see L{prepend}.
@return: Nonzero on success.
@rtype: int
'''
return self._set("append", key, v... | [
"def",
"append",
"(",
"self",
",",
"key",
",",
"val",
",",
"time",
"=",
"0",
",",
"min_compress_len",
"=",
"0",
")",
":",
"return",
"self",
".",
"_set",
"(",
"\"append\"",
",",
"key",
",",
"val",
",",
"time",
",",
"min_compress_len",
")"
] | Append the value to the end of the existing key's value.
Only stores in memcache if key already exists.
Also see L{prepend}.
@return: Nonzero on success.
@rtype: int | [
"Append",
"the",
"value",
"to",
"the",
"end",
"of",
"the",
"existing",
"key",
"s",
"value",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L528-L537 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.prepend | def prepend(self, key, val, time=0, min_compress_len=0):
'''Prepend the value to the beginning of the existing key's value.
Only stores in memcache if key already exists.
Also see L{append}.
@return: Nonzero on success.
@rtype: int
'''
return self._set("prepend"... | python | def prepend(self, key, val, time=0, min_compress_len=0):
'''Prepend the value to the beginning of the existing key's value.
Only stores in memcache if key already exists.
Also see L{append}.
@return: Nonzero on success.
@rtype: int
'''
return self._set("prepend"... | [
"def",
"prepend",
"(",
"self",
",",
"key",
",",
"val",
",",
"time",
"=",
"0",
",",
"min_compress_len",
"=",
"0",
")",
":",
"return",
"self",
".",
"_set",
"(",
"\"prepend\"",
",",
"key",
",",
"val",
",",
"time",
",",
"min_compress_len",
")"
] | Prepend the value to the beginning of the existing key's value.
Only stores in memcache if key already exists.
Also see L{append}.
@return: Nonzero on success.
@rtype: int | [
"Prepend",
"the",
"value",
"to",
"the",
"beginning",
"of",
"the",
"existing",
"key",
"s",
"value",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L539-L548 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.replace | def replace(self, key, val, time=0, min_compress_len=0):
'''Replace existing key with value.
Like L{set}, but only stores in memcache if the key already exists.
The opposite of L{add}.
@return: Nonzero on success.
@rtype: int
'''
return self._set("replace", key,... | python | def replace(self, key, val, time=0, min_compress_len=0):
'''Replace existing key with value.
Like L{set}, but only stores in memcache if the key already exists.
The opposite of L{add}.
@return: Nonzero on success.
@rtype: int
'''
return self._set("replace", key,... | [
"def",
"replace",
"(",
"self",
",",
"key",
",",
"val",
",",
"time",
"=",
"0",
",",
"min_compress_len",
"=",
"0",
")",
":",
"return",
"self",
".",
"_set",
"(",
"\"replace\"",
",",
"key",
",",
"val",
",",
"time",
",",
"min_compress_len",
")"
] | Replace existing key with value.
Like L{set}, but only stores in memcache if the key already exists.
The opposite of L{add}.
@return: Nonzero on success.
@rtype: int | [
"Replace",
"existing",
"key",
"with",
"value",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L550-L559 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.set | def set(self, key, val, time=0, min_compress_len=0):
'''Unconditionally sets a key to a given value in the memcache.
The C{key} can optionally be an tuple, with the first element
being the server hash value and the second being the key.
If you want to avoid making this module calculate ... | python | def set(self, key, val, time=0, min_compress_len=0):
'''Unconditionally sets a key to a given value in the memcache.
The C{key} can optionally be an tuple, with the first element
being the server hash value and the second being the key.
If you want to avoid making this module calculate ... | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"val",
",",
"time",
"=",
"0",
",",
"min_compress_len",
"=",
"0",
")",
":",
"return",
"self",
".",
"_set",
"(",
"\"set\"",
",",
"key",
",",
"val",
",",
"time",
",",
"min_compress_len",
")"
] | Unconditionally sets a key to a given value in the memcache.
The C{key} can optionally be an tuple, with the first element
being the server hash value and the second being the key.
If you want to avoid making this module calculate a hash value.
You may prefer, for example, to keep all o... | [
"Unconditionally",
"sets",
"a",
"key",
"to",
"a",
"given",
"value",
"in",
"the",
"memcache",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L561-L585 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.set_multi | def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
'''
Sets multiple keys in the memcache doing just one query.
>>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'})
>>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'}
1
... | python | def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
'''
Sets multiple keys in the memcache doing just one query.
>>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'})
>>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'}
1
... | [
"def",
"set_multi",
"(",
"self",
",",
"mapping",
",",
"time",
"=",
"0",
",",
"key_prefix",
"=",
"''",
",",
"min_compress_len",
"=",
"0",
")",
":",
"self",
".",
"_statlog",
"(",
"'set_multi'",
")",
"server_keys",
",",
"prefixed_to_orig_key",
"=",
"self",
... | Sets multiple keys in the memcache doing just one query.
>>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'})
>>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'}
1
This method is recommended over regular L{set} as it lowers the
number of tota... | [
"Sets",
"multiple",
"keys",
"in",
"the",
"memcache",
"doing",
"just",
"one",
"query",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L658-L755 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | Client.get_multi | def get_multi(self, keys, key_prefix=''):
'''
Retrieves multiple keys from the memcache doing just one query.
>>> success = mc.set("foo", "bar")
>>> success = mc.set("baz", 42)
>>> mc.get_multi(["foo", "baz", "foobar"]) == {"foo": "bar", "baz": 42}
1
>>> mc.set_m... | python | def get_multi(self, keys, key_prefix=''):
'''
Retrieves multiple keys from the memcache doing just one query.
>>> success = mc.set("foo", "bar")
>>> success = mc.set("baz", 42)
>>> mc.get_multi(["foo", "baz", "foobar"]) == {"foo": "bar", "baz": 42}
1
>>> mc.set_m... | [
"def",
"get_multi",
"(",
"self",
",",
"keys",
",",
"key_prefix",
"=",
"''",
")",
":",
"self",
".",
"_statlog",
"(",
"'get_multi'",
")",
"server_keys",
",",
"prefixed_to_orig_key",
"=",
"self",
".",
"_map_and_prefix_keys",
"(",
"keys",
",",
"key_prefix",
")",... | Retrieves multiple keys from the memcache doing just one query.
>>> success = mc.set("foo", "bar")
>>> success = mc.set("baz", 42)
>>> mc.get_multi(["foo", "baz", "foobar"]) == {"foo": "bar", "baz": 42}
1
>>> mc.set_multi({'k1' : 1, 'k2' : 2}, key_prefix='pfx_') == []
1
... | [
"Retrieves",
"multiple",
"keys",
"from",
"the",
"memcache",
"doing",
"just",
"one",
"query",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L908-L978 | train |
nerdvegas/rez | src/rez/vendor/memcache/memcache.py | _Host.readline | def readline(self, raise_exception=False):
"""Read a line and return it. If "raise_exception" is set,
raise _ConnectionDeadError if the read fails, otherwise return
an empty string.
"""
buf = self.buffer
if self.socket:
recv = self.socket.recv
else:
... | python | def readline(self, raise_exception=False):
"""Read a line and return it. If "raise_exception" is set,
raise _ConnectionDeadError if the read fails, otherwise return
an empty string.
"""
buf = self.buffer
if self.socket:
recv = self.socket.recv
else:
... | [
"def",
"readline",
"(",
"self",
",",
"raise_exception",
"=",
"False",
")",
":",
"buf",
"=",
"self",
".",
"buffer",
"if",
"self",
".",
"socket",
":",
"recv",
"=",
"self",
".",
"socket",
".",
"recv",
"else",
":",
"recv",
"=",
"lambda",
"bufsize",
":",
... | Read a line and return it. If "raise_exception" is set,
raise _ConnectionDeadError if the read fails, otherwise return
an empty string. | [
"Read",
"a",
"line",
"and",
"return",
"it",
".",
"If",
"raise_exception",
"is",
"set",
"raise",
"_ConnectionDeadError",
"if",
"the",
"read",
"fails",
"otherwise",
"return",
"an",
"empty",
"string",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/memcache/memcache.py#L1168-L1194 | train |
nerdvegas/rez | src/rezplugins/package_repository/memory.py | MemoryPackageRepository.create_repository | def create_repository(cls, repository_data):
"""Create a standalone, in-memory repository.
Using this function bypasses the `package_repository_manager` singleton.
This is usually desired however, since in-memory repositories are for
temporarily storing programmatically created packages... | python | def create_repository(cls, repository_data):
"""Create a standalone, in-memory repository.
Using this function bypasses the `package_repository_manager` singleton.
This is usually desired however, since in-memory repositories are for
temporarily storing programmatically created packages... | [
"def",
"create_repository",
"(",
"cls",
",",
"repository_data",
")",
":",
"location",
"=",
"\"memory{%s}\"",
"%",
"hex",
"(",
"id",
"(",
"repository_data",
")",
")",
"resource_pool",
"=",
"ResourcePool",
"(",
"cache_size",
"=",
"None",
")",
"repo",
"=",
"Mem... | Create a standalone, in-memory repository.
Using this function bypasses the `package_repository_manager` singleton.
This is usually desired however, since in-memory repositories are for
temporarily storing programmatically created packages, which we do not
want to cache and that do not ... | [
"Create",
"a",
"standalone",
"in",
"-",
"memory",
"repository",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezplugins/package_repository/memory.py#L134-L152 | train |
nerdvegas/rez | src/build_utils/distlib/metadata.py | LegacyMetadata.read_file | def read_file(self, fileob):
"""Read the metadata values from a file object."""
msg = message_from_file(fileob)
self._fields['Metadata-Version'] = msg['metadata-version']
# When reading, get all the fields we can
for field in _ALL_FIELDS:
if field not in msg:
... | python | def read_file(self, fileob):
"""Read the metadata values from a file object."""
msg = message_from_file(fileob)
self._fields['Metadata-Version'] = msg['metadata-version']
# When reading, get all the fields we can
for field in _ALL_FIELDS:
if field not in msg:
... | [
"def",
"read_file",
"(",
"self",
",",
"fileob",
")",
":",
"msg",
"=",
"message_from_file",
"(",
"fileob",
")",
"self",
".",
"_fields",
"[",
"'Metadata-Version'",
"]",
"=",
"msg",
"[",
"'metadata-version'",
"]",
"for",
"field",
"in",
"_ALL_FIELDS",
":",
"if... | Read the metadata values from a file object. | [
"Read",
"the",
"metadata",
"values",
"from",
"a",
"file",
"object",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/distlib/metadata.py#L334-L354 | train |
nerdvegas/rez | src/build_utils/distlib/metadata.py | LegacyMetadata.check | def check(self, strict=False):
"""Check if the metadata is compliant. If strict is True then raise if
no Name or Version are provided"""
self.set_metadata_version()
# XXX should check the versions (if the file was loaded)
missing, warnings = [], []
for attr in ('Name', ... | python | def check(self, strict=False):
"""Check if the metadata is compliant. If strict is True then raise if
no Name or Version are provided"""
self.set_metadata_version()
# XXX should check the versions (if the file was loaded)
missing, warnings = [], []
for attr in ('Name', ... | [
"def",
"check",
"(",
"self",
",",
"strict",
"=",
"False",
")",
":",
"self",
".",
"set_metadata_version",
"(",
")",
"missing",
",",
"warnings",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"attr",
"in",
"(",
"'Name'",
",",
"'Version'",
")",
":",
"if",
"attr... | Check if the metadata is compliant. If strict is True then raise if
no Name or Version are provided | [
"Check",
"if",
"the",
"metadata",
"is",
"compliant",
".",
"If",
"strict",
"is",
"True",
"then",
"raise",
"if",
"no",
"Name",
"or",
"Version",
"are",
"provided"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/distlib/metadata.py#L487-L529 | train |
nerdvegas/rez | src/rezgui/util.py | create_pane | def create_pane(widgets, horizontal, parent_widget=None, compact=False,
compact_spacing=2):
"""Create a widget containing an aligned set of widgets.
Args:
widgets (list of `QWidget`).
horizontal (bool).
align (str): One of:
- 'left', 'right' (horizontal);
... | python | def create_pane(widgets, horizontal, parent_widget=None, compact=False,
compact_spacing=2):
"""Create a widget containing an aligned set of widgets.
Args:
widgets (list of `QWidget`).
horizontal (bool).
align (str): One of:
- 'left', 'right' (horizontal);
... | [
"def",
"create_pane",
"(",
"widgets",
",",
"horizontal",
",",
"parent_widget",
"=",
"None",
",",
"compact",
"=",
"False",
",",
"compact_spacing",
"=",
"2",
")",
":",
"pane",
"=",
"parent_widget",
"or",
"QtGui",
".",
"QWidget",
"(",
")",
"type_",
"=",
"Qt... | Create a widget containing an aligned set of widgets.
Args:
widgets (list of `QWidget`).
horizontal (bool).
align (str): One of:
- 'left', 'right' (horizontal);
- 'top', 'bottom' (vertical)
parent_widget (`QWidget`): Owner widget, QWidget is created if this
... | [
"Create",
"a",
"widget",
"containing",
"an",
"aligned",
"set",
"of",
"widgets",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L7-L44 | train |
nerdvegas/rez | src/rezgui/util.py | get_icon | def get_icon(name, as_qicon=False):
"""Returns a `QPixmap` containing the given image, or a QIcon if `as_qicon`
is True"""
filename = name + ".png"
icon = icons.get(filename)
if not icon:
path = os.path.dirname(__file__)
path = os.path.join(path, "icons")
filepath = os.path.j... | python | def get_icon(name, as_qicon=False):
"""Returns a `QPixmap` containing the given image, or a QIcon if `as_qicon`
is True"""
filename = name + ".png"
icon = icons.get(filename)
if not icon:
path = os.path.dirname(__file__)
path = os.path.join(path, "icons")
filepath = os.path.j... | [
"def",
"get_icon",
"(",
"name",
",",
"as_qicon",
"=",
"False",
")",
":",
"filename",
"=",
"name",
"+",
"\".png\"",
"icon",
"=",
"icons",
".",
"get",
"(",
"filename",
")",
"if",
"not",
"icon",
":",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"("... | Returns a `QPixmap` containing the given image, or a QIcon if `as_qicon`
is True | [
"Returns",
"a",
"QPixmap",
"containing",
"the",
"given",
"image",
"or",
"a",
"QIcon",
"if",
"as_qicon",
"is",
"True"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L50-L65 | train |
nerdvegas/rez | src/rezgui/util.py | interp_color | def interp_color(a, b, f):
"""Interpolate between two colors.
Returns:
`QColor` object.
"""
a_ = (a.redF(), a.greenF(), a.blueF())
b_ = (b.redF(), b.greenF(), b.blueF())
a_ = [x * (1 - f) for x in a_]
b_ = [x * f for x in b_]
c = [x + y for x, y in zip(a_, b_)]
return QtGui.... | python | def interp_color(a, b, f):
"""Interpolate between two colors.
Returns:
`QColor` object.
"""
a_ = (a.redF(), a.greenF(), a.blueF())
b_ = (b.redF(), b.greenF(), b.blueF())
a_ = [x * (1 - f) for x in a_]
b_ = [x * f for x in b_]
c = [x + y for x, y in zip(a_, b_)]
return QtGui.... | [
"def",
"interp_color",
"(",
"a",
",",
"b",
",",
"f",
")",
":",
"a_",
"=",
"(",
"a",
".",
"redF",
"(",
")",
",",
"a",
".",
"greenF",
"(",
")",
",",
"a",
".",
"blueF",
"(",
")",
")",
"b_",
"=",
"(",
"b",
".",
"redF",
"(",
")",
",",
"b",
... | Interpolate between two colors.
Returns:
`QColor` object. | [
"Interpolate",
"between",
"two",
"colors",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L105-L116 | train |
nerdvegas/rez | src/rezgui/util.py | create_toolbutton | def create_toolbutton(entries, parent=None):
"""Create a toolbutton.
Args:
entries: List of (label, slot) tuples.
Returns:
`QtGui.QToolBar`.
"""
btn = QtGui.QToolButton(parent)
menu = QtGui.QMenu()
actions = []
for label, slot in entries:
action = add_menu_acti... | python | def create_toolbutton(entries, parent=None):
"""Create a toolbutton.
Args:
entries: List of (label, slot) tuples.
Returns:
`QtGui.QToolBar`.
"""
btn = QtGui.QToolButton(parent)
menu = QtGui.QMenu()
actions = []
for label, slot in entries:
action = add_menu_acti... | [
"def",
"create_toolbutton",
"(",
"entries",
",",
"parent",
"=",
"None",
")",
":",
"btn",
"=",
"QtGui",
".",
"QToolButton",
"(",
"parent",
")",
"menu",
"=",
"QtGui",
".",
"QMenu",
"(",
")",
"actions",
"=",
"[",
"]",
"for",
"label",
",",
"slot",
"in",
... | Create a toolbutton.
Args:
entries: List of (label, slot) tuples.
Returns:
`QtGui.QToolBar`. | [
"Create",
"a",
"toolbutton",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/util.py#L119-L139 | train |
nerdvegas/rez | src/build_utils/distlib/locators.py | SimpleScrapingLocator.get_page | def get_page(self, url):
"""
Get the HTML for an URL, possibly from an in-memory cache.
XXX TODO Note: this cache is never actually cleared. It's assumed that
the data won't get stale over the lifetime of a locator instance (not
necessarily true for the default_locator).
... | python | def get_page(self, url):
"""
Get the HTML for an URL, possibly from an in-memory cache.
XXX TODO Note: this cache is never actually cleared. It's assumed that
the data won't get stale over the lifetime of a locator instance (not
necessarily true for the default_locator).
... | [
"def",
"get_page",
"(",
"self",
",",
"url",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"_",
",",
"_",
",",
"_",
"=",
"urlparse",
"(",
"url",
")",
"if",
"scheme",
"==",
"'file'",
"and",
"os",
".",
"path",
".",
"isdir",
"(",
"url2pathname... | Get the HTML for an URL, possibly from an in-memory cache.
XXX TODO Note: this cache is never actually cleared. It's assumed that
the data won't get stale over the lifetime of a locator instance (not
necessarily true for the default_locator). | [
"Get",
"the",
"HTML",
"for",
"an",
"URL",
"possibly",
"from",
"an",
"in",
"-",
"memory",
"cache",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/distlib/locators.py#L673-L730 | train |
nerdvegas/rez | src/rez/package_search.py | get_reverse_dependency_tree | def get_reverse_dependency_tree(package_name, depth=None, paths=None,
build_requires=False,
private_build_requires=False):
"""Find packages that depend on the given package.
This is a reverse dependency lookup. A tree is constructed, showing what
... | python | def get_reverse_dependency_tree(package_name, depth=None, paths=None,
build_requires=False,
private_build_requires=False):
"""Find packages that depend on the given package.
This is a reverse dependency lookup. A tree is constructed, showing what
... | [
"def",
"get_reverse_dependency_tree",
"(",
"package_name",
",",
"depth",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"build_requires",
"=",
"False",
",",
"private_build_requires",
"=",
"False",
")",
":",
"pkgs_list",
"=",
"[",
"[",
"package_name",
"]",
"]",
... | Find packages that depend on the given package.
This is a reverse dependency lookup. A tree is constructed, showing what
packages depend on the given package, with an optional depth limit. A
resolve does not occur. Only the latest version of each package is used,
and requirements from all variants of t... | [
"Find",
"packages",
"that",
"depend",
"on",
"the",
"given",
"package",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L25-L121 | train |
nerdvegas/rez | src/rez/package_search.py | get_plugins | def get_plugins(package_name, paths=None):
"""Find packages that are plugins of the given package.
Args:
package_name (str): Name of the package.
paths (list of str): Paths to search for packages, defaults to
`config.packages_path`.
Returns:
list of str: The packages th... | python | def get_plugins(package_name, paths=None):
"""Find packages that are plugins of the given package.
Args:
package_name (str): Name of the package.
paths (list of str): Paths to search for packages, defaults to
`config.packages_path`.
Returns:
list of str: The packages th... | [
"def",
"get_plugins",
"(",
"package_name",
",",
"paths",
"=",
"None",
")",
":",
"pkg",
"=",
"get_latest_package",
"(",
"package_name",
",",
"paths",
"=",
"paths",
",",
"error",
"=",
"True",
")",
"if",
"not",
"pkg",
".",
"has_plugins",
":",
"return",
"[",... | Find packages that are plugins of the given package.
Args:
package_name (str): Name of the package.
paths (list of str): Paths to search for packages, defaults to
`config.packages_path`.
Returns:
list of str: The packages that are plugins of the given package. | [
"Find",
"packages",
"that",
"are",
"plugins",
"of",
"the",
"given",
"package",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L124-L157 | train |
nerdvegas/rez | src/rez/package_search.py | ResourceSearcher.search | def search(self, resources_request=None):
"""Search for resources.
Args:
resources_request (str): Resource to search, glob-style patterns
are supported. If None, returns all matching resource types.
Returns:
2-tuple:
- str: resource type (fam... | python | def search(self, resources_request=None):
"""Search for resources.
Args:
resources_request (str): Resource to search, glob-style patterns
are supported. If None, returns all matching resource types.
Returns:
2-tuple:
- str: resource type (fam... | [
"def",
"search",
"(",
"self",
",",
"resources_request",
"=",
"None",
")",
":",
"name_pattern",
",",
"version_range",
"=",
"self",
".",
"_parse_request",
"(",
"resources_request",
")",
"family_names",
"=",
"set",
"(",
"x",
".",
"name",
"for",
"x",
"in",
"it... | Search for resources.
Args:
resources_request (str): Resource to search, glob-style patterns
are supported. If None, returns all matching resource types.
Returns:
2-tuple:
- str: resource type (family, package, variant);
- List of `Resour... | [
"Search",
"for",
"resources",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L210-L305 | train |
nerdvegas/rez | src/rez/package_search.py | ResourceSearchResultFormatter.print_search_results | def print_search_results(self, search_results, buf=sys.stdout):
"""Print formatted search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
"""
formatted_lines = self.format_search_results(search_results)
pr = Printer(buf)
for... | python | def print_search_results(self, search_results, buf=sys.stdout):
"""Print formatted search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
"""
formatted_lines = self.format_search_results(search_results)
pr = Printer(buf)
for... | [
"def",
"print_search_results",
"(",
"self",
",",
"search_results",
",",
"buf",
"=",
"sys",
".",
"stdout",
")",
":",
"formatted_lines",
"=",
"self",
".",
"format_search_results",
"(",
"search_results",
")",
"pr",
"=",
"Printer",
"(",
"buf",
")",
"for",
"txt",... | Print formatted search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format. | [
"Print",
"formatted",
"search",
"results",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L347-L357 | train |
nerdvegas/rez | src/rez/package_search.py | ResourceSearchResultFormatter.format_search_results | def format_search_results(self, search_results):
"""Format search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
Returns:
List of 2-tuple: Text and color to print in.
"""
formatted_lines = []
for search_result ... | python | def format_search_results(self, search_results):
"""Format search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
Returns:
List of 2-tuple: Text and color to print in.
"""
formatted_lines = []
for search_result ... | [
"def",
"format_search_results",
"(",
"self",
",",
"search_results",
")",
":",
"formatted_lines",
"=",
"[",
"]",
"for",
"search_result",
"in",
"search_results",
":",
"lines",
"=",
"self",
".",
"_format_search_result",
"(",
"search_result",
")",
"formatted_lines",
"... | Format search results.
Args:
search_results (list of `ResourceSearchResult`): Search to format.
Returns:
List of 2-tuple: Text and color to print in. | [
"Format",
"search",
"results",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L359-L374 | train |
nerdvegas/rez | src/rez/vendor/pygraph/readwrite/dot.py | read | def read(string):
"""
Read a graph from a string in Dot language and return it. Nodes and edges specified in the
input will be added to the current graph.
@type string: string
@param string: Input string in Dot format specifying a graph.
@rtype: graph
@return: Graph
"""
... | python | def read(string):
"""
Read a graph from a string in Dot language and return it. Nodes and edges specified in the
input will be added to the current graph.
@type string: string
@param string: Input string in Dot format specifying a graph.
@rtype: graph
@return: Graph
"""
... | [
"def",
"read",
"(",
"string",
")",
":",
"dotG",
"=",
"pydot",
".",
"graph_from_dot_data",
"(",
"string",
")",
"if",
"(",
"dotG",
".",
"get_type",
"(",
")",
"==",
"\"graph\"",
")",
":",
"G",
"=",
"graph",
"(",
")",
"elif",
"(",
"dotG",
".",
"get_typ... | Read a graph from a string in Dot language and return it. Nodes and edges specified in the
input will be added to the current graph.
@type string: string
@param string: Input string in Dot format specifying a graph.
@rtype: graph
@return: Graph | [
"Read",
"a",
"graph",
"from",
"a",
"string",
"in",
"Dot",
"language",
"and",
"return",
"it",
".",
"Nodes",
"and",
"edges",
"specified",
"in",
"the",
"input",
"will",
"be",
"added",
"to",
"the",
"current",
"graph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/readwrite/dot.py#L47-L104 | train |
nerdvegas/rez | src/rez/vendor/pygraph/readwrite/dot.py | read_hypergraph | def read_hypergraph(string):
"""
Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
added to the current hypergraph.
@type string: string
@param string: Input string in dot format specifying a graph.
@rtype: hypergraph
@return: Hypergrap... | python | def read_hypergraph(string):
"""
Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
added to the current hypergraph.
@type string: string
@param string: Input string in dot format specifying a graph.
@rtype: hypergraph
@return: Hypergrap... | [
"def",
"read_hypergraph",
"(",
"string",
")",
":",
"hgr",
"=",
"hypergraph",
"(",
")",
"dotG",
"=",
"pydot",
".",
"graph_from_dot_data",
"(",
"string",
")",
"for",
"each_node",
"in",
"dotG",
".",
"get_nodes",
"(",
")",
":",
"if",
"'hypernode'",
"==",
"ea... | Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
added to the current hypergraph.
@type string: string
@param string: Input string in dot format specifying a graph.
@rtype: hypergraph
@return: Hypergraph | [
"Read",
"a",
"hypergraph",
"from",
"a",
"string",
"in",
"dot",
"format",
".",
"Nodes",
"and",
"edges",
"specified",
"in",
"the",
"input",
"will",
"be",
"added",
"to",
"the",
"current",
"hypergraph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/readwrite/dot.py#L179-L213 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | graph_from_dot_file | def graph_from_dot_file(path):
"""Load graph as defined by a DOT file.
The file is assumed to be in DOT format. It will
be loaded, parsed and a Dot class will be returned,
representing the graph.
"""
fd = file(path, 'rb')
data = fd.read()
fd.close()
return graph_from_... | python | def graph_from_dot_file(path):
"""Load graph as defined by a DOT file.
The file is assumed to be in DOT format. It will
be loaded, parsed and a Dot class will be returned,
representing the graph.
"""
fd = file(path, 'rb')
data = fd.read()
fd.close()
return graph_from_... | [
"def",
"graph_from_dot_file",
"(",
"path",
")",
":",
"fd",
"=",
"file",
"(",
"path",
",",
"'rb'",
")",
"data",
"=",
"fd",
".",
"read",
"(",
")",
"fd",
".",
"close",
"(",
")",
"return",
"graph_from_dot_data",
"(",
"data",
")"
] | Load graph as defined by a DOT file.
The file is assumed to be in DOT format. It will
be loaded, parsed and a Dot class will be returned,
representing the graph. | [
"Load",
"graph",
"as",
"defined",
"by",
"a",
"DOT",
"file",
".",
"The",
"file",
"is",
"assumed",
"to",
"be",
"in",
"DOT",
"format",
".",
"It",
"will",
"be",
"loaded",
"parsed",
"and",
"a",
"Dot",
"class",
"will",
"be",
"returned",
"representing",
"the"... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L220-L232 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | __find_executables | def __find_executables(path):
"""Used by find_graphviz
path - single directory as a string
If any of the executables are found, it will return a dictionary
containing the program names as keys and their paths as values.
Otherwise returns None
"""
success = False
progs... | python | def __find_executables(path):
"""Used by find_graphviz
path - single directory as a string
If any of the executables are found, it will return a dictionary
containing the program names as keys and their paths as values.
Otherwise returns None
"""
success = False
progs... | [
"def",
"__find_executables",
"(",
"path",
")",
":",
"success",
"=",
"False",
"progs",
"=",
"{",
"'dot'",
":",
"''",
",",
"'twopi'",
":",
"''",
",",
"'neato'",
":",
"''",
",",
"'circo'",
":",
"''",
",",
"'fdp'",
":",
"''",
",",
"'sfdp'",
":",
"''",
... | Used by find_graphviz
path - single directory as a string
If any of the executables are found, it will return a dictionary
containing the program names as keys and their paths as values.
Otherwise returns None | [
"Used",
"by",
"find_graphviz",
"path",
"-",
"single",
"directory",
"as",
"a",
"string",
"If",
"any",
"of",
"the",
"executables",
"are",
"found",
"it",
"will",
"return",
"a",
"dictionary",
"containing",
"the",
"program",
"names",
"as",
"keys",
"and",
"their",... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L347-L398 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Edge.to_string | def to_string(self):
"""Returns a string representation of the edge in dot language.
"""
src = self.parse_node_ref( self.get_source() )
dst = self.parse_node_ref( self.get_destination() )
if isinstance(src, frozendict):
edge = [ Subgraph(obj_dict=src).to_str... | python | def to_string(self):
"""Returns a string representation of the edge in dot language.
"""
src = self.parse_node_ref( self.get_source() )
dst = self.parse_node_ref( self.get_destination() )
if isinstance(src, frozendict):
edge = [ Subgraph(obj_dict=src).to_str... | [
"def",
"to_string",
"(",
"self",
")",
":",
"src",
"=",
"self",
".",
"parse_node_ref",
"(",
"self",
".",
"get_source",
"(",
")",
")",
"dst",
"=",
"self",
".",
"parse_node_ref",
"(",
"self",
".",
"get_destination",
"(",
")",
")",
"if",
"isinstance",
"(",... | Returns a string representation of the edge in dot language. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"edge",
"in",
"dot",
"language",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L974-L1019 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.get_node | def get_node(self, name):
"""Retrieve a node from the graph.
Given a node's name the corresponding Node
instance will be returned.
If one or more nodes exist with that name a list of
Node instances is returned.
An empty list is returned otherwise.
... | python | def get_node(self, name):
"""Retrieve a node from the graph.
Given a node's name the corresponding Node
instance will be returned.
If one or more nodes exist with that name a list of
Node instances is returned.
An empty list is returned otherwise.
... | [
"def",
"get_node",
"(",
"self",
",",
"name",
")",
":",
"match",
"=",
"list",
"(",
")",
"if",
"self",
".",
"obj_dict",
"[",
"'nodes'",
"]",
".",
"has_key",
"(",
"name",
")",
":",
"match",
".",
"extend",
"(",
"[",
"Node",
"(",
"obj_dict",
"=",
"obj... | Retrieve a node from the graph.
Given a node's name the corresponding Node
instance will be returned.
If one or more nodes exist with that name a list of
Node instances is returned.
An empty list is returned otherwise. | [
"Retrieve",
"a",
"node",
"from",
"the",
"graph",
".",
"Given",
"a",
"node",
"s",
"name",
"the",
"corresponding",
"Node",
"instance",
"will",
"be",
"returned",
".",
"If",
"one",
"or",
"more",
"nodes",
"exist",
"with",
"that",
"name",
"a",
"list",
"of",
... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1323-L1340 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.add_edge | def add_edge(self, graph_edge):
"""Adds an edge object to the graph.
It takes a edge object as its only argument and returns
None.
"""
if not isinstance(graph_edge, Edge):
raise TypeError('add_edge() received a non edge class object: ' + str(graph_edge))
... | python | def add_edge(self, graph_edge):
"""Adds an edge object to the graph.
It takes a edge object as its only argument and returns
None.
"""
if not isinstance(graph_edge, Edge):
raise TypeError('add_edge() received a non edge class object: ' + str(graph_edge))
... | [
"def",
"add_edge",
"(",
"self",
",",
"graph_edge",
")",
":",
"if",
"not",
"isinstance",
"(",
"graph_edge",
",",
"Edge",
")",
":",
"raise",
"TypeError",
"(",
"'add_edge() received a non edge class object: '",
"+",
"str",
"(",
"graph_edge",
")",
")",
"edge_points"... | Adds an edge object to the graph.
It takes a edge object as its only argument and returns
None. | [
"Adds",
"an",
"edge",
"object",
"to",
"the",
"graph",
".",
"It",
"takes",
"a",
"edge",
"object",
"as",
"its",
"only",
"argument",
"and",
"returns",
"None",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1365-L1389 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.add_subgraph | def add_subgraph(self, sgraph):
"""Adds an subgraph object to the graph.
It takes a subgraph object as its only argument and returns
None.
"""
if not isinstance(sgraph, Subgraph) and not isinstance(sgraph, Cluster):
raise TypeError('add_subgraph() received a... | python | def add_subgraph(self, sgraph):
"""Adds an subgraph object to the graph.
It takes a subgraph object as its only argument and returns
None.
"""
if not isinstance(sgraph, Subgraph) and not isinstance(sgraph, Cluster):
raise TypeError('add_subgraph() received a... | [
"def",
"add_subgraph",
"(",
"self",
",",
"sgraph",
")",
":",
"if",
"not",
"isinstance",
"(",
"sgraph",
",",
"Subgraph",
")",
"and",
"not",
"isinstance",
"(",
"sgraph",
",",
"Cluster",
")",
":",
"raise",
"TypeError",
"(",
"'add_subgraph() received a non subgrap... | Adds an subgraph object to the graph.
It takes a subgraph object as its only argument and returns
None. | [
"Adds",
"an",
"subgraph",
"object",
"to",
"the",
"graph",
".",
"It",
"takes",
"a",
"subgraph",
"object",
"as",
"its",
"only",
"argument",
"and",
"returns",
"None",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1488-L1508 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Graph.to_string | def to_string(self):
"""Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string from.
"""
graph = list()
if self.obj_dict.get('strict', None) is not None:
if ... | python | def to_string(self):
"""Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string from.
"""
graph = list()
if self.obj_dict.get('strict', None) is not None:
if ... | [
"def",
"to_string",
"(",
"self",
")",
":",
"graph",
"=",
"list",
"(",
")",
"if",
"self",
".",
"obj_dict",
".",
"get",
"(",
"'strict'",
",",
"None",
")",
"is",
"not",
"None",
":",
"if",
"self",
"==",
"self",
".",
"get_parent_graph",
"(",
")",
"and",... | Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string from. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"graph",
"in",
"dot",
"language",
".",
"It",
"will",
"return",
"the",
"graph",
"and",
"all",
"its",
"subelements",
"in",
"string",
"from",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1576-L1670 | train |
nerdvegas/rez | src/rez/vendor/pydot/pydot.py | Dot.create | def create(self, prog=None, format='ps'):
"""Creates and returns a Postscript representation of the graph.
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
reading the Postscript output and returning it as a... | python | def create(self, prog=None, format='ps'):
"""Creates and returns a Postscript representation of the graph.
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
reading the Postscript output and returning it as a... | [
"def",
"create",
"(",
"self",
",",
"prog",
"=",
"None",
",",
"format",
"=",
"'ps'",
")",
":",
"if",
"prog",
"is",
"None",
":",
"prog",
"=",
"self",
".",
"prog",
"if",
"isinstance",
"(",
"prog",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"pr... | Creates and returns a Postscript representation of the graph.
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
reading the Postscript output and returning it as a string is the
operation is successful.
... | [
"Creates",
"and",
"returns",
"a",
"Postscript",
"representation",
"of",
"the",
"graph",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pydot/pydot.py#L1915-L2034 | train |
nerdvegas/rez | src/rez/utils/yaml.py | dump_yaml | def dump_yaml(data, Dumper=_Dumper, default_flow_style=False):
"""Returns data as yaml-formatted string."""
content = yaml.dump(data,
default_flow_style=default_flow_style,
Dumper=Dumper)
return content.strip() | python | def dump_yaml(data, Dumper=_Dumper, default_flow_style=False):
"""Returns data as yaml-formatted string."""
content = yaml.dump(data,
default_flow_style=default_flow_style,
Dumper=Dumper)
return content.strip() | [
"def",
"dump_yaml",
"(",
"data",
",",
"Dumper",
"=",
"_Dumper",
",",
"default_flow_style",
"=",
"False",
")",
":",
"content",
"=",
"yaml",
".",
"dump",
"(",
"data",
",",
"default_flow_style",
"=",
"default_flow_style",
",",
"Dumper",
"=",
"Dumper",
")",
"r... | Returns data as yaml-formatted string. | [
"Returns",
"data",
"as",
"yaml",
"-",
"formatted",
"string",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/yaml.py#L64-L69 | train |
nerdvegas/rez | src/rez/utils/yaml.py | load_yaml | def load_yaml(filepath):
"""Convenience function for loading yaml-encoded data from disk."""
with open(filepath) as f:
txt = f.read()
return yaml.load(txt) | python | def load_yaml(filepath):
"""Convenience function for loading yaml-encoded data from disk."""
with open(filepath) as f:
txt = f.read()
return yaml.load(txt) | [
"def",
"load_yaml",
"(",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"txt",
"=",
"f",
".",
"read",
"(",
")",
"return",
"yaml",
".",
"load",
"(",
"txt",
")"
] | Convenience function for loading yaml-encoded data from disk. | [
"Convenience",
"function",
"for",
"loading",
"yaml",
"-",
"encoded",
"data",
"from",
"disk",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/yaml.py#L72-L76 | train |
nerdvegas/rez | src/rez/utils/memcached.py | memcached_client | def memcached_client(servers=config.memcached_uri, debug=config.debug_memcache):
"""Get a shared memcached instance.
This function shares the same memcached instance across nested invocations.
This is done so that memcached connections can be kept to a minimum, but at
the same time unnecessary extra re... | python | def memcached_client(servers=config.memcached_uri, debug=config.debug_memcache):
"""Get a shared memcached instance.
This function shares the same memcached instance across nested invocations.
This is done so that memcached connections can be kept to a minimum, but at
the same time unnecessary extra re... | [
"def",
"memcached_client",
"(",
"servers",
"=",
"config",
".",
"memcached_uri",
",",
"debug",
"=",
"config",
".",
"debug_memcache",
")",
":",
"key",
"=",
"None",
"try",
":",
"client",
",",
"key",
"=",
"scoped_instance_manager",
".",
"acquire",
"(",
"servers"... | Get a shared memcached instance.
This function shares the same memcached instance across nested invocations.
This is done so that memcached connections can be kept to a minimum, but at
the same time unnecessary extra reconnections are avoided. Typically an
initial scope (using 'with' construct) is made... | [
"Get",
"a",
"shared",
"memcached",
"instance",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L207-L226 | train |
nerdvegas/rez | src/rez/utils/memcached.py | pool_memcached_connections | def pool_memcached_connections(func):
"""Function decorator to pool memcached connections.
Use this to wrap functions that might make multiple calls to memcached. This
will cause a single memcached client to be shared for all connections.
"""
if isgeneratorfunction(func):
def wrapper(*nargs... | python | def pool_memcached_connections(func):
"""Function decorator to pool memcached connections.
Use this to wrap functions that might make multiple calls to memcached. This
will cause a single memcached client to be shared for all connections.
"""
if isgeneratorfunction(func):
def wrapper(*nargs... | [
"def",
"pool_memcached_connections",
"(",
"func",
")",
":",
"if",
"isgeneratorfunction",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"nargs",
",",
"**",
"kwargs",
")",
":",
"with",
"memcached_client",
"(",
")",
":",
"for",
"result",
"in",
"func",
... | Function decorator to pool memcached connections.
Use this to wrap functions that might make multiple calls to memcached. This
will cause a single memcached client to be shared for all connections. | [
"Function",
"decorator",
"to",
"pool",
"memcached",
"connections",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L229-L245 | train |
nerdvegas/rez | src/rez/utils/memcached.py | memcached | def memcached(servers, key=None, from_cache=None, to_cache=None, time=0,
min_compress_len=0, debug=False):
"""memcached memoization function decorator.
The wrapped function is expected to return a value that is stored to a
memcached server, first translated by `to_cache` if provided. In the e... | python | def memcached(servers, key=None, from_cache=None, to_cache=None, time=0,
min_compress_len=0, debug=False):
"""memcached memoization function decorator.
The wrapped function is expected to return a value that is stored to a
memcached server, first translated by `to_cache` if provided. In the e... | [
"def",
"memcached",
"(",
"servers",
",",
"key",
"=",
"None",
",",
"from_cache",
"=",
"None",
",",
"to_cache",
"=",
"None",
",",
"time",
"=",
"0",
",",
"min_compress_len",
"=",
"0",
",",
"debug",
"=",
"False",
")",
":",
"def",
"default_key",
"(",
"fun... | memcached memoization function decorator.
The wrapped function is expected to return a value that is stored to a
memcached server, first translated by `to_cache` if provided. In the event
of a cache hit, the data is translated by `from_cache` if provided, before
being returned. If you do not want a res... | [
"memcached",
"memoization",
"function",
"decorator",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L248-L375 | train |
nerdvegas/rez | src/rez/utils/memcached.py | Client.client | def client(self):
"""Get the native memcache client.
Returns:
`memcache.Client` instance.
"""
if self._client is None:
self._client = Client_(self.servers)
return self._client | python | def client(self):
"""Get the native memcache client.
Returns:
`memcache.Client` instance.
"""
if self._client is None:
self._client = Client_(self.servers)
return self._client | [
"def",
"client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_client",
"is",
"None",
":",
"self",
".",
"_client",
"=",
"Client_",
"(",
"self",
".",
"servers",
")",
"return",
"self",
".",
"_client"
] | Get the native memcache client.
Returns:
`memcache.Client` instance. | [
"Get",
"the",
"native",
"memcache",
"client",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L48-L56 | train |
nerdvegas/rez | src/rez/utils/memcached.py | Client.flush | def flush(self, hard=False):
"""Drop existing entries from the cache.
Args:
hard (bool): If True, all current entries are flushed from the
server(s), which affects all users. If False, only the local
process is affected.
"""
if not self.server... | python | def flush(self, hard=False):
"""Drop existing entries from the cache.
Args:
hard (bool): If True, all current entries are flushed from the
server(s), which affects all users. If False, only the local
process is affected.
"""
if not self.server... | [
"def",
"flush",
"(",
"self",
",",
"hard",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"servers",
":",
"return",
"if",
"hard",
":",
"self",
".",
"client",
".",
"flush_all",
"(",
")",
"self",
".",
"reset_stats",
"(",
")",
"else",
":",
"from",
... | Drop existing entries from the cache.
Args:
hard (bool): If True, all current entries are flushed from the
server(s), which affects all users. If False, only the local
process is affected. | [
"Drop",
"existing",
"entries",
"from",
"the",
"cache",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/memcached.py#L119-L137 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/searching.py | depth_first_search | def depth_first_search(graph, root=None, filter=null()):
"""
Depth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tupple containing a diction... | python | def depth_first_search(graph, root=None, filter=null()):
"""
Depth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tupple containing a diction... | [
"def",
"depth_first_search",
"(",
"graph",
",",
"root",
"=",
"None",
",",
"filter",
"=",
"null",
"(",
")",
")",
":",
"recursionlimit",
"=",
"getrecursionlimit",
"(",
")",
"setrecursionlimit",
"(",
"max",
"(",
"len",
"(",
"graph",
".",
"nodes",
"(",
")",
... | Depth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tupple containing a dictionary and two lists:
1. Generated spanning tree
2. Grap... | [
"Depth",
"-",
"first",
"search",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/searching.py#L39-L96 | train |
nerdvegas/rez | src/rez/vendor/pygraph/algorithms/searching.py | breadth_first_search | def breadth_first_search(graph, root=None, filter=null()):
"""
Breadth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tuple containing a dictiona... | python | def breadth_first_search(graph, root=None, filter=null()):
"""
Breadth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tuple containing a dictiona... | [
"def",
"breadth_first_search",
"(",
"graph",
",",
"root",
"=",
"None",
",",
"filter",
"=",
"null",
"(",
")",
")",
":",
"def",
"bfs",
"(",
")",
":",
"while",
"(",
"queue",
"!=",
"[",
"]",
")",
":",
"node",
"=",
"queue",
".",
"pop",
"(",
"0",
")"... | Breadth-first search.
@type graph: graph, digraph
@param graph: Graph.
@type root: node
@param root: Optional root node (will explore only root's connected component)
@rtype: tuple
@return: A tuple containing a dictionary and a list.
1. Generated spanning tree
2. Graph's le... | [
"Breadth",
"-",
"first",
"search",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/searching.py#L101-L153 | train |
nerdvegas/rez | src/rez/package_resources_.py | PackageResource.normalize_variables | def normalize_variables(cls, variables):
"""Make sure version is treated consistently
"""
# if the version is False, empty string, etc, throw it out
if variables.get('version', True) in ('', False, '_NO_VERSION', None):
del variables['version']
return super(PackageRes... | python | def normalize_variables(cls, variables):
"""Make sure version is treated consistently
"""
# if the version is False, empty string, etc, throw it out
if variables.get('version', True) in ('', False, '_NO_VERSION', None):
del variables['version']
return super(PackageRes... | [
"def",
"normalize_variables",
"(",
"cls",
",",
"variables",
")",
":",
"if",
"variables",
".",
"get",
"(",
"'version'",
",",
"True",
")",
"in",
"(",
"''",
",",
"False",
",",
"'_NO_VERSION'",
",",
"None",
")",
":",
"del",
"variables",
"[",
"'version'",
"... | Make sure version is treated consistently | [
"Make",
"sure",
"version",
"is",
"treated",
"consistently"
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_resources_.py#L300-L306 | train |
nerdvegas/rez | src/rez/vendor/argcomplete/my_shlex.py | shlex.push_source | def push_source(self, newstream, newfile=None):
"Push an input source onto the lexer's input source stack."
if isinstance(newstream, basestring):
newstream = StringIO(newstream)
self.filestack.appendleft((self.infile, self.instream, self.lineno))
self.infile = newfile
... | python | def push_source(self, newstream, newfile=None):
"Push an input source onto the lexer's input source stack."
if isinstance(newstream, basestring):
newstream = StringIO(newstream)
self.filestack.appendleft((self.infile, self.instream, self.lineno))
self.infile = newfile
... | [
"def",
"push_source",
"(",
"self",
",",
"newstream",
",",
"newfile",
"=",
"None",
")",
":",
"\"Push an input source onto the lexer's input source stack.\"",
"if",
"isinstance",
"(",
"newstream",
",",
"basestring",
")",
":",
"newstream",
"=",
"StringIO",
"(",
"newstr... | Push an input source onto the lexer's input source stack. | [
"Push",
"an",
"input",
"source",
"onto",
"the",
"lexer",
"s",
"input",
"source",
"stack",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/argcomplete/my_shlex.py#L100-L107 | train |
nerdvegas/rez | src/rez/vendor/argcomplete/my_shlex.py | shlex.error_leader | def error_leader(self, infile=None, lineno=None):
"Emit a C-compiler-like, Emacs-friendly error-message leader."
if infile is None:
infile = self.infile
if lineno is None:
lineno = self.lineno
return "\"%s\", line %d: " % (infile, lineno) | python | def error_leader(self, infile=None, lineno=None):
"Emit a C-compiler-like, Emacs-friendly error-message leader."
if infile is None:
infile = self.infile
if lineno is None:
lineno = self.lineno
return "\"%s\", line %d: " % (infile, lineno) | [
"def",
"error_leader",
"(",
"self",
",",
"infile",
"=",
"None",
",",
"lineno",
"=",
"None",
")",
":",
"\"Emit a C-compiler-like, Emacs-friendly error-message leader.\"",
"if",
"infile",
"is",
"None",
":",
"infile",
"=",
"self",
".",
"infile",
"if",
"lineno",
"is... | Emit a C-compiler-like, Emacs-friendly error-message leader. | [
"Emit",
"a",
"C",
"-",
"compiler",
"-",
"like",
"Emacs",
"-",
"friendly",
"error",
"-",
"message",
"leader",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/argcomplete/my_shlex.py#L278-L284 | train |
nerdvegas/rez | src/rez/system.py | System.rez_bin_path | def rez_bin_path(self):
"""Get path containing rez binaries, or None if no binaries are
available, or Rez is not a production install.
"""
binpath = None
if sys.argv and sys.argv[0]:
executable = sys.argv[0]
path = which("rezolve", env={"PATH":os.path.dirn... | python | def rez_bin_path(self):
"""Get path containing rez binaries, or None if no binaries are
available, or Rez is not a production install.
"""
binpath = None
if sys.argv and sys.argv[0]:
executable = sys.argv[0]
path = which("rezolve", env={"PATH":os.path.dirn... | [
"def",
"rez_bin_path",
"(",
"self",
")",
":",
"binpath",
"=",
"None",
"if",
"sys",
".",
"argv",
"and",
"sys",
".",
"argv",
"[",
"0",
"]",
":",
"executable",
"=",
"sys",
".",
"argv",
"[",
"0",
"]",
"path",
"=",
"which",
"(",
"\"rezolve\"",
",",
"e... | Get path containing rez binaries, or None if no binaries are
available, or Rez is not a production install. | [
"Get",
"path",
"containing",
"rez",
"binaries",
"or",
"None",
"if",
"no",
"binaries",
"are",
"available",
"or",
"Rez",
"is",
"not",
"a",
"production",
"install",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/system.py#L191-L214 | train |
nerdvegas/rez | src/rez/system.py | System.get_summary_string | def get_summary_string(self):
"""Get a string summarising the state of Rez as a whole.
Returns:
String.
"""
from rez.plugin_managers import plugin_manager
txt = "Rez %s" % __version__
txt += "\n\n%s" % plugin_manager.get_summary_string()
return txt | python | def get_summary_string(self):
"""Get a string summarising the state of Rez as a whole.
Returns:
String.
"""
from rez.plugin_managers import plugin_manager
txt = "Rez %s" % __version__
txt += "\n\n%s" % plugin_manager.get_summary_string()
return txt | [
"def",
"get_summary_string",
"(",
"self",
")",
":",
"from",
"rez",
".",
"plugin_managers",
"import",
"plugin_manager",
"txt",
"=",
"\"Rez %s\"",
"%",
"__version__",
"txt",
"+=",
"\"\\n\\n%s\"",
"%",
"plugin_manager",
".",
"get_summary_string",
"(",
")",
"return",
... | Get a string summarising the state of Rez as a whole.
Returns:
String. | [
"Get",
"a",
"string",
"summarising",
"the",
"state",
"of",
"Rez",
"as",
"a",
"whole",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/system.py#L221-L231 | train |
nerdvegas/rez | src/rez/system.py | System.clear_caches | def clear_caches(self, hard=False):
"""Clear all caches in Rez.
Rez caches package contents and iteration during a python session. Thus
newly released packages, and changes to existing packages, may not be
picked up. You need to clear the cache for these changes to become
visibl... | python | def clear_caches(self, hard=False):
"""Clear all caches in Rez.
Rez caches package contents and iteration during a python session. Thus
newly released packages, and changes to existing packages, may not be
picked up. You need to clear the cache for these changes to become
visibl... | [
"def",
"clear_caches",
"(",
"self",
",",
"hard",
"=",
"False",
")",
":",
"from",
"rez",
".",
"package_repository",
"import",
"package_repository_manager",
"from",
"rez",
".",
"utils",
".",
"memcached",
"import",
"memcached_client",
"package_repository_manager",
".",... | Clear all caches in Rez.
Rez caches package contents and iteration during a python session. Thus
newly released packages, and changes to existing packages, may not be
picked up. You need to clear the cache for these changes to become
visible.
Args:
hard (bool): Perf... | [
"Clear",
"all",
"caches",
"in",
"Rez",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/system.py#L233-L252 | train |
nerdvegas/rez | src/rez/resolver.py | Resolver.solve | def solve(self):
"""Perform the solve.
"""
with log_duration(self._print, "memcache get (resolve) took %s"):
solver_dict = self._get_cached_solve()
if solver_dict:
self.from_cache = True
self._set_result(solver_dict)
else:
self.fro... | python | def solve(self):
"""Perform the solve.
"""
with log_duration(self._print, "memcache get (resolve) took %s"):
solver_dict = self._get_cached_solve()
if solver_dict:
self.from_cache = True
self._set_result(solver_dict)
else:
self.fro... | [
"def",
"solve",
"(",
"self",
")",
":",
"with",
"log_duration",
"(",
"self",
".",
"_print",
",",
"\"memcache get (resolve) took %s\"",
")",
":",
"solver_dict",
"=",
"self",
".",
"_get_cached_solve",
"(",
")",
"if",
"solver_dict",
":",
"self",
".",
"from_cache",... | Perform the solve. | [
"Perform",
"the",
"solve",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolver.py#L107-L123 | train |
nerdvegas/rez | src/rez/resolver.py | Resolver._set_cached_solve | def _set_cached_solve(self, solver_dict):
"""Store a solve to memcached.
If there is NOT a resolve timestamp:
- store the solve to a non-timestamped entry.
If there IS a resolve timestamp (let us call this T):
- if NO newer package in the solve has been released since T... | python | def _set_cached_solve(self, solver_dict):
"""Store a solve to memcached.
If there is NOT a resolve timestamp:
- store the solve to a non-timestamped entry.
If there IS a resolve timestamp (let us call this T):
- if NO newer package in the solve has been released since T... | [
"def",
"_set_cached_solve",
"(",
"self",
",",
"solver_dict",
")",
":",
"if",
"self",
".",
"status_",
"!=",
"ResolverStatus",
".",
"solved",
":",
"return",
"if",
"not",
"(",
"self",
".",
"caching",
"and",
"self",
".",
"memcached_servers",
")",
":",
"return"... | Store a solve to memcached.
If there is NOT a resolve timestamp:
- store the solve to a non-timestamped entry.
If there IS a resolve timestamp (let us call this T):
- if NO newer package in the solve has been released since T,
- then store the solve to a non-times... | [
"Store",
"a",
"solve",
"to",
"memcached",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolver.py#L310-L356 | train |
nerdvegas/rez | src/rez/resolver.py | Resolver._memcache_key | def _memcache_key(self, timestamped=False):
"""Makes a key suitable as a memcache entry."""
request = tuple(map(str, self.package_requests))
repo_ids = []
for path in self.package_paths:
repo = package_repository_manager.get_repository(path)
repo_ids.append(repo.u... | python | def _memcache_key(self, timestamped=False):
"""Makes a key suitable as a memcache entry."""
request = tuple(map(str, self.package_requests))
repo_ids = []
for path in self.package_paths:
repo = package_repository_manager.get_repository(path)
repo_ids.append(repo.u... | [
"def",
"_memcache_key",
"(",
"self",
",",
"timestamped",
"=",
"False",
")",
":",
"request",
"=",
"tuple",
"(",
"map",
"(",
"str",
",",
"self",
".",
"package_requests",
")",
")",
"repo_ids",
"=",
"[",
"]",
"for",
"path",
"in",
"self",
".",
"package_path... | Makes a key suitable as a memcache entry. | [
"Makes",
"a",
"key",
"suitable",
"as",
"a",
"memcache",
"entry",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolver.py#L358-L377 | train |
nerdvegas/rez | src/rez/shells.py | create_shell | def create_shell(shell=None, **kwargs):
"""Returns a Shell of the given type, or the current shell type if shell
is None."""
if not shell:
shell = config.default_shell
if not shell:
from rez.system import system
shell = system.shell
from rez.plugin_managers impor... | python | def create_shell(shell=None, **kwargs):
"""Returns a Shell of the given type, or the current shell type if shell
is None."""
if not shell:
shell = config.default_shell
if not shell:
from rez.system import system
shell = system.shell
from rez.plugin_managers impor... | [
"def",
"create_shell",
"(",
"shell",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"shell",
":",
"shell",
"=",
"config",
".",
"default_shell",
"if",
"not",
"shell",
":",
"from",
"rez",
".",
"system",
"import",
"system",
"shell",
"=",
"system... | Returns a Shell of the given type, or the current shell type if shell
is None. | [
"Returns",
"a",
"Shell",
"of",
"the",
"given",
"type",
"or",
"the",
"current",
"shell",
"type",
"if",
"shell",
"is",
"None",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/shells.py#L25-L35 | train |
nerdvegas/rez | src/rez/shells.py | Shell.startup_capabilities | def startup_capabilities(cls, rcfile=False, norc=False, stdin=False,
command=False):
"""
Given a set of options related to shell startup, return the actual
options that will be applied.
@returns 4-tuple representing applied value of each option.
"""
... | python | def startup_capabilities(cls, rcfile=False, norc=False, stdin=False,
command=False):
"""
Given a set of options related to shell startup, return the actual
options that will be applied.
@returns 4-tuple representing applied value of each option.
"""
... | [
"def",
"startup_capabilities",
"(",
"cls",
",",
"rcfile",
"=",
"False",
",",
"norc",
"=",
"False",
",",
"stdin",
"=",
"False",
",",
"command",
"=",
"False",
")",
":",
"raise",
"NotImplementedError"
] | Given a set of options related to shell startup, return the actual
options that will be applied.
@returns 4-tuple representing applied value of each option. | [
"Given",
"a",
"set",
"of",
"options",
"related",
"to",
"shell",
"startup",
"return",
"the",
"actual",
"options",
"that",
"will",
"be",
"applied",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/shells.py#L54-L61 | train |
nerdvegas/rez | src/rez/vendor/distlib/index.py | PackageIndex.upload_file | def upload_file(self, metadata, filename, signer=None, sign_password=None,
filetype='sdist', pyversion='source', keystore=None):
"""
Upload a release file to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and versio... | python | def upload_file(self, metadata, filename, signer=None, sign_password=None,
filetype='sdist', pyversion='source', keystore=None):
"""
Upload a release file to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and versio... | [
"def",
"upload_file",
"(",
"self",
",",
"metadata",
",",
"filename",
",",
"signer",
"=",
"None",
",",
"sign_password",
"=",
"None",
",",
"filetype",
"=",
"'sdist'",
",",
"pyversion",
"=",
"'source'",
",",
"keystore",
"=",
"None",
")",
":",
"self",
".",
... | Upload a release file to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the file to be uploaded.
:param filename: The pathname of the file to be uploaded.
:param signer: The identifier of the signer of the file.
... | [
"Upload",
"a",
"release",
"file",
"to",
"the",
"index",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/index.py#L238-L293 | train |
nerdvegas/rez | src/rez/solver.py | _get_dependency_order | def _get_dependency_order(g, node_list):
"""Return list of nodes as close as possible to the ordering in node_list,
but with child nodes earlier in the list than parents."""
access_ = accessibility(g)
deps = dict((k, set(v) - set([k])) for k, v in access_.iteritems())
nodes = node_list + list(set(g.... | python | def _get_dependency_order(g, node_list):
"""Return list of nodes as close as possible to the ordering in node_list,
but with child nodes earlier in the list than parents."""
access_ = accessibility(g)
deps = dict((k, set(v) - set([k])) for k, v in access_.iteritems())
nodes = node_list + list(set(g.... | [
"def",
"_get_dependency_order",
"(",
"g",
",",
"node_list",
")",
":",
"access_",
"=",
"accessibility",
"(",
"g",
")",
"deps",
"=",
"dict",
"(",
"(",
"k",
",",
"set",
"(",
"v",
")",
"-",
"set",
"(",
"[",
"k",
"]",
")",
")",
"for",
"k",
",",
"v",... | Return list of nodes as close as possible to the ordering in node_list,
but with child nodes earlier in the list than parents. | [
"Return",
"list",
"of",
"nodes",
"as",
"close",
"as",
"possible",
"to",
"the",
"ordering",
"in",
"node_list",
"but",
"with",
"child",
"nodes",
"earlier",
"in",
"the",
"list",
"than",
"parents",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1110-L1136 | train |
nerdvegas/rez | src/rez/solver.py | _short_req_str | def _short_req_str(package_request):
"""print shortened version of '==X|==Y|==Z' ranged requests."""
if not package_request.conflict:
versions = package_request.range.to_versions()
if versions and len(versions) == len(package_request.range) \
and len(versions) > 1:
re... | python | def _short_req_str(package_request):
"""print shortened version of '==X|==Y|==Z' ranged requests."""
if not package_request.conflict:
versions = package_request.range.to_versions()
if versions and len(versions) == len(package_request.range) \
and len(versions) > 1:
re... | [
"def",
"_short_req_str",
"(",
"package_request",
")",
":",
"if",
"not",
"package_request",
".",
"conflict",
":",
"versions",
"=",
"package_request",
".",
"range",
".",
"to_versions",
"(",
")",
"if",
"versions",
"and",
"len",
"(",
"versions",
")",
"==",
"len"... | print shortened version of '==X|==Y|==Z' ranged requests. | [
"print",
"shortened",
"version",
"of",
"==",
"X|",
"==",
"Y|",
"==",
"Z",
"ranged",
"requests",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2275-L2284 | train |
nerdvegas/rez | src/rez/solver.py | PackageVariant.requires_list | def requires_list(self):
"""
It is important that this property is calculated lazily. Getting the
'requires' attribute may trigger a package load, which may be avoided if
this variant is reduced away before that happens.
"""
requires = self.variant.get_requires(build_requ... | python | def requires_list(self):
"""
It is important that this property is calculated lazily. Getting the
'requires' attribute may trigger a package load, which may be avoided if
this variant is reduced away before that happens.
"""
requires = self.variant.get_requires(build_requ... | [
"def",
"requires_list",
"(",
"self",
")",
":",
"requires",
"=",
"self",
".",
"variant",
".",
"get_requires",
"(",
"build_requires",
"=",
"self",
".",
"building",
")",
"reqlist",
"=",
"RequirementList",
"(",
"requires",
")",
"if",
"reqlist",
".",
"conflict",
... | It is important that this property is calculated lazily. Getting the
'requires' attribute may trigger a package load, which may be avoided if
this variant is reduced away before that happens. | [
"It",
"is",
"important",
"that",
"this",
"property",
"is",
"calculated",
"lazily",
".",
"Getting",
"the",
"requires",
"attribute",
"may",
"trigger",
"a",
"package",
"load",
"which",
"may",
"be",
"avoided",
"if",
"this",
"variant",
"is",
"reduced",
"away",
"b... | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L299-L313 | train |
nerdvegas/rez | src/rez/solver.py | _PackageEntry.sort | def sort(self):
"""Sort variants from most correct to consume, to least.
Sort rules:
version_priority:
- sort by highest versions of packages shared with request;
- THEN least number of additional packages added to solve;
- THEN highest versions of additional packages;
... | python | def sort(self):
"""Sort variants from most correct to consume, to least.
Sort rules:
version_priority:
- sort by highest versions of packages shared with request;
- THEN least number of additional packages added to solve;
- THEN highest versions of additional packages;
... | [
"def",
"sort",
"(",
"self",
")",
":",
"if",
"self",
".",
"sorted",
":",
"return",
"def",
"key",
"(",
"variant",
")",
":",
"requested_key",
"=",
"[",
"]",
"names",
"=",
"set",
"(",
")",
"for",
"i",
",",
"request",
"in",
"enumerate",
"(",
"self",
"... | Sort variants from most correct to consume, to least.
Sort rules:
version_priority:
- sort by highest versions of packages shared with request;
- THEN least number of additional packages added to solve;
- THEN highest versions of additional packages;
- THEN alphabetical... | [
"Sort",
"variants",
"from",
"most",
"correct",
"to",
"consume",
"to",
"least",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L370-L427 | train |
nerdvegas/rez | src/rez/solver.py | _PackageVariantList.get_intersection | def get_intersection(self, range_):
"""Get a list of variants that intersect with the given range.
Args:
range_ (`VersionRange`): Package version range.
Returns:
List of `_PackageEntry` objects.
"""
result = []
for entry in self.entries:
... | python | def get_intersection(self, range_):
"""Get a list of variants that intersect with the given range.
Args:
range_ (`VersionRange`): Package version range.
Returns:
List of `_PackageEntry` objects.
"""
result = []
for entry in self.entries:
... | [
"def",
"get_intersection",
"(",
"self",
",",
"range_",
")",
":",
"result",
"=",
"[",
"]",
"for",
"entry",
"in",
"self",
".",
"entries",
":",
"package",
",",
"value",
"=",
"entry",
"if",
"value",
"is",
"None",
":",
"continue",
"if",
"package",
".",
"v... | Get a list of variants that intersect with the given range.
Args:
range_ (`VersionRange`): Package version range.
Returns:
List of `_PackageEntry` objects. | [
"Get",
"a",
"list",
"of",
"variants",
"that",
"intersect",
"with",
"the",
"given",
"range",
"."
] | 1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7 | https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L453-L502 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.