mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 04:27:58 +01:00
Fixed TypeError when running ponysay --onelist.
Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 170, in _run_module_as_main "__main__", mod_spec) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 85, in _run_code exec(code, run_globals) File "venv/bin/ponysay/__main__.py", line 154, in <module> File "venv/bin/ponysay/ponysay.py", line 248, in run File "venv/bin/ponysay/ponysay.py", line 765, in onelist File "venv/bin/ponysay/lists.py", line 210, in onelist File "venv/bin/ponysay/lists.py", line 210, in <listcomp> File "venv/bin/ponysay/lists.py", line 104, in _get_file_list TypeError: listdir: illegal type for path parameter This bug was introduced in this commit: list.py: Extracted duplicate code for listing files in a directory into a utility function. I fixed the problem by removing the requirement for lists.onelist() to accept None for directory lists that should not be searched.
This commit is contained in:
parent
c077f08259
commit
cc9a4f4324
2 changed files with 9 additions and 10 deletions
13
src/lists.py
13
src/lists.py
|
@ -198,20 +198,19 @@ def linklist(ponydirs = None, quoters = [], ucsiser = None):
|
||||||
_print_columnised(list(ponies))
|
_print_columnised(list(ponies))
|
||||||
|
|
||||||
|
|
||||||
def onelist(standarddirs, extradirs = None, ucsiser = None):
|
def onelist(standarddirs, extradirs, 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 standard:itr<str> Include standard ponies
|
||||||
@param extra:itr<str>? Include extra 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_list in [standarddirs, extradirs] for dir in dir_list 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
|
||||||
|
|
|
@ -760,9 +760,9 @@ 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,
|
lists.onelist(self.ponydirs if standard else [],
|
||||||
self.extraponydirs if extra else None,
|
self.extraponydirs if extra else [],
|
||||||
lambda x : self.__ucsise(x))
|
self.__ucsise)
|
||||||
|
|
||||||
|
|
||||||
def quoters(self, standard = True, extra = False):
|
def quoters(self, standard = True, extra = False):
|
||||||
|
|
Loading…
Reference in a new issue