Return a :class:`.Time` with one or more components replaced
        with new values.
14419
def replace(self, **kwargs):
        
        return Time(kwargs.get("hour", self.__hour),
                    kwargs.get("minute", self.__minute),
                    kwargs.get("second", self.__second),
                    kwargs.get("tzinfo", self.__tzinfo))
924928
def naturaltime(val):
    """"""
    val = val.replace(tzinfo=pytz.utc) \
        if isinstance(val, datetime) else parse(val)
    now = datetime.utcnow().replace(tzinfo=pytz.utc)

    return humanize.naturaltime(now - val)
866616
def default(self, obj, **kwargs):
        """"""
        if isinstance(obj, datetime.datetime):
            return time.mktime(obj.timetuple())

        if isinstance(obj, Timestamp):
            return obj.time

        if isinstance(obj, ObjectId):
            return obj.__str__()

        return JSONEncoder.default(self, obj)
891973
def replace(self, year=None, week=None):
        """"""
        return self.__class__(self.year if year is None else year,
                              self.week if week is None else week)
69894
def replace(self, year=None, month=None, day=None, hour=None,
                minute=None, second=None, microsecond=None, tzinfo=True):
        """"""
        if year is None:
            year = self.year
        if month is None:
            month = self.month
        if day is None:
            day = self.day
        if hour is None:
            hour = self.hour
        if minute is None:
            minute = self.minute
        if second is None:
            second = self.second
        if microsecond is None:
            microsecond = self.microsecond
        if tzinfo is True:
            tzinfo = self.tzinfo
        _check_date_fields(year, month, day)
        _check_time_fields(hour, minute, second, microsecond)
        _check_tzinfo_arg(tzinfo)
        return datetime(year, month, day, hour, minute, second,
                          microsecond, tzinfo)
442492
def pythonvaluetotime(time_val):
    ""
    if time_val is None:
        return None
    elif isinstance(time_val, numeric):
        return str(long(time_val * 1000.0))
    elif isinstance(time_val, date):
        dtlist = [time_val.year, time_val.month, time_val.day]
        if isinstance(time_val, datetime.datetime):
            dtlist += [time_val.hour, time_val.minute, time_val.second]
        else:
            dtlist += [0, 0, 0]
        return long(calendar.timegm(dtlist) * 1000.0)
    elif (isinstance(time_val, sequence)
                    and len(time_val) == 2):
        if all(isinstance(x, numeric) 
               for x in time_val):
            return ",".join(pythonvaluetotime(x) 
                            for x in time_val)
        elif all(isinstance(x, date) 
               for x in time_val):
            return ",".join(pythonvaluetotime(x) 
                            for x in time_val)
    raise ValueError(repr(time_val))
115121
def adapt_timefield_value(self, value):
        
        if value is None:
            return None
        # SQL Server doesn't support microseconds
        if isinstance(value, string_types):
            return datetime.datetime(*(time.strptime(value, '%H:%M:%S')[:6]))
        return datetime.datetime(1900, 1, 1, value.hour, value.minute, value.second)
66994
def get(self, time, interpolate='previous'):
        
        try:
            getter = self.getter_functions[interpolate]
        except KeyError:
            msg = (
                "unknown value '{}' for interpolate, "
                "valid values are in [{}]"
            ).format(interpolate, ', '.join(self.getter_functions))
            raise ValueError(msg)
        else:
            return getter(time)
71661
def change_time(self):
    """"""
    if self._stat_info is None:
      return None

    timestamp = int(self._stat_info.st_ctime)
    return dfdatetime_posix_time.PosixTime(timestamp=timestamp)
894760
def seconds2time(s):
    """"""
    hour, temp = divmod(s, 3600)
    minute, temp = divmod(temp, 60)
    temp, second = math.modf(temp)
    return datetime.time(hour=int(hour), minute=int(minute), second=int(second),
                         microsecond=int(round(temp * 1e6)))
580488
def replace(self, key, val, time=0, min_compress_len=0):
        '''
        '''
        return self._set("replace", key, val, time, min_compress_len)
49770
def parse_time(time):
    """"""
    if isinstance(time, datetime.datetime):
        return time
    return datetime.datetime.strptime(time, DATETIME_FORMAT_OPENVPN)
762554
def to_time(self):
        
        return time(self.hours, self.minutes, self.seconds,
                    self.milliseconds * 1000)
718598
def modification_time(self):
    """"""
    timestamp = getattr(self._tar_info, 'mtime', None)
    if timestamp is None:
      return None
    return dfdatetime_posix_time.PosixTime(timestamp=timestamp)
1240149
def timeit(self, metric, func, *args, **kwargs):
        """"""
        return metrics.timeit(metric, func, *args, **kwargs)
191493
def delFromTimeInv(self,*params):
        '''
        
        '''
        for param in params:
            if param in self.time_inv:
                self.time_inv.remove(param)
191552
def new_datetime(self):
        """"""
        from datetime import datetime

        try:
            return datetime.fromtimestamp(self.state.new)
        except TypeError:
            return None