Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Parse period from string and return GenericPeriod instance.

INPUTS:

-- periodStr:        String that can be parsed as a generic period.

You can provide the following types of input:

  'None' or ''                       : Never.
  year-month-day hour:minute:second  : Event at single exact date and time.(more...)

        def ParsePeriod(periodStr, failureMsgPrefix=''):
    """Parse period from string and return GenericPeriod instance.
    
    INPUTS:
    
    -- periodStr:        String that can be parsed as a generic period.

    You can provide the following types of input:

      'None' or ''                       : Never.
      year-month-day hour:minute:second  : Event at single exact date and time.
      A=hour:minute:second               : Time only; every day at this time.
      D=hour:minute:second               : Time only; weekdays at this time.
      //.../=hour:min:sec : On given days of week at given time.
                                           Monday == 0 ... Sunday == 6.
      M=                              : Whenever minutes mod M == 0.

    -------------------------------------------------------
    
    RETURNS:    Appropriate GenericPeriod instance.
    
    """
    exceptions = []
    classes = [NoPeriod, ExactDateTime, EveryDayAt, SomeDaysAt, ModMinutes]
    for c in classes:
        try:
            return c(periodStr)
        except Exception, e:
            exceptions.append((c,e))
    raise Exception(failureMsgPrefix + '''
    Could not parse periodStr %s. Attempts shown below:\n%s\n
    ''' % (periodStr, '\n'.join(['%s : %s' % (c.__name__, str(e))
                                 for (c, e) in zip(classes, exceptions)])))
        


src/s/u/superpy-1.2.6/superpy/SuperWatch/SPWidgets.py   superpy(Download)
            params = self.scriptDict[scriptName]
            params['period'] = Periodicity.ParsePeriod(
                params['autoRunAt'],failureMsgPrefix='''
                Could not parse period for script %s. Using Never.
                ''' % scriptName)