Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-python-socketio for openSUSE:Factory checked in at 2021-10-26 20:13:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-socketio (Old) and /work/SRC/openSUSE:Factory/.python-python-socketio.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-socketio" Tue Oct 26 20:13:43 2021 rev:4 rq:927348 version:5.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-socketio/python-python-socketio.changes 2021-10-06 19:50:05.652060926 +0200 +++ /work/SRC/openSUSE:Factory/.python-python-socketio.new.1890/python-python-socketio.changes 2021-10-26 20:14:22.950031635 +0200 @@ -1,0 +2,7 @@ +Sat Oct 23 16:21:35 UTC 2021 - Axel Braun <axel.br...@gmx.de> + +- version 5.4.1 + * Catch-all event handlers (commit) + * Implement disconnect method for external processes #684 (commit) + +------------------------------------------------------------------- Old: ---- python-socketio-5.4.0.tar.gz New: ---- python-socketio-5.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-socketio.spec ++++++ --- /var/tmp/diff_new_pack.6ttSnF/_old 2021-10-26 20:14:23.378031862 +0200 +++ /var/tmp/diff_new_pack.6ttSnF/_new 2021-10-26 20:14:23.378031862 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-python-socketio -Version: 5.4.0 +Version: 5.4.1 Release: 0 Summary: SocketIO server License: MIT ++++++ python-socketio-5.4.0.tar.gz -> python-socketio-5.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/.github/ISSUE_TEMPLATE/config.yml new/python-socketio-5.4.1/.github/ISSUE_TEMPLATE/config.yml --- old/python-socketio-5.4.0/.github/ISSUE_TEMPLATE/config.yml 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/.github/ISSUE_TEMPLATE/config.yml 2021-10-14 21:19:50.000000000 +0200 @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: GitHub Discussions - url: https://github.com/miguelgrinberg/Flask-SocketIO/discussions + url: https://github.com/miguelgrinberg/python-socketio/discussions about: Ask questions here. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/CHANGES.md new/python-socketio-5.4.1/CHANGES.md --- old/python-socketio-5.4.0/CHANGES.md 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/CHANGES.md 2021-10-14 21:19:50.000000000 +0200 @@ -1,5 +1,10 @@ # python-socketio change log +**Release 5.4.1** - 2021-10-14 + +- Catch-all event handlers ([commit](https://github.com/miguelgrinberg/python-socketio/commit/28569d48ad74d5414a0d2a8f69d7540dbdddf066)) +- Implement disconnect method for external processes [#684](https://github.com/miguelgrinberg/python-socketio/issues/684) ([commit](https://github.com/miguelgrinberg/python-socketio/commit/a830c9f7887df715227f4284f30e8d62680e58ce)) + **Release 5.4.0** - 2021-08-02 - Support msgpack and custom packet serializers [#749](https://github.com/miguelgrinberg/python-socketio/issues/749) ([commit](https://github.com/miguelgrinberg/python-socketio/commit/5159e84c49daaf2da0579bfc6ee954a9c738a076)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/docs/client.rst new/python-socketio-5.4.1/docs/client.rst --- old/python-socketio-5.4.0/docs/client.rst 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/docs/client.rst 2021-10-14 21:19:50.000000000 +0200 @@ -65,6 +65,28 @@ async def message(data): print('I received a message!') +Catch-All Event Handlers +------------------------ + +A "catch-all" event handler is invoked for any events that do not have an +event handler. You can define a catch-all handler using ``'*'`` as event name:: + + @sio.on('*') + def catch_all(event, sid, data): + pass + +Asyncio clients can also use a coroutine:: + + @sio.on('*') + async def catch_all(event, sid, data): + pass + +A catch-all event handler receives the event name as a first argument. The +remaining arguments are the same as for a regular event handler. + +Connect, Connect Error and Disconnect Event Handlers +---------------------------------------------------- + The ``connect``, ``connect_error`` and ``disconnect`` events are special; they are invoked automatically when a client connects or disconnects from the server:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/docs/server.rst new/python-socketio-5.4.1/docs/server.rst --- old/python-socketio-5.4.0/docs/server.rst 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/docs/server.rst 2021-10-14 21:19:50.000000000 +0200 @@ -178,6 +178,28 @@ client connection. All the events sent by a given client will have the same ``sid`` value. +Catch-All Event Handlers +------------------------ + +A "catch-all" event handler is invoked for any events that do not have an +event handler. You can define a catch-all handler using ``'*'`` as event name:: + + @sio.on('*') + def catch_all(event, sid, data): + pass + +Asyncio servers can also use a coroutine:: + + @sio.on('*') + async def catch_all(event, sid, data): + pass + +A catch-all event handler receives the event name as a first argument. The +remaining arguments are the same as for a regular event handler. + +Connect and Disconnect Event Handlers +------------------------------------- + The ``connect`` and ``disconnect`` events are special; they are invoked automatically when a client connects or disconnects from the server:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/setup.cfg new/python-socketio-5.4.1/setup.cfg --- old/python-socketio-5.4.0/setup.cfg 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/setup.cfg 2021-10-14 21:19:50.000000000 +0200 @@ -1,6 +1,6 @@ [metadata] name = python-socketio -version = 5.4.0 +version = 5.4.1 author = Miguel Grinberg author_email = miguel.grinb...@gmail.com description = Socket.IO server and client for Python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/src/socketio/asyncio_client.py new/python-socketio-5.4.1/src/socketio/asyncio_client.py --- old/python-socketio-5.4.0/src/socketio/asyncio_client.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/src/socketio/asyncio_client.py 2021-10-14 21:19:50.000000000 +0200 @@ -418,15 +418,22 @@ async def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event - if namespace in self.handlers and event in self.handlers[namespace]: - if asyncio.iscoroutinefunction(self.handlers[namespace][event]): - try: - ret = await self.handlers[namespace][event](*args) - except asyncio.CancelledError: # pragma: no cover - ret = None - else: - ret = self.handlers[namespace][event](*args) - return ret + if namespace in self.handlers: + handler = None + if event in self.handlers[namespace]: + handler = self.handlers[namespace][event] + elif '*' in self.handlers[namespace]: + handler = self.handlers[namespace]['*'] + args = (event, *args) + if handler: + if asyncio.iscoroutinefunction(handler): + try: + ret = await handler(*args) + except asyncio.CancelledError: # pragma: no cover + ret = None + else: + ret = handler(*args) + return ret # or else, forward the event to a namepsace handler if one exists elif namespace in self.namespace_handlers: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/src/socketio/asyncio_server.py new/python-socketio-5.4.1/src/socketio/asyncio_server.py --- old/python-socketio-5.4.0/src/socketio/asyncio_server.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/src/socketio/asyncio_server.py 2021-10-14 21:19:50.000000000 +0200 @@ -524,16 +524,22 @@ async def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event - if namespace in self.handlers and event in self.handlers[namespace]: - if asyncio.iscoroutinefunction(self.handlers[namespace][event]) \ - is True: - try: - ret = await self.handlers[namespace][event](*args) - except asyncio.CancelledError: # pragma: no cover - ret = None - else: - ret = self.handlers[namespace][event](*args) - return ret + if namespace in self.handlers: + handler = None + if event in self.handlers[namespace]: + handler = self.handlers[namespace][event] + elif '*' in self.handlers[namespace]: + handler = self.handlers[namespace]['*'] + args = (event, *args) + if handler: + if asyncio.iscoroutinefunction(handler): + try: + ret = await handler(*args) + except asyncio.CancelledError: # pragma: no cover + ret = None + else: + ret = handler(*args) + return ret # or else, forward the event to a namepsace handler if one exists elif namespace in self.namespace_handlers: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/src/socketio/client.py new/python-socketio-5.4.1/src/socketio/client.py --- old/python-socketio-5.4.0/src/socketio/client.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/src/socketio/client.py 2021-10-14 21:19:50.000000000 +0200 @@ -609,8 +609,11 @@ def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event - if namespace in self.handlers and event in self.handlers[namespace]: - return self.handlers[namespace][event](*args) + if namespace in self.handlers: + if event in self.handlers[namespace]: + return self.handlers[namespace][event](*args) + elif '*' in self.handlers[namespace]: + return self.handlers[namespace]['*'](event, *args) # or else, forward the event to a namespace handler if one exists elif namespace in self.namespace_handlers: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/src/socketio/pubsub_manager.py new/python-socketio-5.4.1/src/socketio/pubsub_manager.py --- old/python-socketio-5.4.0/src/socketio/pubsub_manager.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/src/socketio/pubsub_manager.py 2021-10-14 21:19:50.000000000 +0200 @@ -75,6 +75,10 @@ self._publish({'method': 'disconnect', 'sid': sid, 'namespace': namespace or '/'}) + def disconnect(self, sid, namespace=None): + self._publish({'method': 'disconnect', 'sid': sid, + 'namespace': namespace or '/'}) + def close_room(self, room, namespace=None): self._publish({'method': 'close_room', 'room': room, 'namespace': namespace or '/'}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/src/socketio/server.py new/python-socketio-5.4.1/src/socketio/server.py --- old/python-socketio-5.4.0/src/socketio/server.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/src/socketio/server.py 2021-10-14 21:19:50.000000000 +0200 @@ -732,8 +732,11 @@ def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event - if namespace in self.handlers and event in self.handlers[namespace]: - return self.handlers[namespace][event](*args) + if namespace in self.handlers: + if event in self.handlers[namespace]: + return self.handlers[namespace][event](*args) + elif '*' in self.handlers[namespace]: + return self.handlers[namespace]['*'](event, *args) # or else, forward the event to a namespace handler if one exists elif namespace in self.namespace_handlers: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/tests/asyncio/test_asyncio_client.py new/python-socketio-5.4.1/tests/asyncio/test_asyncio_client.py --- old/python-socketio-5.4.0/tests/asyncio/test_asyncio_client.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/tests/asyncio/test_asyncio_client.py 2021-10-14 21:19:50.000000000 +0200 @@ -833,16 +833,24 @@ def test_trigger_event(self): c = asyncio_client.AsyncClient() handler = mock.MagicMock() + catchall_handler = mock.MagicMock() c.on('foo', handler) + c.on('*', catchall_handler) _run(c._trigger_event('foo', '/', 1, '2')) + _run(c._trigger_event('bar', '/', 1, '2', 3)) handler.assert_called_once_with(1, '2') + catchall_handler.assert_called_once_with('bar', 1, '2', 3) def test_trigger_event_namespace(self): c = asyncio_client.AsyncClient() handler = AsyncMock() + catchall_handler = AsyncMock() c.on('foo', handler, namespace='/bar') + c.on('*', catchall_handler, namespace='/bar') _run(c._trigger_event('foo', '/bar', 1, '2')) + _run(c._trigger_event('bar', '/bar', 1, '2', 3)) handler.mock.assert_called_once_with(1, '2') + catchall_handler.mock.assert_called_once_with('bar', 1, '2', 3) def test_trigger_event_class_namespace(self): c = asyncio_client.AsyncClient() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/tests/asyncio/test_asyncio_server.py new/python-socketio-5.4.1/tests/asyncio/test_asyncio_server.py --- old/python-socketio-5.4.0/tests/asyncio/test_asyncio_server.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/tests/asyncio/test_asyncio_server.py 2021-10-14 21:19:50.000000000 +0200 @@ -618,18 +618,28 @@ s = asyncio_server.AsyncServer(async_handlers=False) sid = s.manager.connect('123', '/') handler = AsyncMock() - s.on('my message', handler) + catchall_handler = AsyncMock() + s.on('msg', handler) + s.on('*', catchall_handler) + _run(s._handle_eio_message('123', '2["msg","a","b"]')) _run(s._handle_eio_message('123', '2["my message","a","b","c"]')) - handler.mock.assert_called_once_with(sid, 'a', 'b', 'c') + handler.mock.assert_called_once_with(sid, 'a', 'b') + catchall_handler.mock.assert_called_once_with( + 'my message', sid, 'a', 'b', 'c') def test_handle_event_with_namespace(self, eio): eio.return_value.send = AsyncMock() s = asyncio_server.AsyncServer(async_handlers=False) sid = s.manager.connect('123', '/foo') handler = mock.MagicMock() - s.on('my message', handler, namespace='/foo') + catchall_handler = mock.MagicMock() + s.on('msg', handler, namespace='/foo') + s.on('*', catchall_handler, namespace='/foo') + _run(s._handle_eio_message('123', '2/foo,["msg","a","b"]')) _run(s._handle_eio_message('123', '2/foo,["my message","a","b","c"]')) - handler.assert_called_once_with(sid, 'a', 'b', 'c') + handler.assert_called_once_with(sid, 'a', 'b') + catchall_handler.assert_called_once_with( + 'my message', sid, 'a', 'b', 'c') def test_handle_event_with_disconnected_namespace(self, eio): eio.return_value.send = AsyncMock() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/tests/common/test_client.py new/python-socketio-5.4.1/tests/common/test_client.py --- old/python-socketio-5.4.0/tests/common/test_client.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/tests/common/test_client.py 2021-10-14 21:19:50.000000000 +0200 @@ -934,16 +934,24 @@ def test_trigger_event(self): c = client.Client() handler = mock.MagicMock() + catchall_handler = mock.MagicMock() c.on('foo', handler) + c.on('*', catchall_handler) c._trigger_event('foo', '/', 1, '2') + c._trigger_event('bar', '/', 1, '2', 3) handler.assert_called_once_with(1, '2') + catchall_handler.assert_called_once_with('bar', 1, '2', 3) def test_trigger_event_namespace(self): c = client.Client() handler = mock.MagicMock() + catchall_handler = mock.MagicMock() c.on('foo', handler, namespace='/bar') + c.on('*', catchall_handler, namespace='/bar') c._trigger_event('foo', '/bar', 1, '2') + c._trigger_event('bar', '/bar', 1, '2', 3) handler.assert_called_once_with(1, '2') + catchall_handler.assert_called_once_with('bar', 1, '2', 3) def test_trigger_event_class_namespace(self): c = client.Client() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/tests/common/test_pubsub_manager.py new/python-socketio-5.4.1/tests/common/test_pubsub_manager.py --- old/python-socketio-5.4.0/tests/common/test_pubsub_manager.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/tests/common/test_pubsub_manager.py 2021-10-14 21:19:50.000000000 +0200 @@ -169,6 +169,12 @@ {'method': 'disconnect', 'sid': sid, 'namespace': '/foo'} ) + def test_disconnect(self): + self.pm.disconnect('foo') + self.pm._publish.assert_called_once_with( + {'method': 'disconnect', 'sid': 'foo', 'namespace': '/'} + ) + def test_close_room(self): self.pm.close_room('foo') self.pm._publish.assert_called_once_with( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-socketio-5.4.0/tests/common/test_server.py new/python-socketio-5.4.1/tests/common/test_server.py --- old/python-socketio-5.4.0/tests/common/test_server.py 2021-08-02 01:15:24.000000000 +0200 +++ new/python-socketio-5.4.1/tests/common/test_server.py 2021-10-14 21:19:50.000000000 +0200 @@ -546,17 +546,27 @@ s = server.Server(async_handlers=False) s.manager.connect('123', '/') handler = mock.MagicMock() - s.on('my message', handler) + catchall_handler = mock.MagicMock() + s.on('msg', handler) + s.on('*', catchall_handler) + s._handle_eio_message('123', '2["msg","a","b"]') s._handle_eio_message('123', '2["my message","a","b","c"]') - handler.assert_called_once_with('1', 'a', 'b', 'c') + handler.assert_called_once_with('1', 'a', 'b') + catchall_handler.assert_called_once_with( + 'my message', '1', 'a', 'b', 'c') def test_handle_event_with_namespace(self, eio): s = server.Server(async_handlers=False) s.manager.connect('123', '/foo') handler = mock.MagicMock() - s.on('my message', handler, namespace='/foo') + catchall_handler = mock.MagicMock() + s.on('msg', handler, namespace='/foo') + s.on('*', catchall_handler, namespace='/foo') + s._handle_eio_message('123', '2/foo,["msg","a","b"]') s._handle_eio_message('123', '2/foo,["my message","a","b","c"]') - handler.assert_called_once_with('1', 'a', 'b', 'c') + handler.assert_called_once_with('1', 'a', 'b') + catchall_handler.assert_called_once_with( + 'my message', '1', 'a', 'b', 'c') def test_handle_event_with_disconnected_namespace(self, eio): s = server.Server(async_handlers=False)