Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #1 #2

Merged
merged 2 commits into from
Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions tokei_pie/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 93,10 @@ def build_file_tree(reports):
tree = {}
for report in reports:
full_filename = report["name"]
pathes = full_filename.split("/")
pathes = full_filename.split(os.sep)
last = "."
for path in pathes[1:]:
current = last "/" path
current = last os.sep path
tree.setdefault(last, set()).add(current)
last = current
return tree
Expand All @@ -116,11 116,11 @@ def dir2sector(dirname, dirs, reports, sectors, language):
is_file = item not in flat_dirs
if is_file:
stats = reports[item]
base_dirs = item.split("/")
base_dirs = item.split(os.sep)
filename = base_dirs[-1]
base_dirs[0] = language
parent_id = "/".join(base_dirs[:-1])
myid = "/".join(base_dirs)
parent_id = os.sep.join(base_dirs[:-1])
myid = os.sep.join(base_dirs)
sectors.append(
Sector(
id=item,
Expand All @@ -146,11 146,11 @@ def dir2sector(dirname, dirs, reports, sectors, language):

if dirname == ".":
return 0, 0, 0
base_dirs = dirname.split("/")
base_dirs = dirname.split(os.sep)
filename = base_dirs[-1]
base_dirs[0] = language
parent_id = "/".join(base_dirs[:-1])
myid = "/".join(base_dirs)
parent_id = os.sep.join(base_dirs[:-1])
myid = os.sep.join(base_dirs)
sectors.append(
Sector(
id=myid,
Expand Down Expand Up @@ -234,3 234,6 @@ def main():
logger.info(
"draw sunburst chart done, took {:.2f}s".format(draw_time - parse_file_time)
)

if __name__ == "__main__":
main()