Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-33123: pathlib: Add missing_ok parameter to Path.unlink#6191

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
miss-islington merged 2 commits intopython:masterfromrbu:pathlib-unlink-missing-ok
May 15, 2019

Conversation

rbu
Copy link
Contributor

@rburbu commentedMar 22, 2018
edited by bedevere-bot
Loading

Similarly to how several pathlib file creation functions have an "exists_ok" parameter, we should introduce "missing_ok" that makes removal functions not raise an exception when a file or directory is already absent. IMHO, this should cover Path.unlink and Path.rmdir. Note, Path.resolve() has a "strict" parameter since 3.6 that does the same thing. Naming this of this new parameter tries to be consistent with the "exists_ok" parameter as that is more explicit about what it does (as opposed to "strict").

https://bugs.python.org/issue33123

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed thePSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please followthe steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@rbu
Copy link
ContributorAuthor

rbu commentedMar 22, 2018

CLA is signed and submitted.

@serhiy-storchakaserhiy-storchaka added type-featureA feature request or enhancement and removed CLA not signed labelsMar 27, 2018
@@ -1627,6 +1627,11 @@ def test_unlink(self):
self.assertFileNotFound(p.stat)
self.assertFileNotFound(p.unlink)

def test_unlink_missing_ok(self):
p = self.cls(BASE) / 'fileMissing'
Copy link

@amiroucheamiroucheApr 3, 2018
edited
Loading

Choose a reason for hiding this comment

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

I don't think it's worth changing the name of the file to something sort of explicit such asfileMissing. I'd rather not surprise the reader and use what seems the default in the tests file ie.fileA here too.

WDYT?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Agreed.fileA actually exists, but I changed tofileAAA which seems to be used for a non-existing file in other tests.

@rburbuforce-pushed thepathlib-unlink-missing-ok branch from6d6f2e9 to68d5edbCompareApril 9, 2018 08:54
Copy link
Member

@pitroupitrou left a comment

Choose a reason for hiding this comment

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

A simple enough addition. LGTM.

@miss-islington
Copy link
Contributor

@rbu: Status check is done, and it's a success ✅ .

@miss-islingtonmiss-islington merged commitd9e006b intopython:masterMay 15, 2019
@csabella
Copy link
Contributor

Thank you,@rbu, for the PR and thank you,@pitrou, for the review.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@amiroucheamiroucheamirouche left review comments

@pitroupitroupitrou approved these changes

Assignees
No one assigned
Labels
type-featureA feature request or enhancement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

8 participants
@rbu@the-knights-who-say-ni@miss-islington@csabella@pitrou@amirouche@serhiy-storchaka@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp