pyfortune/loader.py
def fromlist(cls, files, equal=False, offensive=False, lang=None):
        """Initialize based on a list of fortune files"""
        self = cls.__new__(cls)
        self.files = fortunes = []
        count = 0
        for file in files:
            fortune = load_fortune(file, offensive=offensive, lang=lang)
            if fortune is None:
                logger.warn("Can't load: %s", file)
                continue
            count += 1 if equal else fortune.size
            fortunes.append((fortune, count))
        if not fortunes:
            raise ValueError('All fortune files specified are invalid')
        self.count = count
        self.keys = [i[1] for i in self.files]
        return self
def fromlist(cls, files, equal=False, offensive=False, lang=None):
        self = cls.__new__(cls)
        self.files = fortunes = []
        count = 0
        for file in files:
            fortune = load_fortune(file, offensive=offensive, lang=lang)
            if fortune is None:
                logger.warn("Can't load: %s", file)
                continue
            count += 1 if equal else fortune.size
            fortunes.append((fortune, count))
        if not fortunes:
            raise ValueError('All fortune files specified are invalid')
        self.count = count
        self.keys = [i[1] for i in self.files]
        return self
def fromlist ( cls , files , equal = False , offensive = False , lang = None ) : self = cls . __new__ ( cls ) self . files = fortunes = [ ] count = 0 for file in files : fortune = load_fortune ( file , offensive = offensive , lang = lang ) if fortune is None : logger . warn ( "Can't load: %s" , file ) continue count += 1 if equal else fortune . size fortunes . append ( ( fortune , count ) ) if not fortunes : raise ValueError ( 'All fortune files specified are invalid' ) self . count = count self . keys = [ i [ 1 ] for i in self . files ] return self
Initialize based on a list of fortune files
Initialize based on a list of fortune files