unisi 0.4.5__py3-none-any.whl → 0.4.6__py3-none-any.whl

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.
unisi/__init__.py CHANGED
@@ -2,7 +2,7 @@ from .utils import *
2
2
  from .llmrag import Q, Qx
3
3
  from .units import *
4
4
  from .users import User
5
- from .server import start, handle, context_user, context_screen
5
+ from .server import start, handle, test, context_user, context_screen
6
6
  from .tables import *
7
7
  from .containers import *
8
8
  from .proxy import *
unisi/autotest.py CHANGED
@@ -181,7 +181,17 @@ def check_module(module):
181
181
  errors.insert(0, f"\nErrors in screen {screen.name}, file name {module.__file__}:")
182
182
  return errors
183
183
 
184
- def run_tests(user):
184
+ def run_tests(user):
185
+ if config.autotest:
186
+ for test_fn in Unishare.test_list:
187
+ try:
188
+ if asyncio.iscoroutinefunction(test_fn):
189
+ asyncio.run(test_fn())
190
+ else:
191
+ test_fn()
192
+ except Exception as e:
193
+ user.log(f'Test function {test_fn.__name__} failed with exception: {e}')
194
+
185
195
  errors = []
186
196
  for module in user.screens:
187
197
  module_errors = check_module(module)
unisi/server.py CHANGED
@@ -85,6 +85,12 @@ def handle(unit, event):
85
85
 
86
86
  Unishare.handle = handle
87
87
 
88
+ Unishare.test_list = []
89
+
90
+ def test(fn):
91
+ Unishare.test_list.append(fn)
92
+ return fn
93
+
88
94
  async def post_handler(request):
89
95
  reader = await request.multipart()
90
96
  field = await reader.next()
unisi/units.py CHANGED
@@ -49,7 +49,10 @@ class ChangedProxy:
49
49
  self._unit._mark_changed ()
50
50
 
51
51
  def __iter__(self):
52
- return iter(self._obj)
52
+ for item in self._obj:
53
+ if not callable(item) and not isinstance(item, atomics):
54
+ item = ChangedProxy(item, self._unit)
55
+ yield item
53
56
 
54
57
  def __len__(self):
55
58
  try:
@@ -69,8 +72,7 @@ class ChangedProxy:
69
72
 
70
73
  def __getstate__(self):
71
74
  return self._obj
72
-
73
- atomics = (int, float, complex, bool, str, bytes, ChangedProxy, type(None))
75
+
74
76
 
75
77
  class Unit:
76
78
  action_list = set(['complete', 'update', 'changed','delete','append', 'modify'])
@@ -108,6 +110,8 @@ class Unit:
108
110
  #it is correct condition order
109
111
  if name[0] != "_" and self._mark_changed:
110
112
  self._mark_changed(name, value)
113
+ if not callable(value) and not isinstance(value, atomics):
114
+ value = ChangedProxy(value, self)
111
115
  super().__setattr__(name, value)
112
116
 
113
117
  def mutate(self, obj):
@@ -169,6 +173,8 @@ class Unit:
169
173
 
170
174
  def __repr__(self):
171
175
  return f'{type(self).__name__}({self.name})'
176
+
177
+ atomics = (int, float, complex, bool, str, bytes, ChangedProxy, type(None), Unit)
172
178
 
173
179
  Line = Unit("__Line__", type = 'line')
174
180
 
unisi/users.py CHANGED
@@ -96,10 +96,10 @@ class User:
96
96
  setattr(screen, var, getattr(module, var, val))
97
97
  if not isinstance(screen.blocks, list):
98
98
  screen.blocks = [screen.blocks]
99
- if screen.toolbar:
99
+
100
+ if User.toolbar and User.toolbar[0] not in screen.toolbar:
100
101
  screen.toolbar += User.toolbar
101
- else:
102
- screen.toolbar = User.toolbar
102
+
103
103
  if User.count > 0:
104
104
  screen.set_reactivity(self)
105
105
  module.screen = screen#ChangedProxy(screen, screen)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unisi
3
- Version: 0.4.5
3
+ Version: 0.4.6
4
4
  Summary: Unified System Interface, GUI and Remote API
5
5
  Author-Email: UNISI Tech <g.dernovoy@gmail.com>
6
6
  License: Apache-2.0
@@ -1,9 +1,9 @@
1
- unisi-0.4.5.dist-info/METADATA,sha256=F9i5Z3CMamg7aIz3ozUXFaLyu9HtxwXKMuE1JT0h44M,27294
2
- unisi-0.4.5.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- unisi-0.4.5.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- unisi-0.4.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
- unisi/__init__.py,sha256=IDN0JIutBidYTSYd6mM8ST4YU7WufpOFt_8OqHoPHyg,305
6
- unisi/autotest.py,sha256=M6T8q1Yutqr1A1qUBBbdI3LpTlS7ejiGtfdZ9Yvyfqw,8942
1
+ unisi-0.4.6.dist-info/METADATA,sha256=y5IRgwr-ybfc7Aokz81UFXfCXFLPNOhPOaRB6RxcgnA,27294
2
+ unisi-0.4.6.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ unisi-0.4.6.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ unisi-0.4.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
+ unisi/__init__.py,sha256=XGnpUm_JhO5D41VSq_uEL-6hdtvwT8FZJ-pOVqApf9g,311
6
+ unisi/autotest.py,sha256=lQ22S9n01SWFc2dzpA3qgDriGLiz-hQRBrMc2UkZaFE,9324
7
7
  unisi/common.py,sha256=QHSS-pQDtLZxeZls0eDl8-EmYJZuaRmYO1M9izCly-Y,5791
8
8
  unisi/containers.py,sha256=yl5CZrTK3HmNJJxpO7SmzIIsBMehwfCb_otaWG7GriM,7416
9
9
  unisi/dbunits.py,sha256=g1h9pjoSwJrJ0Hmph-xv5jE1yfrxJeXGfuSnyVTg3j8,7438
@@ -18,10 +18,10 @@ unisi/llmrag.py,sha256=HCEP8apy0FtIbLm0koG8BxCxjXS12Xqlo-9fZkGbsDs,12576
18
18
  unisi/multimon.py,sha256=YKwCuvMsMfdgOGkJoqiqh_9wywXMeo9bUhHmbAIUeSE,4060
19
19
  unisi/proxy.py,sha256=QMHSSFJtmVZIexIMAsuFNlF5JpnYNG90rkTM3PYJhY4,7750
20
20
  unisi/reloader.py,sha256=t7z0NgaeJX52044ue_LxITa99WMuE5Jra9qkMEeGhTg,6941
21
- unisi/server.py,sha256=zN2qGA2h-Bb3uJjUOAjkiRmmOIuDD6Ti_mNE62FTG_M,6667
21
+ unisi/server.py,sha256=BU8ERe0ewbJtuZeEGLqU30UMDFSENzO9xEh4BsQSejM,6759
22
22
  unisi/tables.py,sha256=1ZjR_eJ_vf0h26kdv2PjLV3t2cPMoqCV17MQjfilTX0,13810
23
- unisi/units.py,sha256=AGpb1Oad2HrNBaJNLR1Kl1OwjgbswAY7tQN195O7dn0,11691
24
- unisi/users.py,sha256=9incyR7QigCj1BENhZTNuXn8qC59OP2YONCKLtpZMtk,17082
23
+ unisi/units.py,sha256=5MVNJLFptVef1jKcDeDeKEPPti_t5Q5TrLeSt5xaaNk,11973
24
+ unisi/users.py,sha256=yq6rJzK62-NGcvwGIMgeRgBIGV0aDdngIwYgZxwnUII,17085
25
25
  unisi/utils.py,sha256=WD3O0hZzVQmcqQK6Ivv35kGmx4FC3enV1RtiZC_EndQ,2721
26
26
  unisi/voicecom.py,sha256=QzS1gIrBeGLO5dEwiu7KIEdJIIVbPBZFGb5nY632Ws8,16707
27
27
  unisi/web/css/262.46daf72a.css,sha256=esQA388EJR7xe_L5NwO30wvjDEuseTf9pqiacAjyAX8,3508
@@ -55,4 +55,4 @@ unisi/web/js/sigma.ce21336a.js,sha256=ngST-065XWOdnR_Xn7U6oGNHTL8fyiOEI9V8-BWRvl
55
55
  unisi/web/js/sigma.ce21336a.js.gz,sha256=zv6oToZZFCfmrZ4G4fw0sOncVe8-dyYNWh2v5QLKZp4,51965
56
56
  unisi/web/js/vendor.6a64dcc5.js,sha256=OSNK2nadU2DnSOEYQQcAmelybITOFZXMxnRyaDoT3yU,747104
57
57
  unisi/web/js/vendor.6a64dcc5.js.gz,sha256=nmtqRzQRWaToxgHxI9hfJd3UrUCg2-fd-0Fjc4H4wu8,245827
58
- unisi-0.4.5.dist-info/RECORD,,
58
+ unisi-0.4.6.dist-info/RECORD,,
File without changes