synapse 2.176.0__py311-none-any.whl → 2.178.0__py311-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.
Potentially problematic release.
This version of synapse might be problematic. Click here for more details.
- synapse/axon.py +24 -9
- synapse/cortex.py +337 -172
- synapse/cryotank.py +46 -37
- synapse/datamodel.py +17 -4
- synapse/exc.py +19 -0
- synapse/lib/agenda.py +7 -13
- synapse/lib/aha.py +361 -88
- synapse/lib/auth.py +1520 -0
- synapse/lib/base.py +27 -9
- synapse/lib/cell.py +422 -163
- synapse/lib/config.py +15 -11
- synapse/lib/coro.py +13 -0
- synapse/lib/grammar.py +5 -0
- synapse/lib/hive.py +24 -3
- synapse/lib/hiveauth.py +6 -32
- synapse/lib/layer.py +7 -9
- synapse/lib/link.py +22 -18
- synapse/lib/lmdbslab.py +152 -3
- synapse/lib/modelrev.py +1 -1
- synapse/lib/nexus.py +24 -12
- synapse/lib/schemas.py +136 -0
- synapse/lib/storm.py +61 -29
- synapse/lib/stormlib/aha.py +1 -1
- synapse/lib/stormlib/auth.py +185 -10
- synapse/lib/stormlib/cortex.py +16 -5
- synapse/lib/stormlib/gen.py +80 -0
- synapse/lib/stormlib/imap.py +6 -2
- synapse/lib/stormlib/model.py +55 -0
- synapse/lib/stormlib/modelext.py +60 -0
- synapse/lib/stormlib/smtp.py +12 -2
- synapse/lib/stormlib/tabular.py +212 -0
- synapse/lib/stormtypes.py +14 -1
- synapse/lib/trigger.py +1 -1
- synapse/lib/version.py +2 -2
- synapse/lib/view.py +55 -28
- synapse/models/base.py +7 -0
- synapse/models/biz.py +4 -0
- synapse/models/files.py +8 -1
- synapse/models/inet.py +8 -0
- synapse/telepath.py +32 -17
- synapse/tests/files/aha/certs/cas/synapse.crt +28 -0
- synapse/tests/files/aha/certs/cas/synapse.key +51 -0
- synapse/tests/files/aha/certs/hosts/00.aha.loop.vertex.link.crt +30 -0
- synapse/tests/files/aha/certs/hosts/00.aha.loop.vertex.link.key +51 -0
- synapse/tests/files/aha/certs/users/root@synapse.crt +29 -0
- synapse/tests/files/aha/certs/users/root@synapse.key +51 -0
- synapse/tests/files/changelog/model_2.176.0_16ee721a6b7221344eaf946c3ab4602dda546b1a.yaml.gz +0 -0
- synapse/tests/files/changelog/model_2.176.0_2a25c58bbd344716cd7cbc3f4304d8925b0f4ef2.yaml.gz +0 -0
- synapse/tests/files/rstorm/testsvc.py +1 -1
- synapse/tests/test_axon.py +8 -5
- synapse/tests/test_cortex.py +149 -141
- synapse/tests/test_cryotank.py +4 -4
- synapse/tests/test_datamodel.py +7 -0
- synapse/tests/test_lib_agenda.py +10 -3
- synapse/tests/test_lib_aha.py +336 -490
- synapse/tests/{test_lib_hiveauth.py → test_lib_auth.py} +314 -11
- synapse/tests/test_lib_base.py +20 -0
- synapse/tests/test_lib_cell.py +210 -30
- synapse/tests/test_lib_config.py +4 -3
- synapse/tests/test_lib_httpapi.py +18 -14
- synapse/tests/test_lib_layer.py +33 -33
- synapse/tests/test_lib_link.py +42 -1
- synapse/tests/test_lib_lmdbslab.py +68 -0
- synapse/tests/test_lib_nexus.py +12 -4
- synapse/tests/test_lib_node.py +0 -7
- synapse/tests/test_lib_storm.py +45 -0
- synapse/tests/test_lib_stormlib_aha.py +35 -36
- synapse/tests/test_lib_stormlib_auth.py +21 -0
- synapse/tests/test_lib_stormlib_cell.py +4 -15
- synapse/tests/test_lib_stormlib_cortex.py +12 -12
- synapse/tests/test_lib_stormlib_gen.py +99 -0
- synapse/tests/test_lib_stormlib_imap.py +14 -3
- synapse/tests/test_lib_stormlib_model.py +108 -0
- synapse/tests/test_lib_stormlib_modelext.py +64 -0
- synapse/tests/test_lib_stormlib_smtp.py +51 -0
- synapse/tests/test_lib_stormlib_tabular.py +226 -0
- synapse/tests/test_lib_stormsvc.py +4 -1
- synapse/tests/test_lib_stormtypes.py +10 -0
- synapse/tests/test_model_base.py +3 -0
- synapse/tests/test_model_biz.py +3 -0
- synapse/tests/test_model_files.py +12 -2
- synapse/tests/test_model_inet.py +24 -0
- synapse/tests/test_tools_aha.py +78 -101
- synapse/tests/test_tools_changelog.py +196 -0
- synapse/tests/test_tools_healthcheck.py +4 -3
- synapse/tests/utils.py +87 -121
- synapse/tools/aha/clone.py +50 -0
- synapse/tools/aha/enroll.py +2 -1
- synapse/tools/backup.py +2 -2
- synapse/tools/changelog.py +776 -15
- {synapse-2.176.0.dist-info → synapse-2.178.0.dist-info}/METADATA +48 -48
- {synapse-2.176.0.dist-info → synapse-2.178.0.dist-info}/RECORD +95 -82
- {synapse-2.176.0.dist-info → synapse-2.178.0.dist-info}/WHEEL +1 -1
- {synapse-2.176.0.dist-info → synapse-2.178.0.dist-info}/LICENSE +0 -0
- {synapse-2.176.0.dist-info → synapse-2.178.0.dist-info}/top_level.txt +0 -0
synapse/lib/base.py
CHANGED
|
@@ -179,6 +179,13 @@ class Base:
|
|
|
179
179
|
'''
|
|
180
180
|
Add a function/coroutine/Base to be called on fini().
|
|
181
181
|
'''
|
|
182
|
+
if self.isfini:
|
|
183
|
+
if isinstance(func, Base):
|
|
184
|
+
s_coro.create_task(func.fini())
|
|
185
|
+
else:
|
|
186
|
+
s_coro.create_task(s_coro.ornot(func))
|
|
187
|
+
return
|
|
188
|
+
|
|
182
189
|
if isinstance(func, Base):
|
|
183
190
|
self.tofini.add(func)
|
|
184
191
|
return
|
|
@@ -408,8 +415,6 @@ class Base:
|
|
|
408
415
|
for fini in self._fini_funcs:
|
|
409
416
|
try:
|
|
410
417
|
await s_coro.ornot(fini)
|
|
411
|
-
except asyncio.CancelledError: # pragma: no cover TODO: remove once >= py 3.8 only
|
|
412
|
-
raise
|
|
413
418
|
except Exception:
|
|
414
419
|
logger.exception(f'{self} - fini function failed: {fini}')
|
|
415
420
|
|
|
@@ -579,7 +584,7 @@ class Base:
|
|
|
579
584
|
loop.add_signal_handler(signal.SIGINT, sigint)
|
|
580
585
|
loop.add_signal_handler(signal.SIGTERM, sigterm)
|
|
581
586
|
|
|
582
|
-
async def main(self):
|
|
587
|
+
async def main(self): # pragma: no cover
|
|
583
588
|
'''
|
|
584
589
|
Helper function to setup signal handlers for this base as the main object.
|
|
585
590
|
( use base.waitfini() to block )
|
|
@@ -590,7 +595,7 @@ class Base:
|
|
|
590
595
|
await self.addSignalHandlers()
|
|
591
596
|
return await self.waitfini()
|
|
592
597
|
|
|
593
|
-
def waiter(self, count, *names):
|
|
598
|
+
def waiter(self, count, *names, timeout=None):
|
|
594
599
|
'''
|
|
595
600
|
Construct and return a new Waiter for events on this base.
|
|
596
601
|
|
|
@@ -615,16 +620,17 @@ class Base:
|
|
|
615
620
|
race conditions with this mechanism ;)
|
|
616
621
|
|
|
617
622
|
'''
|
|
618
|
-
return Waiter(self, count, *names)
|
|
623
|
+
return Waiter(self, count, *names, timeout=timeout)
|
|
619
624
|
|
|
620
625
|
class Waiter:
|
|
621
626
|
'''
|
|
622
627
|
A helper to wait for a given number of events on a Base.
|
|
623
628
|
'''
|
|
624
|
-
def __init__(self, base, count, *names):
|
|
629
|
+
def __init__(self, base, count, *names, timeout=None):
|
|
625
630
|
self.base = base
|
|
626
631
|
self.names = names
|
|
627
632
|
self.count = count
|
|
633
|
+
self.timeout = timeout
|
|
628
634
|
self.event = asyncio.Event()
|
|
629
635
|
|
|
630
636
|
self.events = []
|
|
@@ -656,6 +662,9 @@ class Waiter:
|
|
|
656
662
|
doStuff(evnt)
|
|
657
663
|
|
|
658
664
|
'''
|
|
665
|
+
if timeout is None:
|
|
666
|
+
timeout = self.timeout
|
|
667
|
+
|
|
659
668
|
try:
|
|
660
669
|
|
|
661
670
|
retn = await s_coro.event_wait(self.event, timeout)
|
|
@@ -676,6 +685,18 @@ class Waiter:
|
|
|
676
685
|
self.base.unlink(self._onWaitEvent)
|
|
677
686
|
del self.event
|
|
678
687
|
|
|
688
|
+
async def __aenter__(self):
|
|
689
|
+
return self
|
|
690
|
+
|
|
691
|
+
async def __aexit__(self, exc, cls, tb):
|
|
692
|
+
if exc is None:
|
|
693
|
+
if await self.wait() is None: # pragma: no cover
|
|
694
|
+
# these lines are 100% covered by the tests but
|
|
695
|
+
# the coverage plugin cannot seem to see them...
|
|
696
|
+
events = ','.join(self.names)
|
|
697
|
+
mesg = f'timeout waiting for {self.count} event(s): {events}'
|
|
698
|
+
raise s_exc.TimeOut(mesg=mesg)
|
|
699
|
+
|
|
679
700
|
class BaseRef(Base):
|
|
680
701
|
'''
|
|
681
702
|
An object for managing multiple Base instances by name.
|
|
@@ -777,9 +798,6 @@ async def schedGenr(genr, maxsize=100):
|
|
|
777
798
|
|
|
778
799
|
await q.put((False, None))
|
|
779
800
|
|
|
780
|
-
except asyncio.CancelledError: # pragma: no cover TODO: remove once >= py 3.8 only
|
|
781
|
-
raise
|
|
782
|
-
|
|
783
801
|
except Exception:
|
|
784
802
|
if not base.isfini:
|
|
785
803
|
await q.put((False, None))
|