def getStartAndEndTimeForPickleRecollection(): """ @summary : Gets the start time and the endTime of the pickle recollection from the user's input. @return : Returns the startTime and endTime. """ startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss) : ") while not StatsDateLib.isValidIsoDate( startTime ): print "Error. The entered date must be of the iso format." startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss) : ") endTime= raw_input( "Enter the endTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : ") while( str(endTime).lower() != "now" and not StatsDateLib.isValidIsoDate( endTime ) and ( StatsDateLib.isValidIsoDate( endTime ) and endTime<= startTime ) ) : if StatsDateLib.isValidIsoDate( endTime ) and endTime<= startTime : print "Error. End time must be after startTime( %s ). " elif StatsDateLib.isValidIsoDate( endTime ): print "Error. The entered date must be of the iso format." endTime= raw_input( "Enter the endTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : ") if endTime == "now" : endTime = StatsDateLib.getIsoFromEpoch( time.time() ) return startTime, endTime
def getStartAndEndTimeForPickleRecollection(): """ @summary : Gets the start time and the endTime of the pickle recollection from the user's input. @return : Returns the startTime and endTime. """ startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss) : " ) while not StatsDateLib.isValidIsoDate(startTime): print "Error. The entered date must be of the iso format." startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss) : " ) endTime = raw_input( "Enter the endTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : " ) while (str(endTime).lower() != "now" and not StatsDateLib.isValidIsoDate(endTime) and (StatsDateLib.isValidIsoDate(endTime) and endTime <= startTime)): if StatsDateLib.isValidIsoDate(endTime) and endTime <= startTime: print "Error. End time must be after startTime( %s ). " elif StatsDateLib.isValidIsoDate(endTime): print "Error. The entered date must be of the iso format." endTime = raw_input( "Enter the endTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : " ) if endTime == "now": endTime = StatsDateLib.getIsoFromEpoch(time.time()) return startTime, endTime
def getStartAndEndTimeForDatabaseRecollection(infos): """ @summary : Gets the start time and the endTime of the pickle recollection from the user's input. @param infos : Previously gathered infos. @note : If pickles are to be recollected, infos must contain the pickles recollection start time and end time. @return : Returns the startTime and endTime. """ if infos.pickles == True: isCertainAboutStartTime = False #************************startTime section********* while isCertainAboutStartTime == False: startTime = raw_input( "Enter the startTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss ) : " ) while not StatsDateLib.isValidIsoDate(startTime): if not StatsDateLib.isValidIsoDate(startTime): print "Error. The entered date must be of the iso format." startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss ) : " ) if (StatsDateLib.isValidIsoDate(startTime) and startTime > infos.picklesRecollectionStartTime): print "Warning : StartTime of database recollection ( %s ) is after startTime of pickleRecollection( %s ) " % ( startTime, infos.picklesRecollectionStartTime) isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : ") while (str(isCertainAnswer).lower() != 'y' and str(isCertainAnswer).lower() != 'n'): print "Error.Answer needs to be either y or n." isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : " ) if str(isCertainAnswer).lower() == 'y': isCertainAboutStartTime = True else: print "A new startTime will be required." else: isCertainAboutStartTime = True #************************endTime section********* isCertainAboutEndTime = False while isCertainAboutEndTime == False: endTime = raw_input( "Enter the endTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : " ) while (not StatsDateLib.isValidIsoDate(endTime) and str(endTime).lower() != "now"): if not StatsDateLib.isValidIsoDate(endTime): print "Error. The entered date must be of the iso format or now." endTime = raw_input( "Enter the endTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : " ) if (endTime != "now" and StatsDateLib.isValidIsoDate(endTime) and endTime < infos.picklesRecollectionEndTime): print "Warning : endTime of database recollection ( %s ) is before the endTime of pickleRecollection( %s ) " % ( startTime, infos.picklesRecollectionStartTime) isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : ") while (str(isCertainAnswer).lower() != 'y' and str(isCertainAnswer).lower() != 'n'): print "Error.Answer needs to be either y or n." isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : " ) if str(isCertainAnswer).lower() == 'y': isCertainAboutEndTime = True else: print "A new endTime will be required." else: isCertainAboutEndTime = True if endTime == "now": endTime = StatsDateLib.getIsoFromEpoch(time.time()) isCertainAboutEndTime = True else: startTime = raw_input( "Enter the startTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss ) : " ) while not StatsDateLib.isValidIsoDate(startTime): if not StatsDateLib.isValidIsoDate(startTime): print "Error. The entered date must be of the iso format." startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss) : " ) endTime = raw_input( "Enter the endTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : " ) while (str(endTime) != "now" and not StatsDateLib.isValidIsoDate(endTime)): if not StatsDateLib.isValidIsoDate(endTime): print "Error. The entered date must be of the iso format." endTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : " ) if endTime == "now": endTime = StatsDateLib.getIsoFromEpoch(time.time()) return startTime, endTime
def getStartAndEndTimeForDatabaseRecollection( infos ): """ @summary : Gets the start time and the endTime of the pickle recollection from the user's input. @param infos : Previously gathered infos. @note : If pickles are to be recollected, infos must contain the pickles recollection start time and end time. @return : Returns the startTime and endTime. """ if infos.pickles == True : isCertainAboutStartTime = False #************************startTime section********* while isCertainAboutStartTime == False: startTime = raw_input( "Enter the startTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss ) : ") while not StatsDateLib.isValidIsoDate( startTime ) : if not StatsDateLib.isValidIsoDate( startTime ): print "Error. The entered date must be of the iso format." startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss ) : ") if ( StatsDateLib.isValidIsoDate( startTime ) and startTime > infos.picklesRecollectionStartTime ) : print "Warning : StartTime of database recollection ( %s ) is after startTime of pickleRecollection( %s ) " %( startTime, infos.picklesRecollectionStartTime) isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : ") while( str(isCertainAnswer).lower() != 'y' and str(isCertainAnswer).lower() != 'n'): print "Error.Answer needs to be either y or n." isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : ") if str(isCertainAnswer).lower() == 'y': isCertainAboutStartTime = True else: print "A new startTime will be required." else: isCertainAboutStartTime = True #************************endTime section********* isCertainAboutEndTime = False while isCertainAboutEndTime == False: endTime = raw_input( "Enter the endTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : ") while ( not StatsDateLib.isValidIsoDate( endTime ) and str(endTime).lower() != "now" ): if not StatsDateLib.isValidIsoDate( endTime ): print "Error. The entered date must be of the iso format or now." endTime = raw_input( "Enter the endTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : ") if ( endTime != "now" and StatsDateLib.isValidIsoDate( endTime ) and endTime < infos.picklesRecollectionEndTime ) : print "Warning : endTime of database recollection ( %s ) is before the endTime of pickleRecollection( %s ) " %( startTime, infos.picklesRecollectionStartTime) isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : ") while( str(isCertainAnswer).lower() != 'y' and str(isCertainAnswer).lower() != 'n'): print "Error.Answer needs to be either y or n." isCertainAnswer = raw_input( "Are you sure you want to keep this date ? ( y or n ) : ") if str(isCertainAnswer).lower() == 'y': isCertainAboutEndTime = True else: print "A new endTime will be required." else: isCertainAboutEndTime = True if endTime == "now" : endTime = StatsDateLib.getIsoFromEpoch( time.time() ) isCertainAboutEndTime = True else: startTime = raw_input( "Enter the startTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss ) : ") while not StatsDateLib.isValidIsoDate( startTime ) : if not StatsDateLib.isValidIsoDate( startTime ): print "Error. The entered date must be of the iso format." startTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss) : ") endTime = raw_input( "Enter the endTime of the dataBase recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : ") while ( str(endTime) != "now" and not StatsDateLib.isValidIsoDate( endTime ) ): if not StatsDateLib.isValidIsoDate( endTime ): print "Error. The entered date must be of the iso format." endTime = raw_input( "Enter the startTime of the pickle recollection ( yyyy-mm-dd hh:mm:ss or 'now' for current time ) : ") if endTime == "now" : endTime = StatsDateLib.getIsoFromEpoch( time.time() ) return startTime, endTime