forked from ungleich-public/cdist
Improve listdir.
This commit is contained in:
parent
80c3dd7572
commit
f9b632eebb
1 changed files with 4 additions and 1 deletions
|
@ -26,7 +26,10 @@ def listdir(path='.', include_dot=False):
|
||||||
"""os.listdir but do not include entries whose names begin with a dot('.')
|
"""os.listdir but do not include entries whose names begin with a dot('.')
|
||||||
if include_dot is False.
|
if include_dot is False.
|
||||||
"""
|
"""
|
||||||
return [x for x in os.listdir(path) if include_dot or not _ishidden(x)]
|
if include_dot:
|
||||||
|
return os.listdir(path)
|
||||||
|
else:
|
||||||
|
return [x for x in os.listdir(path) if not _ishidden(x)]
|
||||||
|
|
||||||
|
|
||||||
def _ishidden(path):
|
def _ishidden(path):
|
||||||
|
|
Loading…
Reference in a new issue