Merge pull request #206 from Feuermurmel/bugfixes

Fixing stuff I broke.
This commit is contained in:
Mattias Andrée [mˈa.tːiː.ˌas ˈanː.drˌeː] 2014-08-30 14:42:38 +00:00
commit 6a6fcbfe3f
2 changed files with 10 additions and 11 deletions

View file

@ -140,7 +140,7 @@ def linklist(ponydirs = None, quoters = [], ucsiser = None):
for ponydir in ponydirs: # Loop ponydirs for ponydir in ponydirs: # Loop ponydirs
## Get all pony files in the directory ## Get all pony files in the directory
ponies = _get_file_list(ponydirs, '.pony') ponies = _get_file_list(ponydir, '.pony')
## If there are no ponies in the directory skip to next directory, otherwise, print the directories name ## If there are no ponies in the directory skip to next directory, otherwise, print the directories name
if len(ponies) == 0: if len(ponies) == 0:
@ -198,20 +198,18 @@ def linklist(ponydirs = None, quoters = [], ucsiser = None):
_print_columnised(list(ponies)) _print_columnised(list(ponies))
def onelist(standarddirs, extradirs = None, ucsiser = None): def onelist(pony_dirs, ucsiser):
''' '''
Lists the available ponies on one column without anything bold or otherwise formated Lists the available ponies on one column without anything bold or otherwise formated
@param standard:itr<str>? Include standard ponies @param pony_dirs:itr<str> List of directories to search for ponies
@param extra:itr<str>? Include extra ponies @param ucsiser:(list<str>)void Function used to UCS:ise names
@param ucsiser:(list<str>)?void Function used to UCS:ise names
''' '''
## Get all pony files ## Get all pony files
ponies = [j for i in [standarddirs, extradirs] for j in _get_file_list(i, '.pony')] ponies = [name for dir in pony_dirs for name in _get_file_list(dir, '.pony')]
## UCS:ise and sort ## UCS:ise and sort
if ucsiser is not None: ucsiser(ponies)
ucsiser(ponies)
ponies.sort() ponies.sort()
## Print each one on a seperate line, but skip duplicates ## Print each one on a seperate line, but skip duplicates

View file

@ -760,9 +760,10 @@ class Ponysay():
@param standard:bool Include standard ponies @param standard:bool Include standard ponies
@param extra:bool Include extra ponies @param extra:bool Include extra ponies
''' '''
lists.onelist(self.ponydirs if standard else None,
self.extraponydirs if extra else None, pony_dirs = (self.ponydirs if standard else []) + (self.extraponydirs if extra else [])
lambda x : self.__ucsise(x))
lists.onelist(pony_dirs, self.__ucsise)
def quoters(self, standard = True, extra = False): def quoters(self, standard = True, extra = False):