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 missing mode property on file wrapper #2495

Merged
merged 2 commits into from
Sep 19, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fix NO_COLOR support on legacy Windows https://github.com/Textualize/rich/pull/2458
- Fix missing `mode` property on file wrapper breaking uploads via `requests` https://github.com/Textualize/rich/pull/2495

## [12.5.2] - 2022-07-18

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The following people have contributed to the development of Rich:
- [Paul McGuire](https://github.com/ptmcg)
- [Antony Milne](https://github.com/AntonyMilneQB)
- [Michael Milton](https://github.com/multimeric)
- [Martina Oefelein](https://github.com/oefe)
- [Nathan Page](https://github.com/nathanrpage97)
- [Avi Perl](https://github.com/avi-perl)
- [Laurent Peuch](https://github.com/psycojoker)
Expand Down
4 changes: 4 additions & 0 deletions rich/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ def fileno(self) -> int:
def isatty(self) -> bool:
return self.handle.isatty()

@property
def mode(self) -> str:
return self.handle.mode

@property
def name(self) -> str:
return self.handle.name
Expand Down
1 change: 1 addition & 0 deletions tests/test_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ def test_wrap_file() -> None:
with open(filename, "rb") as file:
with rich.progress.wrap_file(file, total=total) as f:
assert f.read() == b"Hello, World!"
assert f.mode == "rb"
assert f.name == filename
assert f.closed
assert not f.handle.closed
Expand Down