Skip to content
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
8 changes: 3 additions & 5 deletions hathor/event/websocket/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Literal, Optional, Union
from typing import Annotated, Literal, Optional, Union

from pydantic import NonNegativeInt
from pydantic import Field, NonNegativeInt

from hathor.utils.pydantic import BaseModel

Expand Down Expand Up @@ -54,9 +54,7 @@ class StopStreamRequest(BaseModel):
type: Literal['STOP_STREAM']


# This could be more performatic in Python 3.9:
# Request = Annotated[StartStreamRequest | AckRequest | StopStreamRequest, Field(discriminator='type')]
Request = Union[StartStreamRequest, AckRequest, StopStreamRequest]
Request = Annotated[Union[StartStreamRequest, AckRequest, StopStreamRequest], Field(discriminator='type')]


class RequestWrapper(BaseModel):
Expand Down
3 changes: 1 addition & 2 deletions hathor/indexes/rocksdb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ def _clone_into_dict(self) -> Dict[bytes, bytes]:
return {k: v for (_, k), v in it}


# XXX: should be `Collection[bytes]`, which only works on Python 3.9+
class RocksDBSimpleSet(Collection, RocksDBIndexUtils):
class RocksDBSimpleSet(Collection[bytes], RocksDBIndexUtils):
def __init__(self, db: 'rocksdb.DB', log: 'structlog.stdlib.BoundLogger', *, cf_name: bytes) -> None:
self.log = log
super().__init__(db, cf_name)
Expand Down