Coverage for /media/ldata/code/tendril/tendril/utils/types/time.py : 80%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Copyright (C) 2015 Chintalagiri Shashank # # This file is part of Tendril. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. This file is part of tendril See the COPYING, README, and INSTALL files for more information """
return self.__rdiv__(other)
'TimeDelta instances used to construct TimeSpan instances' 'cannot have non-zero years and months.' ) value.minutes * 60 + value.hours * 3600 + \ value.days * 3600 * 24 "are supported at this time")
def timedelta(self):
if isinstance(other, TimeDelta): return self.clone().replace(years=-other.years, months=-other.months, days=-other.days, hours=-other.hours, minutes=-other.minutes, seconds=-other.seconds, microseconds=-other.microseconds) elif isinstance(other, TimeStamp): return TimeDelta(years=self.year-other.year, months=self.month-other.month, days=self.day-other.day, hours=self.hour-other.hour, minutes=self.minute-other.minute, seconds=self.second-other.second, microseconds=self.microsecond-other.microsecond) else: raise NotImplementedError
if isinstance(other, TimeDelta): return self.clone().replace(years=other.years, months=other.months, days=other.days, hours=other.hours, minutes=other.minutes, seconds=other.seconds, microseconds=other.microseconds) elif isinstance(other, TimeStamp): # return self.clone().replace(years=other.year, # months=other.month, # days=other.day, # hours=other.hour, # minutes=other.minute, # seconds=other.second, # microseconds=other.microsecond) raise ValueError else: raise NotImplementedError("Add not implemented for " + repr(self.__class__) + " + " + repr(other.__class__))
seconds=0, microseconds=0):
if isinstance(other, TimeDelta): return TimeDelta( years=self.years - other.years, months=self.months - other.months, days=self.days - other.days, hours=self.hours - other.hours, minutes=self.minutes - other.minutes, seconds=self.seconds - other.seconds, microseconds=self.microseconds - other.microseconds ) else: raise NotImplementedError
if isinstance(other, TimeDelta): return TimeDelta( years=self.years + other.years, months=self.months + other.months, days=self.days + other.days, hours=self.hours + other.hours, minutes=self.minutes + other.minutes, seconds=self.seconds + other.seconds, microseconds=self.microseconds + other.microseconds ) else: raise NotImplementedError
[str(self.years), str(self.months), str(self.days), str(self.hours), str(self.minutes), str(self.seconds), str(self.microseconds)] )
def timespan(self): return TimeSpan(self)
|