Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 1, 2024
1 parent 73bab41 commit 29c01e7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions python/pycrdt/_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Array(BaseType):
"""
A collection used to store data in an indexed sequence structure, similar to a Python `list`.
"""

_prelim: list | None
_integrated: _Array | None

Expand Down Expand Up @@ -371,6 +372,7 @@ class ArrayEvent(BaseEvent):
delta (list[dict[str, Any]]): A list of items describing the changes.
path (list[int | str]): A list with the indices pointing to the array that was changed.
"""

__slots__ = "target", "delta", "path"


Expand Down
2 changes: 2 additions & 0 deletions python/pycrdt/_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Map(BaseType):
"""
A collection used to store key-value entries in an unordered manner, similar to a Python `dict`.
"""

_prelim: dict | None
_integrated: _Map | None

Expand Down Expand Up @@ -298,6 +299,7 @@ class MapEvent(BaseEvent):
delta (list[dict[str, Any]]): A list of items describing the changes.
path (list[int | str]): A list with the indices pointing to the map that was changed.
"""

__slots__ = "target", "keys", "path"


Expand Down
3 changes: 3 additions & 0 deletions python/pycrdt/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class YMessageType(IntEnum):
SYNC: A message type used for synchronizing documents.
AWARENESS: A message type used for the awareness protocol.
"""

SYNC: int = 0
AWARENESS: int = 1

Expand All @@ -28,6 +29,7 @@ class YSyncMessageType(IntEnum):
consisting of all missing updates and all deletions.
SYNC_UPDATE: A synchronization message type used to send document updates.
"""

SYNC_STEP1: int = 0
SYNC_STEP2: int = 1
SYNC_UPDATE: int = 2
Expand Down Expand Up @@ -111,6 +113,7 @@ class Decoder:
"""
A decoder capable of reading messages from a byte stream.
"""

def __init__(self, stream: bytes):
"""
Args:
Expand Down
2 changes: 2 additions & 0 deletions python/pycrdt/_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Text(BaseType):
"""
A shared data type used for collaborative text editing, similar to a Python `str`.
"""

_prelim: str | None
_integrated: _Text | None

Expand Down Expand Up @@ -264,6 +265,7 @@ class TextEvent(BaseEvent):
delta (list[dict[str, Any]]): A list of items describing the changes.
path (list[int | str]): A list with the indices pointing to the text that was changed.
"""

__slots__ = "target", "delta", "path"


Expand Down
4 changes: 3 additions & 1 deletion python/pycrdt/_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Transaction:
...
```
"""

_doc: Doc
_txn: _Transaction | None
_leases: int
Expand Down Expand Up @@ -87,7 +88,7 @@ def __exit__(
def origin(self) -> Any:
"""
The origin of the transaction.
Raises:
RuntimeError: No current transaction.
"""
Expand All @@ -114,6 +115,7 @@ class NewTransaction(Transaction):
...
```
"""

async def __aenter__(self) -> Transaction:
if self._doc._allow_multithreading:
if not await to_thread.run_sync(
Expand Down
3 changes: 2 additions & 1 deletion python/pycrdt/_undo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class UndoManager:
Changes can be undone/redone by batches using time intervals.
It is possible to include/exclude changes by transaction origin in undo/redo operations.
"""

def __init__(
self,
*,
Expand All @@ -37,7 +38,7 @@ def __init__(
scopes: A list of shared types the undo manager will work with.
capture_timeout_millis: A time interval for grouping changes that will be undone/redone.
Raises:
RuntimeError: UndoManager must be created with doc or scopes.
"""
Expand Down
2 changes: 1 addition & 1 deletion python/pycrdt/_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_update(update: bytes, state: bytes) -> bytes:
def merge_updates(*updates: bytes) -> bytes:
"""
Returns an update consisting of a combination of all given updates.
Args:
updates: The updates to merge.
Expand Down

0 comments on commit 29c01e7

Please sign in to comment.