-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and modify files for the project
- Updated files: - src/bee_py/bee.py - src/bee_py/types/type.py - src/bee_py/utils/data.py - src/bee_py/utils/file.py - src/bee_py/utils/hex.py - src/bee_py/utils/type.py
- Loading branch information
1 parent
33fef63
commit 6139e38
Showing
6 changed files
with
174 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
def prepare_web_socket_data(): | ||
... | ||
import io | ||
from typing import Union | ||
|
||
|
||
def prepare_websocket_data(data: Union[str, bytes, bytearray, memoryview]) -> bytes: | ||
if isinstance(data, str): | ||
return data.encode() | ||
|
||
if isinstance(data, (bytes, bytearray, memoryview)): | ||
return bytes(data) | ||
|
||
if isinstance(data, io.IOBase): | ||
# Read the data from the file-like object | ||
return data.read() | ||
|
||
msg = "Unknown websocket data type" | ||
raise TypeError(msg) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters