From 8861e0bb0e3a966f0e2b6ef753c0e85827f1eb25 Mon Sep 17 00:00:00 2001 From: Michael Schwarz Date: Sat, 30 Aug 2014 12:44:00 +0200 Subject: [PATCH] lists.onelist(): Instead of passing multiple, possibly empty lists, build the list of directories to search before calling the method. --- src/lists.py | 7 +++---- src/ponysay.py | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lists.py b/src/lists.py index b3e8a56e..d06579b0 100755 --- a/src/lists.py +++ b/src/lists.py @@ -198,16 +198,15 @@ def linklist(ponydirs = None, quoters = [], ucsiser = None): _print_columnised(list(ponies)) -def onelist(standarddirs, extradirs, ucsiser): +def onelist(pony_dirs, ucsiser): ''' Lists the available ponies on one column without anything bold or otherwise formated - @param standard:itr Include standard ponies - @param extra:itr Include extra ponies + @param pony_dirs:itr List of directories to search for ponies @param ucsiser:(list)→void Function used to UCS:ise names ''' ## Get all pony files - ponies = [name for dir_list in [standarddirs, extradirs] for dir in dir_list for name in _get_file_list(dir, '.pony')] + ponies = [name for dir in pony_dirs for name in _get_file_list(dir, '.pony')] ## UCS:ise and sort ucsiser(ponies) diff --git a/src/ponysay.py b/src/ponysay.py index cea7a668..dd0768dc 100755 --- a/src/ponysay.py +++ b/src/ponysay.py @@ -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 [], - self.extraponydirs if extra else [], - self.__ucsise) + + 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):