synapse.tools package
Subpackages
Submodules
synapse.tools.apikey module
synapse.tools.autodoc module
- class synapse.tools.autodoc.DocHelp(ctors, types, forms, props, univs)[source]
Bases:
object
Helper to pre-compute all doc strings hierarchically
- synapse.tools.autodoc.lookupedgesforform(form: str, edges: List[Tuple[Tuple[str | None, str, str | None], Dict[str, str]]]) Dict[str, List[Tuple[Tuple[str | None, str, str | None], Dict[str, str]]]] [source]
- async synapse.tools.autodoc.processStormCmds(rst, pkgname, commands)[source]
- Parameters:
rst (RstHelp)
pkgname (str)
commands (list)
- Returns:
None
synapse.tools.axon2axon module
synapse.tools.backup module
- synapse.tools.backup.backup(srcdir, dstdir, skipdirs=None)[source]
Create a backup of a Synapse application.
- Parameters:
srcdir (str) – Path to the directory to backup.
dstdir (str) – Path to backup target directory.
skipdirs (list or None) – Optional list of relative directory name glob patterns to exclude from the backup.
Note
Running this method from the same process as a running user of the directory may lead to a segmentation fault
- synapse.tools.backup.capturelmdbs(srcdir, skipdirs=None, onlydirs=None)[source]
A context manager that opens all the lmdb files under a srcdir and makes a read transaction. All transactions are aborted and environments closed when the context is exited.
- Yields:
Dict[str, Tuple[lmdb.Environment, lmdb.Transaction]] – Maps path to environment, transaction
- synapse.tools.backup.txnbackup(lmdbinfo, srcdir, dstdir, skipdirs=None)[source]
Create a backup of a Synapse application under a (hopefully consistent) set of transactions.
- Parameters:
lmdbinfo (Dict[str, Tuple[lmdb.Environment, lmdb.Transaction]]) – Maps of path to environment, transaction
srcdir (str) – Path to the directory to backup.
dstdir (str) – Path to backup target directory.
skipdirs (list or None) – Optional list of relative directory name glob patterns to exclude from the backup.
Note
Running this method from the same process as a running user of the directory may lead to a segmentation fault
synapse.tools.cellauth module
synapse.tools.changelog module
synapse.tools.cmdr module
synapse.tools.csvtool module
synapse.tools.easycert module
synapse.tools.feed module
synapse.tools.genpkg module
- synapse.tools.genpkg.loadPkgProto(path, opticdir=None, no_docs=False, readonly=False)[source]
Get a Storm Package definition from disk.
- Parameters:
path (str) – Path to the package .yaml file on disk.
opticdir (str) – Path to optional Optic module code to add to the Storm Package.
no_docs (bool) – If true, omit inline documentation content if it is not present on disk.
readonly (bool) – If set, open files in read-only mode. If files are missing, that will raise a NoSuchFile exception.
- Returns:
A Storm package definition.
- Return type:
dict
- synapse.tools.genpkg.tryLoadPkgProto(fp, opticdir=None, readonly=False)[source]
Try to get a Storm Package prototype from disk with or without inline documentation.
- Parameters:
fp (str) – Path to the package .yaml file on disk.
opticdir (str) – Path to optional Optic module code to add to the Storm Package.
readonly (bool) – If set, open files in read-only mode. If files are missing, that will raise a NoSuchFile exception.
- Returns:
A Storm package definition.
- Return type:
dict
synapse.tools.guid module
synapse.tools.healthcheck module
synapse.tools.json2mpk module
synapse.tools.livebackup module
synapse.tools.modrole module
synapse.tools.moduser module
synapse.tools.promote module
synapse.tools.pullfile module
synapse.tools.pushfile module
synapse.tools.reload module
synapse.tools.rstorm module
synapse.tools.snapshot module
synapse.tools.storm module
- class synapse.tools.storm.ExportCmd(cli, **opts)[source]
Bases:
StormCliCmd
Export the results of a storm query into a nodes file.
Example
// Export nodes to a file !export dnsa.nodes { inet:fqdn#mynodes -> inet:dns:a }
// Export nodes to a file and only include specific tags !export fqdn.nodes { inet:fqdn#mynodes } –include-tags footag
- class synapse.tools.storm.HelpCmd(cli, **opts)[source]
Bases:
CmdHelp
List interpreter extended commands and display help output.
Example
!help foocmd
- class synapse.tools.storm.PullFileCmd(cli, **opts)[source]
Bases:
StormCliCmd
Download a file by sha256 and store it locally.
Example
!pullfile c00adfcc316f8b00772cdbce2505b9ea539d74f42861801eceb1017a44344ed3 /path/to/savefile
- class synapse.tools.storm.PushFileCmd(cli, **opts)[source]
Bases:
StormCliCmd
Upload a file and create a file:bytes node.
Example
!pushfile /path/to/file
- class synapse.tools.storm.QuitCmd(cli, **opts)[source]
Bases:
CmdQuit
Quit the current command line interpreter.
Example
!quit
- class synapse.tools.storm.RunFileCmd(cli, **opts)[source]
Bases:
StormCliCmd
Run a local storm file.
Example
!runfile /path/to/file.storm
- class synapse.tools.storm.StormCli[source]
Bases:
Cli
- histfile = 'storm_history'
- class synapse.tools.storm.StormCliCmd(cli, **opts)[source]
Bases:
Cmd
- getCmdOpts(text)[source]
Use the _cmd_syntax def to split/parse/normalize the cmd line.
- Parameters:
text (str) – Command to process.
Notes
This is implemented independent of argparse (et al) due to the need for syntax aware argument splitting. Also, allows different split per command type
- Returns:
An opts dictionary.
- Return type:
dict
- class synapse.tools.storm.StormCompleter(cli)[source]
Bases:
Completer
- get_completions(document, complete_event)[source]
This should be a generator that yields
Completion
instances.If the generation of completions is something expensive (that takes a lot of time), consider wrapping this Completer class in a ThreadedCompleter. In that case, the completer algorithm runs in a background thread and completions will be displayed as soon as they arrive.
- Parameters:
document –
Document
instance.complete_event –
CompleteEvent
instance.