The Wayback Machine - https://web.archive.org/web/20210515083959/https://github.com/TheAlgorithms/Python/pull/4411
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

feat(ci): Hash project euler solutions #4411

Merged
merged 11 commits into from May 12, 2021
Merged

Conversation

@maltejur
Copy link
Member

@maltejur maltejur commented May 11, 2021

Describe your change:

As requested from the Project Euler Team and already discussed in the discord, we should hash the values of the Project Euler solutions for testing so that no direct solutions are stored. This pr hashes all the values in the project_euler_answers.json and updates the tests to use the hashed output.

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
    This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
    All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
    All functions have doctests that pass the automated testing.
    All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
    If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.
@cclauss
Copy link
Member

@cclauss cclauss commented May 11, 2021

As we have discussed elsewhere, I do not believe that Project Euler’s Community Commons license gives them the right to limit the use of their content in this way.

@Panquesito7
Copy link
Member

@Panquesito7 Panquesito7 commented May 11, 2021

@cclauss, please check the Discord and check the latest message. Thanks. 🙂

@maltejur
Copy link
Member Author

@maltejur maltejur commented May 11, 2021

Yes I agree that they can't force this on us with the CC license, but since they just want the solutions in the JSON file for testing hashed so people won't just copy-paste everything from there, I don't see why we shouldn't do that. Is there any disadvantage for us in doing this?

@cclauss
Copy link
Member

@cclauss cclauss commented May 11, 2021

please check the Discord

We are an open source project. I am uncomfortable making decisions behind closed doors. The Euler Project’s Community Commons license does not give them the right to limit our use of their IP except as expressed in that license. If they want to change their license they can do so in the customary way.

Copy link
Member

@cclauss cclauss left a comment

Tests are failing.

scripts/validate_solutions.py Outdated Show resolved Hide resolved
scripts/validate_solutions.py Outdated Show resolved Hide resolved
scripts/validate_solutions.py Outdated Show resolved Hide resolved
@siriak

This comment has been hidden.

scripts/validate_solutions.py Outdated Show resolved Hide resolved
scripts/validate_solutions.py Outdated Show resolved Hide resolved
@siriak
siriak approved these changes May 11, 2021
Copy link
Member

@siriak siriak left a comment

LGTM

Copy link
Member

@Panquesito7 Panquesito7 left a comment

Good work, @maltejur! Thank you! 🎉 👍

@Panquesito7 Panquesito7 dismissed cclauss’s stale review May 11, 2021

Continuous integration issues have been fixed.

cclauss added 3 commits May 12, 2021
@cclauss cclauss merged commit 03d9b67 into master May 12, 2021
7 checks passed
7 checks passed
@github-actions
project-euler
Details
@github-actions
build
Details
@github-actions
build
Details
@github-actions
pre-commit
Details
@github-actions
pre-commit
Details
@github-actions
validate-solutions
Details
@gitpod-io
Gitpod Open an online workspace in Gitpod
Details
@cclauss cclauss deleted the hash_project_euler_solutions branch May 12, 2021
@cclauss
Copy link
Member

@cclauss cclauss commented May 12, 2021

@maltejur Thanks for doing this.

Panquesito7 pushed a commit to Panquesito7/Python that referenced this pull request May 13, 2021
* hash project euler solutions

* fix errors

* Return missing annotation

* Fix typo

* Extract variable to shorten excessively long line

* Update scripts/validate_solutions.py

* Update scripts/validate_solutions.py

* Simplify with str.encode()

* PEP 585: type hinting generics in standard collections;

* str().encode()

* Texas two step to placate black, flake8, mypy

Co-authored-by: Andrii Siriak <[email protected]>
Co-authored-by: Christian Clauss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants