Update the text tuple at `x` and `y` with the given `s` and `d`
3513
def _update_texttuple(self, x, y, s, cs, d):
        """"""
        pos = (x, y, cs)
        for i, (old_x, old_y, old_s, old_cs, old_d) in enumerate(self.value):
            if (old_x, old_y, old_cs) == pos:
                self.value[i] = (old_x, old_y, s, old_cs, d)
                return
        raise ValueError("No text tuple found at {0}!".format(pos))
278239
def substitute(ctx, text, old_text, new_text, instance_num=-1):
    
    text = conversions.to_string(text, ctx)
    old_text = conversions.to_string(old_text, ctx)
    new_text = conversions.to_string(new_text, ctx)

    if instance_num < 0:
        return text.replace(old_text, new_text)
    else:
        splits = text.split(old_text)
        output = splits[0]
        instance = 1
        for split in splits[1:]:
            sep = new_text if instance == instance_num else old_text
            output += sep + split
            instance += 1
        return output
853552
def _update_expression(self):
        ''''''
        self._expression = re.compile(
            '^{0}(?P<index>(?P<padding>0*)\d+?){1}$'
            .format(re.escape(self.head), re.escape(self.tail))
        )
539308
def multiple_replace(d: Dict[str, str], text: str) -> str:
    
  # Create a regular expression from all of the dictionary keys
    regex = re.compile("|".join(map(re.escape, d.keys())))

  # For each match, look up the corresponding value in the dictionary
    return regex.sub(lambda match: d[match.group(0)], text)
1241907
public void moveText(float x, float y) {
        state.xTLM += x;
        state.yTLM += y;
        content.append(x).append(' ').append(y).append(" Td").append_i(separator);
    }
186897
def merge_x_y(collection_x, collection_y, filter_none=False):
    
    data = {}
    for item in collection_x:
        #print item[0:-1]
        #print item[-1]
        label = datetimeutil.tuple_to_string(item[0:-1])
        if filter_none and label == 'None-None':
            continue
        data[label] = {'label': label, 'x': item[-1], 'y': 0}
    for item in collection_y:
        #print item
        label = datetimeutil.tuple_to_string(item[0:-1])
        if filter_none and label == 'None-None':
            continue
        try:
            data[label]['y'] = item[-1]
        except KeyError:
            data[label] = {'label': label, 'x': 0, 'y': item[-1]}

    # Keys are not sorted
    return data
1248813
def flatten(d, sep='.'):
    """"""

    def _flatten(e, parent_key='', sep='.'):
        import collections

        prefix = parent_key + sep if parent_key else ''

        if isinstance(e, collections.MutableMapping):
            return tuple((prefix + k2, v2) for k, v in e.items() for k2, v2 in _flatten(v, k, sep))
        elif isinstance(e, collections.MutableSequence):
            return tuple((prefix + k2, v2) for i, v in enumerate(e) for k2, v2 in _flatten(v, str(i), sep))
        else:
            return (parent_key, (e,)),

    return tuple((k, v[0]) for k, v in _flatten(d, '', sep))
658036
void update()
    {
        mx = x - oldX;
        my = y - oldY;
        oldX = x;
        oldY = y;
    }
1249515
def insert(self, s):
        '''
        
        '''
        for c in s:
            self.text.insert(self.cursor_loc, c)
            self.cursor_loc += 1
983751
def visit_Tuple(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        elems = (self.visit(elt) for elt in node.elts)
        return f"({', '.join(elems)}{')' if len(node.elts) != 1 else ',)'}"
1060357
function update(t) {
    var p, idx;

    if (res.length < num) {
      res.push(t);
    } else {
      idx = ~~((cnt + 1) * random());
      if (idx < res.length && idx >= cap) {
        p = res[idx];
        if (map[tupleid(p)]) out.rem.push(p); // eviction
        res[idx] = t;
      }
    }
    ++cnt;
  }
972555
def _merge_two_dicts(x, y):
    
    z = x.copy()
    z.update(y)
    return z
1097511
def _remove_texttuple(self, pos):
        """"""
        for i, (old_x, old_y, s, old_cs, d) in enumerate(self.value):
            if (old_x, old_y, old_cs) == pos:
                self.value.pop(i)
                return
        raise ValueError("{0} not found!".format(pos))
542488
def update(self, E=None, **F):
        
        if E is not None:
            if hasattr(E, 'keys'):
                for K in E:
                    self.replace(K, E[K])
            elif hasattr(E, 'items'):
                for K, V in E.items():
                    self.replace(K, V)
            else:
                for K, V in E:
                    self.replace(K, V)
        for K in F:
            self.replace(K, F[K])
1107230
def update(self, other, **kwargs):
        """"""
        from itertools import chain
        if hasattr(other, 'items'):
            other = other.items()
        for (k, v) in chain(other, kwargs.items()):
            if (
                    k not in self or
                    self[k] != v
            ):
                self[k] = v
214032
def pgettext(self, context, string, domain=None, **variables):
        """"""
        t = self.get_translations(domain)
        return t.upgettext(context, string) % variables
326947
function mult(x, y) {
  var ans=expand(x, x.length+y.length);
  mult_(ans, y);
  return trim(ans, 1);
}