当前位置: 首页>>代码示例>>Python>>正文


Python StatsDateLib.isValidIsoDate方法代码示例

本文整理汇总了Python中pxStats.lib.StatsDateLib.StatsDateLib.isValidIsoDate方法的典型用法代码示例。如果您正苦于以下问题:Python StatsDateLib.isValidIsoDate方法的具体用法?Python StatsDateLib.isValidIsoDate怎么用?Python StatsDateLib.isValidIsoDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pxStats.lib.StatsDateLib.StatsDateLib的用法示例。


在下文中一共展示了StatsDateLib.isValidIsoDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getStartAndEndTimeForPickleRecollection

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import isValidIsoDate [as 别名]
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
开发者ID:hawkeye438,项目名称:metpx,代码行数:33,代码来源:recollectData.py

示例2: getStartAndEndTimeForDatabaseRecollection

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import isValidIsoDate [as 别名]
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() )
#.........这里部分代码省略.........
开发者ID:hawkeye438,项目名称:metpx,代码行数:103,代码来源:recollectData.py


注:本文中的pxStats.lib.StatsDateLib.StatsDateLib.isValidIsoDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。