portal 3.1.1__tar.gz → 3.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {portal-3.1.1/portal.egg-info → portal-3.1.2}/PKG-INFO +1 -1
- {portal-3.1.1 → portal-3.1.2}/portal/__init__.py +1 -1
- {portal-3.1.1 → portal-3.1.2}/portal/client_socket.py +3 -7
- {portal-3.1.1 → portal-3.1.2}/portal/contextlib.py +10 -0
- {portal-3.1.1 → portal-3.1.2}/portal/server_socket.py +2 -7
- {portal-3.1.1 → portal-3.1.2/portal.egg-info}/PKG-INFO +1 -1
- {portal-3.1.1 → portal-3.1.2}/LICENSE +0 -0
- {portal-3.1.1 → portal-3.1.2}/MANIFEST.in +0 -0
- {portal-3.1.1 → portal-3.1.2}/README.md +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/batching.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/buffers.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/client.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/packlib.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/poollib.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/process.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/server.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/sharray.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/thread.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal/utils.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal.egg-info/SOURCES.txt +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal.egg-info/dependency_links.txt +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal.egg-info/requires.txt +0 -0
- {portal-3.1.1 → portal-3.1.2}/portal.egg-info/top_level.txt +0 -0
- {portal-3.1.1 → portal-3.1.2}/pyproject.toml +0 -0
- {portal-3.1.1 → portal-3.1.2}/requirements.txt +0 -0
- {portal-3.1.1 → portal-3.1.2}/setup.cfg +0 -0
- {portal-3.1.1 → portal-3.1.2}/setup.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_batching.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_client.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_errfile.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_pack.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_process.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_server.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_socket.py +0 -0
- {portal-3.1.1 → portal-3.1.2}/tests/test_thread.py +0 -0
@@ -10,7 +10,6 @@ import time
|
|
10
10
|
from . import buffers
|
11
11
|
from . import contextlib
|
12
12
|
from . import thread
|
13
|
-
from . import utils
|
14
13
|
|
15
14
|
|
16
15
|
class Disconnected(Exception):
|
@@ -39,6 +38,7 @@ class ClientSocket:
|
|
39
38
|
if port is None:
|
40
39
|
host, port = host.rsplit(':', 1)
|
41
40
|
port = int(port)
|
41
|
+
assert host, host
|
42
42
|
self.addr = (host, port)
|
43
43
|
self.name = name
|
44
44
|
self.options = Options(**{**contextlib.context.clientkw, **kwargs})
|
@@ -227,9 +227,5 @@ class ClientSocket:
|
|
227
227
|
def _log(self, *args):
|
228
228
|
if not self.options.logging:
|
229
229
|
return
|
230
|
-
|
231
|
-
|
232
|
-
reset = utils.style(reset=True)
|
233
|
-
else:
|
234
|
-
style, reset = '', ''
|
235
|
-
print(style + f'[{self.name}]' + reset, *args)
|
230
|
+
contextlib.context.print(
|
231
|
+
self.name, *args, color=self.options.logging_color)
|
@@ -96,6 +96,16 @@ class Context:
|
|
96
96
|
self.initfns.append(pkl)
|
97
97
|
call_now and fn()
|
98
98
|
|
99
|
+
def print(self, name, *args, color=None):
|
100
|
+
assert args
|
101
|
+
if color:
|
102
|
+
style = utils.style(color=color)
|
103
|
+
reset = utils.style(reset=True)
|
104
|
+
else:
|
105
|
+
style, reset = '', ''
|
106
|
+
with self.printlock:
|
107
|
+
print(style + f'[{name}]' + reset, *args)
|
108
|
+
|
99
109
|
def error(self, e, name=None):
|
100
110
|
typ, tb = type(e), e.__traceback__
|
101
111
|
summary = list(traceback.format_exception_only(typ, e))[0].strip('\n')
|
@@ -7,7 +7,6 @@ import socket
|
|
7
7
|
from . import buffers
|
8
8
|
from . import contextlib
|
9
9
|
from . import thread
|
10
|
-
from . import utils
|
11
10
|
|
12
11
|
|
13
12
|
class Connection:
|
@@ -164,9 +163,5 @@ class ServerSocket:
|
|
164
163
|
def _log(self, *args, **kwargs):
|
165
164
|
if not self.options.logging:
|
166
165
|
return
|
167
|
-
|
168
|
-
|
169
|
-
reset = utils.style(reset=True)
|
170
|
-
else:
|
171
|
-
style, reset = '', ''
|
172
|
-
print(style + f'[{self.name}]' + reset, *args)
|
166
|
+
contextlib.context.print(
|
167
|
+
self.name, *args, color=self.options.logging_color)
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|