partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_from_proto_sparse_tensor
Deserializes a `tf.SparseTensor` from `sparse_tensor_proto`. Args: sparse_tensor_proto: A proto representing a `tf.SparseTensor`. process_leafs: A function to be applied to the leaf valued of the nested structure. Returns: An instance of `tf.SparseTensor`.
sonnet/python/modules/base_info.py
def _from_proto_sparse_tensor(sparse_tensor_proto, process_leafs): """Deserializes a `tf.SparseTensor` from `sparse_tensor_proto`. Args: sparse_tensor_proto: A proto representing a `tf.SparseTensor`. process_leafs: A function to be applied to the leaf valued of the nested structure. Returns: A...
def _from_proto_sparse_tensor(sparse_tensor_proto, process_leafs): """Deserializes a `tf.SparseTensor` from `sparse_tensor_proto`. Args: sparse_tensor_proto: A proto representing a `tf.SparseTensor`. process_leafs: A function to be applied to the leaf valued of the nested structure. Returns: A...
[ "Deserializes", "a", "tf", ".", "SparseTensor", "from", "sparse_tensor_proto", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/base_info.py#L119-L142
[ "def", "_from_proto_sparse_tensor", "(", "sparse_tensor_proto", ",", "process_leafs", ")", ":", "if", "not", "sparse_tensor_proto", ".", "HasField", "(", "\"named_tuple\"", ")", ":", "raise", "base_errors", ".", "ModuleInfoError", "(", "\"Error while deserializing a Spars...
00612ca3178964d86b556e062694d808ff81fcca
train
_nested_to_proto
Serializes `nested_value` into `nested_proto`. Args: nested_value: A nested Python value. nested_proto: A `module_pb2.NestedData` instance to be filled from the value in `nested_value`. process_leafs: A function to be applied to the leaf values of the nested structure. already_processed: ...
sonnet/python/modules/base_info.py
def _nested_to_proto(nested_value, nested_proto, process_leafs, already_processed): """Serializes `nested_value` into `nested_proto`. Args: nested_value: A nested Python value. nested_proto: A `module_pb2.NestedData` instance to be filled from the value in `nested_value`. pro...
def _nested_to_proto(nested_value, nested_proto, process_leafs, already_processed): """Serializes `nested_value` into `nested_proto`. Args: nested_value: A nested Python value. nested_proto: A `module_pb2.NestedData` instance to be filled from the value in `nested_value`. pro...
[ "Serializes", "nested_value", "into", "nested_proto", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/base_info.py#L160-L223
[ "def", "_nested_to_proto", "(", "nested_value", ",", "nested_proto", ",", "process_leafs", ",", "already_processed", ")", ":", "if", "not", "isinstance", "(", "nested_proto", ",", "module_pb2", ".", "NestedData", ")", ":", "raise", "base_errors", ".", "ModuleInfoE...
00612ca3178964d86b556e062694d808ff81fcca
train
_module_info_to_proto
Serializes `module_into`. Args: module_info: An instance of `ModuleInfo`. export_scope: Optional `string`. Name scope to remove. Returns: An instance of `module_pb2.SonnetModule`.
sonnet/python/modules/base_info.py
def _module_info_to_proto(module_info, export_scope=None): """Serializes `module_into`. Args: module_info: An instance of `ModuleInfo`. export_scope: Optional `string`. Name scope to remove. Returns: An instance of `module_pb2.SonnetModule`. """ def strip_name_scope(name_scope): return ops.s...
def _module_info_to_proto(module_info, export_scope=None): """Serializes `module_into`. Args: module_info: An instance of `ModuleInfo`. export_scope: Optional `string`. Name scope to remove. Returns: An instance of `module_pb2.SonnetModule`. """ def strip_name_scope(name_scope): return ops.s...
[ "Serializes", "module_into", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/base_info.py#L226-L256
[ "def", "_module_info_to_proto", "(", "module_info", ",", "export_scope", "=", "None", ")", ":", "def", "strip_name_scope", "(", "name_scope", ")", ":", "return", "ops", ".", "strip_name_scope", "(", "name_scope", ",", "export_scope", ")", "def", "process_leafs", ...
00612ca3178964d86b556e062694d808ff81fcca
train
_nested_from_proto
Deserializes `nested_proto`. Args: nested_proto: An instance of `module_pb2.NestedData`. process_leafs: A function to be applied to the leaf values of the nested structure. Returns: An instance of `string`, `tuple`, `dict` or `namedtuple`. Raises: base_errors.ModuleInfoError: If the probo...
sonnet/python/modules/base_info.py
def _nested_from_proto(nested_proto, process_leafs): """Deserializes `nested_proto`. Args: nested_proto: An instance of `module_pb2.NestedData`. process_leafs: A function to be applied to the leaf values of the nested structure. Returns: An instance of `string`, `tuple`, `dict` or `namedtuple`...
def _nested_from_proto(nested_proto, process_leafs): """Deserializes `nested_proto`. Args: nested_proto: An instance of `module_pb2.NestedData`. process_leafs: A function to be applied to the leaf values of the nested structure. Returns: An instance of `string`, `tuple`, `dict` or `namedtuple`...
[ "Deserializes", "nested_proto", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/base_info.py#L259-L307
[ "def", "_nested_from_proto", "(", "nested_proto", ",", "process_leafs", ")", ":", "if", "not", "isinstance", "(", "nested_proto", ",", "module_pb2", ".", "NestedData", ")", ":", "raise", "base_errors", ".", "ModuleInfoError", "(", "\"Expected module_pb2.NestedData.\""...
00612ca3178964d86b556e062694d808ff81fcca
train
_module_info_from_proto
Deserializes `module_info_def` proto. Args: module_info_def: An instance of `module_pb2.SonnetModule`. import_scope: Optional `string`. Name scope to use. Returns: An instance of `ModuleInfo`. Raises: base_errors.ModuleInfoError: If the probobuf is of the wrong type or if some of its fiel...
sonnet/python/modules/base_info.py
def _module_info_from_proto(module_info_def, import_scope=None): """Deserializes `module_info_def` proto. Args: module_info_def: An instance of `module_pb2.SonnetModule`. import_scope: Optional `string`. Name scope to use. Returns: An instance of `ModuleInfo`. Raises: base_errors.ModuleInfoEr...
def _module_info_from_proto(module_info_def, import_scope=None): """Deserializes `module_info_def` proto. Args: module_info_def: An instance of `module_pb2.SonnetModule`. import_scope: Optional `string`. Name scope to use. Returns: An instance of `ModuleInfo`. Raises: base_errors.ModuleInfoEr...
[ "Deserializes", "module_info_def", "proto", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/base_info.py#L310-L344
[ "def", "_module_info_from_proto", "(", "module_info_def", ",", "import_scope", "=", "None", ")", ":", "graph", "=", "tf", ".", "get_default_graph", "(", ")", "def", "prepend_name_scope", "(", "name_scope", ")", ":", "return", "ops", ".", "prepend_name_scope", "(...
00612ca3178964d86b556e062694d808ff81fcca
train
_module_info_from_proto_safe
Deserializes the `module_info_def` proto without raising exceptions. Args: module_info_def: An instance of `module_pb2.SonnetModule`. import_scope: Optional `string`. Name scope to use. Returns: An instance of `ModuleInfo`.
sonnet/python/modules/base_info.py
def _module_info_from_proto_safe(module_info_def, import_scope=None): """Deserializes the `module_info_def` proto without raising exceptions. Args: module_info_def: An instance of `module_pb2.SonnetModule`. import_scope: Optional `string`. Name scope to use. Returns: An instance of `ModuleInfo`. "...
def _module_info_from_proto_safe(module_info_def, import_scope=None): """Deserializes the `module_info_def` proto without raising exceptions. Args: module_info_def: An instance of `module_pb2.SonnetModule`. import_scope: Optional `string`. Name scope to use. Returns: An instance of `ModuleInfo`. "...
[ "Deserializes", "the", "module_info_def", "proto", "without", "raising", "exceptions", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/base_info.py#L347-L362
[ "def", "_module_info_from_proto_safe", "(", "module_info_def", ",", "import_scope", "=", "None", ")", ":", "try", ":", "return", "_module_info_from_proto", "(", "module_info_def", ",", "import_scope", ")", "except", "Exception", "as", "e", ":", "# pylint: disable=broa...
00612ca3178964d86b556e062694d808ff81fcca
train
_configure_saver
Returns a tf.train.CheckpointSaverHook for autosaving checkpoints.
sonnet/examples/rnn_shakespeare.py
def _configure_saver(checkpoint_dir, checkpoint_interval): """Returns a tf.train.CheckpointSaverHook for autosaving checkpoints.""" saver = tf.train.Saver() return tf.train.CheckpointSaverHook( checkpoint_dir=checkpoint_dir, save_steps=checkpoint_interval, saver=saver)
def _configure_saver(checkpoint_dir, checkpoint_interval): """Returns a tf.train.CheckpointSaverHook for autosaving checkpoints.""" saver = tf.train.Saver() return tf.train.CheckpointSaverHook( checkpoint_dir=checkpoint_dir, save_steps=checkpoint_interval, saver=saver)
[ "Returns", "a", "tf", ".", "train", ".", "CheckpointSaverHook", "for", "autosaving", "checkpoints", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/examples/rnn_shakespeare.py#L55-L61
[ "def", "_configure_saver", "(", "checkpoint_dir", ",", "checkpoint_interval", ")", ":", "saver", "=", "tf", ".", "train", ".", "Saver", "(", ")", "return", "tf", ".", "train", ".", "CheckpointSaverHook", "(", "checkpoint_dir", "=", "checkpoint_dir", ",", "save...
00612ca3178964d86b556e062694d808ff81fcca
train
build_graph
Constructs the computation graph.
sonnet/examples/rnn_shakespeare.py
def build_graph(lstm_depth=3, batch_size=32, num_embedding=32, num_hidden=128, truncation_length=64, sample_length=1000, max_grad_norm=5, initial_learning_rate=0.1, reduce_learning_rate_multiplier=0.1, optimizer_epsilon=0.01): """Constructs the computation graph.""" ...
def build_graph(lstm_depth=3, batch_size=32, num_embedding=32, num_hidden=128, truncation_length=64, sample_length=1000, max_grad_norm=5, initial_learning_rate=0.1, reduce_learning_rate_multiplier=0.1, optimizer_epsilon=0.01): """Constructs the computation graph.""" ...
[ "Constructs", "the", "computation", "graph", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/examples/rnn_shakespeare.py#L64-L168
[ "def", "build_graph", "(", "lstm_depth", "=", "3", ",", "batch_size", "=", "32", ",", "num_embedding", "=", "32", ",", "num_hidden", "=", "128", ",", "truncation_length", "=", "64", ",", "sample_length", "=", "1000", ",", "max_grad_norm", "=", "5", ",", ...
00612ca3178964d86b556e062694d808ff81fcca
train
train
Trains a deep LSTM model on the Tiny Shakespeare dataset.
sonnet/examples/rnn_shakespeare.py
def train(num_training_iterations, report_interval, reduce_learning_rate_interval): """Trains a deep LSTM model on the Tiny Shakespeare dataset.""" # Build the computation graph. graph_tensors, dataset_train = build_graph( lstm_depth=FLAGS.lstm_depth, batch_size=FLAGS.batch_size, num_embedd...
def train(num_training_iterations, report_interval, reduce_learning_rate_interval): """Trains a deep LSTM model on the Tiny Shakespeare dataset.""" # Build the computation graph. graph_tensors, dataset_train = build_graph( lstm_depth=FLAGS.lstm_depth, batch_size=FLAGS.batch_size, num_embedd...
[ "Trains", "a", "deep", "LSTM", "model", "on", "the", "Tiny", "Shakespeare", "dataset", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/examples/rnn_shakespeare.py#L171-L223
[ "def", "train", "(", "num_training_iterations", ",", "report_interval", ",", "reduce_learning_rate_interval", ")", ":", "# Build the computation graph.", "graph_tensors", ",", "dataset_train", "=", "build_graph", "(", "lstm_depth", "=", "FLAGS", ".", "lstm_depth", ",", ...
00612ca3178964d86b556e062694d808ff81fcca
train
TextModel._build
Builds the deep LSTM model sub-graph. Args: one_hot_input_sequence: A Tensor with the input sequence encoded as a one-hot representation. Its dimensions should be `[truncation_length, batch_size, output_size]`. Returns: Tuple of the Tensor of output logits for the batch, with dimen...
sonnet/examples/rnn_shakespeare.py
def _build(self, one_hot_input_sequence): """Builds the deep LSTM model sub-graph. Args: one_hot_input_sequence: A Tensor with the input sequence encoded as a one-hot representation. Its dimensions should be `[truncation_length, batch_size, output_size]`. Returns: Tuple of the ...
def _build(self, one_hot_input_sequence): """Builds the deep LSTM model sub-graph. Args: one_hot_input_sequence: A Tensor with the input sequence encoded as a one-hot representation. Its dimensions should be `[truncation_length, batch_size, output_size]`. Returns: Tuple of the ...
[ "Builds", "the", "deep", "LSTM", "model", "sub", "-", "graph", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/examples/rnn_shakespeare.py#L280-L320
[ "def", "_build", "(", "self", ",", "one_hot_input_sequence", ")", ":", "input_shape", "=", "one_hot_input_sequence", ".", "get_shape", "(", ")", "batch_size", "=", "input_shape", "[", "1", "]", "batch_embed_module", "=", "snt", ".", "BatchApply", "(", "self", ...
00612ca3178964d86b556e062694d808ff81fcca
train
TextModel.generate_string
Builds sub-graph to generate a string, sampled from the model. Args: initial_logits: Starting logits to sample from. initial_state: Starting state for the RNN core. sequence_length: Number of characters to sample. Returns: A Tensor of characters, with dimensions `[sequence_length, batc...
sonnet/examples/rnn_shakespeare.py
def generate_string(self, initial_logits, initial_state, sequence_length): """Builds sub-graph to generate a string, sampled from the model. Args: initial_logits: Starting logits to sample from. initial_state: Starting state for the RNN core. sequence_length: Number of characters to sample. ...
def generate_string(self, initial_logits, initial_state, sequence_length): """Builds sub-graph to generate a string, sampled from the model. Args: initial_logits: Starting logits to sample from. initial_state: Starting state for the RNN core. sequence_length: Number of characters to sample. ...
[ "Builds", "sub", "-", "graph", "to", "generate", "a", "string", "sampled", "from", "the", "model", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/examples/rnn_shakespeare.py#L323-L354
[ "def", "generate_string", "(", "self", ",", "initial_logits", ",", "initial_state", ",", "sequence_length", ")", ":", "current_logits", "=", "initial_logits", "current_state", "=", "initial_state", "generated_letters", "=", "[", "]", "for", "_", "in", "range", "("...
00612ca3178964d86b556e062694d808ff81fcca
train
VectorQuantizer._build
Connects the module to some inputs. Args: inputs: Tensor, final dimension must be equal to embedding_dim. All other leading dimensions will be flattened and treated as a large batch. is_training: boolean, whether this connection is to training data. Returns: dict containing the follo...
sonnet/python/modules/nets/vqvae.py
def _build(self, inputs, is_training): """Connects the module to some inputs. Args: inputs: Tensor, final dimension must be equal to embedding_dim. All other leading dimensions will be flattened and treated as a large batch. is_training: boolean, whether this connection is to training data....
def _build(self, inputs, is_training): """Connects the module to some inputs. Args: inputs: Tensor, final dimension must be equal to embedding_dim. All other leading dimensions will be flattened and treated as a large batch. is_training: boolean, whether this connection is to training data....
[ "Connects", "the", "module", "to", "some", "inputs", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/nets/vqvae.py#L66-L112
[ "def", "_build", "(", "self", ",", "inputs", ",", "is_training", ")", ":", "# Assert last dimension is same as self._embedding_dim", "input_shape", "=", "tf", ".", "shape", "(", "inputs", ")", "with", "tf", ".", "control_dependencies", "(", "[", "tf", ".", "Asse...
00612ca3178964d86b556e062694d808ff81fcca
train
VectorQuantizerEMA._build
Connects the module to some inputs. Args: inputs: Tensor, final dimension must be equal to embedding_dim. All other leading dimensions will be flattened and treated as a large batch. is_training: boolean, whether this connection is to training data. When this is set to False, the intern...
sonnet/python/modules/nets/vqvae.py
def _build(self, inputs, is_training): """Connects the module to some inputs. Args: inputs: Tensor, final dimension must be equal to embedding_dim. All other leading dimensions will be flattened and treated as a large batch. is_training: boolean, whether this connection is to training data....
def _build(self, inputs, is_training): """Connects the module to some inputs. Args: inputs: Tensor, final dimension must be equal to embedding_dim. All other leading dimensions will be flattened and treated as a large batch. is_training: boolean, whether this connection is to training data....
[ "Connects", "the", "module", "to", "some", "inputs", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/nets/vqvae.py#L181-L252
[ "def", "_build", "(", "self", ",", "inputs", ",", "is_training", ")", ":", "# Ensure that the weights are read fresh for each timestep, which otherwise", "# would not be guaranteed in an RNN setup. Note that this relies on inputs", "# having a data dependency with the output of the previous ...
00612ca3178964d86b556e062694d808ff81fcca
train
_nested_add
Add two arbitrarily nested `Tensors`.
sonnet/python/modules/pondering_rnn.py
def _nested_add(nested_a, nested_b): """Add two arbitrarily nested `Tensors`.""" return nest.map(lambda a, b: a + b, nested_a, nested_b)
def _nested_add(nested_a, nested_b): """Add two arbitrarily nested `Tensors`.""" return nest.map(lambda a, b: a + b, nested_a, nested_b)
[ "Add", "two", "arbitrarily", "nested", "Tensors", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/pondering_rnn.py#L33-L35
[ "def", "_nested_add", "(", "nested_a", ",", "nested_b", ")", ":", "return", "nest", ".", "map", "(", "lambda", "a", ",", "b", ":", "a", "+", "b", ",", "nested_a", ",", "nested_b", ")" ]
00612ca3178964d86b556e062694d808ff81fcca
train
_nested_unary_mul
Multiply `Tensors` in arbitrarily nested `Tensor` `nested_a` with `p`.
sonnet/python/modules/pondering_rnn.py
def _nested_unary_mul(nested_a, p): """Multiply `Tensors` in arbitrarily nested `Tensor` `nested_a` with `p`.""" def mul_with_broadcast(tensor): ndims = tensor.shape.ndims if ndims != 2: p_reshaped = tf.reshape(p, [-1] + [1] * (ndims - 1)) return p_reshaped * tensor else: return p * te...
def _nested_unary_mul(nested_a, p): """Multiply `Tensors` in arbitrarily nested `Tensor` `nested_a` with `p`.""" def mul_with_broadcast(tensor): ndims = tensor.shape.ndims if ndims != 2: p_reshaped = tf.reshape(p, [-1] + [1] * (ndims - 1)) return p_reshaped * tensor else: return p * te...
[ "Multiply", "Tensors", "in", "arbitrarily", "nested", "Tensor", "nested_a", "with", "p", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/pondering_rnn.py#L38-L47
[ "def", "_nested_unary_mul", "(", "nested_a", ",", "p", ")", ":", "def", "mul_with_broadcast", "(", "tensor", ")", ":", "ndims", "=", "tensor", ".", "shape", ".", "ndims", "if", "ndims", "!=", "2", ":", "p_reshaped", "=", "tf", ".", "reshape", "(", "p",...
00612ca3178964d86b556e062694d808ff81fcca
train
ACTCore._cond
The `cond` of the `tf.while_loop`.
sonnet/python/modules/pondering_rnn.py
def _cond(self, unused_x, unused_cumul_out, unused_prev_state, unused_cumul_state, cumul_halting, unused_iteration, unused_remainder): """The `cond` of the `tf.while_loop`.""" return tf.reduce_any(cumul_halting < 1)
def _cond(self, unused_x, unused_cumul_out, unused_prev_state, unused_cumul_state, cumul_halting, unused_iteration, unused_remainder): """The `cond` of the `tf.while_loop`.""" return tf.reduce_any(cumul_halting < 1)
[ "The", "cond", "of", "the", "tf", ".", "while_loop", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/pondering_rnn.py#L132-L136
[ "def", "_cond", "(", "self", ",", "unused_x", ",", "unused_cumul_out", ",", "unused_prev_state", ",", "unused_cumul_state", ",", "cumul_halting", ",", "unused_iteration", ",", "unused_remainder", ")", ":", "return", "tf", ".", "reduce_any", "(", "cumul_halting", "...
00612ca3178964d86b556e062694d808ff81fcca
train
ACTCore._body
The `body` of `tf.while_loop`.
sonnet/python/modules/pondering_rnn.py
def _body(self, x, cumul_out, prev_state, cumul_state, cumul_halting, iteration, remainder, halting_linear, x_ones): """The `body` of `tf.while_loop`.""" # Increase iteration count only for those elements that are still running. all_ones = tf.constant(1, shape=(self._batch_size, 1), dtype=self._...
def _body(self, x, cumul_out, prev_state, cumul_state, cumul_halting, iteration, remainder, halting_linear, x_ones): """The `body` of `tf.while_loop`.""" # Increase iteration count only for those elements that are still running. all_ones = tf.constant(1, shape=(self._batch_size, 1), dtype=self._...
[ "The", "body", "of", "tf", ".", "while_loop", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/pondering_rnn.py#L138-L164
[ "def", "_body", "(", "self", ",", "x", ",", "cumul_out", ",", "prev_state", ",", "cumul_state", ",", "cumul_halting", ",", "iteration", ",", "remainder", ",", "halting_linear", ",", "x_ones", ")", ":", "# Increase iteration count only for those elements that are still...
00612ca3178964d86b556e062694d808ff81fcca
train
ACTCore._build
Connects the core to the graph. Args: x: Input `Tensor` of shape `(batch_size, input_size)`. prev_state: Previous state. This could be a `Tensor`, or a tuple of `Tensor`s. Returns: The tuple `(output, state)` for this core. Raises: ValueError: if the `Tensor` `x` does no...
sonnet/python/modules/pondering_rnn.py
def _build(self, x, prev_state): """Connects the core to the graph. Args: x: Input `Tensor` of shape `(batch_size, input_size)`. prev_state: Previous state. This could be a `Tensor`, or a tuple of `Tensor`s. Returns: The tuple `(output, state)` for this core. Raises: ...
def _build(self, x, prev_state): """Connects the core to the graph. Args: x: Input `Tensor` of shape `(batch_size, input_size)`. prev_state: Previous state. This could be a `Tensor`, or a tuple of `Tensor`s. Returns: The tuple `(output, state)` for this core. Raises: ...
[ "Connects", "the", "core", "to", "the", "graph", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/pondering_rnn.py#L166-L211
[ "def", "_build", "(", "self", ",", "x", ",", "prev_state", ")", ":", "x", ".", "get_shape", "(", ")", ".", "with_rank", "(", "2", ")", "self", ".", "_batch_size", "=", "x", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "[", "0", "]", "s...
00612ca3178964d86b556e062694d808ff81fcca
train
restore_initializer
Custom getter to restore all variables with `snt.restore_initializer`. Args: filename: The filename of the checkpoint. name_fn: A function which can map the name of the variable requested. This allows restoring variables with values having different names in the checkpoint. collection: Only s...
sonnet/python/custom_getters/restore_initializer.py
def restore_initializer(filename, name_fn=None, collection=tf.GraphKeys.GLOBAL_VARIABLES): """Custom getter to restore all variables with `snt.restore_initializer`. Args: filename: The filename of the checkpoint. name_fn: A function which can map the name of the variable requested. ...
def restore_initializer(filename, name_fn=None, collection=tf.GraphKeys.GLOBAL_VARIABLES): """Custom getter to restore all variables with `snt.restore_initializer`. Args: filename: The filename of the checkpoint. name_fn: A function which can map the name of the variable requested. ...
[ "Custom", "getter", "to", "restore", "all", "variables", "with", "snt", ".", "restore_initializer", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/custom_getters/restore_initializer.py#L26-L75
[ "def", "restore_initializer", "(", "filename", ",", "name_fn", "=", "None", ",", "collection", "=", "tf", ".", "GraphKeys", ".", "GLOBAL_VARIABLES", ")", ":", "def", "_restore_initializer", "(", "getter", ",", "name", ",", "*", "args", ",", "*", "*", "kwar...
00612ca3178964d86b556e062694d808ff81fcca
train
_embedding_dim
Calculate a reasonable embedding size for a vocabulary. Rule of thumb is 6 * 4th root of vocab_size. Args: vocab_size: Size of the input vocabulary. Returns: The embedding size to use. Raises: ValueError: if `vocab_size` is invalid.
sonnet/python/modules/embed.py
def _embedding_dim(vocab_size): """Calculate a reasonable embedding size for a vocabulary. Rule of thumb is 6 * 4th root of vocab_size. Args: vocab_size: Size of the input vocabulary. Returns: The embedding size to use. Raises: ValueError: if `vocab_size` is invalid. """ if not vocab_size or...
def _embedding_dim(vocab_size): """Calculate a reasonable embedding size for a vocabulary. Rule of thumb is 6 * 4th root of vocab_size. Args: vocab_size: Size of the input vocabulary. Returns: The embedding size to use. Raises: ValueError: if `vocab_size` is invalid. """ if not vocab_size or...
[ "Calculate", "a", "reasonable", "embedding", "size", "for", "a", "vocabulary", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/embed.py#L30-L44
[ "def", "_embedding_dim", "(", "vocab_size", ")", ":", "if", "not", "vocab_size", "or", "(", "vocab_size", "<=", "0", ")", ":", "raise", "ValueError", "(", "\"Invalid vocab_size %g.\"", "%", "vocab_size", ")", "return", "int", "(", "round", "(", "6.0", "*", ...
00612ca3178964d86b556e062694d808ff81fcca
train
Embed._build
Lookup embeddings. Looks up an embedding vector for each value in `ids`. All ids must be within [0, vocab_size), else an `InvalidArgumentError` is raised at runtime. Args: ids: Tensor of dtype int64. Returns: Tensor of tf.shape(ids) + [embedding_dim] and dtype float32.
sonnet/python/modules/embed.py
def _build(self, ids): """Lookup embeddings. Looks up an embedding vector for each value in `ids`. All ids must be within [0, vocab_size), else an `InvalidArgumentError` is raised at runtime. Args: ids: Tensor of dtype int64. Returns: Tensor of tf.shape(ids) + [embedding_dim] and dtyp...
def _build(self, ids): """Lookup embeddings. Looks up an embedding vector for each value in `ids`. All ids must be within [0, vocab_size), else an `InvalidArgumentError` is raised at runtime. Args: ids: Tensor of dtype int64. Returns: Tensor of tf.shape(ids) + [embedding_dim] and dtyp...
[ "Lookup", "embeddings", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/embed.py#L139-L182
[ "def", "_build", "(", "self", ",", "ids", ")", ":", "# Construct embeddings.", "if", "self", ".", "_existing_vocab", "is", "None", ":", "if", "self", ".", "EMBEDDINGS", "not", "in", "self", ".", "_initializers", ":", "self", ".", "_initializers", "[", "sel...
00612ca3178964d86b556e062694d808ff81fcca
train
_create_affine_features
Generates n-dimensional homogenous coordinates for a given grid definition. `source_shape` and `output_shape` are used to define the size of the source and output signal domains, as opposed to the shape of the respective Tensors. For example, for an image of size `width=W` and `height=H`, `{source,output}_shap...
sonnet/python/modules/spatial_transformer.py
def _create_affine_features(output_shape, source_shape): """Generates n-dimensional homogenous coordinates for a given grid definition. `source_shape` and `output_shape` are used to define the size of the source and output signal domains, as opposed to the shape of the respective Tensors. For example, for an i...
def _create_affine_features(output_shape, source_shape): """Generates n-dimensional homogenous coordinates for a given grid definition. `source_shape` and `output_shape` are used to define the size of the source and output signal domains, as opposed to the shape of the respective Tensors. For example, for an i...
[ "Generates", "n", "-", "dimensional", "homogenous", "coordinates", "for", "a", "given", "grid", "definition", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L107-L147
[ "def", "_create_affine_features", "(", "output_shape", ",", "source_shape", ")", ":", "ranges", "=", "[", "np", ".", "linspace", "(", "-", "1", ",", "1", ",", "x", ",", "dtype", "=", "np", ".", "float32", ")", "for", "x", "in", "reversed", "(", "outp...
00612ca3178964d86b556e062694d808ff81fcca
train
AffineGridWarper._create_features
Creates all the matrices needed to compute the output warped grids.
sonnet/python/modules/spatial_transformer.py
def _create_features(self, constraints): """Creates all the matrices needed to compute the output warped grids.""" affine_warp_constraints = constraints if not isinstance(affine_warp_constraints, AffineWarpConstraints): affine_warp_constraints = AffineWarpConstraints(affine_warp_constraints) mask ...
def _create_features(self, constraints): """Creates all the matrices needed to compute the output warped grids.""" affine_warp_constraints = constraints if not isinstance(affine_warp_constraints, AffineWarpConstraints): affine_warp_constraints = AffineWarpConstraints(affine_warp_constraints) mask ...
[ "Creates", "all", "the", "matrices", "needed", "to", "compute", "the", "output", "warped", "grids", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L214-L272
[ "def", "_create_features", "(", "self", ",", "constraints", ")", ":", "affine_warp_constraints", "=", "constraints", "if", "not", "isinstance", "(", "affine_warp_constraints", ",", "AffineWarpConstraints", ")", ":", "affine_warp_constraints", "=", "AffineWarpConstraints",...
00612ca3178964d86b556e062694d808ff81fcca
train
AffineGridWarper._build
Assembles the module network and adds it to the graph. The internal computation graph is assembled according to the set of constraints provided at construction time. Args: inputs: Tensor containing a batch of transformation parameters. Returns: A batch of warped grids. Raises: ...
sonnet/python/modules/spatial_transformer.py
def _build(self, inputs): """Assembles the module network and adds it to the graph. The internal computation graph is assembled according to the set of constraints provided at construction time. Args: inputs: Tensor containing a batch of transformation parameters. Returns: A batch of ...
def _build(self, inputs): """Assembles the module network and adds it to the graph. The internal computation graph is assembled according to the set of constraints provided at construction time. Args: inputs: Tensor containing a batch of transformation parameters. Returns: A batch of ...
[ "Assembles", "the", "module", "network", "and", "adds", "it", "to", "the", "graph", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L274-L355
[ "def", "_build", "(", "self", ",", "inputs", ")", ":", "input_shape", "=", "tf", ".", "shape", "(", "inputs", ")", "input_dtype", "=", "inputs", ".", "dtype", ".", "as_numpy_dtype", "batch_size", "=", "tf", ".", "expand_dims", "(", "input_shape", "[", "0...
00612ca3178964d86b556e062694d808ff81fcca
train
AffineGridWarper.inverse
Returns a `sonnet` module to compute inverse affine transforms. The function first assembles a network that given the constraints of the current AffineGridWarper and a set of input parameters, retrieves the coefficients of the corresponding inverse affine transform, then feeds its output into a...
sonnet/python/modules/spatial_transformer.py
def inverse(self, name=None): """Returns a `sonnet` module to compute inverse affine transforms. The function first assembles a network that given the constraints of the current AffineGridWarper and a set of input parameters, retrieves the coefficients of the corresponding inverse affine transfor...
def inverse(self, name=None): """Returns a `sonnet` module to compute inverse affine transforms. The function first assembles a network that given the constraints of the current AffineGridWarper and a set of input parameters, retrieves the coefficients of the corresponding inverse affine transfor...
[ "Returns", "a", "sonnet", "module", "to", "compute", "inverse", "affine", "transforms", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L361-L458
[ "def", "inverse", "(", "self", ",", "name", "=", "None", ")", ":", "if", "self", ".", "_num_coeff", "!=", "6", ":", "raise", "tf", ".", "errors", ".", "UnimplementedError", "(", "'AffineGridWarper currently supports'", "'inversion only for the 2D case.'", ")", "...
00612ca3178964d86b556e062694d808ff81fcca
train
AffineWarpConstraints._calc_mask
Computes a boolean mask from the user defined constraints.
sonnet/python/modules/spatial_transformer.py
def _calc_mask(self): """Computes a boolean mask from the user defined constraints.""" mask = [] for row in self._constraints: mask.append(tuple(x is None for x in row)) return tuple(mask)
def _calc_mask(self): """Computes a boolean mask from the user defined constraints.""" mask = [] for row in self._constraints: mask.append(tuple(x is None for x in row)) return tuple(mask)
[ "Computes", "a", "boolean", "mask", "from", "the", "user", "defined", "constraints", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L495-L500
[ "def", "_calc_mask", "(", "self", ")", ":", "mask", "=", "[", "]", "for", "row", "in", "self", ".", "_constraints", ":", "mask", ".", "append", "(", "tuple", "(", "x", "is", "None", "for", "x", "in", "row", ")", ")", "return", "tuple", "(", "mask...
00612ca3178964d86b556e062694d808ff81fcca
train
AffineWarpConstraints._combine
Combines two constraints, raising an error if they are not compatible.
sonnet/python/modules/spatial_transformer.py
def _combine(self, x, y): """Combines two constraints, raising an error if they are not compatible.""" if x is None or y is None: return x or y if x != y: raise ValueError('Incompatible set of constraints provided.') return x
def _combine(self, x, y): """Combines two constraints, raising an error if they are not compatible.""" if x is None or y is None: return x or y if x != y: raise ValueError('Incompatible set of constraints provided.') return x
[ "Combines", "two", "constraints", "raising", "an", "error", "if", "they", "are", "not", "compatible", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L526-L532
[ "def", "_combine", "(", "self", ",", "x", ",", "y", ")", ":", "if", "x", "is", "None", "or", "y", "is", "None", ":", "return", "x", "or", "y", "if", "x", "!=", "y", ":", "raise", "ValueError", "(", "'Incompatible set of constraints provided.'", ")", ...
00612ca3178964d86b556e062694d808ff81fcca
train
AffineWarpConstraints.combine_with
Combines two sets of constraints into a coherent single set.
sonnet/python/modules/spatial_transformer.py
def combine_with(self, additional_constraints): """Combines two sets of constraints into a coherent single set.""" x = additional_constraints if not isinstance(additional_constraints, AffineWarpConstraints): x = AffineWarpConstraints(additional_constraints) new_constraints = [] for left, right...
def combine_with(self, additional_constraints): """Combines two sets of constraints into a coherent single set.""" x = additional_constraints if not isinstance(additional_constraints, AffineWarpConstraints): x = AffineWarpConstraints(additional_constraints) new_constraints = [] for left, right...
[ "Combines", "two", "sets", "of", "constraints", "into", "a", "coherent", "single", "set", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L538-L546
[ "def", "combine_with", "(", "self", ",", "additional_constraints", ")", ":", "x", "=", "additional_constraints", "if", "not", "isinstance", "(", "additional_constraints", ",", "AffineWarpConstraints", ")", ":", "x", "=", "AffineWarpConstraints", "(", "additional_const...
00612ca3178964d86b556e062694d808ff81fcca
train
_Restore._partition_spec
Build magic (and sparsely documented) shapes_and_slices spec string.
sonnet/python/ops/initializers.py
def _partition_spec(self, shape, partition_info): """Build magic (and sparsely documented) shapes_and_slices spec string.""" if partition_info is None: return '' # Empty string indicates a non-partitioned tensor. ssi = tf.Variable.SaveSliceInfo( full_name=self._var_name, full_shape=pa...
def _partition_spec(self, shape, partition_info): """Build magic (and sparsely documented) shapes_and_slices spec string.""" if partition_info is None: return '' # Empty string indicates a non-partitioned tensor. ssi = tf.Variable.SaveSliceInfo( full_name=self._var_name, full_shape=pa...
[ "Build", "magic", "(", "and", "sparsely", "documented", ")", "shapes_and_slices", "spec", "string", "." ]
deepmind/sonnet
python
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/ops/initializers.py#L58-L67
[ "def", "_partition_spec", "(", "self", ",", "shape", ",", "partition_info", ")", ":", "if", "partition_info", "is", "None", ":", "return", "''", "# Empty string indicates a non-partitioned tensor.", "ssi", "=", "tf", ".", "Variable", ".", "SaveSliceInfo", "(", "fu...
00612ca3178964d86b556e062694d808ff81fcca
train
AnsiblePlaybook.bake
Bake an ``ansible-playbook`` command so it's ready to execute and returns ``None``. :return: None
molecule/provisioner/ansible_playbook.py
def bake(self): """ Bake an ``ansible-playbook`` command so it's ready to execute and returns ``None``. :return: None """ # Pass a directory as inventory to let Ansible merge the multiple # inventory sources located under self.add_cli_arg('inventory', ...
def bake(self): """ Bake an ``ansible-playbook`` command so it's ready to execute and returns ``None``. :return: None """ # Pass a directory as inventory to let Ansible merge the multiple # inventory sources located under self.add_cli_arg('inventory', ...
[ "Bake", "an", "ansible", "-", "playbook", "command", "so", "it", "s", "ready", "to", "execute", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible_playbook.py#L51-L83
[ "def", "bake", "(", "self", ")", ":", "# Pass a directory as inventory to let Ansible merge the multiple", "# inventory sources located under", "self", ".", "add_cli_arg", "(", "'inventory'", ",", "self", ".", "_config", ".", "provisioner", ".", "inventory_directory", ")", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
AnsiblePlaybook.execute
Executes ``ansible-playbook`` and returns a string. :return: str
molecule/provisioner/ansible_playbook.py
def execute(self): """ Executes ``ansible-playbook`` and returns a string. :return: str """ if self._ansible_command is None: self.bake() try: self._config.driver.sanity_checks() cmd = util.run_command( self._ansible_c...
def execute(self): """ Executes ``ansible-playbook`` and returns a string. :return: str """ if self._ansible_command is None: self.bake() try: self._config.driver.sanity_checks() cmd = util.run_command( self._ansible_c...
[ "Executes", "ansible", "-", "playbook", "and", "returns", "a", "string", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible_playbook.py#L85-L101
[ "def", "execute", "(", "self", ")", ":", "if", "self", ".", "_ansible_command", "is", "None", ":", "self", ".", "bake", "(", ")", "try", ":", "self", ".", "_config", ".", "driver", ".", "sanity_checks", "(", ")", "cmd", "=", "util", ".", "run_command...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
login
Log in to one instance.
molecule/command/login.py
def login(ctx, host, scenario_name): # pragma: no cover """ Log in to one instance. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'host': host, } s = scenarios.Scenarios( base.get_configs(args, comm...
def login(ctx, host, scenario_name): # pragma: no cover """ Log in to one instance. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'host': host, } s = scenarios.Scenarios( base.get_configs(args, comm...
[ "Log", "in", "to", "one", "instance", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/login.py#L170-L182
[ "def", "login", "(", "ctx", ",", "host", ",", "scenario_name", ")", ":", "# pragma: no cover", "args", "=", "ctx", ".", "obj", ".", "get", "(", "'args'", ")", "subcommand", "=", "base", ".", "_get_subcommand", "(", "__name__", ")", "command_args", "=", "...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Login.execute
Execute the actions necessary to perform a `molecule login` and returns None. :return: None
molecule/command/login.py
def execute(self): """ Execute the actions necessary to perform a `molecule login` and returns None. :return: None """ c = self._config if ((not c.state.created) and c.driver.managed): msg = 'Instances not created. Please create instances first.' ...
def execute(self): """ Execute the actions necessary to perform a `molecule login` and returns None. :return: None """ c = self._config if ((not c.state.created) and c.driver.managed): msg = 'Instances not created. Please create instances first.' ...
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "login", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/login.py#L89-L103
[ "def", "execute", "(", "self", ")", ":", "c", "=", "self", ".", "_config", "if", "(", "(", "not", "c", ".", "state", ".", "created", ")", "and", "c", ".", "driver", ".", "managed", ")", ":", "msg", "=", "'Instances not created. Please create instances f...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
execute_cmdline_scenarios
Execute scenario sequences based on parsed command-line arguments. This is useful for subcommands that run scenario sequences, which excludes subcommands such as ``list``, ``login``, and ``matrix``. ``args`` and ``command_args`` are combined using :func:`get_configs` to generate the scenario(s) config...
molecule/command/base.py
def execute_cmdline_scenarios(scenario_name, args, command_args): """ Execute scenario sequences based on parsed command-line arguments. This is useful for subcommands that run scenario sequences, which excludes subcommands such as ``list``, ``login``, and ``matrix``. ``args`` and ``command_args``...
def execute_cmdline_scenarios(scenario_name, args, command_args): """ Execute scenario sequences based on parsed command-line arguments. This is useful for subcommands that run scenario sequences, which excludes subcommands such as ``list``, ``login``, and ``matrix``. ``args`` and ``command_args``...
[ "Execute", "scenario", "sequences", "based", "on", "parsed", "command", "-", "line", "arguments", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/base.py#L75-L112
[ "def", "execute_cmdline_scenarios", "(", "scenario_name", ",", "args", ",", "command_args", ")", ":", "scenarios", "=", "molecule", ".", "scenarios", ".", "Scenarios", "(", "get_configs", "(", "args", ",", "command_args", ")", ",", "scenario_name", ")", "scenari...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
execute_scenario
Execute each command in the given scenario's configured sequence. :param scenario: The scenario to execute. :returns: None
molecule/command/base.py
def execute_scenario(scenario): """ Execute each command in the given scenario's configured sequence. :param scenario: The scenario to execute. :returns: None """ for action in scenario.sequence: execute_subcommand(scenario.config, action) # pruning only if a 'destroy' step was i...
def execute_scenario(scenario): """ Execute each command in the given scenario's configured sequence. :param scenario: The scenario to execute. :returns: None """ for action in scenario.sequence: execute_subcommand(scenario.config, action) # pruning only if a 'destroy' step was i...
[ "Execute", "each", "command", "in", "the", "given", "scenario", "s", "configured", "sequence", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/base.py#L127-L142
[ "def", "execute_scenario", "(", "scenario", ")", ":", "for", "action", "in", "scenario", ".", "sequence", ":", "execute_subcommand", "(", "scenario", ".", "config", ",", "action", ")", "# pruning only if a 'destroy' step was in the sequence allows for normal", "# debuggin...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
get_configs
Glob the current directory for Molecule config files, instantiate config objects, and returns a list. :param args: A dict of options, arguments and commands from the CLI. :param command_args: A dict of options passed to the subcommand from the CLI. :param ansible_args: An optional tuple of argumen...
molecule/command/base.py
def get_configs(args, command_args, ansible_args=()): """ Glob the current directory for Molecule config files, instantiate config objects, and returns a list. :param args: A dict of options, arguments and commands from the CLI. :param command_args: A dict of options passed to the subcommand from ...
def get_configs(args, command_args, ansible_args=()): """ Glob the current directory for Molecule config files, instantiate config objects, and returns a list. :param args: A dict of options, arguments and commands from the CLI. :param command_args: A dict of options passed to the subcommand from ...
[ "Glob", "the", "current", "directory", "for", "Molecule", "config", "files", "instantiate", "config", "objects", "and", "returns", "a", "list", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/base.py#L145-L167
[ "def", "get_configs", "(", "args", ",", "command_args", ",", "ansible_args", "=", "(", ")", ")", ":", "configs", "=", "[", "config", ".", "Config", "(", "molecule_file", "=", "util", ".", "abs_path", "(", "c", ")", ",", "args", "=", "args", ",", "com...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
_verify_configs
Verify a Molecule config was found and returns None. :param configs: A list containing absolute paths to Molecule config files. :return: None
molecule/command/base.py
def _verify_configs(configs): """ Verify a Molecule config was found and returns None. :param configs: A list containing absolute paths to Molecule config files. :return: None """ if configs: scenario_names = [c.scenario.name for c in configs] for scenario_name, n in collections...
def _verify_configs(configs): """ Verify a Molecule config was found and returns None. :param configs: A list containing absolute paths to Molecule config files. :return: None """ if configs: scenario_names = [c.scenario.name for c in configs] for scenario_name, n in collections...
[ "Verify", "a", "Molecule", "config", "was", "found", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/base.py#L170-L187
[ "def", "_verify_configs", "(", "configs", ")", ":", "if", "configs", ":", "scenario_names", "=", "[", "c", ".", "scenario", ".", "name", "for", "c", "in", "configs", "]", "for", "scenario_name", ",", "n", "in", "collections", ".", "Counter", "(", "scenar...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Gilt.bake
Bake a ``gilt`` command so it's ready to execute and returns None. :return: None
molecule/dependency/gilt.py
def bake(self): """ Bake a ``gilt`` command so it's ready to execute and returns None. :return: None """ self._sh_command = getattr(sh, self.command) self._sh_command = self._sh_command.bake( self.options, 'overlay', _env=self.env, ...
def bake(self): """ Bake a ``gilt`` command so it's ready to execute and returns None. :return: None """ self._sh_command = getattr(sh, self.command) self._sh_command = self._sh_command.bake( self.options, 'overlay', _env=self.env, ...
[ "Bake", "a", "gilt", "command", "so", "it", "s", "ready", "to", "execute", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/dependency/gilt.py#L86-L98
[ "def", "bake", "(", "self", ")", ":", "self", ".", "_sh_command", "=", "getattr", "(", "sh", ",", "self", ".", "command", ")", "self", ".", "_sh_command", "=", "self", ".", "_sh_command", ".", "bake", "(", "self", ".", "options", ",", "'overlay'", ",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Cleanup.execute
Execute the actions necessary to cleanup the instances and returns None. :return: None
molecule/command/cleanup.py
def execute(self): """ Execute the actions necessary to cleanup the instances and returns None. :return: None """ self.print_info() if not self._config.provisioner.playbooks.cleanup: msg = 'Skipping, cleanup playbook not configured.' LOG....
def execute(self): """ Execute the actions necessary to cleanup the instances and returns None. :return: None """ self.print_info() if not self._config.provisioner.playbooks.cleanup: msg = 'Skipping, cleanup playbook not configured.' LOG....
[ "Execute", "the", "actions", "necessary", "to", "cleanup", "the", "instances", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/cleanup.py#L66-L80
[ "def", "execute", "(", "self", ")", ":", "self", ".", "print_info", "(", ")", "if", "not", "self", ".", "_config", ".", "provisioner", ".", "playbooks", ".", "cleanup", ":", "msg", "=", "'Skipping, cleanup playbook not configured.'", "LOG", ".", "warn", "(",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
AnsibleLintMixin.bake
Bake an `ansible-lint` command so it's ready to execute and returns None. :return: None
molecule/provisioner/lint/ansible_lint.py
def bake(self): """ Bake an `ansible-lint` command so it's ready to execute and returns None. :return: None """ options = self.options default_exclude_list = options.pop('default_exclude') options_exclude_list = options.pop('exclude') excludes = d...
def bake(self): """ Bake an `ansible-lint` command so it's ready to execute and returns None. :return: None """ options = self.options default_exclude_list = options.pop('default_exclude') options_exclude_list = options.pop('exclude') excludes = d...
[ "Bake", "an", "ansible", "-", "lint", "command", "so", "it", "s", "ready", "to", "execute", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/lint/ansible_lint.py#L64-L86
[ "def", "bake", "(", "self", ")", ":", "options", "=", "self", ".", "options", "default_exclude_list", "=", "options", ".", "pop", "(", "'default_exclude'", ")", "options_exclude_list", "=", "options", ".", "pop", "(", "'exclude'", ")", "excludes", "=", "defa...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
print_environment_vars
Print ``Ansible`` and ``Molecule`` environment variables and returns None. :param env: A dict containing the shell's environment as collected by ``os.environ``. :return: None
molecule/util.py
def print_environment_vars(env): """ Print ``Ansible`` and ``Molecule`` environment variables and returns None. :param env: A dict containing the shell's environment as collected by ``os.environ``. :return: None """ ansible_env = {k: v for (k, v) in env.items() if 'ANSIBLE_' in k} print...
def print_environment_vars(env): """ Print ``Ansible`` and ``Molecule`` environment variables and returns None. :param env: A dict containing the shell's environment as collected by ``os.environ``. :return: None """ ansible_env = {k: v for (k, v) in env.items() if 'ANSIBLE_' in k} print...
[ "Print", "Ansible", "and", "Molecule", "environment", "variables", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/util.py#L58-L77
[ "def", "print_environment_vars", "(", "env", ")", ":", "ansible_env", "=", "{", "k", ":", "v", "for", "(", "k", ",", "v", ")", "in", "env", ".", "items", "(", ")", "if", "'ANSIBLE_'", "in", "k", "}", "print_debug", "(", "'ANSIBLE ENVIRONMENT'", ",", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
run_command
Execute the given command and returns None. :param cmd: A ``sh.Command`` object to execute. :param debug: An optional bool to toggle debug output. :return: ``sh`` object
molecule/util.py
def run_command(cmd, debug=False): """ Execute the given command and returns None. :param cmd: A ``sh.Command`` object to execute. :param debug: An optional bool to toggle debug output. :return: ``sh`` object """ if debug: # WARN(retr0h): Uses an internal ``sh`` data structure to di...
def run_command(cmd, debug=False): """ Execute the given command and returns None. :param cmd: A ``sh.Command`` object to execute. :param debug: An optional bool to toggle debug output. :return: ``sh`` object """ if debug: # WARN(retr0h): Uses an internal ``sh`` data structure to di...
[ "Execute", "the", "given", "command", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/util.py#L89-L103
[ "def", "run_command", "(", "cmd", ",", "debug", "=", "False", ")", ":", "if", "debug", ":", "# WARN(retr0h): Uses an internal ``sh`` data structure to dig", "# the environment out of the ``sh.command`` object.", "print_environment_vars", "(", "cmd", ".", "_partial_call_args", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
write_file
Writes a file with the given filename and content and returns None. :param filename: A string containing the target filename. :param content: A string containing the data to be written. :return: None
molecule/util.py
def write_file(filename, content): """ Writes a file with the given filename and content and returns None. :param filename: A string containing the target filename. :param content: A string containing the data to be written. :return: None """ with open_file(filename, 'w') as f: f.wr...
def write_file(filename, content): """ Writes a file with the given filename and content and returns None. :param filename: A string containing the target filename. :param content: A string containing the data to be written. :return: None """ with open_file(filename, 'w') as f: f.wr...
[ "Writes", "a", "file", "with", "the", "given", "filename", "and", "content", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/util.py#L123-L134
[ "def", "write_file", "(", "filename", ",", "content", ")", ":", "with", "open_file", "(", "filename", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "content", ")", "file_prepender", "(", "filename", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
file_prepender
Prepend an informational header on files managed by Molecule and returns None. :param filename: A string containing the target filename. :return: None
molecule/util.py
def file_prepender(filename): """ Prepend an informational header on files managed by Molecule and returns None. :param filename: A string containing the target filename. :return: None """ with open_file(filename, 'r+') as f: content = f.read() f.seek(0, 0) f.write(m...
def file_prepender(filename): """ Prepend an informational header on files managed by Molecule and returns None. :param filename: A string containing the target filename. :return: None """ with open_file(filename, 'r+') as f: content = f.read() f.seek(0, 0) f.write(m...
[ "Prepend", "an", "informational", "header", "on", "files", "managed", "by", "Molecule", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/util.py#L141-L152
[ "def", "file_prepender", "(", "filename", ")", ":", "with", "open_file", "(", "filename", ",", "'r+'", ")", "as", "f", ":", "content", "=", "f", ".", "read", "(", ")", "f", ".", "seek", "(", "0", ",", "0", ")", "f", ".", "write", "(", "molecule_p...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
safe_dump
Dump the provided data to a YAML document and returns a string. :param data: A string containing an absolute path to the file to parse. :return: str
molecule/util.py
def safe_dump(data): """ Dump the provided data to a YAML document and returns a string. :param data: A string containing an absolute path to the file to parse. :return: str """ # TODO(retr0h): Do we need to encode? # yaml.dump(data) produces the document as a str object in both python ...
def safe_dump(data): """ Dump the provided data to a YAML document and returns a string. :param data: A string containing an absolute path to the file to parse. :return: str """ # TODO(retr0h): Do we need to encode? # yaml.dump(data) produces the document as a str object in both python ...
[ "Dump", "the", "provided", "data", "to", "a", "YAML", "document", "and", "returns", "a", "string", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/util.py#L155-L166
[ "def", "safe_dump", "(", "data", ")", ":", "# TODO(retr0h): Do we need to encode?", "# yaml.dump(data) produces the document as a str object in both python", "# 2 and 3.", "return", "yaml", ".", "dump", "(", "data", ",", "Dumper", "=", "SafeDumper", ",", "default_flow_style",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
safe_load
Parse the provided string returns a dict. :param string: A string to be parsed. :return: dict
molecule/util.py
def safe_load(string): """ Parse the provided string returns a dict. :param string: A string to be parsed. :return: dict """ try: return yaml.safe_load(string) or {} except yaml.scanner.ScannerError as e: sysexit_with_message(str(e))
def safe_load(string): """ Parse the provided string returns a dict. :param string: A string to be parsed. :return: dict """ try: return yaml.safe_load(string) or {} except yaml.scanner.ScannerError as e: sysexit_with_message(str(e))
[ "Parse", "the", "provided", "string", "returns", "a", "dict", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/util.py#L169-L179
[ "def", "safe_load", "(", "string", ")", ":", "try", ":", "return", "yaml", ".", "safe_load", "(", "string", ")", "or", "{", "}", "except", "yaml", ".", "scanner", ".", "ScannerError", "as", "e", ":", "sysexit_with_message", "(", "str", "(", "e", ")", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
merge_dicts
Merges the values of B into A and returns a mutated dict A. :: dict a b: - c: 0 - c: 2 d: e: "aaa" f: 3 dict b a: 1 b: - c: 3 d: e: "bbb" Will give an object such as:: {'a': 1...
molecule/util.py
def merge_dicts(a, b): """ Merges the values of B into A and returns a mutated dict A. :: dict a b: - c: 0 - c: 2 d: e: "aaa" f: 3 dict b a: 1 b: - c: 3 d: e: "bbb" Will give a...
def merge_dicts(a, b): """ Merges the values of B into A and returns a mutated dict A. :: dict a b: - c: 0 - c: 2 d: e: "aaa" f: 3 dict b a: 1 b: - c: 3 d: e: "bbb" Will give a...
[ "Merges", "the", "values", "of", "B", "into", "A", "and", "returns", "a", "mutated", "dict", "A", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/util.py#L265-L299
[ "def", "merge_dicts", "(", "a", ",", "b", ")", ":", "anyconfig", ".", "merge", "(", "a", ",", "b", ",", "ac_merge", "=", "MERGE_STRATEGY", ")", "return", "a" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Validator._validate_unique
Ensure value uniqueness. The rule's arguments are validated against this schema: {'type': 'boolean'}
molecule/model/schema_v2.py
def _validate_unique(self, unique, field, value): """Ensure value uniqueness. The rule's arguments are validated against this schema: {'type': 'boolean'} """ if unique: root_key = self.schema_path[0] data = (doc[field] for doc in self.root_document[root_k...
def _validate_unique(self, unique, field, value): """Ensure value uniqueness. The rule's arguments are validated against this schema: {'type': 'boolean'} """ if unique: root_key = self.schema_path[0] data = (doc[field] for doc in self.root_document[root_k...
[ "Ensure", "value", "uniqueness", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/model/schema_v2.py#L986-L998
[ "def", "_validate_unique", "(", "self", ",", "unique", ",", "field", ",", "value", ")", ":", "if", "unique", ":", "root_key", "=", "self", ".", "schema_path", "[", "0", "]", "data", "=", "(", "doc", "[", "field", "]", "for", "doc", "in", "self", "....
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Validator._validate_disallowed
Readonly but with a custom error. The rule's arguments are validated against this schema: {'type': 'boolean'}
molecule/model/schema_v2.py
def _validate_disallowed(self, disallowed, field, value): """ Readonly but with a custom error. The rule's arguments are validated against this schema: {'type': 'boolean'} """ if disallowed: msg = 'disallowed user provided config option' self._error(field...
def _validate_disallowed(self, disallowed, field, value): """ Readonly but with a custom error. The rule's arguments are validated against this schema: {'type': 'boolean'} """ if disallowed: msg = 'disallowed user provided config option' self._error(field...
[ "Readonly", "but", "with", "a", "custom", "error", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/model/schema_v2.py#L1000-L1008
[ "def", "_validate_disallowed", "(", "self", ",", "disallowed", ",", "field", ",", "value", ")", ":", "if", "disallowed", ":", "msg", "=", "'disallowed user provided config option'", "self", ".", "_error", "(", "field", ",", "msg", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Validator._validate_molecule_env_var
Readonly but with a custom error. The rule's arguments are validated against this schema: {'type': 'boolean'}
molecule/model/schema_v2.py
def _validate_molecule_env_var(self, molecule_env_var, field, value): """ Readonly but with a custom error. The rule's arguments are validated against this schema: {'type': 'boolean'} """ # TODO(retr0h): This needs to be better handled. pattern = r'^[{$]+MOLECULE[_a-z0-9...
def _validate_molecule_env_var(self, molecule_env_var, field, value): """ Readonly but with a custom error. The rule's arguments are validated against this schema: {'type': 'boolean'} """ # TODO(retr0h): This needs to be better handled. pattern = r'^[{$]+MOLECULE[_a-z0-9...
[ "Readonly", "but", "with", "a", "custom", "error", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/model/schema_v2.py#L1021-L1034
[ "def", "_validate_molecule_env_var", "(", "self", ",", "molecule_env_var", ",", "field", ",", "value", ")", ":", "# TODO(retr0h): This needs to be better handled.", "pattern", "=", "r'^[{$]+MOLECULE[_a-z0-9A-Z]+[}]*$'", "if", "molecule_env_var", ":", "if", "re", ".", "mat...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Idempotence.execute
Execute the actions necessary to perform a `molecule idempotence` and returns None. :return: None
molecule/command/idempotence.py
def execute(self): """ Execute the actions necessary to perform a `molecule idempotence` and returns None. :return: None """ self.print_info() if not self._config.state.converged: msg = 'Instances not converged. Please converge instances first.' ...
def execute(self): """ Execute the actions necessary to perform a `molecule idempotence` and returns None. :return: None """ self.print_info() if not self._config.state.converged: msg = 'Instances not converged. Please converge instances first.' ...
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "idempotence", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/idempotence.py#L69-L90
[ "def", "execute", "(", "self", ")", ":", "self", ".", "print_info", "(", ")", "if", "not", "self", ".", "_config", ".", "state", ".", "converged", ":", "msg", "=", "'Instances not converged. Please converge instances first.'", "util", ".", "sysexit_with_message",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Idempotence._is_idempotent
Parses the output of the provisioning for changed and returns a bool. :param output: A string containing the output of the ansible run. :return: bool
molecule/command/idempotence.py
def _is_idempotent(self, output): """ Parses the output of the provisioning for changed and returns a bool. :param output: A string containing the output of the ansible run. :return: bool """ # Remove blank lines to make regex matches easier output = re.sub(r'\n...
def _is_idempotent(self, output): """ Parses the output of the provisioning for changed and returns a bool. :param output: A string containing the output of the ansible run. :return: bool """ # Remove blank lines to make regex matches easier output = re.sub(r'\n...
[ "Parses", "the", "output", "of", "the", "provisioning", "for", "changed", "and", "returns", "a", "bool", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/idempotence.py#L92-L110
[ "def", "_is_idempotent", "(", "self", ",", "output", ")", ":", "# Remove blank lines to make regex matches easier", "output", "=", "re", ".", "sub", "(", "r'\\n\\s*\\n*'", ",", "'\\n'", ",", "output", ")", "# Look for any non-zero changed lines", "changed", "=", "re",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Idempotence._non_idempotent_tasks
Parses the output to identify the non idempotent tasks. :param (str) output: A string containing the output of the ansible run. :return: A list containing the names of the non idempotent tasks.
molecule/command/idempotence.py
def _non_idempotent_tasks(self, output): """ Parses the output to identify the non idempotent tasks. :param (str) output: A string containing the output of the ansible run. :return: A list containing the names of the non idempotent tasks. """ # Remove blank lines to make...
def _non_idempotent_tasks(self, output): """ Parses the output to identify the non idempotent tasks. :param (str) output: A string containing the output of the ansible run. :return: A list containing the names of the non idempotent tasks. """ # Remove blank lines to make...
[ "Parses", "the", "output", "to", "identify", "the", "non", "idempotent", "tasks", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/idempotence.py#L112-L137
[ "def", "_non_idempotent_tasks", "(", "self", ",", "output", ")", ":", "# Remove blank lines to make regex matches easier.", "output", "=", "re", ".", "sub", "(", "r'\\n\\s*\\n*'", ",", "'\\n'", ",", "output", ")", "# Remove ansi escape sequences.", "output", "=", "uti...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
scenario
Initialize a new scenario for use with Molecule.
molecule/command/init/scenario.py
def scenario(ctx, dependency_name, driver_name, lint_name, provisioner_name, role_name, scenario_name, verifier_name): # pragma: no cover """ Initialize a new scenario for use with Molecule. """ command_args = { 'dependency_name': dependency_name, 'driver_name': driver_name, ...
def scenario(ctx, dependency_name, driver_name, lint_name, provisioner_name, role_name, scenario_name, verifier_name): # pragma: no cover """ Initialize a new scenario for use with Molecule. """ command_args = { 'dependency_name': dependency_name, 'driver_name': driver_name, ...
[ "Initialize", "a", "new", "scenario", "for", "use", "with", "Molecule", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/init/scenario.py#L162-L186
[ "def", "scenario", "(", "ctx", ",", "dependency_name", ",", "driver_name", ",", "lint_name", ",", "provisioner_name", ",", "role_name", ",", "scenario_name", ",", "verifier_name", ")", ":", "# pragma: no cover", "command_args", "=", "{", "'dependency_name'", ":", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Scenario.execute
Execute the actions necessary to perform a `molecule init scenario` and returns None. :return: None
molecule/command/init/scenario.py
def execute(self): """ Execute the actions necessary to perform a `molecule init scenario` and returns None. :return: None """ scenario_name = self._command_args['scenario_name'] role_name = os.getcwd().split(os.sep)[-1] role_directory = util.abs_path(os....
def execute(self): """ Execute the actions necessary to perform a `molecule init scenario` and returns None. :return: None """ scenario_name = self._command_args['scenario_name'] role_name = os.getcwd().split(os.sep)[-1] role_directory = util.abs_path(os....
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "init", "scenario", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/init/scenario.py#L53-L89
[ "def", "execute", "(", "self", ")", ":", "scenario_name", "=", "self", ".", "_command_args", "[", "'scenario_name'", "]", "role_name", "=", "os", ".", "getcwd", "(", ")", ".", "split", "(", "os", ".", "sep", ")", "[", "-", "1", "]", "role_directory", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Docker.sanity_checks
Implement Docker driver sanity checks.
molecule/driver/docker.py
def sanity_checks(self): """Implement Docker driver sanity checks.""" if self._config.state.sanity_checked: return log.info("Sanity checks: '{}'".format(self._name)) HAS_DOCKER_PY = None try: from ansible.module_utils.docker_common import HAS_DOCKER_PY ...
def sanity_checks(self): """Implement Docker driver sanity checks.""" if self._config.state.sanity_checked: return log.info("Sanity checks: '{}'".format(self._name)) HAS_DOCKER_PY = None try: from ansible.module_utils.docker_common import HAS_DOCKER_PY ...
[ "Implement", "Docker", "driver", "sanity", "checks", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/driver/docker.py#L191-L227
[ "def", "sanity_checks", "(", "self", ")", ":", "if", "self", ".", "_config", ".", "state", ".", "sanity_checked", ":", "return", "log", ".", "info", "(", "\"Sanity checks: '{}'\"", ".", "format", "(", "self", ".", "_name", ")", ")", "HAS_DOCKER_PY", "=", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Flake8.bake
Bake a `flake8` command so it's ready to execute and returns None. :return: None
molecule/verifier/lint/flake8.py
def bake(self): """ Bake a `flake8` command so it's ready to execute and returns None. :return: None """ self._flake8_command = sh.flake8.bake( self.options, self._tests, _env=self.env, _out=LOG.out, _err=LOG.error)
def bake(self): """ Bake a `flake8` command so it's ready to execute and returns None. :return: None """ self._flake8_command = sh.flake8.bake( self.options, self._tests, _env=self.env, _out=LOG.out, _err=LOG.error)
[ "Bake", "a", "flake8", "command", "so", "it", "s", "ready", "to", "execute", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/verifier/lint/flake8.py#L94-L105
[ "def", "bake", "(", "self", ")", ":", "self", ".", "_flake8_command", "=", "sh", ".", "flake8", ".", "bake", "(", "self", ".", "options", ",", "self", ".", "_tests", ",", "_env", "=", "self", ".", "env", ",", "_out", "=", "LOG", ".", "out", ",", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
AnsibleGalaxy._setup
Prepare the system for using ``ansible-galaxy`` and returns None. :return: None
molecule/dependency/ansible_galaxy.py
def _setup(self): """ Prepare the system for using ``ansible-galaxy`` and returns None. :return: None """ role_directory = os.path.join(self._config.scenario.directory, self.options['roles-path']) if not os.path.isdir(role_directory)...
def _setup(self): """ Prepare the system for using ``ansible-galaxy`` and returns None. :return: None """ role_directory = os.path.join(self._config.scenario.directory, self.options['roles-path']) if not os.path.isdir(role_directory)...
[ "Prepare", "the", "system", "for", "using", "ansible", "-", "galaxy", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/dependency/ansible_galaxy.py#L154-L163
[ "def", "_setup", "(", "self", ")", ":", "role_directory", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_config", ".", "scenario", ".", "directory", ",", "self", ".", "options", "[", "'roles-path'", "]", ")", "if", "not", "os", ".", "path",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
converge
Use the provisioner to configure instances (dependency, create, prepare converge).
molecule/command/converge.py
def converge(ctx, scenario_name, ansible_args): # pragma: no cover """ Use the provisioner to configure instances (dependency, create, prepare converge). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } ...
def converge(ctx, scenario_name, ansible_args): # pragma: no cover """ Use the provisioner to configure instances (dependency, create, prepare converge). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } ...
[ "Use", "the", "provisioner", "to", "configure", "instances", "(", "dependency", "create", "prepare", "converge", ")", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/converge.py#L93-L105
[ "def", "converge", "(", "ctx", ",", "scenario_name", ",", "ansible_args", ")", ":", "# pragma: no cover", "args", "=", "ctx", ".", "obj", ".", "get", "(", "'args'", ")", "subcommand", "=", "base", ".", "_get_subcommand", "(", "__name__", ")", "command_args",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Converge.execute
Execute the actions necessary to perform a `molecule converge` and returns None. :return: None
molecule/command/converge.py
def execute(self): """ Execute the actions necessary to perform a `molecule converge` and returns None. :return: None """ self.print_info() self._config.provisioner.converge() self._config.state.change_state('converged', True)
def execute(self): """ Execute the actions necessary to perform a `molecule converge` and returns None. :return: None """ self.print_info() self._config.provisioner.converge() self._config.state.change_state('converged', True)
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "converge", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/converge.py#L72-L81
[ "def", "execute", "(", "self", ")", ":", "self", ".", "print_info", "(", ")", "self", ".", "_config", ".", "provisioner", ".", "converge", "(", ")", "self", ".", "_config", ".", "state", ".", "change_state", "(", "'converged'", ",", "True", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Scenarios.all
Return a list containing all scenario objects. :return: list
molecule/scenarios.py
def all(self): """ Return a list containing all scenario objects. :return: list """ if self._scenario_name: scenarios = self._filter_for_scenario() self._verify() return scenarios scenarios = [c.scenario for c in self._configs] ...
def all(self): """ Return a list containing all scenario objects. :return: list """ if self._scenario_name: scenarios = self._filter_for_scenario() self._verify() return scenarios scenarios = [c.scenario for c in self._configs] ...
[ "Return", "a", "list", "containing", "all", "scenario", "objects", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/scenarios.py#L60-L74
[ "def", "all", "(", "self", ")", ":", "if", "self", ".", "_scenario_name", ":", "scenarios", "=", "self", ".", "_filter_for_scenario", "(", ")", "self", ".", "_verify", "(", ")", "return", "scenarios", "scenarios", "=", "[", "c", ".", "scenario", "for", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Scenarios._verify
Verify the specified scenario was found and returns None. :return: None
molecule/scenarios.py
def _verify(self): """ Verify the specified scenario was found and returns None. :return: None """ scenario_names = [c.scenario.name for c in self._configs] if self._scenario_name not in scenario_names: msg = ("Scenario '{}' not found. " '...
def _verify(self): """ Verify the specified scenario was found and returns None. :return: None """ scenario_names = [c.scenario.name for c in self._configs] if self._scenario_name not in scenario_names: msg = ("Scenario '{}' not found. " '...
[ "Verify", "the", "specified", "scenario", "was", "found", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/scenarios.py#L92-L102
[ "def", "_verify", "(", "self", ")", ":", "scenario_names", "=", "[", "c", ".", "scenario", ".", "name", "for", "c", "in", "self", ".", "_configs", "]", "if", "self", ".", "_scenario_name", "not", "in", "scenario_names", ":", "msg", "=", "(", "\"Scenari...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Scenarios._filter_for_scenario
Find the scenario matching the provided scenario name and returns a list. :return: list
molecule/scenarios.py
def _filter_for_scenario(self): """ Find the scenario matching the provided scenario name and returns a list. :return: list """ return [ c.scenario for c in self._configs if c.scenario.name == self._scenario_name ]
def _filter_for_scenario(self): """ Find the scenario matching the provided scenario name and returns a list. :return: list """ return [ c.scenario for c in self._configs if c.scenario.name == self._scenario_name ]
[ "Find", "the", "scenario", "matching", "the", "provided", "scenario", "name", "and", "returns", "a", "list", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/scenarios.py#L104-L114
[ "def", "_filter_for_scenario", "(", "self", ")", ":", "return", "[", "c", ".", "scenario", "for", "c", "in", "self", ".", "_configs", "if", "c", ".", "scenario", ".", "name", "==", "self", ".", "_scenario_name", "]" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Scenarios._get_matrix
Build a matrix of scenarios with sequence to include and returns a dict. { scenario_1: { 'subcommand': [ 'action-1', 'action-2', ], }, scenario_2: { 'subcommand': [ ...
molecule/scenarios.py
def _get_matrix(self): """ Build a matrix of scenarios with sequence to include and returns a dict. { scenario_1: { 'subcommand': [ 'action-1', 'action-2', ], }, scenario_2: { ...
def _get_matrix(self): """ Build a matrix of scenarios with sequence to include and returns a dict. { scenario_1: { 'subcommand': [ 'action-1', 'action-2', ], }, scenario_2: { ...
[ "Build", "a", "matrix", "of", "scenarios", "with", "sequence", "to", "include", "and", "returns", "a", "dict", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/scenarios.py#L116-L154
[ "def", "_get_matrix", "(", "self", ")", ":", "return", "dict", "(", "{", "scenario", ".", "name", ":", "{", "'check'", ":", "scenario", ".", "check_sequence", ",", "'cleanup'", ":", "scenario", ".", "cleanup_sequence", ",", "'converge'", ":", "scenario", "...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
get_logger
Build a logger with the given name and returns the logger. :param name: The name for the logger. This is usually the module name, ``__name__``. :return: logger object
molecule/logger.py
def get_logger(name=None): """ Build a logger with the given name and returns the logger. :param name: The name for the logger. This is usually the module name, ``__name__``. :return: logger object """ logging.setLoggerClass(CustomLogger) logger = logging.getLogger(name) ...
def get_logger(name=None): """ Build a logger with the given name and returns the logger. :param name: The name for the logger. This is usually the module name, ``__name__``. :return: logger object """ logging.setLoggerClass(CustomLogger) logger = logging.getLogger(name) ...
[ "Build", "a", "logger", "with", "the", "given", "name", "and", "returns", "the", "logger", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/logger.py#L86-L107
[ "def", "get_logger", "(", "name", "=", "None", ")", ":", "logging", ".", "setLoggerClass", "(", "CustomLogger", ")", "logger", "=", "logging", ".", "getLogger", "(", "name", ")", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ")", "logger", "."...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
lint
Lint the role.
molecule/command/lint.py
def lint(ctx, scenario_name): # pragma: no cover """ Lint the role. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } base.execute_cmdline_scenarios(scenario_name, args, command_args)
def lint(ctx, scenario_name): # pragma: no cover """ Lint the role. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } base.execute_cmdline_scenarios(scenario_name, args, command_args)
[ "Lint", "the", "role", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/lint.py#L91-L99
[ "def", "lint", "(", "ctx", ",", "scenario_name", ")", ":", "# pragma: no cover", "args", "=", "ctx", ".", "obj", ".", "get", "(", "'args'", ")", "subcommand", "=", "base", ".", "_get_subcommand", "(", "__name__", ")", "command_args", "=", "{", "'subcommand...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Lint.execute
Execute the actions necessary to perform a `molecule lint` and returns None. :return: None
molecule/command/lint.py
def execute(self): """ Execute the actions necessary to perform a `molecule lint` and returns None. :return: None """ self.print_info() linters = [ l for l in [ self._config.lint, self._config.verifier.lint, ...
def execute(self): """ Execute the actions necessary to perform a `molecule lint` and returns None. :return: None """ self.print_info() linters = [ l for l in [ self._config.lint, self._config.verifier.lint, ...
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "lint", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/lint.py#L63-L80
[ "def", "execute", "(", "self", ")", ":", "self", ".", "print_info", "(", ")", "linters", "=", "[", "l", "for", "l", "in", "[", "self", ".", "_config", ".", "lint", ",", "self", ".", "_config", ".", "verifier", ".", "lint", ",", "self", ".", "_con...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.inventory
Create an inventory structure and returns a dict. .. code-block:: yaml ungrouped: vars: foo: bar hosts: instance-1: instance-2: children: $child_group_name: hosts: ...
molecule/provisioner/ansible.py
def inventory(self): """ Create an inventory structure and returns a dict. .. code-block:: yaml ungrouped: vars: foo: bar hosts: instance-1: instance-2: children: $child_group_n...
def inventory(self): """ Create an inventory structure and returns a dict. .. code-block:: yaml ungrouped: vars: foo: bar hosts: instance-1: instance-2: children: $child_group_n...
[ "Create", "an", "inventory", "structure", "and", "returns", "a", "dict", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L529-L588
[ "def", "inventory", "(", "self", ")", ":", "dd", "=", "self", ".", "_vivify", "(", ")", "for", "platform", "in", "self", ".", "_config", ".", "platforms", ".", "instances", ":", "for", "group", "in", "platform", ".", "get", "(", "'groups'", ",", "[",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.cleanup
Executes `ansible-playbook` against the cleanup playbook and returns None. :return: None
molecule/provisioner/ansible.py
def cleanup(self): """ Executes `ansible-playbook` against the cleanup playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.cleanup) pb.execute()
def cleanup(self): """ Executes `ansible-playbook` against the cleanup playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.cleanup) pb.execute()
[ "Executes", "ansible", "-", "playbook", "against", "the", "cleanup", "playbook", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L614-L622
[ "def", "cleanup", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "cleanup", ")", "pb", ".", "execute", "(", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.converge
Executes ``ansible-playbook`` against the converge playbook unless specified otherwise and returns a string. :param playbook: An optional string containing an absolute path to a playbook. :param kwargs: An optional keyword arguments. :return: str
molecule/provisioner/ansible.py
def converge(self, playbook=None, **kwargs): """ Executes ``ansible-playbook`` against the converge playbook unless specified otherwise and returns a string. :param playbook: An optional string containing an absolute path to a playbook. :param kwargs: An optional keywor...
def converge(self, playbook=None, **kwargs): """ Executes ``ansible-playbook`` against the converge playbook unless specified otherwise and returns a string. :param playbook: An optional string containing an absolute path to a playbook. :param kwargs: An optional keywor...
[ "Executes", "ansible", "-", "playbook", "against", "the", "converge", "playbook", "unless", "specified", "otherwise", "and", "returns", "a", "string", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L641-L656
[ "def", "converge", "(", "self", ",", "playbook", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "playbook", "is", "None", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "converge", ",", "*", "*", "kwa...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.destroy
Executes ``ansible-playbook`` against the destroy playbook and returns None. :return: None
molecule/provisioner/ansible.py
def destroy(self): """ Executes ``ansible-playbook`` against the destroy playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.destroy) pb.execute()
def destroy(self): """ Executes ``ansible-playbook`` against the destroy playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.destroy) pb.execute()
[ "Executes", "ansible", "-", "playbook", "against", "the", "destroy", "playbook", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L658-L666
[ "def", "destroy", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "destroy", ")", "pb", ".", "execute", "(", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.side_effect
Executes ``ansible-playbook`` against the side_effect playbook and returns None. :return: None
molecule/provisioner/ansible.py
def side_effect(self): """ Executes ``ansible-playbook`` against the side_effect playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.side_effect) pb.execute()
def side_effect(self): """ Executes ``ansible-playbook`` against the side_effect playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.side_effect) pb.execute()
[ "Executes", "ansible", "-", "playbook", "against", "the", "side_effect", "playbook", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L668-L676
[ "def", "side_effect", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "side_effect", ")", "pb", ".", "execute", "(", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.create
Executes ``ansible-playbook`` against the create playbook and returns None. :return: None
molecule/provisioner/ansible.py
def create(self): """ Executes ``ansible-playbook`` against the create playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.create) pb.execute()
def create(self): """ Executes ``ansible-playbook`` against the create playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.create) pb.execute()
[ "Executes", "ansible", "-", "playbook", "against", "the", "create", "playbook", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L678-L686
[ "def", "create", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "create", ")", "pb", ".", "execute", "(", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.prepare
Executes ``ansible-playbook`` against the prepare playbook and returns None. :return: None
molecule/provisioner/ansible.py
def prepare(self): """ Executes ``ansible-playbook`` against the prepare playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.prepare) pb.execute()
def prepare(self): """ Executes ``ansible-playbook`` against the prepare playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.prepare) pb.execute()
[ "Executes", "ansible", "-", "playbook", "against", "the", "prepare", "playbook", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L688-L696
[ "def", "prepare", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "prepare", ")", "pb", ".", "execute", "(", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.syntax
Executes ``ansible-playbook`` against the converge playbook with the ``-syntax-check`` flag and returns None. :return: None
molecule/provisioner/ansible.py
def syntax(self): """ Executes ``ansible-playbook`` against the converge playbook with the ``-syntax-check`` flag and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.converge) pb.add_cli_arg('syntax-check', True) pb.execute(...
def syntax(self): """ Executes ``ansible-playbook`` against the converge playbook with the ``-syntax-check`` flag and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.converge) pb.add_cli_arg('syntax-check', True) pb.execute(...
[ "Executes", "ansible", "-", "playbook", "against", "the", "converge", "playbook", "with", "the", "-", "syntax", "-", "check", "flag", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L698-L707
[ "def", "syntax", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "converge", ")", "pb", ".", "add_cli_arg", "(", "'syntax-check'", ",", "True", ")", "pb", ".", "execute", "(", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.verify
Executes ``ansible-playbook`` against the verify playbook and returns None. :return: None
molecule/provisioner/ansible.py
def verify(self): """ Executes ``ansible-playbook`` against the verify playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.verify) pb.execute()
def verify(self): """ Executes ``ansible-playbook`` against the verify playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.verify) pb.execute()
[ "Executes", "ansible", "-", "playbook", "against", "the", "verify", "playbook", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L709-L717
[ "def", "verify", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "verify", ")", "pb", ".", "execute", "(", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.write_config
Writes the provisioner's config file to disk and returns None. :return: None
molecule/provisioner/ansible.py
def write_config(self): """ Writes the provisioner's config file to disk and returns None. :return: None """ template = util.render_template( self._get_config_template(), config_options=self.config_options) util.write_file(self.config_file, template)
def write_config(self): """ Writes the provisioner's config file to disk and returns None. :return: None """ template = util.render_template( self._get_config_template(), config_options=self.config_options) util.write_file(self.config_file, template)
[ "Writes", "the", "provisioner", "s", "config", "file", "to", "disk", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L719-L727
[ "def", "write_config", "(", "self", ")", ":", "template", "=", "util", ".", "render_template", "(", "self", ".", "_get_config_template", "(", ")", ",", "config_options", "=", "self", ".", "config_options", ")", "util", ".", "write_file", "(", "self", ".", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible.manage_inventory
Manages inventory for Ansible and returns None. :returns: None
molecule/provisioner/ansible.py
def manage_inventory(self): """ Manages inventory for Ansible and returns None. :returns: None """ self._write_inventory() self._remove_vars() if not self.links: self._add_or_update_vars() else: self._link_or_update_vars()
def manage_inventory(self): """ Manages inventory for Ansible and returns None. :returns: None """ self._write_inventory() self._remove_vars() if not self.links: self._add_or_update_vars() else: self._link_or_update_vars()
[ "Manages", "inventory", "for", "Ansible", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L729-L740
[ "def", "manage_inventory", "(", "self", ")", ":", "self", ".", "_write_inventory", "(", ")", "self", ".", "_remove_vars", "(", ")", "if", "not", "self", ".", "links", ":", "self", ".", "_add_or_update_vars", "(", ")", "else", ":", "self", ".", "_link_or_...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible._add_or_update_vars
Creates host and/or group vars and returns None. :returns: None
molecule/provisioner/ansible.py
def _add_or_update_vars(self): """ Creates host and/or group vars and returns None. :returns: None """ # Create the hosts extra inventory source (only if not empty) hosts_file = os.path.join(self.inventory_directory, 'hosts') if self.hosts: util.write...
def _add_or_update_vars(self): """ Creates host and/or group vars and returns None. :returns: None """ # Create the hosts extra inventory source (only if not empty) hosts_file = os.path.join(self.inventory_directory, 'hosts') if self.hosts: util.write...
[ "Creates", "host", "and", "/", "or", "group", "vars", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L746-L782
[ "def", "_add_or_update_vars", "(", "self", ")", ":", "# Create the hosts extra inventory source (only if not empty)", "hosts_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "inventory_directory", ",", "'hosts'", ")", "if", "self", ".", "hosts", ":", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible._write_inventory
Writes the provisioner's inventory file to disk and returns None. :return: None
molecule/provisioner/ansible.py
def _write_inventory(self): """ Writes the provisioner's inventory file to disk and returns None. :return: None """ self._verify_inventory() util.write_file(self.inventory_file, util.safe_dump(self.inventory))
def _write_inventory(self): """ Writes the provisioner's inventory file to disk and returns None. :return: None """ self._verify_inventory() util.write_file(self.inventory_file, util.safe_dump(self.inventory))
[ "Writes", "the", "provisioner", "s", "inventory", "file", "to", "disk", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L784-L792
[ "def", "_write_inventory", "(", "self", ")", ":", "self", ".", "_verify_inventory", "(", ")", "util", ".", "write_file", "(", "self", ".", "inventory_file", ",", "util", ".", "safe_dump", "(", "self", ".", "inventory", ")", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible._remove_vars
Remove hosts/host_vars/group_vars and returns None. :returns: None
molecule/provisioner/ansible.py
def _remove_vars(self): """ Remove hosts/host_vars/group_vars and returns None. :returns: None """ for name in ("hosts", "group_vars", "host_vars"): d = os.path.join(self.inventory_directory, name) if os.path.islink(d) or os.path.isfile(d): ...
def _remove_vars(self): """ Remove hosts/host_vars/group_vars and returns None. :returns: None """ for name in ("hosts", "group_vars", "host_vars"): d = os.path.join(self.inventory_directory, name) if os.path.islink(d) or os.path.isfile(d): ...
[ "Remove", "hosts", "/", "host_vars", "/", "group_vars", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L794-L805
[ "def", "_remove_vars", "(", "self", ")", ":", "for", "name", "in", "(", "\"hosts\"", ",", "\"group_vars\"", ",", "\"host_vars\"", ")", ":", "d", "=", "os", ".", "path", ".", "join", "(", "self", ".", "inventory_directory", ",", "name", ")", "if", "os",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible._link_or_update_vars
Creates or updates the symlink to group_vars and returns None. :returns: None
molecule/provisioner/ansible.py
def _link_or_update_vars(self): """ Creates or updates the symlink to group_vars and returns None. :returns: None """ for d, source in self.links.items(): target = os.path.join(self.inventory_directory, d) source = os.path.join(self._config.scenario.direc...
def _link_or_update_vars(self): """ Creates or updates the symlink to group_vars and returns None. :returns: None """ for d, source in self.links.items(): target = os.path.join(self.inventory_directory, d) source = os.path.join(self._config.scenario.direc...
[ "Creates", "or", "updates", "the", "symlink", "to", "group_vars", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L807-L822
[ "def", "_link_or_update_vars", "(", "self", ")", ":", "for", "d", ",", "source", "in", "self", ".", "links", ".", "items", "(", ")", ":", "target", "=", "os", ".", "path", ".", "join", "(", "self", ".", "inventory_directory", ",", "d", ")", "source",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Ansible._get_ansible_playbook
Get an instance of AnsiblePlaybook and returns it. :param playbook: A string containing an absolute path to a provisioner's playbook. :param kwargs: An optional keyword arguments. :return: object
molecule/provisioner/ansible.py
def _get_ansible_playbook(self, playbook, **kwargs): """ Get an instance of AnsiblePlaybook and returns it. :param playbook: A string containing an absolute path to a provisioner's playbook. :param kwargs: An optional keyword arguments. :return: object """ ...
def _get_ansible_playbook(self, playbook, **kwargs): """ Get an instance of AnsiblePlaybook and returns it. :param playbook: A string containing an absolute path to a provisioner's playbook. :param kwargs: An optional keyword arguments. :return: object """ ...
[ "Get", "an", "instance", "of", "AnsiblePlaybook", "and", "returns", "it", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L824-L834
[ "def", "_get_ansible_playbook", "(", "self", ",", "playbook", ",", "*", "*", "kwargs", ")", ":", "return", "ansible_playbook", ".", "AnsiblePlaybook", "(", "playbook", ",", "self", ".", "_config", ",", "*", "*", "kwargs", ")" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Yamllint._get_files
Walk the project directory for tests and returns a list. :return: list
molecule/lint/yamllint.py
def _get_files(self): """ Walk the project directory for tests and returns a list. :return: list """ excludes = [ '.git', '.tox', '.vagrant', '.venv', os.path.basename(self._config.verifier.directory), ] ...
def _get_files(self): """ Walk the project directory for tests and returns a list. :return: list """ excludes = [ '.git', '.tox', '.vagrant', '.venv', os.path.basename(self._config.verifier.directory), ] ...
[ "Walk", "the", "project", "directory", "for", "tests", "and", "returns", "a", "list", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/lint/yamllint.py#L143-L161
[ "def", "_get_files", "(", "self", ")", ":", "excludes", "=", "[", "'.git'", ",", "'.tox'", ",", "'.vagrant'", ",", "'.venv'", ",", "os", ".", "path", ".", "basename", "(", "self", ".", "_config", ".", "verifier", ".", "directory", ")", ",", "]", "gen...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Yamllint.bake
Bake a `yamllint` command so it's ready to execute and returns None. :return: None
molecule/verifier/lint/yamllint.py
def bake(self): """ Bake a `yamllint` command so it's ready to execute and returns None. :return: None """ self._yamllint_command = sh.yamllint.bake( self.options, self._tests, _env=self.env, _out=LOG.out, _err=LOG.erro...
def bake(self): """ Bake a `yamllint` command so it's ready to execute and returns None. :return: None """ self._yamllint_command = sh.yamllint.bake( self.options, self._tests, _env=self.env, _out=LOG.out, _err=LOG.erro...
[ "Bake", "a", "yamllint", "command", "so", "it", "s", "ready", "to", "execute", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/verifier/lint/yamllint.py#L96-L107
[ "def", "bake", "(", "self", ")", ":", "self", ".", "_yamllint_command", "=", "sh", ".", "yamllint", ".", "bake", "(", "self", ".", "options", ",", "self", ".", "_tests", ",", "_env", "=", "self", ".", "env", ",", "_out", "=", "LOG", ".", "out", "...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
str_if_nested_or_str
Turn input into a native string if possible.
setup.py
def str_if_nested_or_str(s): """Turn input into a native string if possible.""" if isinstance(s, ALL_STRING_TYPES): return str(s) if isinstance(s, (list, tuple)): return type(s)(map(str_if_nested_or_str, s)) if isinstance(s, (dict, )): return stringify_dict_contents(s) return...
def str_if_nested_or_str(s): """Turn input into a native string if possible.""" if isinstance(s, ALL_STRING_TYPES): return str(s) if isinstance(s, (list, tuple)): return type(s)(map(str_if_nested_or_str, s)) if isinstance(s, (dict, )): return stringify_dict_contents(s) return...
[ "Turn", "input", "into", "a", "native", "string", "if", "possible", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/setup.py#L46-L54
[ "def", "str_if_nested_or_str", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "ALL_STRING_TYPES", ")", ":", "return", "str", "(", "s", ")", "if", "isinstance", "(", "s", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "type", "(", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
stringify_dict_contents
Turn dict keys and values into native strings.
setup.py
def stringify_dict_contents(dct): """Turn dict keys and values into native strings.""" return { str_if_nested_or_str(k): str_if_nested_or_str(v) for k, v in dct.items() }
def stringify_dict_contents(dct): """Turn dict keys and values into native strings.""" return { str_if_nested_or_str(k): str_if_nested_or_str(v) for k, v in dct.items() }
[ "Turn", "dict", "keys", "and", "values", "into", "native", "strings", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/setup.py#L57-L62
[ "def", "stringify_dict_contents", "(", "dct", ")", ":", "return", "{", "str_if_nested_or_str", "(", "k", ")", ":", "str_if_nested_or_str", "(", "v", ")", "for", "k", ",", "v", "in", "dct", ".", "items", "(", ")", "}" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
create
Use the provisioner to start the instances.
molecule/command/create.py
def create(ctx, scenario_name, driver_name): # pragma: no cover """ Use the provisioner to start the instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, } base.execute_cmdli...
def create(ctx, scenario_name, driver_name): # pragma: no cover """ Use the provisioner to start the instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, } base.execute_cmdli...
[ "Use", "the", "provisioner", "to", "start", "the", "instances", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/create.py#L108-L117
[ "def", "create", "(", "ctx", ",", "scenario_name", ",", "driver_name", ")", ":", "# pragma: no cover", "args", "=", "ctx", ".", "obj", ".", "get", "(", "'args'", ")", "subcommand", "=", "base", ".", "_get_subcommand", "(", "__name__", ")", "command_args", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Create.execute
Execute the actions necessary to perform a `molecule create` and returns None. :return: None
molecule/command/create.py
def execute(self): """ Execute the actions necessary to perform a `molecule create` and returns None. :return: None """ self.print_info() self._config.state.change_state('driver', self._config.driver.name) if self._config.driver.delegated and not self._c...
def execute(self): """ Execute the actions necessary to perform a `molecule create` and returns None. :return: None """ self.print_info() self._config.state.change_state('driver', self._config.driver.name) if self._config.driver.delegated and not self._c...
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "create", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/create.py#L70-L92
[ "def", "execute", "(", "self", ")", ":", "self", ".", "print_info", "(", ")", "self", ".", "_config", ".", "state", ".", "change_state", "(", "'driver'", ",", "self", ".", "_config", ".", "driver", ".", "name", ")", "if", "self", ".", "_config", ".",...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
template
Initialize a new role from a Cookiecutter URL.
molecule/command/init/template.py
def template(ctx, url, no_input, role_name): # pragma: no cover """ Initialize a new role from a Cookiecutter URL. """ command_args = { 'role_name': role_name, 'subcommand': __name__, 'url': url, 'no_input': no_input, } t = Template(command_args) t.execute()
def template(ctx, url, no_input, role_name): # pragma: no cover """ Initialize a new role from a Cookiecutter URL. """ command_args = { 'role_name': role_name, 'subcommand': __name__, 'url': url, 'no_input': no_input, } t = Template(command_args) t.execute()
[ "Initialize", "a", "new", "role", "from", "a", "Cookiecutter", "URL", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/init/template.py#L93-L103
[ "def", "template", "(", "ctx", ",", "url", ",", "no_input", ",", "role_name", ")", ":", "# pragma: no cover", "command_args", "=", "{", "'role_name'", ":", "role_name", ",", "'subcommand'", ":", "__name__", ",", "'url'", ":", "url", ",", "'no_input'", ":", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Template.execute
Execute the actions necessary to perform a `molecule init template` and returns None. :return: None
molecule/command/init/template.py
def execute(self): """ Execute the actions necessary to perform a `molecule init template` and returns None. :return: None """ role_name = self._command_args['role_name'] url = self._command_args['url'] no_input = self._command_args['no_input'] r...
def execute(self): """ Execute the actions necessary to perform a `molecule init template` and returns None. :return: None """ role_name = self._command_args['role_name'] url = self._command_args['url'] no_input = self._command_args['no_input'] r...
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "init", "template", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/init/template.py#L46-L74
[ "def", "execute", "(", "self", ")", ":", "role_name", "=", "self", ".", "_command_args", "[", "'role_name'", "]", "url", "=", "self", ".", "_command_args", "[", "'url'", "]", "no_input", "=", "self", ".", "_command_args", "[", "'no_input'", "]", "role_dire...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Prepare.execute
Execute the actions necessary to prepare the instances and returns None. :return: None
molecule/command/prepare.py
def execute(self): """ Execute the actions necessary to prepare the instances and returns None. :return: None """ self.print_info() if (self._config.state.prepared and not self._config.command_args.get('force')): msg = 'Skipping, inst...
def execute(self): """ Execute the actions necessary to prepare the instances and returns None. :return: None """ self.print_info() if (self._config.state.prepared and not self._config.command_args.get('force')): msg = 'Skipping, inst...
[ "Execute", "the", "actions", "necessary", "to", "prepare", "the", "instances", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/prepare.py#L82-L103
[ "def", "execute", "(", "self", ")", ":", "self", ".", "print_info", "(", ")", "if", "(", "self", ".", "_config", ".", "state", ".", "prepared", "and", "not", "self", ".", "_config", ".", "command_args", ".", "get", "(", "'force'", ")", ")", ":", "m...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
State.change_state
Changes the state of the instance data with the given ``key`` and the provided ``value``. Wrapping with a decorator is probably not necessary. :param key: A ``str`` containing the key to update :param value: A value to change the ``key`` to :return: None
molecule/state.py
def change_state(self, key, value): """ Changes the state of the instance data with the given ``key`` and the provided ``value``. Wrapping with a decorator is probably not necessary. :param key: A ``str`` containing the key to update :param value: A value to change the ...
def change_state(self, key, value): """ Changes the state of the instance data with the given ``key`` and the provided ``value``. Wrapping with a decorator is probably not necessary. :param key: A ``str`` containing the key to update :param value: A value to change the ...
[ "Changes", "the", "state", "of", "the", "instance", "data", "with", "the", "given", "key", "and", "the", "provided", "value", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/state.py#L109-L122
[ "def", "change_state", "(", "self", ",", "key", ",", "value", ")", ":", "if", "key", "not", "in", "VALID_KEYS", ":", "raise", "InvalidState", "self", ".", "_data", "[", "key", "]", "=", "value" ]
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Shell.bake
Bake a ``shell`` command so it's ready to execute and returns None. :return: None
molecule/dependency/shell.py
def bake(self): """ Bake a ``shell`` command so it's ready to execute and returns None. :return: None """ command_list = self.command.split(' ') command, args = command_list[0], command_list[1:] self._sh_command = getattr(sh, command) # Reconstruct comma...
def bake(self): """ Bake a ``shell`` command so it's ready to execute and returns None. :return: None """ command_list = self.command.split(' ') command, args = command_list[0], command_list[1:] self._sh_command = getattr(sh, command) # Reconstruct comma...
[ "Bake", "a", "shell", "command", "so", "it", "s", "ready", "to", "execute", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/dependency/shell.py#L90-L102
[ "def", "bake", "(", "self", ")", ":", "command_list", "=", "self", ".", "command", ".", "split", "(", "' '", ")", "command", ",", "args", "=", "command_list", "[", "0", "]", ",", "command_list", "[", "1", ":", "]", "self", ".", "_sh_command", "=", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
RuboCop.bake
Bake a `rubocop` command so it's ready to execute and returns None. :return: None
molecule/verifier/lint/rubocop.py
def bake(self): """ Bake a `rubocop` command so it's ready to execute and returns None. :return: None """ self._rubocop_command = sh.rubocop.bake( self.options, self._tests, _env=self.env, _out=LOG.out, _err=LOG.error)
def bake(self): """ Bake a `rubocop` command so it's ready to execute and returns None. :return: None """ self._rubocop_command = sh.rubocop.bake( self.options, self._tests, _env=self.env, _out=LOG.out, _err=LOG.error)
[ "Bake", "a", "rubocop", "command", "so", "it", "s", "ready", "to", "execute", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/verifier/lint/rubocop.py#L98-L109
[ "def", "bake", "(", "self", ")", ":", "self", ".", "_rubocop_command", "=", "sh", ".", "rubocop", ".", "bake", "(", "self", ".", "options", ",", "self", ".", "_tests", ",", "_env", "=", "self", ".", "env", ",", "_out", "=", "LOG", ".", "out", ","...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Destroy.execute
Execute the actions necessary to perform a `molecule destroy` and returns None. :return: None
molecule/command/destroy.py
def execute(self): """ Execute the actions necessary to perform a `molecule destroy` and returns None. :return: None """ self.print_info() if self._config.command_args.get('destroy') == 'never': msg = "Skipping, '--destroy=never' requested." ...
def execute(self): """ Execute the actions necessary to perform a `molecule destroy` and returns None. :return: None """ self.print_info() if self._config.command_args.get('destroy') == 'never': msg = "Skipping, '--destroy=never' requested." ...
[ "Execute", "the", "actions", "necessary", "to", "perform", "a", "molecule", "destroy", "and", "returns", "None", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/destroy.py#L76-L96
[ "def", "execute", "(", "self", ")", ":", "self", ".", "print_info", "(", ")", "if", "self", ".", "_config", ".", "command_args", ".", "get", "(", "'destroy'", ")", "==", "'never'", ":", "msg", "=", "\"Skipping, '--destroy=never' requested.\"", "LOG", ".", ...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
main
\b _____ _ _ | |___| |___ ___ _ _| |___ | | | | . | | -_| _| | | | -_| |_|_|_|___|_|___|___|___|_|___| Molecule aids in the development and testing of Ansible roles. Enable autocomplete issue: eval "$(_MOLECULE_COMPLETE=source molecule)"
molecule/shell.py
def main(ctx, debug, base_config, env_file): # pragma: no cover """ \b _____ _ _ | |___| |___ ___ _ _| |___ | | | | . | | -_| _| | | | -_| |_|_|_|___|_|___|___|___|_|___| Molecule aids in the development and testing of Ansible roles. Enable autocomplete issue: ...
def main(ctx, debug, base_config, env_file): # pragma: no cover """ \b _____ _ _ | |___| |___ ___ _ _| |___ | | | | . | | -_| _| | | | -_| |_|_|_|___|_|___|___|___|_|___| Molecule aids in the development and testing of Ansible roles. Enable autocomplete issue: ...
[ "\\", "b", "_____", "_", "_", "|", "|___|", "|___", "___", "_", "_|", "|___", "|", "|", "|", "|", ".", "|", "|", "-", "_|", "_|", "|", "|", "|", "-", "_|", "|_|_|_|___|_|___|___|___|_|___|" ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/shell.py#L59-L77
[ "def", "main", "(", "ctx", ",", "debug", ",", "base_config", ",", "env_file", ")", ":", "# pragma: no cover", "ctx", ".", "obj", "=", "{", "}", "ctx", ".", "obj", "[", "'args'", "]", "=", "{", "}", "ctx", ".", "obj", "[", "'args'", "]", "[", "'de...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
from_yaml
Interpolate the provided data and return a dict. Currently, this is used to reinterpolate the `molecule.yml` inside an Ansible playbook. If there were any interpolation errors, they would have been found and raised earlier. :return: dict
molecule/provisioner/ansible/plugins/filters/molecule_core.py
def from_yaml(data): """ Interpolate the provided data and return a dict. Currently, this is used to reinterpolate the `molecule.yml` inside an Ansible playbook. If there were any interpolation errors, they would have been found and raised earlier. :return: dict """ molecule_env_file ...
def from_yaml(data): """ Interpolate the provided data and return a dict. Currently, this is used to reinterpolate the `molecule.yml` inside an Ansible playbook. If there were any interpolation errors, they would have been found and raised earlier. :return: dict """ molecule_env_file ...
[ "Interpolate", "the", "provided", "data", "and", "return", "a", "dict", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible/plugins/filters/molecule_core.py#L28-L46
[ "def", "from_yaml", "(", "data", ")", ":", "molecule_env_file", "=", "os", ".", "environ", "[", "'MOLECULE_ENV_FILE'", "]", "env", "=", "os", ".", "environ", ".", "copy", "(", ")", "env", "=", "config", ".", "set_env_from_file", "(", "env", ",", "molecul...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
matrix
List matrix of steps used to test instances.
molecule/command/matrix.py
def matrix(ctx, scenario_name, subcommand): # pragma: no cover """ List matrix of steps used to test instances. """ args = ctx.obj.get('args') command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.p...
def matrix(ctx, scenario_name, subcommand): # pragma: no cover """ List matrix of steps used to test instances. """ args = ctx.obj.get('args') command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.p...
[ "List", "matrix", "of", "steps", "used", "to", "test", "instances", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/matrix.py#L71-L83
[ "def", "matrix", "(", "ctx", ",", "scenario_name", ",", "subcommand", ")", ":", "# pragma: no cover", "args", "=", "ctx", ".", "obj", ".", "get", "(", "'args'", ")", "command_args", "=", "{", "'subcommand'", ":", "subcommand", ",", "}", "s", "=", "scenar...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c
train
Base._process_templates
Process templates as found in the named directory. :param template_dir: A string containing an absolute or relative path to a directory where the templates are located. If the provided directory is a relative path, it is resolved using a known location. :param extra_context: A dict of...
molecule/command/init/base.py
def _process_templates(self, template_dir, extra_context, output_dir, overwrite=True): """ Process templates as found in the named directory. :param template_dir: A string containing an a...
def _process_templates(self, template_dir, extra_context, output_dir, overwrite=True): """ Process templates as found in the named directory. :param template_dir: A string containing an a...
[ "Process", "templates", "as", "found", "in", "the", "named", "directory", "." ]
ansible/molecule
python
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/command/init/base.py#L36-L69
[ "def", "_process_templates", "(", "self", ",", "template_dir", ",", "extra_context", ",", "output_dir", ",", "overwrite", "=", "True", ")", ":", "template_dir", "=", "self", ".", "_resolve_template_dir", "(", "template_dir", ")", "self", ".", "_validate_template_d...
766dc35b0b0ce498cd5e3a62b40f828742d0d08c