Skip to content

Commit 5fda7a9

Browse files
authored
Add missing mode property to BufferedWriterWithProgress (#251)
1 parent 900f2af commit 5fda7a9

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Fixed
11+
12+
- Fixed incompatibility issue with latest boto3/botocore release (>=1.37.34) .
13+
1014
## [v1.7.1](https://github.com/allenai/cached_path/releases/tag/v1.7.1) - 2025-03-11
1115

1216
### Fixed

cached_path/progress.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,24 @@ def __init__(self, handle: io.BufferedWriter, progress: Progress, task_id: TaskI
4242
self.progress = progress
4343
self.task_id = task_id
4444
self.total_written = 0
45+
self.handle.mode
46+
47+
@property
48+
def mode(self):
49+
return self.handle.mode
50+
51+
@property
52+
def closed(self) -> bool:
53+
return self.handle.closed
4554

4655
def __enter__(self) -> "BufferedWriterWithProgress":
4756
self.handle.__enter__()
4857
return self
4958

5059
def __exit__(self, exc_type, exc_val, exc_tb):
60+
del exc_type, exc_val, exc_tb
5161
self.close()
5262

53-
@property
54-
def closed(self) -> bool:
55-
return self.handle.closed
56-
5763
def close(self):
5864
self.handle.close()
5965

@@ -78,8 +84,8 @@ def writable(self) -> bool:
7884
def read(self, size: Optional[int] = -1) -> bytes:
7985
return self.handle.read(size)
8086

81-
def read1(self, size: Optional[int] = -1) -> bytes:
82-
return self.handle.read1()
87+
def read1(self, size: int = -1, /) -> bytes:
88+
return self.handle.read1(size)
8389

8490
def readinto(self, b):
8591
return self.handle.readinto(b)

0 commit comments

Comments
 (0)