Build an assignment statement
776513
def Assign(target, source):
    """"""
    if not isinstance(target, list):
        target = [target]
    if not isinstance(source, list):
        source.prefix = u" "
        source = [source]

    return Node(syms.atom,
                target + [Leaf(token.EQUAL, u"=", prefix=u" ")] + source)
392333
def _process_assignments(self, anexec, contents, mode="insert"):
        
        for assign in self.RE_ASSIGN.finditer(contents):
            assignee = assign.group("assignee").strip()
            target = re.split(r"[(%\s]", assignee)[0].lower()

            #We only want to include variables that we know are in the scope of the
            #current executable. This excludes function calls etc. with optional params.
            if target in self._intrinsic:
                continue

            if target in anexec.members or \
               target in anexec.parameters or \
               (isinstance(anexec, Function) and target.lower() == anexec.name.lower()):
                if mode == "insert":
                    anexec.add_assignment(re.split(r"[(\s]", assignee)[0])
                elif mode == "delete":
                    #Remove the first instance of this assignment from the list
                    try:
                        index = element.assignments.index(assign)
                        del element.assignments[index]
                    except ValueError:
                        #We didn't have anything to remove, but python
                        pass
1134153
function _assign (target, source) {
  var s, from, key;
  var to = Object(target);
  for (s = 1; s < arguments.length; s++) {
    from = Object(arguments[s]);
    for (key in from) {
      if (own(from, key)) {
        to[key] = from[key];
      }
    }
  }
  return to
}
206893
def parse_assignment(self, stream):
        
        lineno = stream.lineno
        name = self.next_token(stream)
        self.ensure_assignment(stream)
        at_an_end = any((
            self.has_end_group(stream),
            self.has_end_object(stream),
            self.has_end(stream),
            self.has_next(self.statement_delimiter, stream, 0)))
        if at_an_end:
            value = self.broken_assignment(lineno)
            self.skip_whitespace_or_comment(stream)
        else:
            value = self.parse_value(stream)
        self.skip_statement_delimiter(stream)
        return name.decode('utf-8'), value
1230448
def p_arr_assignment(p):
    
    i = 2 if p[1].upper() == 'LET' else 1
    id_ = p[i]
    arg_list = p[i + 1]
    expr = p[i + 3]

    p[0] = None
    if arg_list is None or expr is None:
        return  # There were errors

    entry = SYMBOL_TABLE.access_call(id_, p.lineno(i))
    if entry is None:
        return

    if entry.type_ == TYPE.string:
        variable = gl.SYMBOL_TABLE.access_array(id_, p.lineno(i))
        if len(variable.bounds) + 1 == len(arg_list):
            ss = arg_list.children.pop().value
            p[0] = make_array_substr_assign(p.lineno(i), id_, arg_list, (ss, ss), expr)
            return

    arr = make_array_access(id_, p.lineno(i), arg_list)
    if arr is None:
        return

    expr = make_typecast(arr.type_, expr, p.lineno(i))
    if entry is None:
        return

    p[0] = make_sentence('LETARRAY', arr, expr)
1341055
def visit_Assign(self, node):
    

    # Generate tangent name of the assignment
    self.target = node.targets[0]
    self.value = node.value

    # Get the tangent node
    tangent_node = self.visit(self.value)

    # If no forward-mode statement was created, then no extra work is needed.
    if tangent_node == self.value:
      self.target = None
      return node

    if self.value:
      new_node = template.replace(
          tangents.tangents[gast.Assign],
          replace_grad=template.Replace.TANGENT,
          namer=self.namer,
          temp=self.tmp_node,
          tangent=tangent_node,
          target=self.target,
          value=self.value)
      # Ensure that we use a unique tmp node per primal/tangent pair
      self.reset_tmp_node()
    else:
      # We're already in ANF form right now,
      # so we can assume LHS is a single Name "z"
      def template_(z, f):
        tmp = f
        d[z] = tmp[0]
        z = tmp[1]

      new_node = template.replace(
          template_,
          replace_grad=template.Replace.TANGENT,
          namer=self.namer,
          z=self.target,
          f=tangent_node[0])

    # Add it after the original statement
    self.target = None

    # Add in some cool comments
    for i in range(len(new_node)):
      new_node[i] = comments.add_comment(new_node[i], 'Primal and tangent of: '
                                         '%s' % quoting.unquote(node))
    return new_node
614807
def _assign(self, values):
        
        LOGGER.debug('Assigning values: %r', values)
        if not values:
            return
        keys = self.keys()
        if not self._ref:
            keys.append('_ref')
        if isinstance(values, dict):
            for key in keys:
                if values.get(key):
                    if isinstance(values.get(key), list):
                        items = list()
                        for item in values[key]:
                            if isinstance(item, dict):
                                if '_ref' in item:
                                    obj_class = get_class(item['_ref'])
                                    if obj_class:
                                        items.append(obj_class(self._session,
                                                               **item))
                            else:
                                items.append(item)
                        setattr(self, key, items)
                    else:
                        setattr(self, key, values[key])
        elif isinstance(values, list):
            self._assign(values[0])
        else:
            LOGGER.critical('Unhandled return type: %r', values)
1336027
def visit_Assign(self, node):
        """"""
        line = self._code_lines[node.lineno - 1]
        if SIG_COMMENT in line:
            line = _RE_COMMENT_IN_STRING.sub("", line)

        if (SIG_COMMENT not in line) and (not self.generic):
            return

        if SIG_COMMENT in line:
            _, signature = line.split(SIG_COMMENT)
            _, return_type, requires = parse_signature(signature)
            self.required_types |= requires

        parent = self._parents[-1]
        for var in node.targets:
            if isinstance(var, ast.Name):
                name, p = var.id, parent
            elif (
                isinstance(var, ast.Attribute)
                and isinstance(var.value, ast.Name)
                and (var.value.id == "self")
            ):
                name, p = var.attr, parent.parent
            else:
                name, p = None, None

            if name is not None:
                if self.generic:
                    return_type = "Any"
                    self.required_types.add(return_type)
                stub_node = VariableNode(name, return_type)
                p.add_variable(stub_node)
1033966
def p_Statement(p):
    '''
    
    '''
    if len(p) < 3:
        term = Terminator('')
    else:
        term = p[2]
    p[0] = Statement(p[1], term)
637387
def _assignrepr_bracketed2(assignrepr_bracketed1, values, prefix, width=None):
    """"""
    brackets = getattr(assignrepr_bracketed1, '_brackets')
    prefix += brackets[0]
    lines = []
    blanks = ' '*len(prefix)
    for (idx, subvalues) in enumerate(values):
        if idx == 0:
            lines.append(assignrepr_bracketed1(subvalues, prefix, width))
        else:
            lines.append(assignrepr_bracketed1(subvalues, blanks, width))
        lines[-1] += ','
    if (len(values) > 1) or (brackets != '()'):
        lines[-1] = lines[-1][:-1]
    lines[-1] += brackets[1]
    return '\n'.join(lines)
1235222
def append_condition(statement, condition, key, value):
    
    if isinstance(statement, list):
        statement.append({condition: {key: value}})
    if isinstance(statement, dict):
        statement[condition] = {key: value}
1303699
def p_expr_assign(p):
    ''''''
    if len(p) == 5:
        p[0] = ast.Assignment(p[1], p[4], True, lineno=p.lineno(2))
    else:
        p[0] = ast.Assignment(p[1], p[3], False, lineno=p.lineno(2))
91609
function collectAssignmentsInto(
  assignments: Array<{path: Array<string | number>, value: mixed}>,
  parentPath: Array<string | number>,
  parentValue: Object,
): void {
  // Iterate over the entries in the array or object.
  forEach(parentValue, (value, key) => {
    // The "path" is the sequence of keys to arrive at this assignment.
    const path = parentPath.concat(key);
    // For each entry, either add an assignment or recurse.
    if (typeof value === 'object' && value !== null) {
      collectAssignmentsInto(assignments, path, value);
    } else {
      assignments.push({path, value});
    }
  });
}
302155
def build(self, stmts=None, set_check_var=True, invert=False):
        """"""
        out = ""
        if set_check_var:
            out += self.check_var + " = False\n"
        out += self.out()
        if stmts is not None:
            out += "if " + ("not " if invert else "") + self.check_var + ":" + "\n" + openindent + "".join(stmts) + closeindent
        return out
153337
private void compileAssignment(Sequence sequence, TokenList tokens, TokenList.Token t0) {
        // see if it is assign or a range
        List<Variable> range = parseAssignRange(sequence, tokens, t0);

        TokenList.Token t1 = t0.next;
        if (t1.getType() != Type.SYMBOL || t1.getSymbol() != Symbol.ASSIGN)
            throw new ParseError("Expected assignment operator next");

        // Parse the right side of the equation
        TokenList tokensRight = tokens.extractSubList(t1.next, tokens.last);
        compileTokens(sequence, tokensRight);
        if (tokensRight.getLast().getType() != Type.VARIABLE)
            throw new RuntimeException("BUG the last token must be a variable");

        // copy the results into the output
        Variable variableRight = tokensRight.getFirst().getVariable();
        if (range == null) {
            // no range, so copy results into the entire output matrix
            sequence.output = createVariableInferred(t0, variableRight);
            sequence.addOperation(Operation.copy(variableRight, sequence.output));
        } else {
            // a sub-matrix range is specified.  Copy into that inner part
            if (t0.getType() == Type.WORD) {
                throw new ParseError("Can't do lazy variable initialization with submatrices. " + t0.getWord());
            }
            sequence.addOperation(Operation.copy(variableRight, t0.getVariable(), range));
        }
    }
400083
def add(self, statement, parameters=None):
        
        if isinstance(statement, six.string_types):
            if parameters:
                encoder = Encoder() if self._session is None else self._session.encoder
                statement = bind_params(statement, parameters, encoder)
            self._add_statement_and_params(False, statement, ())
        elif isinstance(statement, PreparedStatement):
            query_id = statement.query_id
            bound_statement = statement.bind(() if parameters is None else parameters)
            self._update_state(bound_statement)
            self._add_statement_and_params(True, query_id, bound_statement.values)
        elif isinstance(statement, BoundStatement):
            if parameters:
                raise ValueError(
                    "Parameters cannot be passed with a BoundStatement "
                    "to BatchStatement.add()")
            self._update_state(statement)
            self._add_statement_and_params(True, statement.prepared_statement.query_id, statement.values)
        else:
            # it must be a SimpleStatement
            query_string = statement.query_string
            if parameters:
                encoder = Encoder() if self._session is None else self._session.encoder
                query_string = bind_params(query_string, parameters, encoder)
            self._update_state(statement)
            self._add_statement_and_params(False, query_string, ())
        return self
1169260
def statement(self):
        
        return (self.assignment ^ self.expression) + Suppress(
            self.syntax.terminator)