Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…

""" | |
Display how much storage is used in your Python files. | |
Usage: | |
python count_py.py <PATH or FS URL> | |
""" | |
import sys | |
from fs import open_fs | |
from fs.filesize import traditional | |
fs_url = sys.argv[1] | |
count = 0 | |
with open_fs(fs_url) as fs: | |
for _path, info in fs.walk.info(filter=["*.py"], namespaces=["details"]): | |
count += info.size | |
print(f'There is {traditional(count)} of Python in "{fs_url}"') |