tractatus/pptx-env/lib/python3.12/site-packages/fontTools/misc/filesystem/_tools.py
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

34 lines
972 B
Python

from __future__ import annotations
import typing
from pathlib import PurePosixPath
from ._errors import DirectoryNotEmpty
if typing.TYPE_CHECKING:
from typing import IO
from ._base import FS
def remove_empty(fs: FS, path: str):
"""Remove all empty parents."""
path = PurePosixPath(path)
root = PurePosixPath("/")
try:
while path != root:
fs.removedir(path.as_posix())
path = path.parent
except DirectoryNotEmpty:
pass
def copy_file_data(src_file: IO, dst_file: IO, chunk_size: int | None = None):
"""Copy data from one file object to another."""
_chunk_size = 1024 * 1024 if chunk_size is None else chunk_size
read = src_file.read
write = dst_file.write
# in iter(callable, sentilel), callable is called until it returns the sentinel;
# this allows to copy `chunk_size` bytes at a time.
for chunk in iter(lambda: read(_chunk_size) or None, None):
write(chunk)