Skip to content

Commit

Permalink
Merge pull request #175 from coreweave/eta/redis-stream-base-class
Browse files Browse the repository at this point in the history
fix(stream_io): Correctly implement `readable()`/`seekable()` again
  • Loading branch information
wbrown authored Aug 26, 2024
2 parents 526477c + 9c669e4 commit 61bab18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- `RedisStreamFile.readable()` and `RedisStreamFile.seekable()` now correctly
return `True`

## [2.9.0] - 2024-04-17

### Added
Expand Down Expand Up @@ -400,6 +407,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `get_gpu_name`
- `no_init_or_tensor`

[Unreleased]: https://github.com/coreweave/tensorizer/compare/v2.9.0...HEAD
[2.9.0]: https://github.com/coreweave/tensorizer/compare/v2.8.1...v2.9.0
[2.8.1]: https://github.com/coreweave/tensorizer/compare/v2.8.0...v2.8.1
[2.8.0]: https://github.com/coreweave/tensorizer/compare/v2.7.2...v2.8.0
Expand Down
14 changes: 9 additions & 5 deletions tensorizer/stream_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,12 +843,16 @@ def read(self, size=None) -> bytes:
goal_position = self._curr + size
return self._read_until(goal_position)

@staticmethod
def writable() -> bool:
def writable(self) -> bool:
return False

@staticmethod
def fileno() -> int:
def readable(self) -> bool:
return True

def seekable(self) -> bool:
return True

def fileno(self) -> int:
return -1

def __enter__(self):
Expand Down Expand Up @@ -878,7 +882,7 @@ def close(self):
self._redis_tcp = None
super(RedisStreamFile, self).close() # will set self.closed to True

def readline(self):
def readline(self, size=-1, /):
raise io.UnsupportedOperation("readline")


Expand Down

0 comments on commit 61bab18

Please sign in to comment.