mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-06 03:25:21 +00:00
Change map and filter to list comprehension for py2 and py3 compatible
This commit is contained in:
parent
a438406f68
commit
eca9884b25
@ -33,8 +33,8 @@ def get_all_imports(start_path):
|
||||
logging.debug('Traversing tree, start: %s', start_path)
|
||||
for root, dirs, files in os.walk(start_path):
|
||||
packages.append(os.path.basename(root))
|
||||
files = filter(lambda fn:os.path.splitext(fn)[1] == ".py", files)
|
||||
packages += map(lambda fn:os.path.splitext(fn)[0], files)
|
||||
files = [fn for fn in files if os.path.splitext(fn)[1] == ".py"]
|
||||
packages += [os.path.splitext(fn)[0] for fn in files]
|
||||
for file_name in files:
|
||||
with open(os.path.join(root, file_name), "r") as file_object:
|
||||
lines = filter(lambda l:len(l) > 0, map(lambda l:l.strip(), file_object))
|
||||
|
Loading…
x
Reference in New Issue
Block a user