(self)
return pairs
Parse at value into (at_type, moment) pairs.
Parse at value into (at_type, moment) pairs.
Parse at value into ( at_type moment ) pairs .
def parse_at(self):
        """Parse at value into (at_type, moment) pairs.
        """
        pairs = dict()
        if not self.at:
            return pairs

        processed_at = self.preprocess_at(self.at)
        ats = processed_at.split(' ')
        at_map = collections.defaultdict(list)

        # Parse at value into (at_type, moments_list) pairs.
        # One same at_type can have multiple moments like:
        # at = "minute.5 minute.10 hour.2"
        for at in ats:
            if 'minute.' in at:
                at_type, moment = MINUTE, get_moment(at)
                if moment not in range(60):
                    raise ParseError("Your at value %s is invalid"
                                     " out of minute range[0-59]" % self.at)
            elif 'hour.' in at:
                at_type, moment = HOUR, get_moment(at)
                if moment not in range(24):
                    raise ParseError("Your at value %s is invalid"
                                     " out of hour range[0-23]" % self.at)
            elif 'day.' in at:
                at_type, moment = DAY, get_moment(at)
                if moment not in range(1, 32):
                    raise ParseError("Your at value %s is invalid"
                                     " out of month day range[1-31]" % self.at)
            elif 'month.' in at or 'year.' in at:
                raise ParseError("Your at value %s is invalid"
                                 " can not set month or year" % self.at)
            elif is_week(at):
                at_type = WEEK
                moment = self.parse_week(at)
            else:
                raise ParseError("Your at value %s is invalid" % self.at)
            if moment not in at_map[at_type]:
                at_map[at_type].append(moment)

        # comma seperate same at_type moments
        for at_type, moments in iteritems(at_map):
            moments = map(str, moments)
            pairs[at_type] = ','.join(moments)

        return pairs
def parse_at ( self ) : pairs = dict ( ) if not self . at : return pairs processed_at = self . preprocess_at ( self . at ) ats = processed_at . split ( ' ' ) at_map = collections . defaultdict ( list ) # Parse at value into (at_type, moments_list) pairs. # One same at_type can have multiple moments like: # at = "minute.5 minute.10 hour.2" for at in ats : if 'minute.' in at : at_type , moment = MINUTE , get_moment ( at ) if moment not in range ( 60 ) : raise ParseError ( "Your at value %s is invalid" " out of minute range[0-59]" % self . at ) elif 'hour.' in at : at_type , moment = HOUR , get_moment ( at ) if moment not in range ( 24 ) : raise ParseError ( "Your at value %s is invalid" " out of hour range[0-23]" % self . at ) elif 'day.' in at : at_type , moment = DAY , get_moment ( at ) if moment not in range ( 1 , 32 ) : raise ParseError ( "Your at value %s is invalid" " out of month day range[1-31]" % self . at ) elif 'month.' in at or 'year.' in at : raise ParseError ( "Your at value %s is invalid" " can not set month or year" % self . at ) elif is_week ( at ) : at_type = WEEK moment = self . parse_week ( at ) else : raise ParseError ( "Your at value %s is invalid" % self . at ) if moment not in at_map [ at_type ] : at_map [ at_type ] . append ( moment ) # comma seperate same at_type moments for at_type , moments in iteritems ( at_map ) : moments = map ( str , moments ) pairs [ at_type ] = ',' . join ( moments ) return pairs