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

GH-132566: Progressively delete files inpathlib.Path.move()#133852

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

Open
barneygale wants to merge4 commits intopython:main
base:main
Choose a base branch
Loading
frombarneygale:gh-132566

Conversation

barneygale
Copy link
Contributor

@barneygalebarneygale commentedMay 10, 2025
edited
Loading

Adjustpathlib.Path.move() so that each file and directory is deleted immediately after it is copied, rather than copying everything before deleting anything.

To achieve this, we rename_copy_from() to_iter_copy_from() and convert it to a generator that yields(source, target) path pairs. ThePath.move() method deletes each source path after it's copied.

Adjust `pathlib.Path.move()` so that each file and directory is deletedimmediately after it is copied, rather than copying everything beforedeleting anything.To achieve this, we rename `_copy_from()` to `_iter_copy_from()` andconvert it to a generator that yields `(target, source)` pairs. The`Path.move()` method deletes each source path after it's copied.
@graingert
Copy link
Contributor

Thanks for this! I'll try to take a look asap

@barneygale
Copy link
ContributorAuthor

barneygale commentedMay 10, 2025
edited
Loading

👍 thanks. FWIW this patch makes_iter_copy_from() yield once after the copying a path.#131636 will make it yield whenever possible. I'll rebase that PR after this PR lands, if that makes sense

@graingert
Copy link
Contributor

sorry for the delay, this looks good to me!

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

@graingertgraingertgraingert approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@barneygale@graingert

[8]ページ先頭

©2009-2025 Movatter.jp