synapse 2.180.0__py311-none-any.whl → 2.181.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.

Files changed (88) hide show
  1. synapse/assets/__init__.py +35 -0
  2. synapse/assets/storm/migrations/model-0.2.28.storm +355 -0
  3. synapse/common.py +2 -1
  4. synapse/cortex.py +49 -35
  5. synapse/cryotank.py +1 -1
  6. synapse/datamodel.py +30 -0
  7. synapse/lib/ast.py +12 -7
  8. synapse/lib/cell.py +1 -1
  9. synapse/lib/certdir.py +4 -4
  10. synapse/lib/chop.py +0 -1
  11. synapse/lib/drive.py +8 -8
  12. synapse/lib/layer.py +55 -13
  13. synapse/lib/lmdbslab.py +26 -5
  14. synapse/lib/modelrev.py +28 -1
  15. synapse/lib/modules.py +1 -0
  16. synapse/lib/nexus.py +1 -1
  17. synapse/lib/node.py +5 -0
  18. synapse/lib/parser.py +23 -16
  19. synapse/lib/scrape.py +1 -1
  20. synapse/lib/slabseqn.py +2 -2
  21. synapse/lib/snap.py +129 -0
  22. synapse/lib/storm.lark +16 -2
  23. synapse/lib/storm.py +3 -0
  24. synapse/lib/storm_format.py +1 -0
  25. synapse/lib/stormhttp.py +34 -1
  26. synapse/lib/stormlib/auth.py +1 -1
  27. synapse/lib/stormlib/cortex.py +5 -2
  28. synapse/lib/stormlib/ipv6.py +2 -2
  29. synapse/lib/stormlib/model.py +114 -12
  30. synapse/lib/stormlib/project.py +1 -1
  31. synapse/lib/stormtypes.py +81 -7
  32. synapse/lib/types.py +7 -0
  33. synapse/lib/version.py +2 -2
  34. synapse/lib/view.py +47 -0
  35. synapse/models/inet.py +10 -3
  36. synapse/models/infotech.py +2 -1
  37. synapse/models/language.py +4 -0
  38. synapse/models/math.py +50 -0
  39. synapse/models/orgs.py +8 -0
  40. synapse/models/risk.py +9 -0
  41. synapse/tests/files/stormcov/pragma-nocov.storm +18 -0
  42. synapse/tests/test_assets.py +25 -0
  43. synapse/tests/test_cortex.py +129 -0
  44. synapse/tests/test_datamodel.py +6 -0
  45. synapse/tests/test_lib_aha.py +2 -1
  46. synapse/tests/test_lib_certdir.py +9 -0
  47. synapse/tests/test_lib_grammar.py +7 -1
  48. synapse/tests/test_lib_layer.py +35 -0
  49. synapse/tests/test_lib_lmdbslab.py +11 -9
  50. synapse/tests/test_lib_modelrev.py +655 -1
  51. synapse/tests/test_lib_slabseqn.py +5 -4
  52. synapse/tests/test_lib_snap.py +4 -0
  53. synapse/tests/test_lib_storm.py +72 -1
  54. synapse/tests/test_lib_stormhttp.py +99 -1
  55. synapse/tests/test_lib_stormlib_cortex.py +21 -4
  56. synapse/tests/test_lib_stormlib_iters.py +8 -5
  57. synapse/tests/test_lib_stormlib_model.py +45 -6
  58. synapse/tests/test_lib_stormtypes.py +158 -2
  59. synapse/tests/test_lib_types.py +6 -0
  60. synapse/tests/test_model_inet.py +10 -0
  61. synapse/tests/test_model_language.py +4 -0
  62. synapse/tests/test_model_math.py +22 -0
  63. synapse/tests/test_model_orgs.py +6 -2
  64. synapse/tests/test_model_risk.py +4 -0
  65. synapse/tests/test_utils_stormcov.py +5 -0
  66. synapse/tests/utils.py +18 -5
  67. synapse/utils/stormcov/plugin.py +31 -1
  68. synapse/vendor/cpython/LICENSE +279 -0
  69. synapse/vendor/cpython/__init__.py +0 -0
  70. synapse/vendor/cpython/lib/__init__.py +0 -0
  71. synapse/vendor/cpython/lib/email/__init__.py +0 -0
  72. synapse/vendor/cpython/lib/email/_parseaddr.py +560 -0
  73. synapse/vendor/cpython/lib/email/utils.py +505 -0
  74. synapse/vendor/cpython/lib/ipaddress.py +2366 -0
  75. synapse/vendor/cpython/lib/test/__init__.py +0 -0
  76. synapse/vendor/cpython/lib/test/support/__init__.py +114 -0
  77. synapse/vendor/cpython/lib/test/test_email/__init__.py +0 -0
  78. synapse/vendor/cpython/lib/test/test_email/test_email.py +480 -0
  79. synapse/vendor/cpython/lib/test/test_email/test_utils.py +167 -0
  80. synapse/vendor/cpython/lib/test/test_ipaddress.py +2672 -0
  81. synapse/vendor/utils.py +4 -3
  82. {synapse-2.180.0.dist-info → synapse-2.181.0.dist-info}/METADATA +2 -2
  83. {synapse-2.180.0.dist-info → synapse-2.181.0.dist-info}/RECORD +86 -69
  84. {synapse-2.180.0.dist-info → synapse-2.181.0.dist-info}/WHEEL +1 -1
  85. synapse/lib/jupyter.py +0 -505
  86. synapse/tests/test_lib_jupyter.py +0 -224
  87. {synapse-2.180.0.dist-info → synapse-2.181.0.dist-info}/LICENSE +0 -0
  88. {synapse-2.180.0.dist-info → synapse-2.181.0.dist-info}/top_level.txt +0 -0
synapse/lib/jupyter.py DELETED
@@ -1,505 +0,0 @@
1
- import os
2
- import copy
3
- import json
4
- import logging
5
- import pathlib
6
- import contextlib
7
-
8
- import synapse.common as s_common
9
- import synapse.cortex as s_cortex
10
-
11
- import synapse.lib.base as s_base
12
- import synapse.lib.cmdr as s_cmdr
13
- import synapse.lib.msgpack as s_msgpack
14
-
15
- import synapse.tools.storm as s_t_storm
16
-
17
- loggers_to_supress = (
18
- 'synapse.lib.view',
19
- )
20
-
21
- def getDocPath(fn, root=None):
22
- '''
23
- Helper for getting a documentation data file paths.
24
-
25
- Args:
26
- fn (str): Name of the file to retrieve the full path for.
27
- root (str): Optional root path to look for a docdata in.
28
-
29
- Notes:
30
- Defaults to looking for the ``docdata`` directory in the current
31
- working directory. This behavior works fine for notebooks nested
32
- in the docs directory of synapse; but this root directory that
33
- is looked for may be overridden by providing an alternative root.
34
-
35
- Returns:
36
- str: A file path.
37
-
38
- Raises:
39
- ValueError if the file does not exist or directory traversal attempted..
40
- '''
41
- s_common.deprdate('synapse.lib.jupyter.getDocPath', '2024-08-26')
42
- cwd = pathlib.Path(os.getcwd())
43
- if root:
44
- cwd = pathlib.Path(root)
45
- # Walk up a directory until you find '...d./data'
46
- while True:
47
- dpath = cwd.joinpath('docdata')
48
- if dpath.is_dir():
49
- break
50
- parent = cwd.parent
51
- if parent == cwd:
52
- raise ValueError(f'Unable to find data directory from {os.getcwd()}.')
53
- cwd = parent
54
-
55
- # Protect against traversal
56
- fpath = os.path.abspath(os.path.join(dpath.as_posix(), fn))
57
- if not fpath.startswith(dpath.as_posix()):
58
- raise ValueError(f'Path escaping detected: {fn}')
59
-
60
- # Existence
61
- if not os.path.isfile(fpath):
62
- raise ValueError(f'File does not exist: {fn}')
63
-
64
- return fpath
65
-
66
- def getDocData(fp, root=None):
67
- '''
68
-
69
- Args:
70
- fp (str): Name of the file to retrieve the data of.
71
- root (str): Optional root path to look for a docdata directory in.
72
-
73
- Notes:
74
- Will detect json/jsonl/yaml/mpk extensions and automatically
75
- decode that data if found; otherwise it returns bytes.
76
-
77
- Defaults to looking for the ``docdata`` directory in the current
78
- working directory. This behavior works fine for notebooks nested
79
- in the docs directory of synapse; but this root directory that
80
- is looked for may be overridden by providing an alternative root.
81
-
82
- Returns:
83
- data: May be deserialized data or bytes.
84
-
85
- Raises:
86
- ValueError if the file does not exist or directory traversal attempted..
87
- '''
88
- s_common.deprdate('synapse.lib.jupyter.getDocData', '2024-08-26')
89
- fpath = getDocPath(fp, root)
90
- if fpath.endswith('.yaml'):
91
- return s_common.yamlload(fpath)
92
- if fpath.endswith('.json'):
93
- return s_common.jsload(fpath)
94
- with s_common.genfile(fpath) as fd:
95
- if fpath.endswith('.mpk'):
96
- return s_msgpack.un(fd.read())
97
- if fpath.endswith('.jsonl'):
98
- recs = []
99
- for line in fd.readlines():
100
- recs.append(json.loads(line.decode()))
101
- return recs
102
- return fd.read()
103
-
104
-
105
- @contextlib.asynccontextmanager
106
- async def genTempCoreProxy(mods=None):
107
- '''Get a temporary cortex proxy.'''
108
- s_common.deprdate('synapse.lib.jupyter.genTempCoreProxy', '2024-08-26')
109
- with s_common.getTempDir() as dirn:
110
- async with await s_cortex.Cortex.anit(dirn) as core:
111
- if mods:
112
- for mod in mods:
113
- await core.loadCoreModule(mod)
114
- async with core.getLocalProxy() as prox:
115
- # Use object.__setattr__ to hulk smash and avoid proxy getattr magick
116
- object.__setattr__(prox, '_core', core)
117
- yield prox
118
-
119
- @contextlib.asynccontextmanager
120
- async def genTempStormsvcProxy(cmdrcore, svcname, svcctor, conf=None):
121
- s_common.deprdate('synapse.lib.jupyter.genTempStormsvcProxy', '2024-08-26')
122
-
123
- if conf is None:
124
- conf = {}
125
-
126
- conf = copy.deepcopy(conf)
127
-
128
- with s_common.getTempDir() as dirn:
129
-
130
- async with await svcctor(dirn, conf=conf) as svc:
131
-
132
- root = await svc.auth.getUserByName('root')
133
- await root.setPasswd('secret')
134
-
135
- info = await svc.dmon.listen('tcp://127.0.0.1:0/')
136
- svc.dmon.test_addr = info
137
- host, port = info
138
- surl = f'tcp://root:secret@127.0.0.1:{port}/'
139
-
140
- await cmdrcore.storm(f'service.add {svcname} {surl}')
141
- await cmdrcore.storm(f'$lib.service.wait({svcname})')
142
-
143
- async with svc.getLocalProxy() as prox:
144
- # Use object.__setattr__ to hulk smash and avoid proxy getattr magick
145
- object.__setattr__(prox, '_svc', svc)
146
- yield prox
147
-
148
- async def getItemStorm(prox, outp=None):
149
- '''Get a Storm CLI instance with prepopulated locs'''
150
- s_common.deprdate('synapse.lib.jupyter.getItemStorm', '2024-08-26')
151
- storm = await s_t_storm.StormCli.anit(prox, outp=outp)
152
- storm.echoline = True
153
- return storm
154
-
155
- async def getItemCmdr(prox, outp=None, locs=None):
156
- '''Get a Cmdr instance with prepopulated locs'''
157
- s_common.deprdate('synapse.lib.jupyter.getItemCmdr', '2024-08-26')
158
- cmdr = await s_cmdr.getItemCmdr(prox, outp=outp)
159
- cmdr.echoline = True
160
- if locs:
161
- cmdr.locs.update(locs)
162
- return cmdr
163
-
164
- @contextlib.contextmanager
165
- def suppress_logging(suppress):
166
- '''
167
- Context manager to suppress specific loggers.
168
- '''
169
- s_common.deprdate('synapse.lib.jupyter.suppress_logging', '2024-08-26')
170
- logs = {}
171
- if not suppress:
172
- yield None
173
- else:
174
- try:
175
- for logname in loggers_to_supress:
176
- logger = logging.getLogger(logname)
177
- if logger is not None:
178
- logs[logname] = (logger, logger.level)
179
- logger.setLevel(logger.level + 100)
180
- yield None
181
- finally:
182
- for (logger, level) in logs.values():
183
- logger.setLevel(level)
184
-
185
- class StormCore(s_base.Base):
186
- '''
187
- A helper for jupyter/storm CLI interaction
188
- '''
189
- async def __anit__(self, core, outp=None):
190
- await s_base.Base.__anit__(self)
191
- self.core = core
192
- self.stormcli = await getItemStorm(self.core, outp=outp)
193
- self.onfini(self._onCmdrCoreFini)
194
- self.acm = None # A placeholder for the context manager
195
-
196
- async def _onCmdrCoreFini(self):
197
- await self.stormcli.fini()
198
- # await self.core.fini()
199
- # If self.acm is set, acm.__aexit should handle the self.core fini.
200
- if self.acm:
201
- await self.acm.__aexit__(None, None, None)
202
-
203
- @contextlib.contextmanager
204
- def suppress_logging(self, suppress):
205
- '''
206
- Context manager to suppress specific loggers.
207
- '''
208
- s_common.deprdate('StormCore.suppress_logging', '2024-08-26')
209
- with suppress_logging(suppress):
210
- yield None
211
-
212
- async def runCmdLine(self, text, opts=None):
213
- '''
214
- Run a line of text directly via storm cli.
215
- '''
216
- s_common.deprdate('StormCore.runCmdLine', '2024-08-26')
217
- await self.stormcli.runCmdLine(text, opts=opts)
218
-
219
- async def _runStorm(self, text, opts=None, cli=False, suppress_logging=False):
220
- mesgs = []
221
- with self.suppress_logging(suppress_logging):
222
- if cli:
223
- def onEvent(event):
224
- mesg = event[1].get('mesg')
225
- mesgs.append(mesg)
226
-
227
- with self.stormcli.onWith('storm:mesg', onEvent):
228
- await self.runCmdLine(text, opts=opts)
229
-
230
- else:
231
- async for mesg in self.core.storm(text, opts=opts):
232
- mesgs.append(mesg)
233
-
234
- return mesgs
235
-
236
- async def storm(self, text, opts=None, num=None, cli=False, suppress_logging=False):
237
- '''
238
- A helper for executing a storm command and getting a list of storm messages.
239
-
240
- Args:
241
- text (str): Storm command to execute.
242
- opts (dict): Opt to pass to the cortex during execution.
243
- num (int): Number of nodes to expect in the output query. Checks that with an assert statement.
244
- cli (bool): If True, executes the line via the Storm CLI and will send output to outp.
245
- suppress_logging (bool): If True, suppresses some logging related to Storm runtime exceptions.
246
-
247
- Notes:
248
- The opts dictionary will not be used if cmdr=True.
249
-
250
- Returns:
251
- list: A list of storm messages.
252
- '''
253
- s_common.deprdate('StormCore.storm', '2024-08-26')
254
- mesgs = await self._runStorm(text, opts, cli, suppress_logging)
255
- if num is not None:
256
- nodes = [m for m in mesgs if m[0] == 'node']
257
- if len(nodes) != num:
258
- raise AssertionError(f'Expected {num} nodes, got {len(nodes)}')
259
-
260
- return mesgs
261
-
262
- class CmdrCore(s_base.Base):
263
- '''
264
- A helper for jupyter/cmdr CLI interaction
265
- '''
266
- async def __anit__(self, core, outp=None):
267
- await s_base.Base.__anit__(self)
268
- self.prefix = 'storm' # Eventually we may remove or change this
269
- self.core = core
270
- locs = {'storm:hide-unknown': True}
271
- self.cmdr = await getItemCmdr(self.core, outp=outp, locs=locs)
272
- self.onfini(self._onCmdrCoreFini)
273
- self.acm = None # A placeholder for the context manager
274
-
275
- async def addFeedData(self, name, items, *, viewiden=None):
276
- '''
277
- Add feed data to the cortex.
278
- '''
279
- s_common.deprdate('CmdrCore.addFeedData', '2024-08-26')
280
- return await self.core.addFeedData(name, items, viewiden=viewiden)
281
-
282
- async def runCmdLine(self, text):
283
- '''
284
- Run a line of text directly via cmdr.
285
- '''
286
- s_common.deprdate('CmdrCore.runCmdLine', '2024-08-26')
287
- await self.cmdr.runCmdLine(text)
288
-
289
- @contextlib.contextmanager
290
- def suppress_logging(self, suppress):
291
- '''
292
- Context manager to suppress specific loggers.
293
- '''
294
- s_common.deprdate('CmdrCore.suppress_logging', '2024-08-26')
295
- with suppress_logging(suppress):
296
- yield None
297
-
298
- async def _runStorm(self, text, opts=None, cmdr=False, suppress_logging=False):
299
- mesgs = []
300
- with self.suppress_logging(suppress_logging):
301
- if cmdr:
302
- if self.prefix:
303
- text = ' '.join((self.prefix, text))
304
-
305
- def onEvent(event):
306
- mesg = event[1].get('mesg')
307
- mesgs.append(mesg)
308
-
309
- with self.cmdr.onWith('storm:mesg', onEvent):
310
- await self.runCmdLine(text)
311
-
312
- else:
313
- async for mesg in self.core.storm(text, opts=opts):
314
- mesgs.append(mesg)
315
-
316
- return mesgs
317
-
318
- async def storm(self, text, opts=None, num=None, cmdr=False, suppress_logging=False):
319
- '''
320
- A helper for executing a storm command and getting a list of storm messages.
321
-
322
- Args:
323
- text (str): Storm command to execute.
324
- opts (dict): Opt to pass to the cortex during execution.
325
- num (int): Number of nodes to expect in the output query. Checks that with an assert statement.
326
- cmdr (bool): If True, executes the line via the Cmdr CLI and will send output to outp.
327
- suppress_logging (bool): If True, suppresses some logging related to Storm runtime exceptions.
328
-
329
- Notes:
330
- The opts dictionary will not be used if cmdr=True.
331
-
332
- Returns:
333
- list: A list of storm messages.
334
- '''
335
- s_common.deprdate('CmdrCore.storm', '2024-08-26')
336
- mesgs = await self._runStorm(text, opts, cmdr, suppress_logging)
337
- if num is not None:
338
- nodes = [m for m in mesgs if m[0] == 'node']
339
- if len(nodes) != num:
340
- raise AssertionError(f'Expected {num} nodes, got {len(nodes)}')
341
-
342
- return mesgs
343
-
344
- async def eval(self, text, opts=None, num=None, cmdr=False):
345
- '''
346
- A helper for executing a storm command and getting a list of packed nodes.
347
-
348
- Args:
349
- text (str): Storm command to execute.
350
- opts (dict): Opt to pass to the cortex during execution.
351
- num (int): Number of nodes to expect in the output query. Checks that with an assert statement.
352
- cmdr (bool): If True, executes the line via the Cmdr CLI and will send output to outp.
353
-
354
- Notes:
355
- The opts dictionary will not be used if cmdr=True.
356
-
357
- Returns:
358
- list: A list of packed nodes.
359
- '''
360
- s_common.deprdate('CmdrCore.eval', '2024-08-26')
361
- mesgs = await self._runStorm(text, opts, cmdr)
362
- for mesg in mesgs:
363
- if mesg[0] == 'err': # pragma: no cover
364
- raise AssertionError(f'Query { {text} } got err: {mesg!r}')
365
-
366
- nodes = [m[1] for m in mesgs if m[0] == 'node']
367
-
368
- if num is not None:
369
- if len(nodes) != num: # pragma: no cover
370
- raise AssertionError(f'Query { {text} } expected {num} nodes, got {len(nodes)}')
371
-
372
- return nodes
373
-
374
- async def _onCmdrCoreFini(self):
375
- await self.cmdr.fini()
376
- # await self.core.fini()
377
- # If self.acm is set, acm.__aexit should handle the self.core fini.
378
- if self.acm:
379
- await self.acm.__aexit__(None, None, None)
380
-
381
- async def getTempCoreProx(mods=None):
382
- '''
383
- Get a Telepath Proxt to a Cortex instance which is backed by a temporary Cortex.
384
-
385
- Args:
386
- mods (list): A list of additional CoreModules to load in the Cortex.
387
-
388
- Notes:
389
- The Proxy returned by this should be fini()'d to tear down the temporary Cortex.
390
-
391
- Returns:
392
- s_telepath.Proxy
393
- '''
394
- s_common.deprdate('synapse.lib.jupyter.getTempCoreProx', '2024-08-26')
395
- acm = genTempCoreProxy(mods)
396
- prox = await acm.__aenter__()
397
- # Use object.__setattr__ to hulk smash and avoid proxy getattr magick
398
- object.__setattr__(prox, '_acm', acm)
399
-
400
- async def onfini():
401
- await prox._acm.__aexit__(None, None, None)
402
- prox.onfini(onfini)
403
- return prox
404
-
405
- async def getTempCoreStorm(mods=None, outp=None):
406
- '''
407
- Get a StormCore instance which is backed by a temporary Cortex.
408
-
409
- Args:
410
- mods (list): A list of additional CoreModules to load in the Cortex.
411
- outp: A output helper. Will be used for the Cmdr instance.
412
-
413
- Notes:
414
- The StormCore returned by this should be fini()'d to tear down the temporary Cortex.
415
-
416
- Returns:
417
- StormCore: A StormCore instance.
418
- '''
419
- s_common.deprdate('synapse.lib.jupyter.getTempCoreStorm', '2024-08-26')
420
- acm = genTempCoreProxy(mods)
421
- prox = await acm.__aenter__()
422
- stormcore = await StormCore.anit(prox, outp=outp)
423
- stormcore.acm = acm
424
- return stormcore
425
-
426
- async def getTempCoreCmdr(mods=None, outp=None):
427
- '''
428
- Get a CmdrCore instance which is backed by a temporary Cortex.
429
-
430
- Args:
431
- mods (list): A list of additional CoreModules to load in the Cortex.
432
- outp: A output helper. Will be used for the Cmdr instance.
433
-
434
- Notes:
435
- The CmdrCore returned by this should be fini()'d to tear down the temporary Cortex.
436
-
437
- Returns:
438
- CmdrCore: A CmdrCore instance.
439
- '''
440
- s_common.deprdate('synapse.lib.jupyter.getTempCoreCmdr', '2024-08-26')
441
- acm = genTempCoreProxy(mods)
442
- prox = await acm.__aenter__()
443
- cmdrcore = await CmdrCore.anit(prox, outp=outp)
444
- cmdrcore.acm = acm
445
- return cmdrcore
446
-
447
- async def getTempCoreCmdrStormsvc(svcname, svcctor, svcconf=None, outp=None):
448
- '''
449
- Get a proxy to a Storm service and a CmdrCore instance backed by a temporary Cortex with the service added.
450
-
451
- Args:
452
- svcname (str): Storm service name
453
- svcctor: Storm service constructor (e.g. Example.anit)
454
- svcconf: Optional conf for the Storm service
455
- outp: A output helper for the Cmdr instance
456
-
457
- Notes:
458
- Both the CmdrCore and Storm service proxy should be fini()'d for proper teardown
459
-
460
- Returns:
461
- (CmdrCore, Proxy): A CmdrCore instance and proxy to the Storm service
462
- '''
463
- s_common.deprdate('synapse.lib.jupyter.getTempCoreCmdrStormsvc', '2024-08-26')
464
- cmdrcore = await getTempCoreCmdr(outp=outp)
465
-
466
- acm = genTempStormsvcProxy(cmdrcore, svcname, svcctor, svcconf)
467
- svcprox = await acm.__aenter__()
468
- # Use object.__setattr__ to hulk smash and avoid proxy getattr magick
469
- object.__setattr__(svcprox, '_acm', acm)
470
-
471
- async def onfini():
472
- await svcprox._acm.__aexit__(None, None, None)
473
- svcprox.onfini(onfini)
474
-
475
- return cmdrcore, svcprox
476
-
477
- async def getTempCoreStormStormsvc(svcname, svcctor, svcconf=None, outp=None):
478
- '''
479
- Get a proxy to a Storm service and a StormCore instance backed by a temporary Cortex with the service added.
480
-
481
- Args:
482
- svcname (str): Storm service name
483
- svcctor: Storm service constructor (e.g. Example.anit)
484
- svcconf: Optional conf for the Storm service
485
- outp: A output helper for the Cmdr instance
486
-
487
- Notes:
488
- Both the StormCore and Storm service proxy should be fini()'d for proper teardown
489
-
490
- Returns:
491
- (StormCore, Proxy): A StormCore instance and proxy to the Storm service
492
- '''
493
- s_common.deprdate('synapse.lib.jupyter.getTempCoreStormStormsvc', '2024-08-26')
494
- stormcore = await getTempCoreStorm(outp=outp)
495
-
496
- acm = genTempStormsvcProxy(stormcore, svcname, svcctor, svcconf)
497
- svcprox = await acm.__aenter__()
498
- # Use object.__setattr__ to hulk smash and avoid proxy getattr magick
499
- object.__setattr__(svcprox, '_acm', acm)
500
-
501
- async def onfini():
502
- await svcprox._acm.__aexit__(None, None, None)
503
- svcprox.onfini(onfini)
504
-
505
- return stormcore, svcprox