Skip to content

gh-123614: Add save function to turtle.py #123617

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

Merged
merged 12 commits into from
Sep 13, 2024

Conversation

yngvem
Copy link
Contributor

@yngvem yngvem commented Sep 2, 2024

Adds a save(filename: str, overwrite: bool = False)-function to turtle.py with the following input validation:

  • FileNotFoundError that explicitly state that the directory is missing if someone tries to save to an non-existing directory
  • ValueError if the file exists and overwrite=False
  • ValueError if the file does not end with ps or eps

Co-authored-by: Marie Roald [email protected]

@ghost
Copy link

ghost commented Sep 2, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Sep 2, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@nineteendo
Copy link
Contributor

Could you add documentation? And I would raise FileExistsError if the file already exists and overwrite is false.

@MarieRoald
Copy link
Contributor

We have updated the documentation now and changed the code to use the FileExistsError and make sure that the all pipeline checks pass

Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

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

Successfully merging this pull request may close these issues.

5 participants