wslink 2.2.0__tar.gz → 2.2.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. {wslink-2.2.0 → wslink-2.2.1}/PKG-INFO +1 -1
  2. {wslink-2.2.0 → wslink-2.2.1}/setup.cfg +1 -1
  3. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/websocket.py +15 -0
  4. {wslink-2.2.0 → wslink-2.2.1}/src/wslink.egg-info/PKG-INFO +1 -1
  5. {wslink-2.2.0 → wslink-2.2.1}/MANIFEST.in +0 -0
  6. {wslink-2.2.0 → wslink-2.2.1}/README.rst +0 -0
  7. {wslink-2.2.0 → wslink-2.2.1}/setup.py +0 -0
  8. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/LICENSE +0 -0
  9. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/__init__.py +0 -0
  10. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/__init__.py +0 -0
  11. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/aiohttp/__init__.py +0 -0
  12. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/aiohttp/launcher.py +0 -0
  13. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/aiohttp/relay.py +0 -0
  14. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/generic/__init__.py +0 -0
  15. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/generic/core.py +0 -0
  16. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/jupyter/__init__.py +0 -0
  17. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/jupyter/core.py +0 -0
  18. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/tornado/__init__.py +0 -0
  19. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/backends/tornado/core.py +0 -0
  20. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/chunking.py +0 -0
  21. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/launcher.py +0 -0
  22. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/protocol.py +0 -0
  23. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/publish.py +0 -0
  24. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/relay.py +0 -0
  25. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/server.py +0 -0
  26. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/ssl_context.py +0 -0
  27. {wslink-2.2.0 → wslink-2.2.1}/src/wslink/uri.py +0 -0
  28. {wslink-2.2.0 → wslink-2.2.1}/src/wslink.egg-info/SOURCES.txt +0 -0
  29. {wslink-2.2.0 → wslink-2.2.1}/src/wslink.egg-info/dependency_links.txt +0 -0
  30. {wslink-2.2.0 → wslink-2.2.1}/src/wslink.egg-info/requires.txt +0 -0
  31. {wslink-2.2.0 → wslink-2.2.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.2.0
3
+ Version: 2.2.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.2.0
2
+ version = 2.2.1
3
3
 
4
4
  [egg_info]
5
5
  tag_build =
@@ -67,17 +67,28 @@ class LinkProtocol(object):
67
67
 
68
68
 
69
69
  class NetworkMonitor:
70
+ """
71
+ Provide context manager for increase/decrease pending request
72
+ either synchronously or asynchronously.
73
+
74
+ The Asynchronous version also await completion.
75
+ """
76
+
70
77
  def __init__(self):
78
+
71
79
  self.pending = 0
72
80
  self.event = asyncio.Event()
73
81
 
74
82
  def network_call_completed(self):
83
+ """Trigger completion event"""
75
84
  self.event.set()
76
85
 
77
86
  def on_enter(self, *args, **kwargs):
87
+ """Increase pending request"""
78
88
  self.pending += 1
79
89
 
80
90
  def on_exit(self, *args, **kwargs):
91
+ """Decrease pending request and trigger completion event if we reach 0 pending request"""
81
92
  self.pending -= 1
82
93
  if self.pending == 0 and not self.event.is_set():
83
94
  self.event.set()
@@ -97,6 +108,10 @@ class NetworkMonitor:
97
108
 
98
109
  async def __aexit__(self, exc_t, exc_v, exc_tb):
99
110
  self.on_exit()
111
+ await self.completion()
112
+
113
+ async def completion(self):
114
+ """Await completion of any pending network request"""
100
115
  while self.pending:
101
116
  self.event.clear()
102
117
  await self.event.wait()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wslink
3
- Version: 2.2.0
3
+ Version: 2.2.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