Skip to content

Commit

Permalink
2.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCommCraft committed Jun 11, 2024
1 parent 82df4cd commit c638bf9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scratchcommunication/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module for communicating with scratch projects.
"""

__version_number__ = '2.10.1'
__version_number__ = '2.10.2'

from .session import *
from .cloud import *
Expand Down
1 change: 0 additions & 1 deletion scratchcommunication/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from websocket import WebSocket, WebSocketConnectionClosedException, WebSocketTimeoutException

NoneType = type(None)
CloudConnection = None

class EventDispatcher(Protocol):
def __call__(self, data : dict, **entries) -> None:
Expand Down
2 changes: 1 addition & 1 deletion scratchcommunication/cloud_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
pass
self.stop()

@staticmethod
def _decode(data : int) -> str:
Expand Down
14 changes: 10 additions & 4 deletions scratchcommunication/cloudrequests/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ def request(self, func : FunctionType = None, *, name : str = None, auto_convert
Decorator for adding requests.
"""
if func:
func.__name__ = name or func.__name__
func.__req_name__ = name or func.__name__
func.auto_convert = auto_convert
func.allow_python_syntax = allow_python_syntax
func.thread = thread
self.requests[func.__name__] = func
self.requests[func.__req_name__] = func
return
return lambda x : self.request(x, name=name, auto_convert=auto_convert, allow_python_syntax=allow_python_syntax)

def add_request(self, func : FunctionType, *, name : str = None, auto_convert : bool = False, allow_python_syntax : bool = True, thread : bool = False):
"""
Method for adding requests.
"""
func.__name__ = name or func.__name__
func.__req_name__ = name or func.__name__
func.auto_convert = auto_convert
func.allow_python_syntax = allow_python_syntax
func.thread = thread
self.requests[func.__name__] = func
self.requests[func.__req_name__] = func

def start(self, *, thread : bool = None, daemon_thread : bool = False, duration : Union[float, int, None] = None):
"""
Expand Down Expand Up @@ -128,6 +128,12 @@ def stop(self):
with self.cloud_socket.any_update:
self.cloud_socket.any_update.notify_all()
self.thread.join(5)

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
self.stop()


KW = Parameter.KEYWORD_ONLY
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
with open("README.md", encoding="utf-8") as f:
long_description = f.read()

VERSION = '2.10.1'
VERSION = '2.10.2'

setup(
name='scratchcommunication',
Expand Down

0 comments on commit c638bf9

Please sign in to comment.