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

stats.py it's broken after partial build integration: handle_files has bugs #161

Closed
ryukinix opened this issue May 4, 2018 · 2 comments
Closed
Assignees

Comments

@ryukinix
Copy link
Member

ryukinix commented May 4, 2018

After the PR #160 we can check this following error at this log:

Traceback (most recent call last):
  File "stats.py", line 747, in <module>
    main()
  File "stats.py", line 743, in main
    handle_options(options)
  File "stats.py", line 677, in handle_options
    uncommited_solutions, uncommited_core_files = handle_files(options.files)
  File "stats.py", line 512, in handle_files
    solutions += [(f, lang, solution) for lang in os.listdir(os.getcwd() + '/' + f)

This bug is related to the function handle_files and this it's definition:

ProjectEuler/stats.py

Lines 497 to 516 in e675460

def handle_files(files):
"""
Analyse files to return two lists :
- solutions : list of files as 3-uple of strings that are more likely solutions
on the format: (ProblemXXX, 'Lang', 'solution_x.y')
- build_files : list of files that are more build files (stats.py,
stats.exs, ...)
"""
solutions = []
build_files = []
for f in files:
if f.count("/") == 2:
solutions.append(tuple(f.split("/")))
elif f.count("/") == 1 and "Problem" in f:
f = f.strip('/')
solutions += [(f, lang, solution) for lang in os.listdir(os.getcwd() + '/' + f)
if lang in BUILD_SUPPORT for solution in os.listdir(os.getcwd() + '/' + f + '/' + lang)]
elif f.count("/") == 0:
build_files.append(f)
return list(filter(lambda x: is_solution(x[2]), solutions)), build_files

@a-hilaly
Copy link
Member

a-hilaly commented May 5, 2018

I checked this this morning, apparently handle_files doesn't take care of the case README.md and .hash. 😱
I will open a PR fixing this soon.

@ryukinix
Copy link
Member Author

ryukinix commented May 5, 2018

Thanks, @a-hilaly. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants