Guest User

Untitled

a guest
Apr 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. class AbstractTimeQueryTest(AbstractTest):
  2.  
  3.   def __init__(self):
  4.     AbstractTest.__init__(self)
  5.     print("I am getting here")
  6.     self.stepHours = 1
  7.     self.stepDays  = 1
  8.     self.__path = self.path
  9.  
  10.   # %tsb - Unix Time Stamp Before  (now - stepHours, default to 1 hour)
  11.   # %tsa - Unix Time Stamp After   (now + stepHours)
  12.   # %db  - Date Before in YYYYMMDD (now - stepDays, default to 1 day)
  13.   # %da  - Date After  in YYYYMMDD (now + stepDays)
  14.   def __set_path(self,path):
  15.     if path != '': #Python seriously calls this before __init__?!?!
  16.       now = int(time.time())    
  17.       t = path.replace('%tsb', ((now - 86,400) * self.stepHours) )
  18.       t = t.replace('%tsa',''  ((now + 86,400) * self.stepHours) )
  19.       t = t.replace('%db', (date.today() - timedelta(self.stepDays)).strftime('%yyyy%m%d'))
  20.       t = t.replace('%da', (date.today() + timedelta(self.stepDays)).strftime('%yyyy%m%d'))
  21.       self.__path = t  
  22.      
  23.   path = property(lambda self : self.__path,__set_path)
Add Comment
Please, Sign In to add comment