mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 04:27:58 +01:00
Merge pull request #206 from Feuermurmel/bugfixes
Fixing stuff I broke.
This commit is contained in:
commit
6a6fcbfe3f
2 changed files with 10 additions and 11 deletions
12
src/lists.py
12
src/lists.py
|
@ -140,7 +140,7 @@ def linklist(ponydirs = None, quoters = [], ucsiser = None):
|
|||
|
||||
for ponydir in ponydirs: # Loop ponydirs
|
||||
## 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 len(ponies) == 0:
|
||||
|
@ -198,19 +198,17 @@ def linklist(ponydirs = None, quoters = [], ucsiser = None):
|
|||
_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
|
||||
|
||||
@param standard:itr<str>? Include standard ponies
|
||||
@param extra:itr<str>? Include extra ponies
|
||||
@param ucsiser:(list<str>)?→void Function used to UCS:ise names
|
||||
@param pony_dirs:itr<str> List of directories to search for ponies
|
||||
@param ucsiser:(list<str>)→void Function used to UCS:ise names
|
||||
'''
|
||||
## 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
|
||||
if ucsiser is not None:
|
||||
ucsiser(ponies)
|
||||
ponies.sort()
|
||||
|
||||
|
|
|
@ -760,9 +760,10 @@ class Ponysay():
|
|||
@param standard:bool Include standard ponies
|
||||
@param extra:bool Include extra ponies
|
||||
'''
|
||||
lists.onelist(self.ponydirs if standard else None,
|
||||
self.extraponydirs if extra else None,
|
||||
lambda x : self.__ucsise(x))
|
||||
|
||||
pony_dirs = (self.ponydirs if standard else []) + (self.extraponydirs if extra else [])
|
||||
|
||||
lists.onelist(pony_dirs, self.__ucsise)
|
||||
|
||||
|
||||
def quoters(self, standard = True, extra = False):
|
||||
|
|
Loading…
Reference in a new issue