Get a tick, tock time pair.

        Args:
            vals (list): A pair of values to norm.

        Returns:
            (int, int): A ordered pair of integers.
765932
def getTickTock(self, vals):
        '''
        
        '''
        val0, val1 = vals

        try:
            _tick = self._getLiftValu(val0)
        except ValueError as e:
            raise s_exc.BadTypeValu(name=self.name, valu=val0,
                                    mesg='Unable to process the value for val0 in getTickTock.')

        sortval = False
        if isinstance(val1, str):
            if val1.startswith(('+-', '-+')):
                sortval = True
                delt = s_time.delta(val1[2:])
                # order matters
                _tock = _tick + delt
                _tick = _tick - delt
            elif val1.startswith('-'):
                sortval = True
                _tock = self._getLiftValu(val1, relto=_tick)
            else:
                _tock = self._getLiftValu(val1, relto=_tick)
        else:
            _tock = self._getLiftValu(val1, relto=_tick)

        if sortval and _tick >= _tock:
            tick = min(_tick, _tock)
            tock = max(_tick, _tock)
            return tick, tock

        return _tick, _tock
1301257
def Qk(self, k):
        
        return self.Q[:, :, self.index[self.Q_time_var_index, k]]
1274979
def value(self):
        
        with self.lock:
            now = time.time()
            dt = now - self.t0
            self.t0 = now
            self.p = self.p * (math.pow(self.e, self.r * dt))
            return self.p
584272
def labels_ticks_and_vals(self):
        """"""
        y_ticks = defaultdict(list)
        for y, label, _, vals, color in self.iterator():
            y_ticks[label].append((y, vals, color))
        labels, ticks, vals, colors = [], [], [], []
        for label, data in y_ticks.items():
            labels.append(label)
            ticks.append(np.mean([j[0] for j in data]))
            vals.append(np.vstack([j[1] for j in data]))
            colors.append(data[0][2])  # the colors are all the same
        return labels, ticks, vals, colors
135126
def to_seconds(value, time_unit):
        
        if isinstance(value, bool):
            # bool is a subclass of int. Don't let bool and float multiplication.
            raise TypeError
        return float(value) * time_unit
42822
def field_timedelta_from_json(self, json_val):
        
        if isinstance(json_val, str):
            return timedelta(seconds=float(json_val))
        elif json_val is None:
            return None
        else:
            return timedelta(seconds=json_val)
960620
def indxByRange(self, valu):
        '''
        
        '''

        if not isinstance(valu, (list, tuple)):
            raise s_exc.BadCmprValu(valu=valu, cmpr='*range=')

        if len(valu) != 2:
            raise s_exc.BadCmprValu(valu=valu, cmpr='*range=')

        tick, tock = self.getTickTock(valu)

        if tick > tock:
            # User input has requested a nullset
            return ()

        return self._indxTimeRange(tick, tock)
1292914
def _to_key_val_pairs(defs):
    

    if isinstance(defs, STRING_TYPES):
        # Convert 'a' to [('a', None)], or 'a.b.c' to [('a', 'b.c')]
        return [defs.split('.', 1) if '.' in defs else (defs, None)]
    else:
        pairs = []

        # Convert collections of strings or lists as above; break dicts into component items
        pairs.extend(p for s in defs if isinstance(s, STRING_TYPES) for p in _to_key_val_pairs(s))
        pairs.extend(p for l in defs if isinstance(l, list) for p in _to_key_val_pairs(l))
        pairs.extend(p for d in defs if isinstance(d, dict) for p in iteritems(d))

        return pairs
13080
def edge_val_set(self, graph, orig, dest, idx, key, branch, turn, tick, value):
        """"""
        if (branch, turn, tick) in self._btts:
            raise TimeError
        self._btts.add((branch, turn, tick))
        graph, orig, dest, key, value = map(self.pack, (graph, orig, dest, key, value))
        self._edgevals2set.append(
            (graph, orig, dest, idx, key, branch, turn, tick, value)
        )
907868
def _add_timedeltalike_scalar(self, other):
        
        if isna(other):
            # i.e np.timedelta64("NaT"), not recognized by delta_to_nanoseconds
            new_values = np.empty(len(self), dtype='i8')
            new_values[:] = iNaT
            return new_values

        inc = delta_to_nanoseconds(other)
        new_values = checked_add_with_arr(self.asi8, inc,
                                          arr_mask=self._isnan).view('i8')
        new_values = self._maybe_mask_results(new_values)
        return new_values.view('i8')
524691
def ytickvals(self, values, index=1):
        
        self.layout['yaxis' + str(index)]['tickvals'] = values
        return self
750972
def _values(self):
        """"""
        if self.interpolate:
            return [
                val[0] for serie in self.series for val in serie.interpolated
            ]
        else:
            return super(Line, self)._values
276966
def power_tick(val, pos, times_sign=r'\times'):
    
    if val == 0:
        return r'$\mathregular{0}$'
    elif val < 0:
        exponent = int(np.log10(-val))
    else:
        exponent = int(np.log10(val))
    coeff = val / 10**exponent

    return r'$\mathregular{{{:.1f} {} 10^{:2d}}}$'.format(coeff,
                                                          times_sign,
                                                          exponent)
190627
def _get_value_type(self, other):
        
        if self.values:
            return type(self.values[0])
        elif isinstance(other, TimeSeries) and other.values:
            return type(other.values[0])
        else:
            raise ValueError('Cannot perform arithmetic on empty time series.')
413864
def get_fld2val(self, name, vals):
        """"""
        if vals:
            return self._init_fld2val_stats(name, vals)
        return self._init_fld2val_null(name)
920622
def to_timestamp(val):
    
    # If we're given a number, give it right back - it's already a timestamp.
    if isinstance(val, numbers.Number):
        return val
    elif isinstance(val, six.string_types):
        dt = _parse_datetime_string(val)
    else:
        dt = val
    return time.mktime(dt.timetuple())
667085
def escape_vals(vals, escape_numerics=True):
    
    # Ints formatted as floats to disambiguate with counter mode
    ints, floats = "%.1f", "%.10f"

    escaped = []
    for v in vals:
        if isinstance(v, np.timedelta64):
            v = "'"+str(v)+"'"
        elif isinstance(v, np.datetime64):
            v = "'"+str(v.astype('datetime64[ns]'))+"'"
        elif not isnumeric(v):
            v = "'"+unicode(bytes_to_unicode(v))+"'"
        else:
            if v % 1 == 0:
                v = ints % v
            else:
                v = (floats % v)[:-1]
            if escape_numerics:
                v = "'"+v+"'"
        escaped.append(v)
    return escaped