From 67d8da224b8a2e490be44c5b027b2a5d88173129 Mon Sep 17 00:00:00 2001 From: epiphyte Date: Tue, 18 Aug 2020 23:18:17 +0000 Subject: [PATCH 1/3] Docstirng for addUser --- synapse/lib/hiveauth.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/synapse/lib/hiveauth.py b/synapse/lib/hiveauth.py index d59c25fc7b..9c6b01d1ec 100644 --- a/synapse/lib/hiveauth.py +++ b/synapse/lib/hiveauth.py @@ -333,6 +333,17 @@ def reqAuthGate(self, iden): return gate async def addUser(self, name, passwd=None, email=None): + ''' + Add a User to the Hive. + + Args: + name (str): The name of the User. + passwd (str): A optional password for the user. + email (str): A optional emall for the user. + + Returns: + HiveUser: A Hive User. + ''' if self.usersbyname.get(name) is not None: raise s_exc.DupUserName(name=name) From f4b0909ff377cdbb706bc80089f8a4f5b4aa0312 Mon Sep 17 00:00:00 2001 From: epiphyte Date: Tue, 18 Aug 2020 23:19:56 +0000 Subject: [PATCH 2/3] Docstrings --- synapse/lib/stormlib/backup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/synapse/lib/stormlib/backup.py b/synapse/lib/stormlib/backup.py index 46597b9385..f4a9c70995 100644 --- a/synapse/lib/stormlib/backup.py +++ b/synapse/lib/stormlib/backup.py @@ -3,7 +3,9 @@ @s_stormtypes.registry.registerLib class BackupLib(s_stormtypes.Lib): - + ''' + A Storm Library for interacting with the backup APIs in the Cortex. + ''' _storm_lib_path = ('backup',) def getObjLocals(self): @@ -19,6 +21,7 @@ async def _runBackup(self, name=None, wait=True): Args: name (str): The name of the backup to generate. + wait (bool): If true, wait for the backup to complete before returning. Returns: From e8f258aee6b67f0dc9bd05064988c73ac4675127 Mon Sep 17 00:00:00 2001 From: epiphyte Date: Wed, 19 Aug 2020 00:22:32 +0000 Subject: [PATCH 3/3] Support wildcard out pivoting for runt props --- synapse/lib/ast.py | 5 +++++ synapse/tests/test_model_syn.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/synapse/lib/ast.py b/synapse/lib/ast.py index e4ad028924..a39cf6107a 100644 --- a/synapse/lib/ast.py +++ b/synapse/lib/ast.py @@ -1283,6 +1283,11 @@ async def getPivsOut(self, runt, node, path): if form is None: continue + if prop.isrunt: + async for pivo in runt.snap.nodesByPropValu(form.name, '=', valu): + yield pivo, path.fork(pivo) + continue + pivo = await runt.snap.getNodeByNdef((form.name, valu)) if pivo is None: # pragma: no cover continue diff --git a/synapse/tests/test_model_syn.py b/synapse/tests/test_model_syn.py index a020e55541..6746b9cff8 100644 --- a/synapse/tests/test_model_syn.py +++ b/synapse/tests/test_model_syn.py @@ -251,6 +251,13 @@ async def delExtModelConfigs(cortex): nodes = await core.nodes(q) self.ge(len(nodes), 7) + # Wildcard pivot out from a prop and ensure we got the form + q = 'syn:prop=test:comp -> * ' + nodes = await core.nodes(q) + self.len(2, nodes) + self.eq({('syn:form', 'test:comp'), ('syn:type', 'test:comp')}, + {n.ndef for n in nodes}) + # Some forms inherit from a single type nodes = await core.nodes('syn:type="inet:addr" -> syn:type:subof') self.ge(len(nodes), 2)