Adds noise to an individual operation.

        Args:
            operation: The operation to make noisy.

        Returns:
            An OP_TREE corresponding to the noisy operations implementing the
            noisy version of the given operation.
774298
def noisy_operation(self, operation: 'cirq.Operation') -> 'cirq.OP_TREE':
        
        if not hasattr(self.noisy_moments, '_not_overridden'):
            return self.noisy_moments([ops.Moment([operation])],
                                      operation.qubits)

        if not hasattr(self.noisy_moment, '_not_overridden'):
            return self.noisy_moment(ops.Moment([operation]), operation.qubits)

        assert False, 'Should be unreachable.'
199283
def build_operation(operation, ns, rule, func):
    
    swagger_operation = swagger.Operation(
        operationId=operation_name(operation, ns),
        parameters=swagger.ParametersList([
        ]),
        responses=swagger.Responses(),
        tags=[ns.subject_name],
    )

    # custom header parameter
    swagger_operation.parameters.append(
        header_param("X-Response-Skip-Null")
    )

    # path parameters
    swagger_operation.parameters.extend([
        path_param(argument, ns)
        for argument in rule.arguments
    ])

    # query string parameters
    qs_schema = get_qs_schema(func)
    if qs_schema:
        swagger_operation.parameters.extend([
            query_param(name, field)
            for name, field in qs_schema.fields.items()
        ])

    # body parameter
    request_schema = get_request_schema(func)
    if request_schema:
        swagger_operation.parameters.append(
            body_param(request_schema)
        )

    # sort parameters for predictable output
    swagger_operation.parameters.sort(key=lambda parameter: parameter["name"])

    add_responses(swagger_operation, operation, ns, func)
    return swagger_operation
1242626
public void addOperation(GetOperation o) {
    getKeys().addAll(o.getKeys());
    pcb.addCallbacks(o);
  }
1149439
def operation_helper(
        self, path=None, operations=None, methods=None, func=None, **kwargs
    ):
        
        for method in methods:
            yaml_doc_string = yaml_utils.load_operations_from_docstring(func.__doc__)
            yaml_doc_string = yaml.safe_load(
                str(yaml_doc_string).replace(
                    "{{self.__class__.__name__}}", self.__class__.__name__
                )
            )
            if yaml_doc_string:
                operations[method.lower()] = yaml_doc_string.get(method.lower(), {})
            else:
                operations[method.lower()] = {}
655090
def perform_patch(cls, operations, obj, state=None):
        
        if state is None:
            state = {}
        for operation in operations:
            if not cls._process_patch_operation(operation, obj=obj, state=state):
                log.info(
                    "%s patching has been stopped because of unknown operation %s",
                    obj.__class__.__name__,
                    operation
                )
                raise ValidationError(
                    "Failed to update %s details. Operation %s could not succeed." % (
                        obj.__class__.__name__,
                        operation
                    )
                )
        return True
107482
def annotate_op(self, op):
        

        if isinstance(op, Label):
            return op
        else:
            return AnnotatedOp(self, op.name, op.arg)
1371437
def count_operations(elements: Iterable[Operation]) \
        -> Dict[Type[Operation], int]:
    
    op_count: Dict[Type[Operation], int] = defaultdict(int)
    for elem in elements:
        op_count[type(elem)] += 1
    return dict(op_count)
1020945
def to_op(self):
        
        if not self._adds:
            return None
        changes = {}
        if self._adds:
            changes['adds'] = list(self._adds)
        return changes
172791
def build_operation_chain(stack)
      empty_op = EmptyOperation.new(nil)

      stack.reverse.reduce(empty_op) do |next_op, current_op|
        klass, args, block = current_op

        if Class === klass
          klass.new(next_op, *args, &block)
        elsif Proc === klass
          lambda do |env|
            next_op.call(klass.call(env, *args))
          end
        else
          raise StandardError, "Invalid operation, doesn't respond to `call`: #{klass.inspect}"
        end
      end
    end
1093944
@Override
    public void planOperation(Runnable operation) {
        operations.add(operation);

        if (operation instanceof AbstractOperation) {
            ExecutionEntity execution = ((AbstractOperation) operation).getExecution();
            if (execution != null) {
                commandContext.addInvolvedExecution(execution);
            }
        }

        logger.debug("Operation {} added to agenda", operation.getClass());
    }
1129748
private void addOp(String op, String path, String value) {
        if (this.operations == null) {
            this.operations = new JsonArray();
        }

        this.operations.add(new JsonObject()
                .add("op", op)
                .add("path", path)
                .add("value", value));
    }
494397
def make_task(operator: str, task_params: Dict[str, Any]) -> BaseOperator:
        
        try:
            # class is a Callable https://stackoverflow.com/a/34578836/3679900
            operator_obj: Callable[..., BaseOperator] = import_string(operator)
        except Exception as e:
            raise Exception(f"Failed to import operator: {operator}. err: {e}")
        try:
            task: BaseOperator = operator_obj(**task_params)
        except Exception as e:
            raise Exception(f"Failed to create {operator_obj} task. err: {e}")
        return task
1222940
def noise_op(latents, hparams):
  
  if hparams.latent_noise == 0 or hparams.mode != tf.estimator.ModeKeys.TRAIN:
    return latents
  latent_shape = common_layers.shape_list(latents)
  return latents + tf.random_normal(latent_shape, stddev=hparams.latent_noise)
66643
def _get_op_handler(operation):
        
        try:
            mod_to_import, attr_path = operation.split('#')
            op = import_module(mod_to_import)
            for part in attr_path.split('.'):
                op = getattr(op, part)
            if isinstance(op, types.FunctionType):
                return op
            return six.get_method_function(op)
        except (ValueError, AttributeError):
            raise ValueError("The operation '{}' is invalid.".format(operation))
165423
public void setOperations(java.util.Collection<String> operations) {
        if (operations == null) {
            this.operations = null;
            return;
        }

        this.operations = new com.amazonaws.internal.SdkInternalList<String>(operations);
    }
388035
public static ModelNode createOperation(final String operation) {
        final ModelNode op = new ModelNode();
        op.get(OP).set(operation);
        op.get(OP_ADDR).setEmptyList();
        return op;
    }
334751
function() {
                var m, a, op, operation;
                m = $(this.operand);
                if (m) {
                    while ((op = ($('/') || $('*') || $('%'))) && (a = $(this.operand))) {
                        operation = new tree.Operation(op, [operation || m, a], memo, env.filename);
                    }
                    return operation || m;
                }
            }