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

Fix async file copying helper; use aiofiles typeshed definitions instead of ignoring the package #11

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/11-copy-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "Fix async file copying helper (https://github.com/ansible-community/antsibull-core/pull/11)."
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
[mypy-sh.*]
ignore_missing_imports = True

[mypy-aiofiles.*]
ignore_missing_imports = True

[mypy-semantic_version.*]
ignore_missing_imports = True
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pylint = "^2.12.0"
pytest = "*"
pytest-asyncio = ">= 0.12"
pytest-cov = "*"
types-aiofiles = "*"
types-PyYAML = "*"

[tool.isort]
Expand Down
2 changes: 1 addition & 1 deletion src/antsibull_core/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def copy_file(source_path: str, dest_path: str) -> None:
# Since we already read the contents of the file to copy, simply write it to
# the destination instead of reading it again
async with aiofiles.open(dest_path, 'wb') as f_out:
f_out.write(content_to_copy)
await f_out.write(content_to_copy)
return
except FileNotFoundError:
# Destination (or source) file does not exist
Expand Down