wslink 2.3.0__tar.gz → 2.3.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. {wslink-2.3.0 → wslink-2.3.1}/PKG-INFO +1 -1
  2. {wslink-2.3.0 → wslink-2.3.1}/setup.cfg +1 -1
  3. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/emitter.py +23 -13
  4. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/websocket.py +1 -6
  5. {wslink-2.3.0 → wslink-2.3.1}/src/wslink.egg-info/PKG-INFO +1 -1
  6. {wslink-2.3.0 → wslink-2.3.1}/MANIFEST.in +0 -0
  7. {wslink-2.3.0 → wslink-2.3.1}/README.rst +0 -0
  8. {wslink-2.3.0 → wslink-2.3.1}/setup.py +0 -0
  9. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/LICENSE +0 -0
  10. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/__init__.py +0 -0
  11. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/__init__.py +0 -0
  12. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/aiohttp/__init__.py +0 -0
  13. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/aiohttp/launcher.py +0 -0
  14. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/aiohttp/relay.py +0 -0
  15. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/generic/__init__.py +0 -0
  16. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/generic/core.py +0 -0
  17. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/jupyter/__init__.py +0 -0
  18. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/jupyter/core.py +0 -0
  19. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/tornado/__init__.py +0 -0
  20. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/backends/tornado/core.py +0 -0
  21. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/chunking.py +0 -0
  22. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/launcher.py +0 -0
  23. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/protocol.py +0 -0
  24. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/publish.py +0 -0
  25. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/relay.py +0 -0
  26. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/server.py +0 -0
  27. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/ssl_context.py +0 -0
  28. {wslink-2.3.0 → wslink-2.3.1}/src/wslink/uri.py +0 -0
  29. {wslink-2.3.0 → wslink-2.3.1}/src/wslink.egg-info/SOURCES.txt +0 -0
  30. {wslink-2.3.0 → wslink-2.3.1}/src/wslink.egg-info/dependency_links.txt +0 -0
  31. {wslink-2.3.0 → wslink-2.3.1}/src/wslink.egg-info/requires.txt +0 -0
  32. {wslink-2.3.0 → wslink-2.3.1}/src/wslink.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wslink
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Python/JavaScript library for communicating over WebSocket
5
5
  Home-page: https://github.com/kitware/wslink
6
6
  Author: Kitware, Inc.
@@ -1,5 +1,5 @@
1
1
  [metadata]
2
- version = 2.3.0
2
+ version = 2.3.1
3
3
 
4
4
  [egg_info]
5
5
  tag_build =
@@ -1,26 +1,36 @@
1
- from typing import TypeVar, Generic, LiteralString
2
-
3
1
  import asyncio
4
2
  import functools
5
3
 
6
4
 
7
- T = TypeVar("T", bound=LiteralString)
8
-
9
-
10
- class EventEmitter(Generic[T]):
5
+ class EventEmitter:
11
6
  def __init__(self):
12
7
  self._listeners = {}
13
8
 
14
9
  def clear(self):
15
10
  self._listeners = {}
16
11
 
17
- def __call__(self, event: T, *args, **kwargs):
12
+ def __call__(self, event, *args, **kwargs):
18
13
  self.emit(event, *args, **kwargs)
19
14
 
20
- def __getattr__(self, name: T):
15
+ def __getattr__(self, name):
21
16
  return functools.partial(self.emit, name)
22
17
 
23
- def emit(self, event: T, *args, **kwargs):
18
+ def exception(self, *args, **kwargs):
19
+ self.emit("exception", *args, **kwargs)
20
+
21
+ def error(self, *args, **kwargs):
22
+ self.emit("error", *args, **kwargs)
23
+
24
+ def critical(self, *args, **kwargs):
25
+ self.emit("critical", *args, **kwargs)
26
+
27
+ def info(self, *args, **kwargs):
28
+ self.emit("info", *args, **kwargs)
29
+
30
+ def debug(self, *args, **kwargs):
31
+ self.emit("debug", *args, **kwargs)
32
+
33
+ def emit(self, event, *args, **kwargs):
24
34
  listeners = self._listeners.get(event)
25
35
  if listeners is None:
26
36
  return
@@ -36,7 +46,7 @@ class EventEmitter(Generic[T]):
36
46
  else:
37
47
  listener(*args, **kwargs)
38
48
 
39
- def add_event_listener(self, event: T, listener):
49
+ def add_event_listener(self, event, listener):
40
50
  listeners = self._listeners.get(event)
41
51
  if listeners is None:
42
52
  listeners = set()
@@ -44,7 +54,7 @@ class EventEmitter(Generic[T]):
44
54
 
45
55
  listeners.add(listener)
46
56
 
47
- def remove_event_listener(self, event: T, listener):
57
+ def remove_event_listener(self, event, listener):
48
58
  listeners = self._listeners.get(event)
49
59
  if listeners is None:
50
60
  return
@@ -52,10 +62,10 @@ class EventEmitter(Generic[T]):
52
62
  if listener in listeners:
53
63
  listeners.remove(listener)
54
64
 
55
- def has(self, event: T):
65
+ def has(self, event):
56
66
  return self.listeners_count(event) > 0
57
67
 
58
- def listeners_count(self, event: T):
68
+ def listeners_count(self, event):
59
69
  listeners = self._listeners.get(event)
60
70
  if listeners is None:
61
71
  return 0
@@ -6,8 +6,6 @@ ServerProtocol to hook all the needed LinkProtocols together.
6
6
 
7
7
  import logging
8
8
  import asyncio
9
- from typing import Literal
10
- from dataclasses import dataclass
11
9
 
12
10
  from wslink import register as exportRpc
13
11
  from wslink import schedule_callback
@@ -120,9 +118,6 @@ class NetworkMonitor:
120
118
  await self.event.wait()
121
119
 
122
120
 
123
- LogEmitterEvents = Literal["exception", "error", "critical", "info", "debug"]
124
-
125
-
126
121
  class ServerProtocol(object):
127
122
  """
128
123
  Defines the core server protocol for wslink. Gathers a list of LinkProtocol
@@ -131,7 +126,7 @@ class ServerProtocol(object):
131
126
 
132
127
  def __init__(self):
133
128
  self.network_monitor = NetworkMonitor()
134
- self.log_emitter = EventEmitter[LogEmitterEvents]()
129
+ self.log_emitter = EventEmitter()
135
130
  self.linkProtocols = []
136
131
  self.secret = None
137
132
  self.initialize()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wslink
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Python/JavaScript library for communicating over WebSocket
5
5
  Home-page: https://github.com/kitware/wslink
6
6
  Author: Kitware, Inc.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes