From cb51118fd646b1335c9b72731dd7d1b5c6c7b2f6 Mon Sep 17 00:00:00 2001 From: Abdelrahman Ghanem Date: Mon, 10 Oct 2022 20:54:32 +0200 Subject: [PATCH] update pdoc3 and watchdog (#609) * update pdoc3 and watchdog * regenerate docs --- docs/api/jumpscale/clients/base.html | 40 +- docs/api/jumpscale/clients/docker/docker.html | 167 ++-- docs/api/jumpscale/clients/docker/index.html | 34 +- docs/api/jumpscale/clients/git/git.html | 104 ++- docs/api/jumpscale/clients/git/index.html | 32 +- docs/api/jumpscale/clients/index.html | 34 +- docs/api/jumpscale/clients/redis/index.html | 32 +- docs/api/jumpscale/clients/redis/redis.html | 86 +- .../jumpscale/clients/sshclient/index.html | 32 +- .../clients/sshclient/sshclient.html | 130 +-- docs/api/jumpscale/clients/sshkey/index.html | 34 +- docs/api/jumpscale/clients/sshkey/sshkey.html | 132 +-- docs/api/jumpscale/clients/zdb/client.html | 268 ++++--- docs/api/jumpscale/clients/zdb/index.html | 40 +- .../core/application/application.html | 36 +- .../api/jumpscale/core/application/index.html | 32 +- docs/api/jumpscale/core/base/events.html | 48 +- docs/api/jumpscale/core/base/factory.html | 213 +++-- docs/api/jumpscale/core/base/fields.html | 668 +++++++++------- docs/api/jumpscale/core/base/index.html | 34 +- docs/api/jumpscale/core/base/meta.html | 120 +-- .../jumpscale/core/base/store/filesystem.html | 104 ++- docs/api/jumpscale/core/base/store/index.html | 206 +++-- docs/api/jumpscale/core/base/store/redis.html | 95 ++- .../core/base/store/serializers.html | 62 +- .../jumpscale/core/base/store/whooshfts.html | 98 ++- docs/api/jumpscale/core/config/config.html | 146 ++-- docs/api/jumpscale/core/config/index.html | 26 +- docs/api/jumpscale/core/db/index.html | 30 +- docs/api/jumpscale/core/dirs/dirs.html | 103 +-- docs/api/jumpscale/core/dirs/index.html | 32 +- docs/api/jumpscale/core/events/index.html | 86 +- .../jumpscale/core/exceptions/exceptions.html | 136 ++-- docs/api/jumpscale/core/exceptions/index.html | 26 +- .../core/executors/command_builder.html | 40 +- docs/api/jumpscale/core/executors/index.html | 32 +- docs/api/jumpscale/core/executors/local.html | 40 +- docs/api/jumpscale/core/executors/remote.html | 68 +- docs/api/jumpscale/core/executors/tmux.html | 32 +- docs/api/jumpscale/core/index.html | 38 +- docs/api/jumpscale/core/logging/index.html | 32 +- docs/api/jumpscale/core/logging/logging.html | 235 +++--- docs/api/jumpscale/data/bcdb/bcdb.html | 305 +++---- docs/api/jumpscale/data/bcdb/clients.html | 127 +-- docs/api/jumpscale/data/bcdb/dumpsql.html | 30 +- docs/api/jumpscale/data/bcdb/flush.html | 30 +- docs/api/jumpscale/data/bcdb/index.html | 36 +- docs/api/jumpscale/data/bcdb/interfaces.html | 130 +-- docs/api/jumpscale/data/bcdb/models/base.html | 144 ++-- .../jumpscale/data/bcdb/models/db_model.html | 30 +- .../data/bcdb/models/emplyee_model.html | 30 +- .../api/jumpscale/data/bcdb/models/index.html | 46 +- .../data/bcdb/models/model_model.html | 30 +- .../data/bcdb/models/post_model.html | 30 +- .../data/bcdb/models/proj_model.html | 30 +- .../data/bcdb/models/test_model.html | 30 +- .../data/bcdb/models/user_model.html | 30 +- docs/api/jumpscale/data/cache/index.html | 24 +- .../jumpscale/data/encryption/exceptions.html | 30 +- docs/api/jumpscale/data/encryption/index.html | 30 +- .../jumpscale/data/encryption/mnemonic.html | 94 ++- .../jumpscale/data/encryption/wordlist.html | 24 +- docs/api/jumpscale/data/fake/index.html | 30 +- docs/api/jumpscale/data/hash/hash.html | 365 +++++---- docs/api/jumpscale/data/hash/index.html | 26 +- .../data/idgenerator/idgenerator.html | 138 ++-- .../api/jumpscale/data/idgenerator/index.html | 26 +- docs/api/jumpscale/data/index.html | 56 +- docs/api/jumpscale/data/inifile/index.html | 26 +- docs/api/jumpscale/data/inifile/inifile.html | 158 ++-- docs/api/jumpscale/data/nacl/index.html | 32 +- docs/api/jumpscale/data/nacl/jsnacl.html | 167 ++-- docs/api/jumpscale/data/platform/index.html | 148 ++-- .../jumpscale/data/random_names/index.html | 38 +- docs/api/jumpscale/data/schema/index.html | 26 +- docs/api/jumpscale/data/schema/schema.html | 90 ++- .../jumpscale/data/serializers/base64.html | 44 +- docs/api/jumpscale/data/serializers/dill.html | 24 +- .../api/jumpscale/data/serializers/index.html | 60 +- docs/api/jumpscale/data/serializers/json.html | 64 +- docs/api/jumpscale/data/serializers/lzma.html | 60 +- .../jumpscale/data/serializers/msgpack.html | 72 +- .../jumpscale/data/serializers/pickle.html | 72 +- docs/api/jumpscale/data/serializers/toml.html | 72 +- docs/api/jumpscale/data/serializers/yaml.html | 72 +- docs/api/jumpscale/data/tarfile/index.html | 26 +- docs/api/jumpscale/data/tarfile/tar_file.html | 74 +- .../jumpscale/data/terminaltable/index.html | 46 +- docs/api/jumpscale/data/text/index.html | 58 +- docs/api/jumpscale/data/time/index.html | 129 ++- docs/api/jumpscale/data/types/index.html | 28 +- docs/api/jumpscale/data/types/pritypes.html | 250 +++--- docs/api/jumpscale/data/types/types.html | 380 +++++---- docs/api/jumpscale/entry_points/index.html | 30 +- docs/api/jumpscale/entry_points/jsctl.html | 66 +- docs/api/jumpscale/entry_points/jsng.html | 24 +- docs/api/jumpscale/entry_points/jsync.html | 24 +- .../api/jumpscale/entry_points/usershell.html | 118 ++- docs/api/jumpscale/index.html | 40 +- docs/api/jumpscale/loader.html | 143 ++-- docs/api/jumpscale/sals/fs/index.html | 756 +++++++++++------- docs/api/jumpscale/sals/hostsfile/index.html | 85 +- docs/api/jumpscale/sals/index.html | 34 +- docs/api/jumpscale/sals/nettools/index.html | 302 ++++--- docs/api/jumpscale/sals/process/index.html | 522 +++++++----- docs/api/jumpscale/sals/testdocs/index.html | 46 +- docs/api/jumpscale/sals/unix/index.html | 26 +- docs/api/jumpscale/sals/unix/user.html | 68 +- docs/api/jumpscale/servers/index.html | 24 +- .../jumpscale/servers/openresty/index.html | 36 +- .../jumpscale/servers/openresty/location.html | 206 +++-- .../jumpscale/servers/openresty/server.html | 234 +++--- .../jumpscale/servers/openresty/utils.html | 30 +- docs/api/jumpscale/servers/rack/index.html | 32 +- docs/api/jumpscale/servers/rack/rack.html | 78 +- docs/api/jumpscale/shell/config.html | 62 +- docs/api/jumpscale/shell/index.html | 26 +- docs/api/jumpscale/threesdk/container.html | 73 +- .../jumpscale/threesdk/identitymanager.html | 56 +- docs/api/jumpscale/threesdk/index.html | 107 +-- docs/api/jumpscale/threesdk/settings.html | 24 +- .../tools/alerthandler/alerthandler.html | 177 ++-- .../jumpscale/tools/alerthandler/index.html | 32 +- .../api/jumpscale/tools/codeloader/index.html | 40 +- docs/api/jumpscale/tools/console/index.html | 254 +++--- .../tools/depsresolver/depsresolver.html | 125 ++- .../jumpscale/tools/depsresolver/index.html | 32 +- .../tools/errorhandler/errorhandler.html | 74 +- .../jumpscale/tools/errorhandler/index.html | 32 +- docs/api/jumpscale/tools/git/index.html | 148 ++-- .../jumpscale/tools/highlighter/index.html | 66 +- docs/api/jumpscale/tools/http/index.html | 24 +- docs/api/jumpscale/tools/index.html | 52 +- docs/api/jumpscale/tools/jinja2/index.html | 80 +- docs/api/jumpscale/tools/keygen/index.html | 22 +- docs/api/jumpscale/tools/keygen/keygen.html | 24 +- .../api/jumpscale/tools/schemac/compiler.html | 54 +- docs/api/jumpscale/tools/schemac/index.html | 48 +- .../tools/schemac/plugins/crystal.html | 36 +- .../tools/schemac/plugins/index.html | 32 +- .../jumpscale/tools/schemac/plugins/jsng.html | 36 +- .../tools/schemac/plugins/plugin.html | 41 +- .../tools/schemac/plugins/utils.html | 30 +- .../api/jumpscale/tools/startupcmd/index.html | 32 +- .../tools/startupcmd/startupcmd.html | 216 +++-- docs/api/jumpscale/tools/syncer/index.html | 87 +- docs/api/jumpscale/tools/timer/index.html | 30 +- poetry.lock | 68 +- pyproject.toml | 4 +- 149 files changed, 7615 insertions(+), 5653 deletions(-) diff --git a/docs/api/jumpscale/clients/base.html b/docs/api/jumpscale/clients/base.html index 4e036edac..f250b48a0 100644 --- a/docs/api/jumpscale/clients/base.html +++ b/docs/api/jumpscale/clients/base.html @@ -3,15 +3,17 @@ - + jumpscale.clients.base API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.base

-Source code + +Expand source code +
from jumpscale.core.base import Base
 
 
@@ -43,11 +47,11 @@ 

Classes

(parent_=None, instance_name_=None, **values)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -62,9 +66,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class Client(Base):
     pass
@@ -76,11 +82,11 @@

Ancestors

Subclasses

Inherited members

    @@ -118,9 +124,7 @@

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/docker/docker.html b/docs/api/jumpscale/clients/docker/docker.html index bd513efac..3fb29f038 100644 --- a/docs/api/jumpscale/clients/docker/docker.html +++ b/docs/api/jumpscale/clients/docker/docker.html @@ -3,19 +3,21 @@ - + jumpscale.clients.docker.docker API documentation - - - - - + + + + + + +
    @@ -39,7 +41,9 @@

    Module jumpscale.clients.docker.docker

    or container.exec_run("ls /tmp)

-Source code + +Expand source code +
"""This module used to manage your conatiners, create ,run, list, delete and exec commands on docker
 for example
 ```
@@ -368,11 +372,11 @@ 

Classes

(*args, **kwargs)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -387,9 +391,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class DockerClient(Client):
     base_url = fields.String()
 
@@ -692,16 +698,18 @@ 

Instance variables

var base_url
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -717,9 +725,11 @@ 

Returns

var client
-
+
-Source code + +Expand source code +
@property
 def client(self):
     if not self.__client:
@@ -734,10 +744,10 @@ 

Returns

Methods

-def create(self, name, image, command=None, environment=None, entrypoint=None, volumes=None, devices=None, detach=True, ports=None, privileged=False, auto_remove=False, hostname='js-ng') +def create(self, name, image, command=None, environment=None, entrypoint=None, volumes=None, devices=None, detach=True, ports=None, privileged=False, auto_remove=False, hostname='js-ng')
-

Creates a docker container without starting it

+

Creates a docker container without starting it

Args

name : str
@@ -770,11 +780,13 @@

Args

hostname (str) - hostname to be set on docker container default "js-ng"

Returns

-
container
+
container
container object
-
+
-Source code + +Expand source code +
def create(
     self,
     name,
@@ -841,7 +853,7 @@ 

Returns

def delete(self, container_id, force=False)
-

Deletes docker container

+

Deletes docker container

Args

container_id : str
@@ -851,11 +863,13 @@

Args

Returns

-
bool
+
bool
True container deleted
-
+
-Source code + +Expand source code +
def delete(self, container_id, force=False):
     """Deletes docker container
     Args:
@@ -871,10 +885,10 @@ 

Returns

-def exec(self, container_id, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', detach=False, stream=False, socket=False, environment=None, workdir=None, demux=True) +def exec(self, container_id, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', detach=False, stream=False, socket=False, environment=None, workdir=None, demux=True)
-

Executes command docker container

+

Executes command docker container

Args

container_id : str
@@ -895,22 +909,23 @@

Args

demux (bool) – Return stdout and stderr separately

Returns

-
A tuple of (exit_code, output)
-
 
-
exit_code
+
A tuple of (exit_code, output)
+
exit_code
(int):

Exit code for the executed command or None if either stream or socket is True.

-
output
+
output
(generator, bytes, or tuple): If stream=True, a generator yielding response chunks. If socket=True, a socket object for the connection. If demux=True, a tuple of two bytes: stdout and stderr. A bytestring containing response data otherwise.
-
+
-Source code + +Expand source code +
def exec(
     self,
     container_id,
@@ -978,9 +993,11 @@ 

Returns

def exists(self, container_id)
-
+
-Source code + +Expand source code +
def exists(self, container_id):
     try:
         self.client.containers.get(container_id)
@@ -993,7 +1010,7 @@ 

Returns

def get(self, container_id)
-

Runs docker container

+

Runs docker container

Args

container_id : str
@@ -1001,11 +1018,13 @@

Args

Returns

-
container
+
container
container object
-
+
-Source code + +Expand source code +
def get(self, container_id):
     """Runs docker container
     Args:
@@ -1022,7 +1041,7 @@ 

Returns

def kill(self, container_id, sig=None)
-

Kills docker container

+

Kills docker container

Args

container_id : str
@@ -1032,11 +1051,13 @@

Args

Returns

-
bool
+
bool
True container killed
-
+
-Source code + +Expand source code +
def kill(self, container_id, sig=None):
     """Kills docker container
     Args:
@@ -1055,7 +1076,7 @@ 

Returns

def list(self, all=False)
-

Returns list of docker containers created

+

Returns list of docker containers created

Args

all : bool
@@ -1063,11 +1084,13 @@

Args

Returns

-
list
+
list
list of containers
-
+
-Source code + +Expand source code +
def list(self, all=False):
     """Returns list of docker containers created
     Args:
@@ -1083,7 +1106,7 @@ 

Returns

def restart(self, container_id, timeout=10)
-

Kills docker container

+

Kills docker container

Args

container_id : str
@@ -1093,11 +1116,13 @@

Args

Returns

-
bool
+
bool
True if container restarted
-
+
-Source code + +Expand source code +
def restart(self, container_id, timeout=10):
     """Kills docker container
     Args:
@@ -1113,10 +1138,10 @@ 

Returns

-def run(self, name, image, command=None, environment=None, entrypoint=None, volumes=None, devices=None, detach=True, ports=None, privileged=False, auto_remove=False, hostname='js-ng') +def run(self, name, image, command=None, environment=None, entrypoint=None, volumes=None, devices=None, detach=True, ports=None, privileged=False, auto_remove=False, hostname='js-ng')
-

Runs docker container

+

Runs docker container

Args

name : str
@@ -1149,11 +1174,13 @@

Args

hostname (str) - hostname to be set on docker container default "js-ng"

Returns

-
container
+
container
container object
-
+
-Source code + +Expand source code +
def run(
     self,
     name,
@@ -1219,7 +1246,7 @@ 

Returns

def start(self, container_id)
-

starts docker container

+

starts docker container

Args

container_id : str
@@ -1229,11 +1256,13 @@

Args

Returns

-
bool
+
bool
True if container started
-
+
-Source code + +Expand source code +
def start(self, container_id):
     """starts docker container
     Args:
@@ -1252,7 +1281,7 @@ 

Returns

def stop(self, container_id)
-

stops docker container

+

stops docker container

Args

container_id : str
@@ -1262,11 +1291,13 @@

Args

Returns

-
bool
+
bool
True if container started
-
+
-Source code + +Expand source code +
def stop(self, container_id):
     """stops docker container
     Args:
@@ -1333,9 +1364,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/docker/index.html b/docs/api/jumpscale/clients/docker/index.html index 7cdf9f682..c49e3fc2c 100644 --- a/docs/api/jumpscale/clients/docker/index.html +++ b/docs/api/jumpscale/clients/docker/index.html @@ -3,15 +3,17 @@ - + jumpscale.clients.docker API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.docker

-Source code + +Expand source code +
def export_module_as():
 
     from jumpscale.core.base import StoredFactory
@@ -36,11 +40,11 @@ 

Sub-modules

jumpscale.clients.docker.docker
-

This module used to manage your conatiners, create ,run, list, delete and exec commands on docker +

This module used to manage your conatiners, create ,run, list, delete and exec commands on docker for example ``` getting docker clinet -cl = …

+cl = …

@@ -53,9 +57,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
 
     from jumpscale.core.base import StoredFactory
@@ -95,9 +101,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/git/git.html b/docs/api/jumpscale/clients/git/git.html index 71ef13ca7..a84c1bed1 100644 --- a/docs/api/jumpscale/clients/git/git.html +++ b/docs/api/jumpscale/clients/git/git.html @@ -3,15 +3,17 @@ - + jumpscale.clients.git.git API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.git.git

-Source code + +Expand source code +
import git
 from jumpscale.clients.base import Client
 from jumpscale.core.base import fields
@@ -112,11 +116,11 @@ 

Classes

(*args, **kwargs)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -131,9 +135,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class GitClient(Client):
     path = fields.String()
 
@@ -213,9 +219,11 @@ 

Instance variables

var branch_name
-
+
-Source code + +Expand source code +
@property
 def branch_name(self):
     return self.repo.active_branch.name
@@ -223,16 +231,18 @@

Instance variables

var path
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -248,9 +258,11 @@ 

Returns

var remote_url
-
+
-Source code + +Expand source code +
@property
 def remote_url(self):
     return self.repo.remote().url
@@ -258,9 +270,11 @@

Returns

var repo
-
+
-Source code + +Expand source code +
@property
 def repo(self):
     if not self.__repo:
@@ -275,7 +289,7 @@ 

Methods

def commit(self, message, add_all=True)
-

adds a commit

+

adds a commit

Args

message : str
@@ -283,9 +297,15 @@

Args

add_all : bool, optional
will add all changes before commiting. Defaults to True.
-

Returns

+

Returns

+
+
[type]
+
[description]
+
-Source code + +Expand source code +
def commit(self, message, add_all=True):
     """adds a commit
 
@@ -306,14 +326,16 @@ 

Returns

def get_modified_files(self)
-

returns local changes in the repo

+

returns local changes in the repo

Returns

-
dict
+
dict
dict containing different types of changes(check git status man)
-
+
-Source code + +Expand source code +
def get_modified_files(self):
     """returns local changes in the repo
 
@@ -338,14 +360,16 @@ 

Returns

def pull(self)
-

Pulls from origin

+

Pulls from origin

Raises

-
j.exceptions.Input: if there is locaal changes
-
 
-
+
j.exceptions.Input
+
if there is locaal changes
+
-Source code + +Expand source code +
def pull(self):
     """Pulls from origin
 
@@ -358,12 +382,14 @@ 

Raises

-def set_remote_url(self, url, remote_name='origin') +def set_remote_url(self, url, remote_name='origin')
-
+
-Source code + +Expand source code +
def set_remote_url(self, url, remote_name="origin"):
     remote = self.repo.remote(remote_name)
     remote.set_url(url)
@@ -416,9 +442,7 @@

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/git/index.html b/docs/api/jumpscale/clients/git/index.html index aa5a876f8..1a9fbd71a 100644 --- a/docs/api/jumpscale/clients/git/index.html +++ b/docs/api/jumpscale/clients/git/index.html @@ -3,15 +3,17 @@ - + jumpscale.clients.git API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.git

-Source code + +Expand source code +
def export_module_as():
 
     from jumpscale.core.base import StoredFactory
@@ -36,7 +40,7 @@ 

Sub-modules

jumpscale.clients.git.git
-
+
@@ -49,9 +53,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
 
     from jumpscale.core.base import StoredFactory
@@ -91,9 +97,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/index.html b/docs/api/jumpscale/clients/index.html index b802f2152..deeba2ba2 100644 --- a/docs/api/jumpscale/clients/index.html +++ b/docs/api/jumpscale/clients/index.html @@ -3,15 +3,17 @@ - + jumpscale.clients API documentation - - - - - + + + + + + +
@@ -26,31 +28,31 @@

Sub-modules

jumpscale.clients.base
-
+
jumpscale.clients.docker
-
+
jumpscale.clients.git
-
+
jumpscale.clients.redis
-
+
jumpscale.clients.sshclient
-
+
jumpscale.clients.sshkey
-
+
jumpscale.clients.zdb
-
+

@@ -87,9 +89,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/redis/index.html b/docs/api/jumpscale/clients/redis/index.html index 3317d75ce..ae61da0f8 100644 --- a/docs/api/jumpscale/clients/redis/index.html +++ b/docs/api/jumpscale/clients/redis/index.html @@ -3,15 +3,17 @@ - + jumpscale.clients.redis API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.redis

-Source code + +Expand source code +
def export_module_as():
     from jumpscale.core.base import StoredFactory
 
@@ -35,7 +39,7 @@ 

Sub-modules

jumpscale.clients.redis.redis
-

Redis client

+

Redis client

@@ -48,9 +52,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
     from jumpscale.core.base import StoredFactory
 
@@ -89,9 +95,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/redis/redis.html b/docs/api/jumpscale/clients/redis/redis.html index 74c19b883..58979f0ef 100644 --- a/docs/api/jumpscale/clients/redis/redis.html +++ b/docs/api/jumpscale/clients/redis/redis.html @@ -3,15 +3,17 @@ - + jumpscale.clients.redis.redis API documentation - - - - - + + + + + + +
@@ -22,7 +24,9 @@

Module jumpscale.clients.redis.redis

Redis client

-Source code + +Expand source code +
"""
 Redis client
 """
@@ -70,7 +74,7 @@ 

Module jumpscale.clients.redis.redis

self.__client = Redis(self.hostname, self.port) return self.__client - + def is_running(self): try: return self.redis_client.ping() @@ -96,11 +100,11 @@

Classes

(*args, **kwargs)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -115,9 +119,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class RedisClient(Client):
     hostname = fields.String(default="localhost")
     port = fields.Integer(default=6379)
@@ -148,7 +154,7 @@ 

Args

self.__client = Redis(self.hostname, self.port) return self.__client - + def is_running(self): try: return self.redis_client.ping() @@ -169,16 +175,18 @@

Instance variables

var hostname
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -194,16 +202,18 @@ 

Returns

var password
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -219,16 +229,18 @@ 

Returns

var port
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -244,9 +256,11 @@ 

Returns

var redis_client
-
+
-Source code + +Expand source code +
@property
 def redis_client(self):
     if not self.__client:
@@ -265,9 +279,11 @@ 

Methods

def is_running(self)
-
+
-Source code + +Expand source code +
def is_running(self):
     try:
         return self.redis_client.ping()
@@ -292,9 +308,11 @@ 

Inherited members

(instance, name, new_value)
-
+
-Source code + +Expand source code +
class RedisClientAttributeUpdated(AttributeUpdateEvent):
     pass
@@ -339,9 +357,7 @@

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/sshclient/index.html b/docs/api/jumpscale/clients/sshclient/index.html index 27f9a8e15..901137305 100644 --- a/docs/api/jumpscale/clients/sshclient/index.html +++ b/docs/api/jumpscale/clients/sshclient/index.html @@ -3,15 +3,17 @@ - + jumpscale.clients.sshclient API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.sshclient

-Source code + +Expand source code +
def export_module_as():
 
     from jumpscale.core.base import StoredFactory
@@ -36,7 +40,7 @@ 

Sub-modules

jumpscale.clients.sshclient.sshclient
-

SSHClient modules helps connecting and executing commands to a remote machine …

+

SSHClient modules helps connecting and executing commands to a remote machine …

@@ -49,9 +53,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
 
     from jumpscale.core.base import StoredFactory
@@ -91,9 +97,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/sshclient/sshclient.html b/docs/api/jumpscale/clients/sshclient/sshclient.html index ca9eb8edb..39b083386 100644 --- a/docs/api/jumpscale/clients/sshclient/sshclient.html +++ b/docs/api/jumpscale/clients/sshclient/sshclient.html @@ -3,15 +3,17 @@ - + jumpscale.clients.sshclient.sshclient API documentation - - - - - + + + + + + +
@@ -22,7 +24,7 @@

Module jumpscale.clients.sshclient.sshclient

SSHClient modules helps connecting and executing commands to a remote machine.

Create SSH Key

-
JS-NG> xmonader = j.clients.sshkey.new("xmonader")
+
JS-NG> xmonader = j.clients.sshkey.new("xmonader")
 JS-NG> xmonader.private_key_path = "/home/xmonader/.ssh/id_rsa"
 JS-NG>
 
@@ -38,7 +40,9 @@ 

Creating sshcl

-Source code + +Expand source code +
"""
 
 SSHClient modules helps connecting and executing commands to a remote machine.
@@ -157,7 +161,7 @@ 

Classes

(*args, **kwargs)
-

SSHClient has the following properties: +

SSHClient has the following properties: sshkey (str): sshkey to use within that client host (str): host ip user (str): user to connect as default: True @@ -167,7 +171,7 @@

Classes

connect_timeout (int): timeout (default 10 seconds)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -182,9 +186,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class SSHClient(Client):
     """
     SSHClient has the following properties:
@@ -267,16 +273,18 @@ 

Instance variables

var connect_timeout
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -292,16 +300,18 @@ 

Returns

var connection_kwargs
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -317,16 +327,18 @@ 

Returns

var forward_agent
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -342,16 +354,18 @@ 

Returns

var host
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -367,16 +381,18 @@ 

Returns

var inline_ssh_env
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -392,16 +408,18 @@ 

Returns

var port
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -417,9 +435,11 @@ 

Returns

var sshclient
-
+
-Source code + +Expand source code +
@property
 def sshclient(self):
     self.validate()
@@ -443,16 +463,18 @@ 

Returns

var sshkey
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -468,16 +490,18 @@ 

Returns

var user
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -498,12 +522,14 @@ 

Methods

def reset_connection(self)
-

Reset the connection +

Reset the connection e.g localconnection = j.clients.sshclient.new("localconnection") -localconnection.reset_connection()

+localconnection.reset_connection()

-Source code + +Expand source code +
def reset_connection(self):
     """ Reset the connection
     e.g
@@ -566,9 +592,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/sshkey/index.html b/docs/api/jumpscale/clients/sshkey/index.html index 580a72ec2..e6f247a79 100644 --- a/docs/api/jumpscale/clients/sshkey/index.html +++ b/docs/api/jumpscale/clients/sshkey/index.html @@ -3,15 +3,17 @@ - + jumpscale.clients.sshkey API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.sshkey

-Source code + +Expand source code +
def export_module_as():
     from jumpscale.core.base import StoredFactory
 
@@ -35,8 +39,8 @@ 

Sub-modules

jumpscale.clients.sshkey.sshkey
-

This module used to manage your ssh keys, get the public key, get the private key, generate key, write key to the file system, -delete key from the …

+

This module used to manage your ssh keys, get the public key, get the private key, generate key, write key to the file system, +delete key from the …

@@ -49,9 +53,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
     from jumpscale.core.base import StoredFactory
 
@@ -90,9 +96,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/sshkey/sshkey.html b/docs/api/jumpscale/clients/sshkey/sshkey.html index 6268aeb60..44ccdacfe 100644 --- a/docs/api/jumpscale/clients/sshkey/sshkey.html +++ b/docs/api/jumpscale/clients/sshkey/sshkey.html @@ -3,16 +3,18 @@ - + jumpscale.clients.sshkey.sshkey API documentation - - - - - + + + + + + +
@@ -39,7 +41,9 @@

Writing ssh keys to files system

ssh_cl.write_to_filesystem()
 
-Source code + +Expand source code +
"""
 This module used to manage your ssh keys, get the public key, get the private key, generate key, write key to the file system,
 delete key from the file system, load key from the file system.
@@ -161,11 +165,11 @@ 

Classes

(*args, **kwargs)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -180,9 +184,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class SSHKeyClient(Client):
     public_key = fields.String()
     private_key = fields.Secret()
@@ -267,16 +273,18 @@ 

Instance variables

var allow_agent
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -292,16 +300,18 @@ 

Returns

var duration
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -317,16 +327,18 @@ 

Returns

var passphrase
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -342,16 +354,18 @@ 

Returns

var private_key
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -367,16 +381,18 @@ 

Returns

var private_key_path
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -392,16 +408,18 @@ 

Returns

var public_key
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -417,15 +435,17 @@ 

Returns

var public_key_path
-

Get the public key path +

Get the public key path e.g ssh_cl = j.clients.sshkey.get("ssh_test") ssh_cl.public_key_path -> "/root/.config/jumpscale/sshkeys/tU59lc6P.pub" Returns -str: the path for public key

+str: the path for public key

-Source code + +Expand source code +
@property
 def public_key_path(self):
     """ Get the public key path
@@ -446,9 +466,11 @@ 

Methods

def delete_from_filesystem(self)
-
+
-Source code + +Expand source code +
def delete_from_filesystem(self):
     pass
@@ -457,12 +479,14 @@

Methods

def generate_keys(self)
-

Generate a new ssh key +

Generate a new ssh key e.g ssh_cl = j.clients.sshkey.get("ssh_test") -ssh_cl.generate_keys()

+ssh_cl.generate_keys()

-Source code + +Expand source code +
def generate_keys(self):
     """Generate a new ssh key
     e.g
@@ -489,12 +513,14 @@ 

Methods

def load_from_file_system(self)
-

Load public key and private key from files using private key path and public key path +

Load public key and private key from files using private key path and public key path e.g ssh_cl = j.clients.sshkey.get("ssh_test") -ssh_cl.load_from_file_system()

+ssh_cl.load_from_file_system()

-Source code + +Expand source code +
def load_from_file_system(self):
     """ Load public key and private key from files using private key path and public key path
     e.g
@@ -509,12 +535,14 @@ 

Methods

def write_to_filesystem(self)
-

Write public key and private key to files using private key path and public key path. +

Write public key and private key to files using private key path and public key path. e.g ssh_cl = j.clients.sshkey.get("ssh_test") -ssh_cl.write_to_filesystem()

+ssh_cl.write_to_filesystem()

-Source code + +Expand source code +
def write_to_filesystem(self):
     """ Write public key and private key to files using private key path and public key path.
     e.g
@@ -589,9 +617,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/zdb/client.html b/docs/api/jumpscale/clients/zdb/client.html index c85eb364c..9b5608256 100644 --- a/docs/api/jumpscale/clients/zdb/client.html +++ b/docs/api/jumpscale/clients/zdb/client.html @@ -3,15 +3,17 @@ - + jumpscale.clients.zdb.client API documentation - - - - - + + + + + + +
@@ -24,7 +26,9 @@

To get a new ZDB instance

zcl = j.clients.zdb.get("instance", admin=True, mode="user")

This will gets an instance with admin capabilities in user mode

-Source code + +Expand source code +
"""
 # To get a new ZDB instance
 
@@ -407,12 +411,14 @@ 

Classes

class Mode -(*args, **kwargs) +(value, names=None, *, module=None, qualname=None, type=None, start=1)
-

An enumeration.

+

An enumeration.

-Source code + +Expand source code +
class Mode(Enum):
     SEQ = "seq"
     USER = "user"
@@ -425,11 +431,11 @@

Class variables

var SEQ
-
+
var USER
-
+
@@ -438,11 +444,11 @@

Class variables

(*args, **kwargs)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -457,9 +463,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-

+
-Source code + +Expand source code +
class ZDBAdminClient(ZDBClient):
     def auth(self):
         assert self.admin
@@ -558,9 +566,11 @@ 

Methods

def auth(self)
-
+
-Source code + +Expand source code +
def auth(self):
     assert self.admin
     if self.secret_:
@@ -572,9 +582,11 @@ 

Methods

def namespace_delete(self, name)
-
+
-Source code + +Expand source code +
def namespace_delete(self, name):
     assert self.admin
     self.auth()
@@ -586,9 +598,11 @@ 

Methods

def namespace_exists(self, name)
-
+
-Source code + +Expand source code +
def namespace_exists(self, name):
     assert self.admin
     self.auth()
@@ -602,12 +616,14 @@ 

Methods

-def namespace_get(self, name, secret='') +def namespace_get(self, name, secret='')
-
+
-Source code + +Expand source code +
def namespace_get(self, name, secret=""):
     assert self.admin
     self.auth()
@@ -618,14 +634,16 @@ 

Methods

def namespace_new(self, name, secret=None, maxsize=0, die=False)
-

check namespace exists & will return zdb client to that namespace

+

check namespace exists & will return zdb client to that namespace

:param name: :param secret: :param maxsize: :param die: -:return:

+:return:

-Source code + +Expand source code +
def namespace_new(self, name, secret=None, maxsize=0, die=False):
     """
     check namespace exists & will return zdb client to that namespace
@@ -669,9 +687,11 @@ 

Methods

def namespaces_list(self)
-
+
-Source code + +Expand source code +
def namespaces_list(self):
     assert self.admin
     self.auth()
@@ -683,11 +703,13 @@ 

Methods

def reset(self, ignore=[])
-

dangerous, will remove all namespaces & all data +

dangerous, will remove all namespaces & all data :param: list of namespace names not to reset -:return:

+:return:

-Source code + +Expand source code +
def reset(self, ignore=[]):
     """
     dangerous, will remove all namespaces & all data
@@ -730,11 +752,11 @@ 

Inherited members

(*args, **kwargs)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -749,9 +771,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class ZDBClient(Client):
     addr = fields.String(default="localhost")
     port = fields.Integer(default=9900)
@@ -954,16 +978,18 @@ 

Instance variables

var addr
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -979,16 +1005,18 @@ 

Returns

var admin
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -1004,10 +1032,12 @@ 

Returns

var count
-

:return: return the number of entries in the namespace -:rtype: int

+

:return: return the number of entries in the namespace +:rtype: int

-Source code + +Expand source code +
@property
 def count(self):
     """
@@ -1019,16 +1049,18 @@ 

Returns

var mode
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -1044,10 +1076,12 @@ 

Returns

var next_id
-

:return: return the next id -:rtype: int

+

:return: return the next id +:rtype: int

-Source code + +Expand source code +
@property
 def next_id(self):
     """
@@ -1060,9 +1094,11 @@ 

Returns

var nsinfo
-
+
-Source code + +Expand source code +
@property
 def nsinfo(self):
     cmd = self.redis.execute_command("NSINFO", self.nsname)
@@ -1071,16 +1107,18 @@ 

Returns

var nsname
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -1096,16 +1134,18 @@ 

Returns

var port
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -1121,9 +1161,11 @@ 

Returns

var redis
-
+
-Source code + +Expand source code +
@property
 def redis(self):
     if not self._redis:
@@ -1142,16 +1184,18 @@ 

Returns

var secret_
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -1172,9 +1216,11 @@ 

Methods

def delete(self, key)
-
+
-Source code + +Expand source code +
def delete(self, key):
     if not key:
         raise j.exceptions.Value("key must be provided")
@@ -1186,9 +1232,11 @@ 

Methods

def exists(self, key)
-
+
-Source code + +Expand source code +
def exists(self, key):
     key = self._key_encode(key)
     return self.redis.execute_command("EXISTS", key) == 1
@@ -1198,12 +1246,14 @@

Methods

def flush(self)
-

will remove all data from the database DANGEROUS !!!! +

will remove all data from the database DANGEROUS !!!! This is only allowed on private and password protected namespace You need to select the namespace before running the command. -:return:

+:return:

-Source code + +Expand source code +
def flush(self):
     """
     will remove all data from the database DANGEROUS !!!!
@@ -1219,9 +1269,11 @@ 

Methods

def get(self, key)
-
+
-Source code + +Expand source code +
def get(self, key):
     key = self._key_encode(key)
     return self.redis.execute_command("GET", key)
@@ -1231,7 +1283,7 @@

Methods

def iterate(self, key_start=None, reverse=False, keyonly=False)
-

walk over all the namespace and yield (key,data) for each entries in a namespace

+

walk over all the namespace and yield (key,data) for each entries in a namespace

:param key_start: if specified start to walk from that key instead of the first one, defaults to None :param key_start: str, optional :param reverse: decide how to walk the namespace @@ -1241,9 +1293,11 @@

Methods

:param reverse: bool, optional :param keyonly: [description], defaults to False :param keyonly: bool, optional -:raises e: [description]

+:raises e: [description]

-Source code + +Expand source code +
def iterate(self, key_start=None, reverse=False, keyonly=False):
     """
     walk over all the namespace and yield (key,data) for each entries in a namespace
@@ -1298,7 +1352,7 @@ 

Methods

def list(self, key_start=None, reverse=False)
-

list all the keys in the namespace

+

list all the keys in the namespace

:param key_start: if specified start to walk from that key instead of the first one, defaults to None :param key_start: str, optional :param reverse: decide how to walk the namespace @@ -1307,9 +1361,11 @@

Methods

defaults to False :param reverse: bool, optional :return: list of keys -:rtype: [str]

+:rtype: [str]

-Source code + +Expand source code +
def list(self, key_start=None, reverse=False):
     """
     list all the keys in the namespace
@@ -1334,10 +1390,12 @@ 

Methods

def ping(self)
-

go to default namespace & ping -:return:

+

go to default namespace & ping +:return:

-Source code + +Expand source code +
def ping(self):
     """
     go to default namespace & ping
@@ -1350,9 +1408,11 @@ 

Methods

def set(self, data, key=None)
-
+
-Source code + +Expand source code +
def set(self, data, key=None):
     key = key or ""
     key = self._key_encode(key)
@@ -1366,9 +1426,11 @@ 

Methods

def stop(self)
-
+
-Source code + +Expand source code +
def stop(self):
     pass
@@ -1390,10 +1452,12 @@

Inherited members

(namespace=None, namespace_password=None, admin=False, *args, **kwargs)
-

ZDBConnection implement the custom selection of namespace -on 0-DB

+

ZDBConnection implement the custom selection of namespace +on 0-DB

-Source code + +Expand source code +
class ZDBConnection(redis.Connection):
     """
     ZDBConnection implement the custom selection of namespace
@@ -1440,9 +1504,11 @@ 

Methods

def on_connect(self)
-

when a new connection is created, switch to the proper namespace

+

when a new connection is created, switch to the proper namespace

-Source code + +Expand source code +
def on_connect(self):
     """
     when a new connection is created, switch to the proper namespace
@@ -1544,9 +1610,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/clients/zdb/index.html b/docs/api/jumpscale/clients/zdb/index.html index 26492b3dc..9d5157acf 100644 --- a/docs/api/jumpscale/clients/zdb/index.html +++ b/docs/api/jumpscale/clients/zdb/index.html @@ -3,15 +3,17 @@ - + jumpscale.clients.zdb API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.clients.zdb

-Source code + +Expand source code +
from jumpscale.core.base import StoredFactory
 from .client import ZDBClient, ZDBAdminClient
 
@@ -43,7 +47,7 @@ 

Sub-modules

jumpscale.clients.zdb.client
-

To get a new ZDB instance …

+

To get a new ZDB instance …

@@ -56,9 +60,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
 
     return ZDBFactory(ZDBClient)
@@ -74,7 +80,7 @@

Classes

(type_, name_=None, parent_instance_=None, parent_factory_=None)
-

Stored factories are a custom type of Factory, which uses current configured store backend +

Stored factories are a custom type of Factory, which uses current configured store backend to store all instance configurations.

get a new stored factory given the type to create and store instances for.

Any factory can have a name, parent Base instance and a parent factory.

@@ -89,9 +95,11 @@

Args

a parent Base instance. Defaults to None.
parent_factory_ : Factory, optional
a parent Factory. Defaults to None.
-
+
-Source code + +Expand source code +
class ZDBFactory(StoredFactory):
     def new(self, name, *args, **kwargs):
         if kwargs.get("admin"):
@@ -157,9 +165,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/application/application.html b/docs/api/jumpscale/core/application/application.html index 592ba5200..75c0f7473 100644 --- a/docs/api/jumpscale/core/application/application.html +++ b/docs/api/jumpscale/core/application/application.html @@ -3,15 +3,17 @@ - + jumpscale.core.application.application API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.core.application.application

-Source code + +Expand source code +
import sys
 
 from jumpscale.loader import j
@@ -49,9 +53,11 @@ 

Classes

class Application
-
+
-Source code + +Expand source code +
class Application:
     def __init__(self):
         sys.excepthook = j.tools.errorhandler.excepthook
@@ -64,9 +70,11 @@ 

Instance variables

var process_id
-
+
-Source code + +Expand source code +
@property
 def process_id(self):
     return j.sals.process.get_my_process().pid
@@ -102,9 +110,7 @@

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/application/index.html b/docs/api/jumpscale/core/application/index.html index c06302d40..acf7b8a81 100644 --- a/docs/api/jumpscale/core/application/index.html +++ b/docs/api/jumpscale/core/application/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.application API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.core.application

-Source code + +Expand source code +
def export_module_as():
     from .application import Application
 
@@ -33,7 +37,7 @@ 

Sub-modules

jumpscale.core.application.application
-
+
@@ -46,9 +50,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
     from .application import Application
 
@@ -85,9 +91,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/events.html b/docs/api/jumpscale/core/base/events.html index da5116554..61c00bf88 100644 --- a/docs/api/jumpscale/core/base/events.html +++ b/docs/api/jumpscale/core/base/events.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.events API documentation - - - - - + + + + + + +
@@ -22,7 +24,9 @@

Module jumpscale.core.base.events

Base and factory related events.

-Source code + +Expand source code +
"""
 Base and factory related events.
 """
@@ -65,9 +69,11 @@ 

Classes

(instance, name, new_value)
-
+
-Source code + +Expand source code +
class AttributeUpdateEvent(InstanceEvent):
     def __init__(self, instance, name, new_value):
         super().__init__(instance=instance)
@@ -88,9 +94,11 @@ 

Subclasses

(instance=None, factory=None)
-
+
-Source code + +Expand source code +
class InstanceCreateEvent(InstanceEvent):
     pass
@@ -104,9 +112,11 @@

Ancestors

(name, instance=None, factory=None)
-
+
-Source code + +Expand source code +
class InstanceDeleteEvent(InstanceEvent):
     def __init__(self, name, instance=None, factory=None):
         super().__init__(instance, factory)
@@ -122,9 +132,11 @@ 

Ancestors

(instance=None, factory=None)
-
+
-Source code + +Expand source code +
class InstanceEvent:
     def __init__(self, instance=None, factory=None):
         self.instance = instance
@@ -171,9 +183,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/factory.html b/docs/api/jumpscale/core/base/factory.html index 644555135..de98da0b4 100644 --- a/docs/api/jumpscale/core/base/factory.html +++ b/docs/api/jumpscale/core/base/factory.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.factory API documentation - - - - - + + + + + + +
@@ -20,11 +22,11 @@

Module jumpscale.core.base.factory

-

Hierarchal configurations and factories for any Base type/class.

+

Hierarchal configurations and factories for any Base type/class.

It is implemented using:

    -
  • Factory: the base for all factories, implements an in-memory factory for any type.
  • -
  • StoredFactory: a factory which stores and load configuration according to the current configured store backend.
  • +
  • Factory: the base for all factories, implements an in-memory factory for any type.
  • +
  • StoredFactory: a factory which stores and load configuration according to the current configured store backend.

Default store configured is file system, you can show current store config by doing:

✗ jsctl config get store
@@ -42,7 +44,9 @@ 

Module jumpscale.core.base.factory

This will use current redis config (hostname: localhost, port: 6379).

-Source code + +Expand source code +
"""
 Hierarchal configurations and factories for any `jumpscale.core.base.meta.Base` type/class.
 
@@ -648,9 +652,11 @@ 

Classes

(*args, **kwargs)
-

raised when you try to create an instance by the same name of an existing one for a factory

+

raised when you try to create an instance by the same name of an existing one for a factory

-Source code + +Expand source code +
class DuplicateError(Exception):
     """
     raised when you try to create an instance by the same name of an existing one for a factory
@@ -667,10 +673,10 @@ 

Ancestors

(type_, name_=None, parent_instance_=None, parent_factory_=None)
-

Base factory, where you can create/get/list/delete new instances.

+

Base factory, where you can create/get/list/delete new instances.

All of the operations are done in memory, also instances will be available as properties.

Example:

-

+

 class Car(Base):
     name = fields.String()
     color = fields.String()
@@ -691,11 +697,13 @@ 

Args

factory name. Defaults to None.
parent_instance_ : Base, optional
a parent Base instance. Defaults to None.
-
parent_factory_ : Factory, optional
-
a parent Factory. Defaults to None.
-

+
parent_factory_ : Factory, optional
+
a parent Factory. Defaults to None.
+
-Source code + +Expand source code +
class Factory:
     """
     Base factory, where you can create/get/list/delete new instances.
@@ -921,9 +929,11 @@ 

Instance variables

var name
-
+
-Source code + +Expand source code +
@property
 def name(self):
     return self.__name
@@ -931,9 +941,11 @@

Instance variables

var parent_factory
-
+
-Source code + +Expand source code +
@property
 def parent_factory(self):
     return self.__parent_factory
@@ -941,9 +953,11 @@

Instance variables

var parent_instance
-
+
-Source code + +Expand source code +
@property
 def parent_instance(self):
     return self.__parent_instance
@@ -956,12 +970,14 @@

Methods

def delete(self, name)
-

delete an instance (with its attribute)

+

delete an instance (with its attribute)

this will update the count and trigger _deleted

Args

-

name (str)

+

name (str)

-Source code + +Expand source code +
def delete(self, name):
     """
     delete an instance (with its attribute)
@@ -980,7 +996,7 @@ 

Args

def find(self, name)
-

find an instance with the given name

+

find an instance with the given name

Args

name : str
@@ -988,16 +1004,18 @@

Args

Raises

-
ValueError
+
ValueError
in case the name is an internal attribute of this factory, like get or new.

Returns

-
Base or NoneType: an instance or none
-
 
-
+
Base or NoneType
+
an instance or none
+
-Source code + +Expand source code +
def find(self, name):
     """
     find an instance with the given name
@@ -1021,7 +1039,7 @@ 

Returns

def get(self, name, *args, **kwargs)
-

get an instance (will create if it does not exist)

+

get an instance (will create if it does not exist)

if the instance with name exists, args and kwargs are ignored.

Args

@@ -1034,16 +1052,18 @@

Args

Raises

-
DuplicateError
+
DuplicateError
in case an instance with the same name exists

Returns

-
Base
+
Base
instance
-
+
-Source code + +Expand source code +
def get(self, name, *args, **kwargs):
     """
     get an instance (will create if it does not exist)
@@ -1071,15 +1091,14 @@ 

Returns

def list_all(self)
-

get a set of all instance names

+

get a set of all instance names

this only get a list of all properties that are of factory Base type.

Returns

-
-
set
-
 
-
+

set

-Source code + +Expand source code +
def list_all(self):
     """
     get a set of all instance names
@@ -1100,7 +1119,7 @@ 

Returns

def new(self, name, *args, **kwargs)
-

get a new instance and make it available as an attribute

+

get a new instance and make it available as an attribute

Args

name : str
@@ -1112,16 +1131,18 @@

Args

Raises

-
DuplicateError
+
DuplicateError
in case an instance with the same name exists

Returns

-
Base
+
Base
instance
-
+
-Source code + +Expand source code +
def new(self, name, *args, **kwargs):
     """
     get a new instance and make it available as an attribute
@@ -1152,7 +1173,7 @@ 

Returns

(type_, name_=None, parent_instance_=None, parent_factory_=None)
-

Stored factories are a custom type of Factory, which uses current configured store backend +

Stored factories are a custom type of Factory, which uses current configured store backend to store all instance configurations.

get a new stored factory given the type to create and store instances for.

Any factory can have a name, parent Base instance and a parent factory.

@@ -1165,11 +1186,13 @@

Args

factory name. Defaults to None.
parent_instance_ : Base, optional
a parent Base instance. Defaults to None.
-
parent_factory_ : Factory, optional
-
a parent Factory. Defaults to None.
-
+
parent_factory_ : Factory, optional
+
a parent Factory. Defaults to None.
+
-Source code + +Expand source code +
class StoredFactory(events.Handler, Factory):
     """
     Stored factories are a custom type of `Factory`, which uses current configured store backend
@@ -1502,23 +1525,25 @@ 

Class variables

var STORE
-

Filesystem store is an EncryptedConfigStore

+

Filesystem store is an EncryptedConfigStore

It saves the config relative to config_env.get_store_config("filesystem")

-

To store every instance config in a different path, it uses the given Location.

+

To store every instance config in a different path, it uses the given Location.

Instance variables

var location
-

get a unique location for this factory

+

get a unique location for this factory

Returns

-
Location
+
Location
location object
-
+
-Source code + +Expand source code +
@property
 def location(self):
     """
@@ -1551,9 +1576,11 @@ 

Returns

var parent_location
-
+
-Source code + +Expand source code +
@property
 def parent_location(self):
     if not self.parent_factory:
@@ -1563,9 +1590,11 @@ 

Returns

var store
-
+
-Source code + +Expand source code +
@property
 def store(self):
     if not self.__store:
@@ -1580,7 +1609,7 @@ 

Methods

def find_many(self, cursor_=None, limit_=None, **query)
-

do a search against the store (not loaded objects) with this query.

+

do a search against the store (not loaded objects) with this query.

queries can relate to current store backend used.

Keyword Args: cursor_ (any, optional): an optional cursor, to start searching from. Defaults to None. @@ -1588,11 +1617,13 @@

Methods

query: a mapping for field/query, e.g. first_name="aa"

Returns

-
tuple
+
tuple
the new cursor, total results count, and a list of objects as a result
-
+
-Source code + +Expand source code +
def find_many(self, cursor_=None, limit_=None, **query):
     """
     do a search against the store (not loaded objects) with this query.
@@ -1618,7 +1649,7 @@ 

Returns

def get_instance_property(self, name)
-

return a new property descriptor for a given name, this will help in lazy-loading +

return a new property descriptor for a given name, this will help in lazy-loading as this property will only create and load an instance from the store once accessed.

Args

@@ -1627,11 +1658,13 @@

Args

Returns

-
property
+
property
property descriptor (object)
-
+
-Source code + +Expand source code +
def get_instance_property(self, name):
     """
     return a new property descriptor for a given name, this will help in lazy-loading
@@ -1662,14 +1695,16 @@ 

Returns

def handle(self, ev)
-

handle when the parent instance is deleted

+

handle when the parent instance is deleted

Args

ev : InstanceDeleteEvent
instance delete event
-
+
-Source code + +Expand source code +
def handle(self, ev):
     """
     handle when the parent instance is deleted
@@ -1692,14 +1727,16 @@ 

Args

def list_all(self)
-

get all instance names (stored or not)

+

get all instance names (stored or not)

Returns

-
set
+
set
instance names
-
+
-Source code + +Expand source code +
def list_all(self):
     """
     get all instance names (stored or not)
@@ -1715,7 +1752,7 @@ 

Returns

def new(self, name, *args, **kwargs)
-

get a new instance and make it available as an attribute

+

get a new instance and make it available as an attribute

this method also initialize sub-factories for this instance.

Args

@@ -1728,16 +1765,18 @@

Args

Raises

-
DuplicateError
+
DuplicateError
in case an instance with the same name exists

Returns

-
Base
+
Base
instance
-
+
-Source code + +Expand source code +
def new(self, name, *args, **kwargs):
     """
     get a new instance and make it available as an attribute
@@ -1824,9 +1863,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/fields.html b/docs/api/jumpscale/core/base/fields.html index b2db06e7e..afa489691 100644 --- a/docs/api/jumpscale/core/base/fields.html +++ b/docs/api/jumpscale/core/base/fields.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.fields API documentation - - - - - + + + + + + +
@@ -23,9 +25,9 @@

Module jumpscale.core.base.fields

fields have all possible fields where they can be used as a class variables for any Base classselfself.

Field instances will not hold the value or any date, they will be converted by Base to function descriptors, where the data itself resides in Base objects (instances).

-

See jumpscale.core.base.meta.

+

See jumpscale.core.base.meta.

Example:

-
from enum import Enum
+
from enum import Enum
 
 class Permission(Base):
     read_posts = fields.Boolean()
@@ -62,13 +64,15 @@ 

Module jumpscale.core.base.fields

In addition to custom options every field can accept and define, they can be used in the following methods:

  • validate: -raises a ValidationError in case it's not valid.
  • +raises a ValidationError in case it's not valid.
  • to_raw: returns a raw (primitive type) object from a value of this field
  • from_raw: returns a new object of the field type (if any) from a raw value

No need for from_raw to raise an error on e.g. type mismatch, as validate will do the validation.

-Source code + +Expand source code +
"""
 `fields` have all possible fields where they can be used as a class variables for any Base classselfself.
 
@@ -1239,7 +1243,7 @@ 

Classes

(default=False, **kwargs)
-

Boolean fields to hold a bool value.

+

Boolean fields to hold a bool value.

values can be set using strings or numbers and will be converted to bool like:

  • "on", "off"
  • @@ -1253,10 +1257,12 @@

    Args

    default : bool, optional
    default value. Defaults to False.
    kwargs
    -
    any keyword arguments supported by Field
    -
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Boolean(Typed):
     def __init__(self, default=False, **kwargs):
         """
@@ -1309,16 +1315,18 @@ 

Methods

def from_raw(self, value)
-

get bool value from strings and numbers

+

get bool value from strings and numbers

Args

value (str or int or float or complex)

Returns

-
bool
+
bool
boolean value
-
+
-Source code + +Expand source code +
def from_raw(self, value):
     """
     get bool value from strings and numbers
@@ -1359,17 +1367,19 @@ 

Inherited members

(default=b'', encoding='utf-8', **kwargs)
-

same as string field, but will hold bytes.

+

same as string field, but will hold bytes.

Args

default (b"", optional): default value. Defaults to b""
encoding
encoding to be used when serializing the value. Defaults to "utf-8"
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Bytes(Typed):
     def __init__(self, default=b"", encoding="utf-8", **kwargs):
         """
@@ -1414,7 +1424,7 @@ 

Inherited members

(default=None, format_=None, **kwargs)
-

date field, will hold datetime.date objects.

+

date field, will hold datetime.date objects.

values can be set using strings in the given format_ too like "12/1/2020" or a utc timestamp, they will converted to objects.

Args

@@ -1424,10 +1434,12 @@

Args

format_ : str, optional
date format. Defaults to "%Y-%m-%d" if None.
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Date(DateTimeMixin, Typed):
     def __init__(self, default=None, format_=None, **kwargs):
         """
@@ -1475,7 +1487,7 @@ 

Inherited members

(default=None, format_=None, **kwargs)
-

datetime field, will hold datetime.datetime objects.

+

datetime field, will hold datetime.datetime objects.

values can be set using strings in the given format_ too like "12/1/2020" or a utc timestamp, they will converted to objects.

Args

@@ -1485,10 +1497,12 @@

Args

format_ : str, optional
datetime format. Defaults to "%Y-%m-%d %H:%M" if None.
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class DateTime(DateTimeMixin, Typed):
     # maybe add something like auto_now and auto_today for date/time fields
     def __init__(self, default=None, format_=None, **kwargs):
@@ -1534,12 +1548,13 @@ 

Inherited members

class DateTimeMixin -(*args, **kwargs)
-
+
-Source code + +Expand source code +
class DateTimeMixin:
     def get_arrow_obj(self, value):
         """
@@ -1621,8 +1636,8 @@ 

Inherited members

Subclasses

Methods

@@ -1631,7 +1646,7 @@

Methods

def from_raw(self, value)
-

get a datetime object from a numberic (epoch) or string value

+

get a datetime object from a numberic (epoch) or string value

Args

value : str or int or float
@@ -1639,11 +1654,13 @@

Args

Returns

-
datetime.datetime or datetime.date or datetime.time: datetime or date/time object
-
 
-
+
datetime.datetime or datetime.date or datetime.time
+
datetime or date/time object
+
-Source code + +Expand source code +
def from_raw(self, value):
     """
     get a datetime object from a numberic (epoch) or string value
@@ -1674,7 +1691,7 @@ 

Returns

def get_arrow_obj(self, value)
-

get an arrow object from int, float and str and datetime.time objects.

+

get an arrow object from int, float and str and datetime.time objects.

Args

value : int or float or str
@@ -1682,11 +1699,13 @@

Args

Returns

-
arrow.Arrow: arrow object in utc
-
 
-
+
arrow.Arrow
+
arrow object in utc
+
-Source code + +Expand source code +
def get_arrow_obj(self, value):
     """
     get an arrow object from int, float and str and `datetime.time` objects.
@@ -1712,7 +1731,7 @@ 

Returns

def get_timestamp(self, obj)
-

get a utc timestamp from datetime/date/time objects

+

get a utc timestamp from datetime/date/time objects

Args

obj : datetime.datetime or datetime.date or datetime.time
@@ -1720,11 +1739,13 @@

Args

Returns

-
int or float: utc timestamp
-
 
-
+
int or float
+
utc timestamp
+
-Source code + +Expand source code +
def get_timestamp(self, obj):
     """
     get a utc timestamp from datetime/date/time objects
@@ -1743,7 +1764,7 @@ 

Returns

def to_raw(self, dt_obj)
-

get a utc timestamp from datetime object

+

get a utc timestamp from datetime object

Args

dt_obj : datetime.datetime or datetime.date or datetime.time
@@ -1751,11 +1772,13 @@

Args

Returns

-
int or float: utc timestamp
-
 
-
+
int or float
+
utc timestamp
+
-Source code + +Expand source code +
def to_raw(self, dt_obj):
     """
     get a utc timestamp from datetime object
@@ -1774,9 +1797,11 @@ 

Returns

def validate(self, value)
-
+
-Source code + +Expand source code +
def validate(self, value):
     if isinstance(self.from_raw(value), str):
         # cannot convert from string, still an invalid format
@@ -1792,7 +1817,7 @@ 

Returns

(default='', **kwargs)
-

Email field, will validate the value of emails

+

Email field, will validate the value of emails

will hold string email values.

Args

@@ -1800,9 +1825,11 @@

Args

default value. Defaults to ""
kwargs
other keyword arguments supported by string
-
+
-Source code + +Expand source code +
class Email(String):
     def __init__(self, default="", **kwargs):
         """
@@ -1843,16 +1870,18 @@ 

Methods

def validate(self, value)
-

check whether provided value is a valid email representation

+

check whether provided value is a valid email representation

Args

value (str)

Raises

-
ValidationError
+
ValidationError
in case the value is not a telephone
-
+
-Source code + +Expand source code +
def validate(self, value):
     """
     check whether provided value is a valid email representation
@@ -1885,9 +1914,9 @@ 

Inherited members

(enum_type, **kwargs)
-

Enum field, to be used with enum.Enum.

+

Enum field, to be used with enum.Enum.

Example:

-
class UserType(Enum):
+
class UserType(Enum):
     USER = "user"
     ADMIN = "admin"
 
@@ -1900,10 +1929,12 @@ 

Args

enum_type : type
enum type (class)
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Enum(Typed):
     def __init__(self, enum_type, **kwargs):
         """
@@ -1971,7 +2002,7 @@ 

Methods

def from_raw(self, value)
-

get an enum object from value

+

get an enum object from value

Args

value : any
@@ -1979,11 +2010,13 @@

Args

Returns

-
enum
+
enum
enum object of enum type of the field
-
+
-Source code + +Expand source code +
def from_raw(self, value):
     """
     get an enum object from value
@@ -2005,7 +2038,7 @@ 

Returns

def to_raw(self, enum_obj)
-

get enum value

+

get enum value

Args

enum_obj : enum.Enum
@@ -2013,11 +2046,13 @@

Args

Returns

-
any
+
any
enum value
-
+
-Source code + +Expand source code +
def to_raw(self, enum_obj):
     """
     get enum value
@@ -2048,16 +2083,16 @@ 

Inherited members

(type_, factory_type=None, **kwargs)
-

A factory field for any Base type, also, you can specify your factory type/class

+

A factory field for any Base type, also, you can specify your factory type/class

Example:

-
class User(Base):
+
class User(Base):
     name = fields.String()
 
 class Server(Base):
     users = fields.Factory(User)
 

Another example with a custom factory class:

-
class User(Base):
+
class User(Base):
     name = fields.String()
 
 class UserFactory(StoredFactory):
@@ -2074,9 +2109,11 @@ 

Args

type_ : Base
any base type to be used by the factory
-

factory_type (BaseFactory, optional): factory class/type. Defaults to None.

+

factory_type (BaseFactory, optional): factory class/type. Defaults to None.

-Source code + +Expand source code +
class Factory(Field):
     def __init__(self, type_, factory_type=None, **kwargs):
         """
@@ -2159,7 +2196,7 @@ 

Inherited members

(default=None, required=False, indexed=False, readonly=False, validators=None, stored=True, on_update=None, compute=None, **kwargs)
-

Base field for all field types, have some common options that can be used any other field type too.

+

Base field for all field types, have some common options that can be used any other field type too.

Args

default : any, optional
@@ -2178,9 +2215,11 @@

Args

a callable that takes the instance and new value on field updates. Defaults to None.
compute : callable, optional
a callable that takes the instance and returns a computed value for this field. on_update won't be called in this case. Defaults to None.
-
+
-Source code + +Expand source code +
class Field:
     def __init__(
         self,
@@ -2297,17 +2336,19 @@ 

Args

Subclasses

Instance variables

var computed
-
+
-Source code + +Expand source code +
@property
 def computed(self):
     return callable(self.compute)
@@ -2315,9 +2356,11 @@

Instance variables

var trigger_updates
-
+
-Source code + +Expand source code +
@property
 def trigger_updates(self):
     return callable(self.on_update)
@@ -2330,7 +2373,7 @@

Methods

def from_raw(self, value)
-

get the value of this field from primitive raw types

+

get the value of this field from primitive raw types

Args

value : any
@@ -2338,11 +2381,13 @@

Args

Returns

-
any
+
any
raw value
-
+
-Source code + +Expand source code +
def from_raw(self, value):
     """
     get the value of this field from primitive raw types
@@ -2360,9 +2405,11 @@ 

Returns

def preprocess(self, value)
-
+
-Source code + +Expand source code +
def preprocess(self, value):
     # TODO: make from/to raw methods only for serialization
     # and let preprocess/validate do the cleanup/checking step
@@ -2375,7 +2422,7 @@ 

Returns

def to_raw(self, value)
-

get the raw value of this field

+

get the raw value of this field

Args

value : any
@@ -2383,11 +2430,13 @@

Args

Returns

-
any
+
any
a primitive raw value
-
+
-Source code + +Expand source code +
def to_raw(self, value):
     """
     get the raw value of this field
@@ -2405,7 +2454,7 @@ 

Returns

def validate(self, value)
-

validate value if required and call custom self.validators if any

+

validate value if required and call custom self.validators if any

Args

value : any
@@ -2413,11 +2462,13 @@

Args

Raises

-
ValidationError
+
ValidationError
[description]
-
+
-Source code + +Expand source code +
def validate(self, value):
     """
     validate value if required and call custom self.validators if any
@@ -2440,7 +2491,7 @@ 

Raises

def validate_with_name(self, value, name)
-

validates the value using validate method and prepends the field name +

validates the value using validate method and prepends the field name in case an exception was thrown

Args

@@ -2451,11 +2502,13 @@

Args

(str): the field name

Raises

-
ValidationError
+
ValidationError
The original validation error with the field name prepended to the message
-
+
-Source code + +Expand source code +
def validate_with_name(self, value, name):
     """
     validates the value using validate method and prepends the field name
@@ -2482,7 +2535,7 @@ 

Raises

(default=0.0, **kwargs)
-

Same as Integer field, but with a type of float.

+

Same as Integer field, but with a type of float.

values can be set using strings like (will be converted to float):

  • "12.3", " 1212.23 @@ -2493,10 +2546,12 @@

    Args

    default : float, optional
    default value. Defaults to 0.0.
    kwargs
    -
    any keyword arguments supported by Field
    -
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Float(Typed):
     def __init__(self, default=0.0, **kwargs):
         """
@@ -2545,7 +2600,7 @@ 

Inherited members

(default=None, **kwargs)
-

UUID v4 field, will be auto-generated by default.

+

UUID v4 field, will be auto-generated by default.

Will hold the UUID as a string.

It accepts setting UUID value by many ways and converts them to strings:

    @@ -2559,10 +2614,12 @@

    Args

    default : str, optional
    default value, will be auto-generated if None. Defaults to None
    kwargs
    -
    other keyword arguments supported by String
    -
+
other keyword arguments supported by String
+
-Source code + +Expand source code +
class GUID(String):
     def __init__(self, default=None, **kwargs):
         """
@@ -2641,7 +2698,7 @@ 

Methods

def from_raw(self, value)
-

convert string, bytes, int to UUID object, then to a string

+

convert string, bytes, int to UUID object, then to a string

Args

value : int or str or bytes or uuid.UUID
@@ -2649,11 +2706,13 @@

Args

Returns

-
str
+
str
UUID string
-
+
-Source code + +Expand source code +
def from_raw(self, value):
     """
     convert string, bytes, int to UUID object, then to a string
@@ -2705,17 +2764,19 @@ 

Inherited members

(default='0.0.0.0', **kwargs)
-

IP address field, will validate the value of ip address (v4 and v6)

+

IP address field, will validate the value of ip address (v4 and v6)

Will hold string ip addresses.

Args

default : str, optional
default value. Defaults to ""
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class IPAddress(IPMixin, String):
     def __init__(self, default="0.0.0.0", **kwargs):
         """
@@ -2763,17 +2824,19 @@ 

Methods

def validate(self, value)
-

check whether provided value is a valid IPaddress representation +

check whether provided value is a valid IPaddress representation including IPv4,IPv6 and network

Args

value (str)

Raises

-
ValidationError
+
ValidationError
in case the value is not an IPAddress
-
+
-Source code + +Expand source code +
def validate(self, value):
     """
     check whether provided value is a valid IPaddress representation
@@ -2817,12 +2880,13 @@ 

Inherited members

class IPMixin -(*args, **kwargs)
-
+
-Source code + +Expand source code +
class IPMixin:
     def is_a(self, value, *types):
         """
@@ -2904,16 +2968,18 @@ 

Methods

def is_a(self, value, *types)
-

try creating any type of types from the given value

+

try creating any type of types from the given value

Args

value (str)

Returns

-
bool
+
bool
True if any matched, False otherwise
-
+
-Source code + +Expand source code +
def is_a(self, value, *types):
     """
     try creating any type of `types` from the given value
@@ -2940,7 +3006,7 @@ 

Returns

def is_iface(self, value)
-

check if a given value is an IP interface

+

check if a given value is an IP interface

Args

value : str
@@ -2948,11 +3014,13 @@

Args

Returns

-
bool
+
bool
True if it's a valid v4/v6 IP interface
-
+
-Source code + +Expand source code +
def is_iface(self, value):
     """
     check if a given value is an IP interface
@@ -2970,7 +3038,7 @@ 

Returns

def is_ip(self, value)
-

check if a given value is a v4/v6 IP address

+

check if a given value is a v4/v6 IP address

Args

value : str
@@ -2978,12 +3046,14 @@

Args

Returns

-
bool
+
bool
True if it's a valid v4/v6 IP address
-
+
-Source code + +Expand source code +
def is_ip(self, value):
     """
     check if a given value is a v4/v6 IP address
@@ -3001,7 +3071,7 @@ 

Returns

def is_ipv4(self, value)
-

check if a given value is a v4 IP address

+

check if a given value is a v4 IP address

Args

value : str
@@ -3009,11 +3079,13 @@

Args

Returns

-
bool
+
bool
True if it's a valid v4 IP address
-
+
-Source code + +Expand source code +
def is_ipv4(self, value):
     """
     check if a given value is a v4 IP address
@@ -3031,7 +3103,7 @@ 

Returns

def is_ipv6(self, value)
-

check if a given value is a v6 IP address

+

check if a given value is a v6 IP address

Args

value : str
@@ -3039,11 +3111,13 @@

Args

Returns

-
bool
+
bool
True if it's a valid v6 IP address
-
+
-Source code + +Expand source code +
def is_ipv6(self, value):
     """
     check if a given value is a v6 IP address
@@ -3064,17 +3138,19 @@ 

Returns

(default='::/128', **kwargs)
-

ip range field, will validate the value of ip ranges (v4 and v6)

+

ip range field, will validate the value of ip ranges (v4 and v6)

will be stored as a string.

Args

default : str, optional
default value. Defaults to ""
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class IPRange(IPMixin, String):
     def __init__(self, default="::/128", **kwargs):
         """
@@ -3117,17 +3193,19 @@ 

Methods

def validate(self, value)
-

check whether provided value is a valid IPaddress representation +

check whether provided value is a valid IPaddress representation including IPv4,IPv6 and network

Args

value (str)

Raises

-
ValidationError
+
ValidationError
in case the value is not an IPAddress
-
+
-Source code + +Expand source code +
def validate(self, value):
     """
     check whether provided value is a valid IPaddress representation
@@ -3171,7 +3249,7 @@ 

Inherited members

(default=0, min=None, max=None, **kwargs)
-

Intger field, the same as Typed, but with a type of int

+

Intger field, the same as Typed, but with a type of int

It can have a minimum value, if min is not set, it will ignore it.

values can be set using strings like (will be converted to int):

    @@ -3187,10 +3265,12 @@

    Args

    max : int, optional
    maximum value (inclusive). Defaults to None.
    kwargs
    -
    any keyword arguments supported by Field
    -
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Integer(Typed):
     def __init__(self, default=0, min=None, max=None, **kwargs):
         """
@@ -3256,17 +3336,19 @@ 

Inherited members

(default='{}', **kwargs)
-

Json field, will check if the value is a valid json string.

+

Json field, will check if the value is a valid json string.

It will hold json strings, if the value is not string, it will be converted.

Args

default : str, optional
default value. Defaults to "{}"
kwargs
-
other keyword arguments supported by String
-
+
other keyword arguments supported by String
+
-Source code + +Expand source code +
class Json(String):
     def __init__(self, default="{}", **kwargs):
         """
@@ -3330,7 +3412,7 @@ 

Methods

def from_raw(self, value)
-

convert non-string values to json string

+

convert non-string values to json string

Args

value : any
@@ -3338,11 +3420,13 @@

Args

Returns

-
str
+
str
a json string
-
+
-Source code + +Expand source code +
def from_raw(self, value):
     """
     convert non-string values to json string
@@ -3365,16 +3449,18 @@ 

Returns

def validate(self, value)
-

check whether provided value is a valid json

+

check whether provided value is a valid json

Args

value (str)

Raises

-
ValidationError
+
ValidationError
in case the value isn't a valid json
-
+
-Source code + +Expand source code +
def validate(self, value):
     """
     check whether provided value is a valid json
@@ -3413,16 +3499,18 @@ 

Inherited members

(field, **kwargs)
-

A list field for any field types.

+

A list field for any field types.

Args

-
field : Field
+
field : Field
a field instance of any fields, e.g. fields.String(maxlen=14).
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class List(Field):
     def __init__(self, field, **kwargs):
         """
@@ -3488,7 +3576,7 @@ 

Methods

def from_raw(self, values)
-

get a list of field type from raw values

+

get a list of field type from raw values

Args

values : list
@@ -3496,11 +3584,13 @@

Args

Returns

-
list
+
list
list of objects of field type
-
+
-Source code + +Expand source code +
def from_raw(self, values):
     """
     get a list of field type from raw values
@@ -3521,7 +3611,7 @@ 

Returns

def to_raw(self, values)
-

get a list of values as raw

+

get a list of values as raw

Args

values : list
@@ -3529,11 +3619,13 @@

Args

Returns

-
list
+
list
list of raw values
-
+
-Source code + +Expand source code +
def to_raw(self, values):
     """
     get a list of values as raw
@@ -3554,10 +3646,12 @@ 

Returns

def validate(self, value)
-

validate the value of every item in the list -Will just call the field.validate of the given field

+

validate the value of every item in the list +Will just call the field.validate of the given field

-Source code + +Expand source code +
def validate(self, value):
     """
     validate the value of every item in the list
@@ -3587,7 +3681,7 @@ 

Inherited members

(type_, type_kwargs=None, **kwargs)
-

An embedded Base object field of any type.

+

An embedded Base object field of any type.

Args

type_ : type
@@ -3595,10 +3689,12 @@

Args

type_kwargs : dict, optional
kwargs as a dict to be passed to Base instance when created. Defaults to None.
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Object(Typed):
     def __init__(self, type_, type_kwargs=None, **kwargs):
         """
@@ -3669,7 +3765,7 @@ 

Methods

def from_raw(self, data)
-

get an object from dict

+

get an object from dict

Args

data : dict
@@ -3677,11 +3773,13 @@

Args

Returns

-
Base
+
Base
base object
-
+
-Source code + +Expand source code +
def from_raw(self, data):
     """
     get an object from dict
@@ -3701,7 +3799,7 @@ 

Returns

def to_raw(self, obj)
-

get raw value of an object as dict

+

get raw value of an object as dict

Args

obj : Base
@@ -3709,11 +3807,13 @@

Args

Returns

-
dict
+
dict
raw data
-
+
-Source code + +Expand source code +
def to_raw(self, obj):
     """
     get raw value of an object as dict
@@ -3732,14 +3832,16 @@ 

Returns

def validate(self, value)
-

validate Base objects

+

validate Base objects

Args

value : Base
object
-
+
-Source code + +Expand source code +
def validate(self, value):
     """
     validate Base objects
@@ -3767,17 +3869,19 @@ 

Inherited members

(default='', **kwargs)
-

Path field, will validate the value of file system paths

+

Path field, will validate the value of file system paths

Will hold string path values.

Args

default : str, optional
default value. Defaults to ""
kwargs
-
other keyword arguments supported by Field
-
+
other keyword arguments supported by Field
+
-Source code + +Expand source code +
class Path(String):
     # TODO: Validate that it is working on windows
     def __init__(self, default="", **kwargs):
@@ -3819,16 +3923,18 @@ 

Methods

def validate(self, value)
-

check whether provided value is a valid path representation

+

check whether provided value is a valid path representation

Args

value (str)

Raises

-
ValidationError
+
ValidationError
in case the value is not a telephone
-
+
-Source code + +Expand source code +
def validate(self, value):
     """
     check whether provided value is a valid path representation
@@ -3861,15 +3967,17 @@ 

Inherited members

(**kwargs)
-

Port field, will check if the given port is within the range of 0-65535.

+

Port field, will check if the given port is within the range of 0-65535.

Will hold integers, but also accepts string values like "8080".

Args

kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Port(Integer):
     def __init__(self, **kwargs):
         """
@@ -3911,14 +4019,14 @@ 

Inherited members

(maxlen=None, allow_empty=True, **kwargs)
-

Same as String, but encrypted by default.

+

Same as String, but encrypted by default.

Should be used with sensitive data.

Args

kwargs
-
any keyword arguments supported by String
+
any keyword arguments supported by String
-

Same as Typed, but with a type of str.

+

Same as Typed, but with a type of str.

If maxlen is set, it will validate the length of the string.

Args

@@ -3927,10 +4035,12 @@

Args

allow_empty : bool
if empty string values are allowed or not. Defaults to True
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class Secret(String):
     """
     Same as `String`, but encrypted by default.
@@ -3964,7 +4074,7 @@ 

Inherited members

(maxlen=None, allow_empty=True, **kwargs)
-

Same as Typed, but with a type of str.

+

Same as Typed, but with a type of str.

If maxlen is set, it will validate the length of the string.

Args

@@ -3973,10 +4083,12 @@

Args

allow_empty : bool
if empty string values are allowed or not. Defaults to True
kwargs
-
any keyword arguments supported by Field
-
+
any keyword arguments supported by Field
+
-Source code + +Expand source code +
class String(Typed):
     def __init__(self, maxlen=None, allow_empty=True, **kwargs):
         """
@@ -4010,15 +4122,15 @@ 

Ancestors

Subclasses

Inherited members

    @@ -4037,7 +4149,7 @@

    Inherited members

    (default='', **kwargs)
    -

    Telephone field, will validate the value of telephone numbers

    +

    Telephone field, will validate the value of telephone numbers

    Will hold telephone values as strings.

    It will strip any additional characters that are not numbers.

    Args

    @@ -4045,10 +4157,12 @@

    Args

    default : str, optional
    default value. Defaults to ""
    kwargs
    -
    other keyword arguments supported by String
    -
    +
    other keyword arguments supported by String
    +
    -Source code + +Expand source code +
    class Tel(String):
         def __init__(self, default="", **kwargs):
             """
    @@ -4102,9 +4216,11 @@ 

    Methods

    def from_raw(self, value)
    -

    clean the telephone value from unwanted signs like , - ( )

    +

    clean the telephone value from unwanted signs like , - ( )

    -Source code + +Expand source code +
    def from_raw(self, value):
         """clean the telephone value from unwanted signs like , - ( )"""
         if value is not None:
    @@ -4121,16 +4237,18 @@ 

    Methods

    def validate(self, value)
    -

    check whether provided value is a valid telephone number representation

    +

    check whether provided value is a valid telephone number representation

    Args

    value (str)

    Raises

    -
    ValidationError
    +
    ValidationError
    in case the value is not a telephone
    -
    +
    -Source code + +Expand source code +
    def validate(self, value):
         """
         check whether provided value is a valid telephone number representation
    @@ -4162,7 +4280,7 @@ 

    Inherited members

    (default=None, format_=None, **kwargs)
    -

    time field, will hold utc datetime.time objects

    +

    time field, will hold utc datetime.time objects

    values can be set using strings in the given format_ too like "12:13" or a utc timestamp, they will converted to objects.

    Args

    @@ -4172,10 +4290,12 @@

    Args

    format_ : str, optional
    time format. Defaults to "%H:%M" if None.
    kwargs
    -
    any keyword arguments supported by Field
    -
    +
    any keyword arguments supported by Field
    +
    -Source code + +Expand source code +
    class Time(DateTimeMixin, Typed):
         def __init__(self, default=None, format_=None, **kwargs):
             """
    @@ -4223,16 +4343,18 @@ 

    Inherited members

    (type_, **kwargs)
    -

    Base field for any type, it will hold values of type_

    +

    Base field for any type, it will hold values of type_

    Args

    type_ : type
    any type (class)
    kwargs
    -
    any keyword arguments supported by Field
    -
    +
    any keyword arguments supported by Field
    +
    -Source code + +Expand source code +
    class Typed(Field):
         def __init__(self, type_, **kwargs):
             """
    @@ -4258,15 +4380,15 @@ 

    Ancestors

    Subclasses

    Inherited members

      @@ -4285,17 +4407,19 @@

      Inherited members

      (default='', **kwargs)
      -

      URL field, will validate the value of urls

      +

      URL field, will validate the value of urls

      Will hold string URLs.

      Args

      default : str, optional
      default value. Defaults to ""
      kwargs
      -
      other keyword arguments supported by Field
      -
      +
      other keyword arguments supported by Field
      +
      -Source code + +Expand source code +
      class URL(String):
           def __init__(self, default="", **kwargs):
               """
      @@ -4338,16 +4462,18 @@ 

      Methods

      def validate(self, value)
      -

      check whether provided value is a valid URL representation

      +

      check whether provided value is a valid URL representation

      Args

      value (str)

      Raises

      -
      ValidationError
      +
      ValidationError
      in case the value is not a telephone
      -
      +
      -Source code + +Expand source code +
      def validate(self, value):
           """
           check whether provided value is a valid URL representation
      @@ -4382,9 +4508,11 @@ 

      Inherited members

      (*args, **kwargs)
      -

      base type for any validation error

      +

      base type for any validation error

      -Source code + +Expand source code +
      class ValidationError(Exception):
           """
           base type for any validation error
      @@ -4565,9 +4693,7 @@ 

      -

      Generated by pdoc 0.6.4.

      +

      Generated by pdoc 0.10.0.

      - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/index.html b/docs/api/jumpscale/core/base/index.html index 3ab34716d..24d3cdbf8 100644 --- a/docs/api/jumpscale/core/base/index.html +++ b/docs/api/jumpscale/core/base/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.base API documentation - - - - - + + + + + + +
      @@ -21,7 +23,9 @@

      Module jumpscale.core.base

      -Source code + +Expand source code +
      from .meta import Base
       from .fields import ValidationError
       from .factory import Factory, StoredFactory, DuplicateError
      @@ -32,23 +36,23 @@

      Sub-modules

      jumpscale.core.base.events
      -

      Base and factory related events.

      +

      Base and factory related events.

      jumpscale.core.base.factory
      -

      Hierarchal configurations and factories for any Base type/class …

      +

      Hierarchal configurations and factories for any Base type/class …

      jumpscale.core.base.fields
      -

      jumpscale.core.base.fields have all possible fields where they can be used as a class variables for any Base classselfself …

      +

      jumpscale.core.base.fields have all possible fields where they can be used as a class variables for any Base classselfself …

      jumpscale.core.base.meta
      -

      Meta and Base classes for any class with fields …

      +

      Meta and Base classes for any class with fields …

      jumpscale.core.base.store
      -

      Store defines the interface for the backend storage, let it be filesystem or redis …

      +

      Store defines the interface for the backend storage, let it be filesystem or redis …

      @@ -83,9 +87,7 @@

      Index

      - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/meta.html b/docs/api/jumpscale/core/base/meta.html index bf22491d7..ea55a1f55 100644 --- a/docs/api/jumpscale/core/base/meta.html +++ b/docs/api/jumpscale/core/base/meta.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.meta API documentation - - - - - + + + + + + +
      @@ -23,23 +25,23 @@

      Module jumpscale.core.base.meta

      Meta and Base classes for any class with fields.

      Contains mainly:

        -
      • BaseMeta: A meta class to get a new class with field property descriptors ready
      • -
      • Base: The base class which can be used to get/set current field values
      • +
      • BaseMeta: A meta class to get a new class with field property descriptors ready
      • +
      • Base: The base class which can be used to get/set current field values

      To explain what it does, we will illustrate the following examples:

      If we have a class called Person, with the following definition:

      -
      class Person:
      +
      class Person:
           name = fields.String(default="ahmed")
       

      Accessing name from class or instance level will yield the same value, an instance of String field:

      -
      Person.name  #=> <jumpscale.core.base.fields.String object at 0x7efd89980c18>
      +
      Person.name  #=> <jumpscale.core.base.fields.String object at 0x7efd89980c18>
       
       p = Person()
       p.name  #=> <jumpscale.core.base.fields.String object at 0x7efd89980c18>
       

      The solution to this problem is using data descriptors (see https://docs.python.org/3/howto/descriptor.html)

      In meta and base implementations, we use property data descriptors, so the following class:

      -
      class Person(Base):
      +
      class Person(Base):
           name = fields.String(default="ahmed")
       

      Should have different behavior when accessing name from a class or an objects, so, it will be converted by meta class to a class like:

      @@ -58,15 +60,17 @@

      Module jumpscale.core.base.meta

      name = property(get_name, set_name)

      And accessing name from class and object levels will yield:

      -
      Person.name  #=> <property object at 0x7efd89a259f8>
      +
      Person.name  #=> <property object at 0x7efd89a259f8>
       
       
       p = Person()
       p.name  #=> "ahmed"
       
      -

      Parent relationship is supported too, every instance can have a parent object (which must be a Base type too)

      +

      Parent relationship is supported too, every instance can have a parent object (which must be a Base type too)

      -Source code + +Expand source code +
      """
       Meta and Base classes for any class with fields.
       
      @@ -592,16 +596,16 @@ 

      Module jumpscale.core.base.meta

      Functions

      -def get_field_property(name, field) +def get_field_property(name: str, field: Field) ‑> property
      -

      get a new property descriptor object for a field, +

      get a new property descriptor object for a field, this property will be used to enable getting/setting the actual value

      as the field only describes the type and other validation/conversion options, but do not hold the value itself, the vale will be held in the base instance

      the getter and setter will be called when an object is already created, and any field is accessed:

      -
      car = Car()
      +
      car = Car()
       print(car.color)  #=> getter will be called
       car.color = "red"  #=> setter will be called
       
      @@ -614,11 +618,13 @@

      Args

      Returns

      -
      property
      +
      property
      property descriptor (object)
      -
      +
      -Source code + +Expand source code +
      def get_field_property(name: str, field: fields.Field) -> property:
           """
           get a new property descriptor object for a field,
      @@ -696,11 +702,11 @@ 

      Classes

      (parent_=None, instance_name_=None, **values)
      -

      A simple attribute-based namespace.

      +

      A simple attribute-based namespace.

      SimpleNamespace(**kwargs)

      base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

      any instance can have an optional name and a parent.

      -
      class Person(Base):
      +
      class Person(Base):
           name = fields.String()
           age = fields.Float()
       
      @@ -709,15 +715,17 @@ 

      Classes

      Args

      -
      parent_ : Base, optional
      +
      parent_ : Base, optional
      parent instance. Defaults to None.
      instance_name_ : str, optional
      instance name. Defaults to None.
      **values
      any given field values to initiate the instance with
      -
      +
      -Source code + +Expand source code +
      class Base(SimpleNamespace, metaclass=BaseMeta):
           def __init__(self, parent_=None, instance_name_=None, **values):
               """
      @@ -1043,8 +1051,8 @@ 

      Subclasses

      @@ -1054,8 +1062,8 @@

      Static methods

      def from_dict(data)
      -

      get an instance from a dict

      -
      class Person(Base):
      +

      get an instance from a dict

      +
      class Person(Base):
           name = fields.String()
           age = fields.Float()
       
      @@ -1069,11 +1077,13 @@ 

      Args

      Returns

      -
      Base
      -
      an instance from current Base type
      -
      +
      Base
      +
      an instance from current Base type
      +
      -Source code + +Expand source code +
      @classmethod
       def from_dict(cls, data):
           """
      @@ -1102,9 +1112,11 @@ 

      Instance variables

      var instance_name
      -
      +
      -Source code + +Expand source code +
      @property
       def instance_name(self):
           return self.__instance_name
      @@ -1112,9 +1124,11 @@

      Instance variables

      var parent
      -
      +
      -Source code + +Expand source code +
      @property
       def parent(self):
           return self.__parent
      @@ -1127,8 +1141,8 @@

      Methods

      def to_dict(self)
      -

      get a serializable dict from all values of all fields (except factories)

      -
      class Person(Base):
      +

      get a serializable dict from all values of all fields (except factories)

      +
      class Person(Base):
           name = fields.String()
           age = fields.Float()
       
      @@ -1138,11 +1152,13 @@ 

      Methods

      Returns

      -
      dict
      +
      dict
      data as dict with {name: value}
      -
      +
      -Source code + +Expand source code +
      def _get_data(self):
           """
           get a serializable dict from all values of all fields (except factories)
      @@ -1184,9 +1200,11 @@ 

      Returns

      def validate(self)
      -

      validate all fields of current instance

      +

      validate all fields of current instance

      -Source code + +Expand source code +
      def validate(self):
           """
           validate all fields of current instance
      @@ -1202,13 +1220,15 @@ 

      Returns

      (*args, **kwargs)
      -

      this class is used to get a new class with all field attributes replaced by property data descriptors.

      +

      this class is used to get a new class with all field attributes replaced by property data descriptors.

      this should be used as a metaclass, example:

      -
      class ExampleWithFields(metaclass=BaseMeta):
      +
      class ExampleWithFields(metaclass=BaseMeta):
           name = fields.String()
      -
      +
      -Source code + +Expand source code +
      class BaseMeta(type):
           """
           this class is used to get a new class with all field attributes replaced by property data descriptors.
      @@ -1308,9 +1328,7 @@ 

      -

      Generated by pdoc 0.6.4.

      +

      Generated by pdoc 0.10.0.

      - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/store/filesystem.html b/docs/api/jumpscale/core/base/store/filesystem.html index 4094aca35..207b7c5df 100644 --- a/docs/api/jumpscale/core/base/store/filesystem.html +++ b/docs/api/jumpscale/core/base/store/filesystem.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.store.filesystem API documentation - - - - - + + + + + + +
      @@ -21,7 +23,9 @@

      Module jumpscale.core.base.store.filesystem

      -Source code + +Expand source code +
      import os
       
       from . import ConfigNotFound, EncryptedConfigStore
      @@ -152,18 +156,20 @@ 

      Classes

      (location)
      -

      Filesystem store is an EncryptedConfigStore

      +

      Filesystem store is an EncryptedConfigStore

      It saves the config relative to config_env.get_store_config("filesystem")

      To store every instance config in a different path, it uses the given Location.

      -

      create a new FileSystemStore that stores config at the given location under configured root.

      -

      The root directory can be configured, see jumpscale.core.config

      +

      create a new FileSystemStore that stores config at the given location under configured root.

      +

      The root directory can be configured, see jumpscale.core.config

      Args

      location : Location
      where config will be stored per instance
      -
      +
      -Source code + +Expand source code +
      class FileSystemStore(EncryptedConfigStore):
           """
           Filesystem store is an EncryptedConfigStore
      @@ -282,14 +288,16 @@ 

      Instance variables

      var config_root
      -

      get the root directory where all configurations are written

      +

      get the root directory where all configurations are written

      Returns

      -
      str
      +
      str
      path
      -
      +
      -Source code + +Expand source code +
      @property
       def config_root(self):
           """
      @@ -308,11 +316,13 @@ 

      Methods

      def delete(self, instance_name)
      -

      delete instance config directory

      +

      delete instance config directory

      Args

      -

      instance_name (str):

      +

      instance_name (str):

      -Source code + +Expand source code +
      def delete(self, instance_name):
           """
           delete instance config directory
      @@ -329,7 +339,7 @@ 

      Args

      def get_instance_root(self, instance_name)
      -

      get the directory where instance config is written

      +

      get the directory where instance config is written

      Args

      instance_name : str
      @@ -337,11 +347,13 @@

      Args

      Returns

      -
      str
      +
      str
      path
      -
      +
      -Source code + +Expand source code +
      def get_instance_root(self, instance_name):
           """
           get the directory where instance config is written
      @@ -359,7 +371,7 @@ 

      Returns

      def get_path(self, instance_name)
      -

      get the path to data file where instance config is written

      +

      get the path to data file where instance config is written

      Args

      instance_name : str
      @@ -367,11 +379,13 @@

      Args

      Returns

      -
      str
      +
      str
      path
      -
      +
      -Source code + +Expand source code +
      def get_path(self, instance_name):
           """
           get the path to data file where instance config is written
      @@ -389,14 +403,16 @@ 

      Returns

      def list_all(self)
      -

      list all instance names (directories under config root)

      +

      list all instance names (directories under config root)

      Returns

      -
      list
      +
      list
      instance/directory names
      -
      +
      -Source code + +Expand source code +
      def list_all(self):
           """
           list all instance names (directories under config root)
      @@ -413,7 +429,7 @@ 

      Returns

      def read(self, instance_name)
      -

      read config data from the data file

      +

      read config data from the data file

      Args

      instance_name : str
      @@ -421,11 +437,13 @@

      Args

      Returns

      -
      str
      +
      str
      data
      -
      +
      -Source code + +Expand source code +
      def read(self, instance_name):
           """
           read config data from the data file
      @@ -446,7 +464,7 @@ 

      Returns

      def write(self, instance_name, data)
      -

      write config data to data file

      +

      write config data to data file

      Args

      instance_name : str
      @@ -456,11 +474,13 @@

      Args

      Returns

      -
      bool
      +
      bool
      written or not
      -
      +
      -Source code + +Expand source code +
      def write(self, instance_name, data):
           """
           write config data to data file
      @@ -525,9 +545,7 @@ 

      -

      Generated by pdoc 0.6.4.

      +

      Generated by pdoc 0.10.0.

      - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/store/index.html b/docs/api/jumpscale/core/base/store/index.html index f60ac3351..4ac45e098 100644 --- a/docs/api/jumpscale/core/base/store/index.html +++ b/docs/api/jumpscale/core/base/store/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.store API documentation - - - - - + + + + + + +
      @@ -25,7 +27,9 @@

      Module jumpscale.core.base.store

      Every backend should be able to organize configuration for multiple instance given a location, also read/write the config data in raw (string) format.

      -Source code + +Expand source code +
      """
       Store defines the interface for the backend storage, let it be filesystem or redis.
       
      @@ -359,19 +363,19 @@ 

      Sub-modules

      jumpscale.core.base.store.filesystem
      -
      +
      jumpscale.core.base.store.redis
      -
      +
      jumpscale.core.base.store.serializers
      -
      +
      jumpscale.core.base.store.whooshfts
      -
      +

      @@ -387,9 +391,11 @@

      Classes

      (*args, **kwargs)
      -

      raised when a config is not found for an instance

      +

      raised when a config is not found for an instance

      -Source code + +Expand source code +
      class ConfigNotFound(Exception):
           """
           raised when a config is not found for an instance
      @@ -403,10 +409,9 @@ 

      Ancestors

      class ConfigStore -(*args, **kwargs)
      -

      the interface every config store should implement:

      +

      the interface every config store should implement:

      • read(instance_name): reads the data of this instance name
      • @@ -414,9 +419,11 @@

        Ancestors

      • list_all(instance_name): lists all instance names
      • delete(instance_name): delete instance data
      • find(self, cursor_=None, limit_=None, **query): optional search method with query as field mapping
      • -
      +

    -Source code + +Expand source code +
    class ConfigStore(ABC):
         """
         the interface every config store should implement:
    @@ -462,9 +469,11 @@ 

    Methods

    def delete(self, instance_name)
    -
    +
    -Source code + +Expand source code +
    @abstractmethod
     def delete(self, instance_name):
         pass
    @@ -474,9 +483,11 @@

    Methods

    def find(self, cursor_=None, limit_=None, **query)
    -
    +
    -Source code + +Expand source code +
    @abstractmethod
     def find(self, cursor_=None, limit_=None, **query):
         pass
    @@ -486,9 +497,11 @@

    Methods

    def list_all(self)
    -
    +
    -Source code + +Expand source code +
    @abstractmethod
     def list_all(self):
         pass
    @@ -498,9 +511,11 @@

    Methods

    def read(self, instance_name)
    -
    +
    -Source code + +Expand source code +
    @abstractmethod
     def read(self, instance_name):
         pass
    @@ -510,9 +525,11 @@

    Methods

    def write(self, instance_name, data)
    -
    +
    -Source code + +Expand source code +
    @abstractmethod
     def write(self, instance_name, data):
         pass
    @@ -525,18 +542,20 @@

    Methods

    (location, serializer)
    -

    the base class for any config store backend

    +

    the base class for any config store backend

    the base for encrypted config store

    Args

    location (Location) serializer (Serializer)

    Raises

    -
    InvalidPrivateKey
    +
    InvalidPrivateKey
    in case the private key is not configured
    -
    +
    -Source code + +Expand source code +
    class EncryptedConfigStore(ConfigStore, EncryptionMixin):
         """the base class for any config store backend"""
     
    @@ -710,7 +729,7 @@ 

    Methods

    def find(self, cursor_=None, limit_=None, **query)
    -

    a generic find, which do a linear search over all items

    +

    a generic find, which do a linear search over all items

    if you want a better way, use a store which provides search

    Args

    @@ -723,11 +742,13 @@

    Args

    Returns

    -
    tuple
    +
    tuple
    the new cursor, total result count and a generator for results
    -
    +
    -Source code + +Expand source code +
    def find(self, cursor_=None, limit_=None, **query):
         """
         a generic find, which do a linear search over all items
    @@ -791,7 +812,7 @@ 

    Returns

    def get(self, instance_name)
    -

    get instance config

    +

    get instance config

    Args

    instance_name : str
    @@ -799,11 +820,13 @@

    Args

    Returns

    -
    dict
    +
    dict
    instance config as dict
    -
    +
    -Source code + +Expand source code +
    def get(self, instance_name):
         """
         get instance config
    @@ -822,7 +845,7 @@ 

    Returns

    def save(self, instance_name, config)
    -

    save instance config

    +

    save instance config

    Args

    instance_name : str
    @@ -832,11 +855,13 @@

    Args

    Returns

    -
    bool
    +
    bool
    written or not
    -
    +
    -Source code + +Expand source code +
    def save(self, instance_name, config):
         """
         save instance config
    @@ -865,12 +890,13 @@ 

    Inherited members

    class EncryptionMixin -(*args, **kwargs)
    -

    A mixin that provides encrypt and decrypt methods, which can be used in any store

    +

    A mixin that provides encrypt and decrypt methods, which can be used in any store

    -Source code + +Expand source code +
    class EncryptionMixin:
         """
         A mixin that provides encrypt and decrypt methods, which can be used in any store
    @@ -910,7 +936,7 @@ 

    Methods

    def decrypt(self, data)
    -

    decrypt data

    +

    decrypt data

    Args

    data : bytes
    @@ -918,11 +944,13 @@

    Args

    Returns

    -
    str
    +
    str
    decrypted data
    -
    +
    -Source code + +Expand source code +
    def decrypt(self, data):
         """decrypt data
     
    @@ -939,7 +967,7 @@ 

    Returns

    def encrypt(self, data)
    -

    encrypt data

    +

    encrypt data

    Args

    data : str
    @@ -947,11 +975,13 @@

    Args

    Returns

    -
    bytes
    +
    bytes
    encrypted data as byte string
    -
    +
    -Source code + +Expand source code +
    def encrypt(self, data):
         """encrypt data
     
    @@ -970,12 +1000,14 @@ 

    Returns

    class EncryptionMode -(*args, **kwargs) +(value, names=None, *, module=None, qualname=None, type=None, start=1)
    -

    An enum to select encryption mode based on loading or storing the data

    +

    An enum to select encryption mode based on loading or storing the data

    -Source code + +Expand source code +
    class EncryptionMode(Enum):
         """
         An enum to select encryption mode based on loading or storing the data
    @@ -992,11 +1024,11 @@ 

    Class variables

    var Decrypt
    -
    +
    var Encrypt
    -
    +
    @@ -1005,9 +1037,11 @@

    Class variables

    (*args, **kwargs)
    -

    raised when the private key configured is invalid

    +

    raised when the private key configured is invalid

    -Source code + +Expand source code +
    class InvalidPrivateKey(Exception):
         """
         raised when the private key configured is invalid
    @@ -1024,11 +1058,13 @@ 

    Ancestors

    (*name_list, type_=None)
    -

    dot-separated auto-location for any type

    +

    dot-separated auto-location for any type

    for example, if we have a class in jumpscale/clients/redis/ -location name will be jumpscale.clients.redis.

    +location name will be jumpscale.clients.redis.

    -Source code + +Expand source code +
    class Location:
         """
         dot-separated auto-location for any type
    @@ -1093,7 +1129,7 @@ 

    Static methods

    def from_type(type_)
    -

    get a location from any type/class

    +

    get a location from any type/class

    Args

    type_ : type
    @@ -1101,11 +1137,13 @@

    Args

    Returns

    -
    Location
    +
    Location
    a location object
    -
    +
    -Source code + +Expand source code +
    @classmethod
     def from_type(cls, type_):
         """
    @@ -1125,14 +1163,16 @@ 

    Instance variables

    var name
    -

    get dot seprated string from current name list

    +

    get dot seprated string from current name list

    Returns

    -
    str
    +
    str
    dot separated string
    -
    +
    -Source code + +Expand source code +
    @property
     def name(self):
         """
    @@ -1146,14 +1186,16 @@ 

    Returns

    var path
    -

    get a filesystem path with from name, where dots are replaced by os.sep

    +

    get a filesystem path with from name, where dots are replaced by os.sep

    Returns

    -
    str
    +
    str
    path
    -
    +
    -Source code + +Expand source code +
    @property
     def path(self):
         """
    @@ -1172,9 +1214,11 @@ 

    Returns

    (*args, **kwargs)
    -

    raised by store backends

    +

    raised by store backends

    -Source code + +Expand source code +
    class StoreException(Exception):
         """
         raised by store backends
    @@ -1265,9 +1309,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/store/redis.html b/docs/api/jumpscale/core/base/store/redis.html index c8132888d..55f58d0d5 100644 --- a/docs/api/jumpscale/core/base/store/redis.html +++ b/docs/api/jumpscale/core/base/store/redis.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.store.redis API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.core.base.store.redis

    -Source code + +Expand source code +
    import redis
     
     from . import ConfigNotFound, EncryptedConfigStore
    @@ -162,14 +166,16 @@ 

    Classes

    (location)
    -

    RedisStore store is an EncryptedConfigStore

    +

    RedisStore store is an EncryptedConfigStore

    It saves the data in redis and configuration for redis comes from config_env.get_store_config("redis")

    create a new redis store, the location given will be used to generate keys

    this keys will be combined to get/set instance config

    Args

    -

    location (Location)

    +

    location (Location)

    -Source code + +Expand source code +
    class RedisStore(EncryptedConfigStore):
         """
         RedisStore store is an EncryptedConfigStore
    @@ -302,19 +308,18 @@ 

    Methods

    def delete(self, instance_name)
    -

    delete given instance

    +

    delete given instance

    Args

    instance_name : str
    name

    Returns

    -
    -
    bool
    -
     
    -
    +

    bool

    -Source code + +Expand source code +
    def delete(self, instance_name):
         """
         delete given instance
    @@ -332,7 +337,7 @@ 

    Returns

    def get_key(self, instance_name)
    -

    get a key for an instance

    +

    get a key for an instance

    this will return a dot-separated key derived from current location

    Args

    @@ -341,11 +346,13 @@

    Args

    Returns

    -
    str
    +
    str
    key
    -
    +
    -Source code + +Expand source code +
    def get_key(self, instance_name):
         """
         get a key for an instance
    @@ -365,14 +372,16 @@ 

    Returns

    def get_location_keys(self)
    -

    get all keys under current location (scanned)

    +

    get all keys under current location (scanned)

    Returns

    -
    list
    +
    list
    a list of keys
    -
    +
    -Source code + +Expand source code +
    def get_location_keys(self):
         """
         get all keys under current location (scanned)
    @@ -387,10 +396,16 @@ 

    Returns

    def list_all(self)
    -

    get all names of instances (instance keys)

    -

    Returns

    +

    get all names of instances (instance keys)

    +

    Returns

    +
    +
    [type]
    +
    [description]
    +
    -Source code + +Expand source code +
    def list_all(self):
         """
         get all names of instances (instance keys)
    @@ -414,7 +429,7 @@ 

    Returns

    def read(self, instance_name)
    -

    read instance config from redis

    +

    read instance config from redis

    Args

    instance_name : name
    @@ -422,11 +437,13 @@

    Args

    Returns

    -
    str
    +
    str
    data
    -
    +
    -Source code + +Expand source code +
    def read(self, instance_name):
         """
         read instance config from redis
    @@ -447,7 +464,7 @@ 

    Returns

    def write(self, instance_name, data)
    -

    set data with the corresponding key for this instance

    +

    set data with the corresponding key for this instance

    Args

    instance_name : str
    @@ -457,11 +474,13 @@

    Args

    Returns

    -
    bool
    +
    bool
    written or not
    -
    +
    -Source code + +Expand source code +
    def write(self, instance_name, data):
         """
         set data with the corresponding key for this instance
    @@ -523,9 +542,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/store/serializers.html b/docs/api/jumpscale/core/base/store/serializers.html index 8ec28c489..f4e126583 100644 --- a/docs/api/jumpscale/core/base/store/serializers.html +++ b/docs/api/jumpscale/core/base/store/serializers.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.store.serializers API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.core.base.store.serializers

    -Source code + +Expand source code +
    from jumpscale.data.serializers import json
     
     
    @@ -52,12 +56,13 @@ 

    Classes

    class JsonSerializer -(*args, **kwargs)
    -
    +
    -Source code + +Expand source code +
    class JsonSerializer(Serializer):
         def serialize(self, obj):
             return json.dumps(obj)
    @@ -75,9 +80,11 @@ 

    Methods

    def deserialize(self, data)
    -
    +
    -Source code + +Expand source code +
    def deserialize(self, data):
         return json.loads(data)
    @@ -86,9 +93,11 @@

    Methods

    def serialize(self, obj)
    -
    +
    -Source code + +Expand source code +
    def serialize(self, obj):
         return json.dumps(obj)
    @@ -97,12 +106,13 @@

    Methods

    class Serializer -(*args, **kwargs)
    -
    +
    -Source code + +Expand source code +
    class Serializer:
         def serialize(self, obj):
             return obj
    @@ -120,9 +130,11 @@ 

    Methods

    def deserialize(self, data)
    -
    +
    -Source code + +Expand source code +
    def deserialize(self, data):
         return data
    @@ -131,9 +143,11 @@

    Methods

    def serialize(self, obj)
    -
    +
    -Source code + +Expand source code +
    def serialize(self, obj):
         return obj
    @@ -176,9 +190,7 @@

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/base/store/whooshfts.html b/docs/api/jumpscale/core/base/store/whooshfts.html index a12c6c71b..fd6331b5b 100644 --- a/docs/api/jumpscale/core/base/store/whooshfts.html +++ b/docs/api/jumpscale/core/base/store/whooshfts.html @@ -3,15 +3,17 @@ - + jumpscale.core.base.store.whooshfts API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.core.base.store.whooshfts

    -Source code + +Expand source code +
    from whoosh import fields
     from whoosh.index import create_in, exists_in, open_dir
     from whoosh.qparser import FuzzyTermPlugin, GtLtPlugin, MultifieldParser, PhrasePlugin
    @@ -236,14 +240,16 @@ 

    Classes

    (location)
    -

    whoosh store is an EncryptedConfigStore

    +

    whoosh store is an EncryptedConfigStore

    It saves and indexes the data in a whoosh index

    create a new redis store, the location given will be used to generate keys

    this keys will be combined to get/set instance config

    Args

    -

    location (Location)

    +

    location (Location)

    -Source code + +Expand source code +
    class WhooshStore(EncryptedConfigStore):
         """
         whoosh store is an EncryptedConfigStore
    @@ -412,9 +418,11 @@ 

    Instance variables

    var index_path
    -
    +
    -Source code + +Expand source code +
    @property
     def index_path(self):
         path = join_paths(self.base_index_path, self.location.name)
    @@ -424,9 +432,11 @@ 

    Instance variables

    var type_fields
    -
    +
    -Source code + +Expand source code +
    @property
     def type_fields(self):
         return self.location.type._fields.items()
    @@ -439,9 +449,11 @@

    Methods

    def delete(self, instance_name)
    -
    +
    -Source code + +Expand source code +
    def delete(self, instance_name):
         writer = self.get_writer()
         writer.delete_by_term(KEY_FIELD_NAME, instance_name)
    @@ -452,9 +464,11 @@ 

    Methods

    def get_index(self, schema)
    -
    +
    -Source code + +Expand source code +
    def get_index(self, schema):
         if exists_in(self.index_path):
             return open_dir(self.index_path, schema=schema)
    @@ -465,9 +479,11 @@ 

    Methods

    def get_reader(self)
    -
    +
    -Source code + +Expand source code +
    def get_reader(self):
         return self.index.reader()
    @@ -476,9 +492,11 @@

    Methods

    def get_schema(self)
    -
    +
    -Source code + +Expand source code +
    def get_schema(self):
         schema_fields = {
             KEY_FIELD_NAME: fields.ID(unique=True, stored=True),
    @@ -509,9 +527,11 @@ 

    Methods

    def get_searcher(self, up_to_date=True)
    -
    +
    -Source code + +Expand source code +
    def get_searcher(self, up_to_date=True):
         searcher = self.index.searcher()
     
    @@ -525,9 +545,11 @@ 

    Methods

    def get_writer(self)
    -
    +
    -Source code + +Expand source code +
    def get_writer(self):
         return AsyncWriter(self.index)
    @@ -536,9 +558,11 @@

    Methods

    def list_all(self)
    -
    +
    -Source code + +Expand source code +
    def list_all(self):
         with self.get_reader() as reader:
             for _, doc in reader.iter_docs():
    @@ -549,9 +573,11 @@ 

    Methods

    def read(self, instance_name)
    -
    +
    -Source code + +Expand source code +
    def read(self, instance_name):
         with self.get_searcher() as searcher:
             kw = {KEY_FIELD_NAME: instance_name}
    @@ -580,9 +606,11 @@ 

    Methods

    def write(self, instance_name, data)
    -
    +
    -Source code + +Expand source code +
    def write(self, instance_name, data):
         data[KEY_FIELD_NAME] = instance_name
     
    @@ -652,9 +680,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/config/config.html b/docs/api/jumpscale/core/config/config.html index 65c45d6df..b0f08b6de 100644 --- a/docs/api/jumpscale/core/config/config.html +++ b/docs/api/jumpscale/core/config/config.html @@ -3,15 +3,17 @@ - + jumpscale.core.config.config API documentation - - - - - + + + + + + +
    @@ -23,9 +25,9 @@

    Module jumpscale.core.config.config

    Config module is the single entry of configurations across the framework.

    It allows - resolving configurations paths for configuration directoryconfig_root, or configuration file path config_path -- rebuildling default configurations or retrieving them (using get_default_config()) -- Getting configurations using get_default_config() -- Updating configuration using update_config()

    +- rebuildling default configurations or retrieving them (using get_default_config()) +- Getting configurations using get_default_config() +- Updating configuration using update_config()

    JS-NG> j.core.config

    Getting where is the config.toml path

    @@ -65,7 +67,9 @@

    Get/Set

    'grey'

    -Source code + +Expand source code +
    """Config module is the single entry of configurations across the framework.
     
     It allows
    @@ -359,16 +363,14 @@ 

    Functions

    def get(key, default=None)
    -

    Retrives value from jumpscale config

    +

    Retrives value from jumpscale config

    Arguments

    -
    -
    key : str
    -
    the key you wish to retrieve
    -
    default : object
    -
    return value if key doesn't exist in configurations
    -
    +

    key (str): the key you wish to retrieve +default (object): return value if key doesn't exist in configurations

    -Source code + +Expand source code +
    def get(key, default=None):
         """ Retrives value from jumpscale config
     
    @@ -384,11 +386,13 @@ 

    Arguments

    def get_config()
    -

    Gets jumpscale configurations

    +

    Gets jumpscale configurations

    Returns

    -

    [dict] - toml loaded config of CONFIG_DIR/config.toml

    +

    [dict] - toml loaded config of CONFIG_DIR/config.toml

    -Source code + +Expand source code +
    def get_config():
         """Gets jumpscale configurations
     
    @@ -403,9 +407,11 @@ 

    Returns

    def get_current_version()
    -
    +
    -Source code + +Expand source code +
    def get_current_version():
         return __version__
    @@ -414,14 +420,16 @@

    Returns

    def get_default_config()
    -

    retrieves default configurations for plain jumpscale

    +

    retrieves default configurations for plain jumpscale

    Returns

    -
    dict
    +
    dict
    default configuration
    -
    +
    -Source code + +Expand source code +
    def get_default_config():
         """retrieves default configurations for plain jumpscale
     
    @@ -466,16 +474,14 @@ 

    Returns

    def set(key, val)
    -

    Sets value in jumpscale config

    +

    Sets value in jumpscale config

    Arguments

    -
    -
    key : str
    -
    the key you wish to update
    -
    val
    -
    value to update with
    -
    +

    key (str): the key you wish to update +val: value to update with

    -Source code + +Expand source code +
    def set(key, val):
         """ Sets value in jumpscale config
     
    @@ -492,21 +498,16 @@ 

    Arguments

    def set_default(key, val)
    -

    Sets key to value in jumpscale config and returns

    +

    Sets key to value in jumpscale config and returns

    Arguments

    -
    -
    key : str
    -
    the key you wish to update
    -
    val
    -
    value to update with and to return if key doesn't exist in configurations
    -
    +

    key (str): the key you wish to update +val: value to update with and to return if key doesn't exist in configurations

    Returns

    -
    -
    val : str
    -
    returned if key doesn't exist in configuration or the value of key in configurations
    -
    +

    val (str): returned if key doesn't exist in configuration or the value of key in configurations

    -Source code + +Expand source code +
    def set_default(key, val):
         """ Sets key to value in jumpscale config and returns
     
    @@ -529,11 +530,13 @@ 

    Returns

    def update_config(data)
    -

    Update jumpscale config with new data

    +

    Update jumpscale config with new data

    Arguments

    -

    data {dict} – dict to update the config with.

    +

    data {dict} – dict to update the config with.

    -Source code + +Expand source code +
    def update_config(data):
         """Update jumpscale config with new data
     
    @@ -551,12 +554,13 @@ 

    Classes

    class Environment -(*args, **kwargs)
    -
    +
    -Source code + +Expand source code +
    class Environment:
         def get_private_key_path(self):
             config = get_config()
    @@ -593,9 +597,11 @@ 

    Methods

    def get_logging_config(self)
    -
    +
    -Source code + +Expand source code +
    def get_logging_config(self):
         return get_config()["logging"]
    @@ -604,9 +610,11 @@

    Methods

    def get_private_key(self)
    -
    +
    -Source code + +Expand source code +
    def get_private_key(self):
         private_key_path = self.get_private_key_path()
         if not private_key_path:
    @@ -622,9 +630,11 @@ 

    Methods

    def get_private_key_path(self)
    -
    +
    -Source code + +Expand source code +
    def get_private_key_path(self):
         config = get_config()
         private_key_path = config["private_key_path"]
    @@ -635,9 +645,11 @@ 

    Methods

    def get_store_config(self, name)
    -
    +
    -Source code + +Expand source code +
    def get_store_config(self, name):
         config = get_config()
         stores = config["stores"]
    @@ -650,9 +662,11 @@ 

    Methods

    def get_threebot_data(self)
    -
    +
    -Source code + +Expand source code +
    def get_threebot_data(self):
         config = get_config()
         return config.get("threebot", {})
    @@ -710,9 +724,7 @@

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/config/index.html b/docs/api/jumpscale/core/config/index.html index 05aa78b4c..6337ebfd3 100644 --- a/docs/api/jumpscale/core/config/index.html +++ b/docs/api/jumpscale/core/config/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.config API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.core.config

    -Source code + +Expand source code +
    from .config import *
    @@ -30,7 +34,7 @@

    Sub-modules

    jumpscale.core.config.config
    -

    Config module is the single entry of configurations across the framework …

    +

    Config module is the single entry of configurations across the framework …

    @@ -61,9 +65,7 @@

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/db/index.html b/docs/api/jumpscale/core/db/index.html index f3bcb29fd..afc092899 100644 --- a/docs/api/jumpscale/core/db/index.html +++ b/docs/api/jumpscale/core/db/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.db API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.core.db

    -Source code + +Expand source code +
    def export_module_as():
     
         from jumpscale.loader import j
    @@ -51,9 +55,11 @@ 

    Functions

    def export_module_as()
    -
    +
    -Source code + +Expand source code +
    def export_module_as():
     
         from jumpscale.loader import j
    @@ -97,9 +103,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/dirs/dirs.html b/docs/api/jumpscale/core/dirs/dirs.html index 25f3c0b49..a910fda39 100644 --- a/docs/api/jumpscale/core/dirs/dirs.html +++ b/docs/api/jumpscale/core/dirs/dirs.html @@ -3,15 +3,17 @@ - + jumpscale.core.dirs.dirs API documentation - - - - - + + + + + + +
    @@ -21,76 +23,78 @@

    Module jumpscale.core.dirs.dirs

    This module defines main dirs in jumpscale to be used

    -
    JS-NG> j.core.dirs                                                                                                                                                        
    +
    JS-NG> j.core.dirs
     ExportedModule(__doc__=None, _exportedas=<class 'jumpscale.core.dirs.dirs.Dirs'>, _loaded=True, _m=<module 'jumpscale.core.dirs' from '/home/ahmed/wspace/js/js-ng/jumpscale/core/dirs/__init__.py'>)
     
    -JS-NG> j.core.dirs.BASEDIR                                                                                                                                                
    +JS-NG> j.core.dirs.BASEDIR
     '/home/ahmed/sandbox'
     
    -JS-NG> j.core.dirs.BINDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.BINDIR
     '/home/ahmed/sandbox/bin'
     
    -JS-NG>                                                                                                                                                                    
    -JS-NG> j.core.dirs.CFGDIR                                                                                                                                                 
    +JS-NG>
    +JS-NG> j.core.dirs.CFGDIR
     '/home/ahmed/sandbox/cfg'
     
    -JS-NG>                                                                                                                                                                    
    -JS-NG> j.core.dirs.CODEDIR                                                                                                                                                
    +JS-NG>
    +JS-NG> j.core.dirs.CODEDIR
     '/home/ahmed/sandbox/code'
     
    -JS-NG>                                                                                                                                                                    
    -JS-NG> j.core.dirs.HOMEDIR                                                                                                                                                
    +JS-NG>
    +JS-NG> j.core.dirs.HOMEDIR
     '/home/ahmed'
     
    -JS-NG> j.core.dirs.LOGDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.LOGDIR
     '/home/ahmed/sandbox/var/log'
     
    -JS-NG> j.core.dirs.TEMPLATEDIR                                                                                                                                            
    +JS-NG> j.core.dirs.TEMPLATEDIR
     '/home/ahmed/sandbox/var/templates'
     
    -JS-NG> j.core.dirs.TMPDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.TMPDIR
     '/tmp/jumpscale'
     
    -JS-NG> j.core.dirs.VARDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.VARDIR
     '/home/ahmed/sandbox/var'
     
    -Source code + +Expand source code +
    """
     This module defines main dirs in jumpscale to be used
     
     ```
    -JS-NG> j.core.dirs                                                                                                                                                        
    +JS-NG> j.core.dirs
     ExportedModule(__doc__=None, _exportedas=<class 'jumpscale.core.dirs.dirs.Dirs'>, _loaded=True, _m=<module 'jumpscale.core.dirs' from '/home/ahmed/wspace/js/js-ng/jumpscale/core/dirs/__init__.py'>)
     
    -JS-NG> j.core.dirs.BASEDIR                                                                                                                                                
    +JS-NG> j.core.dirs.BASEDIR
     '/home/ahmed/sandbox'
     
    -JS-NG> j.core.dirs.BINDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.BINDIR
     '/home/ahmed/sandbox/bin'
     
    -JS-NG>                                                                                                                                                                    
    -JS-NG> j.core.dirs.CFGDIR                                                                                                                                                 
    +JS-NG>
    +JS-NG> j.core.dirs.CFGDIR
     '/home/ahmed/sandbox/cfg'
     
    -JS-NG>                                                                                                                                                                    
    -JS-NG> j.core.dirs.CODEDIR                                                                                                                                                
    +JS-NG>
    +JS-NG> j.core.dirs.CODEDIR
     '/home/ahmed/sandbox/code'
     
    -JS-NG>                                                                                                                                                                    
    -JS-NG> j.core.dirs.HOMEDIR                                                                                                                                                
    +JS-NG>
    +JS-NG> j.core.dirs.HOMEDIR
     '/home/ahmed'
     
    -JS-NG> j.core.dirs.LOGDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.LOGDIR
     '/home/ahmed/sandbox/var/log'
     
    -JS-NG> j.core.dirs.TEMPLATEDIR                                                                                                                                            
    +JS-NG> j.core.dirs.TEMPLATEDIR
     '/home/ahmed/sandbox/var/templates'
     
    -JS-NG> j.core.dirs.TMPDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.TMPDIR
     '/tmp/jumpscale'
     
    -JS-NG> j.core.dirs.VARDIR                                                                                                                                                 
    +JS-NG> j.core.dirs.VARDIR
     '/home/ahmed/sandbox/var'
     ```
     
    @@ -125,12 +129,13 @@ 

    Classes

    class Dirs -(*args, **kwargs)
    -
    +
    -Source code + +Expand source code +
    class Dirs:
     
         HOMEDIR = os.path.expanduser("~")  # TODO: check homedir defined in sal.fs
    @@ -148,43 +153,43 @@ 

    Class variables

    var BASEDIR
    -
    +
    var BINDIR
    -
    +
    var CFGDIR
    -
    +
    var CODEDIR
    -
    +
    var HOMEDIR
    -
    +
    var JSCFGDIR
    -
    +
    var LOGDIR
    -
    +
    var TEMPLATEDIR
    -
    +
    var TMPDIR
    -
    +
    var VARDIR
    -
    +
    @@ -225,9 +230,7 @@

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/dirs/index.html b/docs/api/jumpscale/core/dirs/index.html index ff8422da3..6c3b4be90 100644 --- a/docs/api/jumpscale/core/dirs/index.html +++ b/docs/api/jumpscale/core/dirs/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.dirs API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.core.dirs

    -Source code + +Expand source code +
    def export_module_as():
         from .dirs import Dirs
     
    @@ -33,7 +37,7 @@ 

    Sub-modules

    jumpscale.core.dirs.dirs
    -

    This module defines main dirs in jumpscale to be used …

    +

    This module defines main dirs in jumpscale to be used …

    @@ -46,9 +50,11 @@

    Functions

    def export_module_as()
    -
    +
    -Source code + +Expand source code +
    def export_module_as():
         from .dirs import Dirs
     
    @@ -85,9 +91,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/events/index.html b/docs/api/jumpscale/core/events/index.html index 9fef5f900..7c0b0de7e 100644 --- a/docs/api/jumpscale/core/events/index.html +++ b/docs/api/jumpscale/core/events/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.events API documentation - - - - - + + + + + + +
    @@ -24,7 +26,7 @@

    Module jumpscale.core.events

    The modules is based on https://github.com/xmonader/events.

    Events can be of any type (class), there are two ways for listening to an event:

    Using decorators:

    -
    from jumpscale.core.base import events
    +
    from jumpscale.core.base import events
     
     class ImportantEvent:
         def __init__(self):
    @@ -35,8 +37,8 @@ 

    Module jumpscale.core.events

    def handle_event(ev): print(ev.name)
    -

    Or using it in your classes, just inherit from events.Handler and implement handle method.

    -
    class Impl(events.Handler):
    +

    Or using it in your classes, just inherit from events.Handler and implement handle() method.

    +
    class Impl(events.Handler):
         def __init__(self):
             events.add_listeners(self, ImprotantEvent)
     
    @@ -51,7 +53,9 @@ 

    Module jumpscale.core.events

    This can be used with base classes too, you just need to define your own custom events. For an example, see redis.RedisClient

    -Source code + +Expand source code +
    """
     This module is for event handling, where any component can listen to certain event notifications
     
    @@ -181,9 +185,11 @@ 

    Functions

    def add_global_listener(handler)
    -
    +
    -Source code + +Expand source code +
    def add_global_listener(handler):
         add_listenter(handler, Any)
    @@ -192,9 +198,11 @@

    Functions

    def add_listenter(handler, *event_types)
    -
    +
    -Source code + +Expand source code +
    def add_listenter(handler, *event_types):
         if not event_types:
             raise ValueError("must specify at least 1 event type/class")
    @@ -207,9 +215,11 @@ 

    Functions

    def handle(event_type)
    -
    +
    -Source code + +Expand source code +
    def handle(event_type):
         def decorator(fun):
             add_listenter(fun, event_type)
    @@ -227,9 +237,11 @@ 

    Functions

    def handle_any(fun)
    -
    +
    -Source code + +Expand source code +
    def handle_any(fun):
         add_global_listener(fun)
     
    @@ -244,9 +256,11 @@ 

    Functions

    def handle_many(*event_types)
    -
    +
    -Source code + +Expand source code +
    def handle_many(*event_types):
         def decorator(fun):
             add_listenter(fun, *event_types)
    @@ -264,9 +278,11 @@ 

    Functions

    def notify(event)
    -
    +
    -Source code + +Expand source code +
    def notify(event):
         event_type = event.__class__
         interested = listeners.get(event_type, []) + listeners[Any]
    @@ -285,24 +301,26 @@ 

    Classes

    class Any -(*args, **kwargs)
    -
    +
    -Source code + +Expand source code +
    class Any:
         pass
    class Handler -(*args, **kwargs)
    -
    +
    -Source code + +Expand source code +
    class Handler:
         def handle(self, ev):
             pass
    @@ -317,9 +335,11 @@

    Methods

    def handle(self, ev)
    -
    +
    -Source code + +Expand source code +
    def handle(self, ev):
         pass
    @@ -367,9 +387,7 @@

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/exceptions/exceptions.html b/docs/api/jumpscale/core/exceptions/exceptions.html index 1f5e4bd77..d12753b9f 100644 --- a/docs/api/jumpscale/core/exceptions/exceptions.html +++ b/docs/api/jumpscale/core/exceptions/exceptions.html @@ -3,15 +3,17 @@ - + jumpscale.core.exceptions.exceptions API documentation - - - - - + + + + + + +
    @@ -38,7 +40,9 @@

    Module jumpscale.core.exceptions.exceptions

  • SSHTimeout
-Source code + +Expand source code +
"""
 Exceptions module provide a carefully picked list of exceptions to be used across the framework
 
@@ -140,9 +144,11 @@ 

Classes

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Base(JSException):
     pass
@@ -158,9 +164,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Bug(JSException):
     pass
@@ -176,9 +184,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Halt(JSException):
     pass
@@ -194,9 +204,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class IO(JSException):
     pass
@@ -212,9 +224,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Input(JSException):
     pass
@@ -230,9 +244,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class JSException(Exception):
     def __init__(self, message, category=None, level=None, context=None):
         super().__init__(message)
@@ -245,20 +261,20 @@

Ancestors

Subclasses

@@ -267,9 +283,11 @@

Subclasses

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class NotFound(JSException):
     pass
@@ -285,9 +303,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class NotImplemented(JSException):
     pass
@@ -303,9 +323,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Operations(JSException):
     pass
@@ -321,9 +343,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Permission(JSException):
     pass
@@ -339,9 +363,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Runtime(JSException):
     pass
@@ -357,9 +383,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class SSH(JSException):
     pass
@@ -375,9 +403,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class SSHTimeout(JSException):
     pass
@@ -393,9 +423,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Timeout(JSException):
     pass
@@ -411,9 +443,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Validation(JSException):
     pass
@@ -429,9 +463,11 @@

Ancestors

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class Value(JSException):
     pass
@@ -512,9 +548,7 @@

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/exceptions/index.html b/docs/api/jumpscale/core/exceptions/index.html index 925f5ce0c..12d7b6120 100644 --- a/docs/api/jumpscale/core/exceptions/index.html +++ b/docs/api/jumpscale/core/exceptions/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.exceptions API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.core.exceptions

-Source code + +Expand source code +
from .exceptions import *
@@ -30,7 +34,7 @@

Sub-modules

jumpscale.core.exceptions.exceptions
-

Exceptions module provide a carefully picked list of exceptions to be used across the framework …

+

Exceptions module provide a carefully picked list of exceptions to be used across the framework …

@@ -61,9 +65,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/executors/command_builder.html b/docs/api/jumpscale/core/executors/command_builder.html index c4b999c26..c05bba0bb 100644 --- a/docs/api/jumpscale/core/executors/command_builder.html +++ b/docs/api/jumpscale/core/executors/command_builder.html @@ -3,15 +3,17 @@ - + jumpscale.core.executors.command_builder API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.core.executors.command_builder
-Source code + +Expand source code +
from functools import wraps
 from subprocess import list2cmdline
 
@@ -65,7 +69,7 @@ 

Functions

def cmd_from_args(func)
-

a decorator to allow passing cmd as a list, with auto-escaping using subprocess.list2cmdline

+

a decorator to allow passing cmd as a list, with auto-escaping using subprocess.list2cmdline

cmd must be the first positional arguments

Args

@@ -74,11 +78,13 @@

Args

Returns

-
function
+
function
a new function
-
+
-Source code + +Expand source code +
def cmd_from_args(func):
     """
     a decorator to allow passing cmd as a list, with auto-escaping using `subprocess.list2cmdline`
@@ -106,9 +112,11 @@ 

Returns

def format_cmd(cmd)
-
+
-Source code + +Expand source code +
def format_cmd(cmd):
     ## code around it to run in tmux.
     pass
@@ -140,9 +148,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/executors/index.html b/docs/api/jumpscale/core/executors/index.html index 82a20b781..c07c57faa 100644 --- a/docs/api/jumpscale/core/executors/index.html +++ b/docs/api/jumpscale/core/executors/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.executors API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.core.executors

-Source code + +Expand source code +
from .local import execute as run_local
 from .remote import execute as run_remote, RemoteExecutor
 from .tmux import execute_in_window as run_tmux
@@ -32,19 +36,19 @@

Sub-modules

jumpscale.core.executors.command_builder
-
+
jumpscale.core.executors.local
-

Local executor allows executing commands within specific env on the local machine. using the executor framework you can retrieve the stdout, stderr, …

+

Local executor allows executing commands within specific env on the local machine. using the executor framework you can retrieve the stdout, stderr, …

jumpscale.core.executors.remote
-

Remote executor allows executing commands within specific env on any machine. using the executor framework you can retrieve the stdout, stderr, and …

+

Remote executor allows executing commands within specific env on any machine. using the executor framework you can retrieve the stdout, stderr, and …

jumpscale.core.executors.tmux
-

tmux module allows manipulation of tmux sessions, pane and launching background commands in it

+

tmux module allows manipulation of tmux sessions, pane and launching background commands in it

@@ -78,9 +82,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/executors/local.html b/docs/api/jumpscale/core/executors/local.html index cd3ca4855..e6997d667 100644 --- a/docs/api/jumpscale/core/executors/local.html +++ b/docs/api/jumpscale/core/executors/local.html @@ -3,15 +3,17 @@ - + jumpscale.core.executors.local API documentation - - - - - + + + + + + +
@@ -37,7 +39,9 @@

Module jumpscale.core.executors.local

<Result cmd='uname' exited=0>

-Source code + +Expand source code +
"""
 Local executor allows executing commands within specific env on the local machine. using the executor framework you can retrieve the stdout, stderr, and the return code as well.
 ```
@@ -187,7 +191,7 @@ 

Functions

def execute(cmd, **command_ctx)
-

execute cmd locally

+

execute cmd locally

Args

cmd
@@ -276,20 +280,22 @@

Args

Raises

-
UnexpectedExit
+
UnexpectedExit
if the command exited nonzero and warn was False.
-
Failure
+
Failure
if the command didn’t even exit cleanly, e.g. if a StreamWatcher raised WatcherError.
-
ThreadException
+
ThreadException
(if the background I/O threads encountered exceptions other than WatcherError).

Returns

-
tuple
+
tuple
return code, stdout, stderr (from invoke.run Result)
-
+
-Source code + +Expand source code +
@cmd_from_args
 def execute(cmd, **command_ctx):
     """execute `cmd` locally
@@ -427,9 +433,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/executors/remote.html b/docs/api/jumpscale/core/executors/remote.html index 240ae934c..0219a3292 100644 --- a/docs/api/jumpscale/core/executors/remote.html +++ b/docs/api/jumpscale/core/executors/remote.html @@ -3,15 +3,17 @@ - + jumpscale.core.executors.remote API documentation - - - - - + + + + + + +
@@ -28,7 +30,9 @@

Module jumpscale.core.executors.remote

JS-NG>

-Source code + +Expand source code +
"""
 Remote executor allows executing commands within specific env on any machine. using the executor framework you can retrieve the stdout, stderr, and the return code as well.
 
@@ -119,23 +123,25 @@ 

Functions

def execute(cmd, command_ctx, connection_ctx)
-

execute a command on a remote context

+

execute a command on a remote context

Args

cmd : str or list
command as a string or an argument list, e.g. "ls -la" or ["ls", "la"]
command_ctx : dict
-
command runner context (the same as local execute())
+
command runner context (the same as local execute())
connection_ctx : dict
context passed to fabric e.g. fabric.Connection(host, user=None, port=None, config=None, gateway=None, forward_agent=None, connect_timeout=None, connect_kwargs=None, inline_ssh_env=None)

Returns

-
tuple
+
tuple
return code, stdout, stderr
-
+
-Source code + +Expand source code +
@cmd_from_args
 def execute(cmd, command_ctx, connection_ctx):
     """
@@ -164,7 +170,7 @@ 

Classes

(**connection_ctx)
-

Remote executor allows executing commands within specific env on the any machine. using the executor framework you can retrieve the stdout, stderr, and the return code as well. +

Remote executor allows executing commands within specific env on the any machine. using the executor framework you can retrieve the stdout, stderr, and the return code as well. e.g with j.core.executors.RemoteExecutor(host="localhost", connect_kwargs={"key_filename":"/home/xmonader/.ssh/id_rsa",}) as c:c.run("hostname")

Args

@@ -172,11 +178,13 @@

Args

connect_kwargs is currently the right place to hand in paramiko connection parameters such as pkey or key_filename. e.g connect_kwargs={"key_filename": "/home/myuser/.ssh/private.key"}

Returns

-
str
+
str
return the result of the executed command
-
+
-Source code + +Expand source code +
class RemoteExecutor:
     """Remote executor allows executing commands within specific env on the any machine. using the executor framework you can retrieve the stdout, stderr, and the return code as well.
     e.g
@@ -223,9 +231,11 @@ 

Instance variables

var connection
-
+
-Source code + +Expand source code +
@property
 def connection(self):
     return fabric.Connection(**self._connection_ctx)
@@ -233,9 +243,11 @@

Instance variables

var sftp
-
+
-Source code + +Expand source code +
@property
 def sftp(self):
     return self.connection.sftp()
@@ -248,7 +260,7 @@

Methods

def run(self, cmd, **command_ctx)
-

execute a command

+

execute a command

Args

cmd : str or list
@@ -256,11 +268,13 @@

Args

Returns

-
tuple
+
tuple
return code, stdout, stderr
-
+
-Source code + +Expand source code +
def run(self, cmd, **command_ctx):
     """
     execute a command
@@ -311,9 +325,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/executors/tmux.html b/docs/api/jumpscale/core/executors/tmux.html index abb6cf53f..6335060e5 100644 --- a/docs/api/jumpscale/core/executors/tmux.html +++ b/docs/api/jumpscale/core/executors/tmux.html @@ -3,15 +3,17 @@ - + jumpscale.core.executors.tmux API documentation - - - - - + + + + + + +
@@ -22,7 +24,9 @@

Module jumpscale.core.executors.tmux

tmux module allows manipulation of tmux sessions, pane and launching background commands in it

-Source code + +Expand source code +
"""tmux module allows manipulation of tmux sessions, pane and launching background commands in it"""
 import libtmux
 from jumpscale.core.logging import export_module_as as logger
@@ -96,16 +100,18 @@ 

Functions

def execute_in_window(cmd, window_name, session_name=None)
-

execute a command in a new tmux window

+

execute a command in a new tmux window

Args

cmd : str or list
command as a string or an argument list, e.g. "ls -la" or ["ls", "la"]
window_name : str
window name
-
+
-Source code + +Expand source code +
@cmd_from_args
 def execute_in_window(cmd, window_name, session_name=None):
     """
@@ -147,9 +153,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/index.html b/docs/api/jumpscale/core/index.html index 33333a96b..ed9bf88fa 100644 --- a/docs/api/jumpscale/core/index.html +++ b/docs/api/jumpscale/core/index.html @@ -3,15 +3,17 @@ - + jumpscale.core API documentation - - - - - + + + + + + +
@@ -26,39 +28,39 @@

Sub-modules

jumpscale.core.application
-
+
jumpscale.core.base
-
+
jumpscale.core.config
-
+
jumpscale.core.db
-
+
jumpscale.core.dirs
-
+
jumpscale.core.events
-

This module is for event handling, where any component can listen to certain event notifications …

+

This module is for event handling, where any component can listen to certain event notifications …

jumpscale.core.exceptions
-
+
jumpscale.core.executors
-
+
jumpscale.core.logging
-
+
@@ -97,9 +99,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/logging/index.html b/docs/api/jumpscale/core/logging/index.html index a2d8c8ccf..e2e522b01 100644 --- a/docs/api/jumpscale/core/logging/index.html +++ b/docs/api/jumpscale/core/logging/index.html @@ -3,15 +3,17 @@ - + jumpscale.core.logging API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.core.logging

-Source code + +Expand source code +
import sys
 
 
@@ -60,7 +64,7 @@ 

Sub-modules

jumpscale.core.logging.logging
-
+
@@ -73,9 +77,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
 
     from jumpscale.loader import j
@@ -136,9 +142,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/core/logging/logging.html b/docs/api/jumpscale/core/logging/logging.html index 2bbef7b90..b4388ebf2 100644 --- a/docs/api/jumpscale/core/logging/logging.html +++ b/docs/api/jumpscale/core/logging/logging.html @@ -3,15 +3,17 @@ - + jumpscale.core.logging.logging API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.core.logging.logging

-Source code + +Expand source code +
import math
 import loguru
 import msgpack
@@ -421,12 +425,13 @@ 

Classes

class LogHandler -(*args, **kwargs)
-

the interface every cutom log handler should implement

+

the interface every cutom log handler should implement

-Source code + +Expand source code +
class LogHandler(ABC):
     """the interface every cutom log handler should implement"""
 
@@ -447,9 +452,11 @@ 

Subclasses

class Logger
-
+
-Source code + +Expand source code +
class Logger:
     def __init__(self):
         self._default_app_name = DEFAULT_APP_NAME
@@ -525,9 +532,11 @@ 

Instance variables

var default_app_name
-
+
-Source code + +Expand source code +
@property
 def default_app_name(self):
     return self._default_app_name
@@ -537,17 +546,16 @@

Instance variables

Methods

-def add_custom_handler(self, name, handler, *args, **kwargs) +def add_custom_handler(self, name: str, handler: LogHandler, *args, **kwargs)
-

Add custom log handler

+

Add custom log handler

Arguments

-
-
handler : LogHandler
-
handler function
-
+

handler (LogHandler): handler function

-Source code + +Expand source code +
def add_custom_handler(self, name: str, handler: LogHandler, *args, **kwargs):
     """
     Add custom log handler
@@ -563,10 +571,12 @@ 

Arguments

def add_handler(self, *args, **kwargs)
-

Add handler to the logger

-

takes the same parameters of loguru.logger.add

+

Add handler to the logger

+

takes the same parameters of loguru.logger.add

-Source code + +Expand source code +
def add_handler(self, *args, **kwargs):
     """
     Add handler to the logger
@@ -577,48 +587,56 @@ 

Arguments

-def critical(self, message, *args, category='', data=None) +def critical(self, message, *args, category: str = '', data: dict = None)
-

Log critical message

+

Log critical message

-Source code + +Expand source code +
def critical(self, message, *args, category: str = "", data: dict = None):
     """Log critical message"""
     self._log("CRITICAL", message, *args, category=category, data=data)
-def debug(self, message, *args, category='', data=None) +def debug(self, message, *args, category: str = '', data: dict = None)
-

Log debug message

+

Log debug message

-Source code + +Expand source code +
def debug(self, message, *args, category: str = "", data: dict = None):
     """Log debug message"""
     self._log("DEBUG", message, *args, category=category, data=data)
-def error(self, message, *args, category='', data=None) +def error(self, message, *args, category: str = '', data: dict = None)
-

Log error message

+

Log error message

-Source code + +Expand source code +
def error(self, message, *args, category: str = "", data: dict = None):
     """Log error message"""
     self._log("ERROR", message, *args, category=category, data=data)
-def exception(self, message, *args, category='', data=None, level=40, exception=None) +def exception(self, message, *args, category: str = '', data: dict = None, level: int = 40, exception: Exception = None)
-

Log exception message

+

Log exception message

-Source code + +Expand source code +
def exception(
     self, message, *args, category: str = "", data: dict = None, level: int = 40, exception: Exception = None
 ):
@@ -627,30 +645,34 @@ 

Arguments

-def info(self, message, *args, category='', data=None) +def info(self, message, *args, category: str = '', data: dict = None)
-

Log info message

+

Log info message

-Source code + +Expand source code +
def info(self, message, *args, category: str = "", data: dict = None):
     """Log info message"""
     self._log("INFO", message, *args, category=category, data=data)
-def remove_handler(self, handler_id) +def remove_handler(self, handler_id: int)
-

Remove loguru handler by id

+

Remove loguru handler by id

The pre-configured handler has the id of 0

Args

handler_id : int
handler id that was returned by add_handler method
-
+
-Source code + +Expand source code +
def remove_handler(self, handler_id: int):
     """
     Remove loguru handler by id
@@ -664,12 +686,14 @@ 

Args

-def warning(self, message, *args, category='', data=None) +def warning(self, message, *args, category: str = '', data: dict = None)
-

Log warning message

+

Log warning message

-Source code + +Expand source code +
def warning(self, message, *args, category: str = "", data: dict = None):
     """Log warning message"""
     self._log("WARNING", message, *args, category=category, data=data)
@@ -681,9 +705,11 @@

Args

class MainLogger
-
+
-Source code + +Expand source code +
class MainLogger(Logger):
     def __init__(self):
         super().__init__()
@@ -823,15 +849,17 @@ 

Methods

def get_app_names(self)
-

Get a set of all registered app names

+

Get a set of all registered app names

If redis is running, it would get them from applications set.

Returns

-
set
+
set
available app names
-
+
-Source code + +Expand source code +
def get_app_names(self):
     """
     Get a set of all registered app names
@@ -855,7 +883,7 @@ 

Returns

def register(self, app_name, module_name=None)
-

Register and bind given module (and sub-modules) logs with a given app name

+

Register and bind given module (and sub-modules) logs with a given app name

Will also add the app to applications set in redis.

If module_name is not passed or empty, it would be the caller module name.

Args

@@ -864,9 +892,11 @@

Args

app name
module_name : str, optional
module name. Defaults to None.
-
+
-Source code + +Expand source code +
def register(self, app_name, module_name=None):
     """
     Register and bind given module (and sub-modules) logs with a given app name
@@ -895,16 +925,18 @@ 

Args

def unregister(self, module_name=None)
-

Unregister a module from log binding with the app name.

+

Unregister a module from log binding with the app name.

Will also remove the app from applications set in redis.

If module_name is not passed or empty, it would be the caller module name.

Args

module_name : str, optional
module name. Defaults to None.
-
+
-Source code + +Expand source code +
def unregister(self, module_name=None):
     """
     Unregister a module from log binding with the app name.
@@ -946,12 +978,14 @@ 

Inherited members

class RedisLogHandler -(max_size=1000, dump=True, dump_dir=None) +(max_size: int = 1000, dump: bool = True, dump_dir: str = None)
-

the interface every cutom log handler should implement

+

the interface every cutom log handler should implement

-Source code + +Expand source code +
class RedisLogHandler(LogHandler):
     def __init__(self, max_size: int = 1000, dump: bool = True, dump_dir: str = None):
         self._max_size = max_size
@@ -1117,9 +1151,11 @@ 

Instance variables

var dump
-
+
-Source code + +Expand source code +
@property
 def dump(self):
     return self._dump
@@ -1127,9 +1163,11 @@

Instance variables

var dump_dir
-
+
-Source code + +Expand source code +
@property
 def dump_dir(self):
     return self._dump_dir
@@ -1137,9 +1175,11 @@

Instance variables

var max_size
-
+
-Source code + +Expand source code +
@property
 def max_size(self):
     return self._max_size
@@ -1149,20 +1189,22 @@

Instance variables

Methods

-def record_get(self, identifier, app_name='init') +def record_get(self, identifier: int, app_name: str = 'init') ‑> dict
-

Get app log record by its identifier

+

Get app log record by its identifier

Arguments

identifier {int} – record identifier app_name {str} – app name

Returns

-
dict
+
dict
requested log record
-
+
-Source code + +Expand source code +
def record_get(self, identifier: int, app_name: str = DEFAULT_APP_NAME) -> dict:
     """Get app log record by its identifier
 
@@ -1192,22 +1234,18 @@ 

Returns

-def records_count(self, app_name='init') +def records_count(self, app_name: str = 'init') ‑> int
-

Gets total number of the records of the app

+

Gets total number of the records of the app

Arguments

-
-
app_name : str
-
app name
-
+

app_name (str): app name

Returns

-
-
inittotal number of the records
-
 
-
+

init – total number of the records

-Source code + +Expand source code +
def records_count(self, app_name: str = DEFAULT_APP_NAME) -> int:
     """Gets total number of the records of the app
 
@@ -1224,17 +1262,16 @@ 

Returns

-def remove_all_records(self, app_name) +def remove_all_records(self, app_name: str)
-

Delete all app's log records

+

Delete all app's log records

Arguments

-
-
app_name : str
-
app name
-
+

app_name (str): app name

-Source code + +Expand source code +
def remove_all_records(self, app_name: str):
     """Delete all app's log records
 
@@ -1249,20 +1286,22 @@ 

Arguments

-def tail(self, app_name='init', limit=None) +def tail(self, app_name: str = 'init', limit: int = None) ‑> 
-

Tail records

+

Tail records

Keyword Arguments: app_name (str): app name. limit (int, optional): max number of record to be returned per page (default: max size)

Yields

-
iter
+
iter
iterator of the requested logs
-
+
-Source code + +Expand source code +
def tail(self, app_name: str = DEFAULT_APP_NAME, limit: int = None) -> iter:
     """Tail records
 
@@ -1343,9 +1382,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/bcdb.html b/docs/api/jumpscale/data/bcdb/bcdb.html index 1360e41f8..c4c381847 100644 --- a/docs/api/jumpscale/data/bcdb/bcdb.html +++ b/docs/api/jumpscale/data/bcdb/bcdb.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.bcdb API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.bcdb

-Source code + +Expand source code +
from redis import Redis
 import json
 from jumpscale.data.bcdb import models as models
@@ -35,7 +39,7 @@ 

Module jumpscale.data.bcdb.bcdb

self.indexer_set = SQLiteIndexSetClient(ns) self.indexer_text = SonicIndexTextClient(ns) self.models = { - + } self.loaded_models = { @@ -49,10 +53,10 @@

Module jumpscale.data.bcdb.bcdb

model = getattr(models, model_name) if isinstance(model, type) and issubclass(model, models.ModelBase): self.models[model._name] = model - + def save_obj(self, model, obj): """Saves the given objects which belongs to model in the db and update the indexes. - + Args: model (ModelObj): The model object that obj belongs to. obj (JSObjBase): The object that will be saved. @@ -71,10 +75,10 @@

Module jumpscale.data.bcdb.bcdb

def model_id_incr(self, model): """Increment the id counter in the model and returns the new id. Used to assign unique id for each created object. - + Args: model (ModelObj): The model object. - + Returns: int: The new unique id """ @@ -82,11 +86,11 @@

Module jumpscale.data.bcdb.bcdb

def get_item_by_id(self, model, id): """Gets the object in the model with the given id. - + Args: model (ModelObj): The model to be searched in. id (int): The object's id. - + Returns: JSObjBase or None: The JSObject with the given id. None if none was found. """ @@ -97,15 +101,15 @@

Module jumpscale.data.bcdb.bcdb

1. It searches in the redis index if key is indexed. 2. Else, It's searched for in the sqlite index if the key is indexed for range search. 3. Else, All objects in the db belonging to the given model is scanned linearly to determine the matching object. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. val (value): The value. - + Raises: RuntimeError: If the key is not a part of the schema. - + Returns: JSObjBase or None: The matched object (o: o.key == val). None if none matched. """ @@ -125,16 +129,16 @@

Module jumpscale.data.bcdb.bcdb

def get_range(self, model, key, min, max): """Searches for objects whose key lies between min and max. It tries to search for it in the index. If the key is not indexed it loops through all the objects. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. min (value): The minimum. max (value): The maximum. - + Raises: RuntimeError: If the key is not a part of the schema. - + Returns: List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max) """ @@ -149,20 +153,20 @@

Module jumpscale.data.bcdb.bcdb

if obj_val >= min and obj_val <= max: result.append(obj) return result - + def get_item_from_index(self, model, key, val): """Search for objects whose key equal val. The key must be indexed for search. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. val (value): The value. - + Raises: RuntimeError: If the key is not a part of the schema. RuntimeError: If the key is not indexed for search. - + Returns: List[JSObjBase]: A list of matched objects (o: o.key == val) """ @@ -175,17 +179,17 @@

Module jumpscale.data.bcdb.bcdb

def get_item_from_index_set(self, model, key, min, max): """Searches for objects whose key lies between min and max. The key must be indexed for range search. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. min (value): The minimum. max (value): The maximum. - + Raises: RuntimeError: If the key is not a part of the schema. RuntimeError: If the key is not indexed for range search. - + Returns: List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max) """ @@ -194,23 +198,23 @@

Module jumpscale.data.bcdb.bcdb

if not model.schema.props[key].index_key: raise RuntimeError(f"{key} is not indexed.") return [self.get_item_by_id(model, x[0]) for x in self.indexer_set.get(model, key, min, max)] - + def get_item_from_index_text(self, model, key, pattern): """Searches for objects whose key matches the given pattern inside model. The key must be registered in the text index. - + Args: model (Modelobj): The model object in which the pattern is searched. key (str): The model property that the pattern is searched for in. pattern (str): The pattern to be searched for. - + Notes: Currently sonic server matches for some patterns and doesn't for others. Raises: RuntimeError: If the key is not defined in the model. RuntimeError: If the key is not indexed for search - + Returns: list[JSObjBase]: List of matching objects (o: o.key matches pattern). """ @@ -222,13 +226,13 @@

Module jumpscale.data.bcdb.bcdb

def get_model_by_name(self, model_name): """Returns a Model object given its name. - + Args: model_name (str): The name of the model. - + Raises: RuntimeError: Raised when no model exists with the given. - + Returns: ModelObj: The model object. """ @@ -253,9 +257,11 @@

Classes

(ns)
-
+
-Source code + +Expand source code +
class BCDB:
     def __init__(self, ns):
         self.ns = ns
@@ -264,7 +270,7 @@ 

Classes

self.indexer_set = SQLiteIndexSetClient(ns) self.indexer_text = SonicIndexTextClient(ns) self.models = { - + } self.loaded_models = { @@ -278,10 +284,10 @@

Classes

model = getattr(models, model_name) if isinstance(model, type) and issubclass(model, models.ModelBase): self.models[model._name] = model - + def save_obj(self, model, obj): """Saves the given objects which belongs to model in the db and update the indexes. - + Args: model (ModelObj): The model object that obj belongs to. obj (JSObjBase): The object that will be saved. @@ -300,10 +306,10 @@

Classes

def model_id_incr(self, model): """Increment the id counter in the model and returns the new id. Used to assign unique id for each created object. - + Args: model (ModelObj): The model object. - + Returns: int: The new unique id """ @@ -311,11 +317,11 @@

Classes

def get_item_by_id(self, model, id): """Gets the object in the model with the given id. - + Args: model (ModelObj): The model to be searched in. id (int): The object's id. - + Returns: JSObjBase or None: The JSObject with the given id. None if none was found. """ @@ -326,15 +332,15 @@

Classes

1. It searches in the redis index if key is indexed. 2. Else, It's searched for in the sqlite index if the key is indexed for range search. 3. Else, All objects in the db belonging to the given model is scanned linearly to determine the matching object. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. val (value): The value. - + Raises: RuntimeError: If the key is not a part of the schema. - + Returns: JSObjBase or None: The matched object (o: o.key == val). None if none matched. """ @@ -354,16 +360,16 @@

Classes

def get_range(self, model, key, min, max): """Searches for objects whose key lies between min and max. It tries to search for it in the index. If the key is not indexed it loops through all the objects. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. min (value): The minimum. max (value): The maximum. - + Raises: RuntimeError: If the key is not a part of the schema. - + Returns: List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max) """ @@ -378,20 +384,20 @@

Classes

if obj_val >= min and obj_val <= max: result.append(obj) return result - + def get_item_from_index(self, model, key, val): """Search for objects whose key equal val. The key must be indexed for search. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. val (value): The value. - + Raises: RuntimeError: If the key is not a part of the schema. RuntimeError: If the key is not indexed for search. - + Returns: List[JSObjBase]: A list of matched objects (o: o.key == val) """ @@ -404,17 +410,17 @@

Classes

def get_item_from_index_set(self, model, key, min, max): """Searches for objects whose key lies between min and max. The key must be indexed for range search. - + Args: model (ModelObj): The model in which the key is searched for. key (str): The model property that is checked for. min (value): The minimum. max (value): The maximum. - + Raises: RuntimeError: If the key is not a part of the schema. RuntimeError: If the key is not indexed for range search. - + Returns: List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max) """ @@ -423,23 +429,23 @@

Classes

if not model.schema.props[key].index_key: raise RuntimeError(f"{key} is not indexed.") return [self.get_item_by_id(model, x[0]) for x in self.indexer_set.get(model, key, min, max)] - + def get_item_from_index_text(self, model, key, pattern): """Searches for objects whose key matches the given pattern inside model. The key must be registered in the text index. - + Args: model (Modelobj): The model object in which the pattern is searched. key (str): The model property that the pattern is searched for in. pattern (str): The pattern to be searched for. - + Notes: Currently sonic server matches for some patterns and doesn't for others. Raises: RuntimeError: If the key is not defined in the model. RuntimeError: If the key is not indexed for search - + Returns: list[JSObjBase]: List of matching objects (o: o.key matches pattern). """ @@ -451,13 +457,13 @@

Classes

def get_model_by_name(self, model_name): """Returns a Model object given its name. - + Args: model_name (str): The name of the model. - + Raises: RuntimeError: Raised when no model exists with the given. - + Returns: ModelObj: The model object. """ @@ -473,9 +479,11 @@

Methods

def detect_models(self)
-

It scans all the models and store its classes for later use.

+

It scans all the models and store its classes for later use.

-Source code + +Expand source code +
def detect_models(self):
     """It scans all the models and store its classes for later use."""
     for model_name in dir(models):
@@ -488,7 +496,7 @@ 

Methods

def get_entry(self, model, key, val)
-

Search for objects whose key equal val. +

Search for objects whose key equal val. 1. It searches in the redis index if key is indexed. 2. Else, It's searched for in the sqlite index if the key is indexed for range search. 3. Else, All objects in the db belonging to the given model is scanned linearly to determine the matching object.

@@ -503,27 +511,32 @@

Args

Raises

-
RuntimeError
+
RuntimeError
If the key is not a part of the schema.

Returns

-

JSObjBase or None: The matched object (o: o.key == val). None if none matched.

+
+
JSObjBase or None
+
The matched object (o: o.key == val). None if none matched.
+
-Source code + +Expand source code +
def get_entry(self, model, key, val):
     """Search for objects whose key equal val.
     1. It searches in the redis index if key is indexed.
     2. Else, It's searched for in the sqlite index if the key is indexed for range search.
     3. Else, All objects in the db belonging to the given model is scanned linearly to determine the matching object.
-    
+
     Args:
         model (ModelObj): The model in which the key is searched for.
         key (str): The model property that is checked for.
         val (value): The value.
-    
+
     Raises:
         RuntimeError: If the key is not a part of the schema.
-    
+
     Returns:
         JSObjBase or None: The matched object (o: o.key == val). None if none matched.
     """
@@ -545,7 +558,7 @@ 

Returns

def get_item_by_id(self, model, id)
-

Gets the object in the model with the given id.

+

Gets the object in the model with the given id.

Args

model : ModelObj
@@ -554,16 +567,21 @@

Args

The object's id.

Returns

-

JSObjBase or None: The JSObject with the given id. None if none was found.

+
+
JSObjBase or None
+
The JSObject with the given id. None if none was found.
+
-Source code + +Expand source code +
def get_item_by_id(self, model, id):
     """Gets the object in the model with the given id.
-    
+
     Args:
         model (ModelObj): The model to be searched in.
         id (int): The object's id.
-    
+
     Returns:
         JSObjBase or None: The JSObject with the given id. None if none was found.
     """
@@ -574,7 +592,7 @@ 

Returns

def get_item_from_index(self, model, key, val)
-

Search for objects whose key equal val. The key must be indexed for search.

+

Search for objects whose key equal val. The key must be indexed for search.

Args

model : ModelObj
@@ -586,30 +604,32 @@

Args

Raises

-
RuntimeError
+
RuntimeError
If the key is not a part of the schema.
-
RuntimeError
+
RuntimeError
If the key is not indexed for search.

Returns

-
List[JSObjBase]: A list of matched objects (o: o.key == val)
-
 
-
+
List[JSObjBase]
+
A list of matched objects (o: o.key == val)
+
-Source code + +Expand source code +
def get_item_from_index(self, model, key, val):
     """Search for objects whose key equal val. The key must be indexed for search.
-    
+
     Args:
         model (ModelObj): The model in which the key is searched for.
         key (str): The model property that is checked for.
         val (value): The value.
-    
+
     Raises:
         RuntimeError: If the key is not a part of the schema.
         RuntimeError: If the key is not indexed for search.
-    
+
     Returns:
         List[JSObjBase]: A list of matched objects (o: o.key == val)
     """
@@ -625,7 +645,7 @@ 

Returns

def get_item_from_index_set(self, model, key, min, max)
-

Searches for objects whose key lies between min and max. The key must be indexed for range search.

+

Searches for objects whose key lies between min and max. The key must be indexed for range search.

Args

model : ModelObj
@@ -639,31 +659,33 @@

Args

Raises

-
RuntimeError
+
RuntimeError
If the key is not a part of the schema.
-
RuntimeError
+
RuntimeError
If the key is not indexed for range search.

Returns

-
List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max)
-
 
-
+
List[JSObjBase]
+
A list of matched objects (o: o.key >= min and o.key <= max)
+
-Source code + +Expand source code +
def get_item_from_index_set(self, model, key, min, max):
     """Searches for objects whose key lies between min and max. The key must be indexed for range search.
-    
+
     Args:
         model (ModelObj): The model in which the key is searched for.
         key (str): The model property that is checked for.
         min (value): The minimum.
         max (value): The maximum.
-    
+
     Raises:
         RuntimeError: If the key is not a part of the schema.
         RuntimeError: If the key is not indexed for range search.
-    
+
     Returns:
         List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max)
     """
@@ -678,7 +700,7 @@ 

Returns

def get_item_from_index_text(self, model, key, pattern)
-

Searches for objects whose key matches the given pattern inside model. The key must be registered in the text index.

+

Searches for objects whose key matches the given pattern inside model. The key must be registered in the text index.

Args

model : Modelobj
@@ -692,30 +714,35 @@

Notes

Currently sonic server matches for some patterns and doesn't for others.

Raises

-
RuntimeError
+
RuntimeError
If the key is not defined in the model.
-
RuntimeError
+
RuntimeError
If the key is not indexed for search

Returns

-

list[JSObjBase]: List of matching objects (o: o.key matches pattern).

+
+
list[JSObjBase]
+
List of matching objects (o: o.key matches pattern).
+
-Source code + +Expand source code +
def get_item_from_index_text(self, model, key, pattern):
     """Searches for objects whose key matches the given pattern inside model. The key must be registered in the text index.
-    
+
     Args:
         model (Modelobj): The model object in which the pattern is searched.
         key (str): The model property that the pattern is searched for in.
         pattern (str): The pattern to be searched for.
-    
+
     Notes:
         Currently sonic server matches for some patterns and doesn't for others.
 
     Raises:
         RuntimeError: If the key is not defined in the model.
         RuntimeError: If the key is not indexed for search
-    
+
     Returns:
         list[JSObjBase]: List of matching objects (o: o.key matches pattern).
     """
@@ -730,7 +757,7 @@ 

Returns

def get_model_by_name(self, model_name)
-

Returns a Model object given its name.

+

Returns a Model object given its name.

Args

model_name : str
@@ -738,25 +765,27 @@

Args

Raises

-
RuntimeError
+
RuntimeError
Raised when no model exists with the given.

Returns

-
ModelObj
+
ModelObj
The model object.
-
+
-Source code + +Expand source code +
def get_model_by_name(self, model_name):
     """Returns a Model object given its name.
-    
+
     Args:
         model_name (str): The name of the model.
-    
+
     Raises:
         RuntimeError: Raised when no model exists with the given.
-    
+
     Returns:
         ModelObj: The model object.
     """
@@ -771,7 +800,7 @@ 

Returns

def get_range(self, model, key, min, max)
-

Searches for objects whose key lies between min and max. +

Searches for objects whose key lies between min and max. It tries to search for it in the index. If the key is not indexed it loops through all the objects.

Args

@@ -786,29 +815,31 @@

Args

Raises

-
RuntimeError
+
RuntimeError
If the key is not a part of the schema.

Returns

-
List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max)
-
 
-
+
List[JSObjBase]
+
A list of matched objects (o: o.key >= min and o.key <= max)
+
-Source code + +Expand source code +
def get_range(self, model, key, min, max):
     """Searches for objects whose key lies between min and max.
     It tries to search for it in the index. If the key is not indexed it loops through all the objects.
-    
+
     Args:
         model (ModelObj): The model in which the key is searched for.
         key (str): The model property that is checked for.
         min (value): The minimum.
         max (value): The maximum.
-    
+
     Raises:
         RuntimeError: If the key is not a part of the schema.
-    
+
     Returns:
         List[JSObjBase]: A list of matched objects (o: o.key >= min and o.key <= max)
     """
@@ -829,7 +860,7 @@ 

Returns

def model_id_incr(self, model)
-

Increment the id counter in the model and returns the new id. +

Increment the id counter in the model and returns the new id. Used to assign unique id for each created object.

Args

@@ -838,18 +869,20 @@

Args

Returns

-
int
+
int
The new unique id
-
+
-Source code + +Expand source code +
def model_id_incr(self, model):
     """Increment the id counter in the model and returns the new id.
     Used to assign unique id for each created object.
-    
+
     Args:
         model (ModelObj): The model object.
-    
+
     Returns:
         int: The new unique id
     """
@@ -860,19 +893,21 @@ 

Returns

def save_obj(self, model, obj)
-

Saves the given objects which belongs to model in the db and update the indexes.

+

Saves the given objects which belongs to model in the db and update the indexes.

Args

model : ModelObj
The model object that obj belongs to.
obj : JSObjBase
The object that will be saved.
-
+
-Source code + +Expand source code +
def save_obj(self, model, obj):
     """Saves the given objects which belongs to model in the db and update the indexes.
-    
+
     Args:
         model (ModelObj): The model object that obj belongs to.
         obj (JSObjBase): The object that will be saved.
@@ -928,9 +963,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/clients.html b/docs/api/jumpscale/data/bcdb/clients.html index caf3d6319..bbdb9fdcf 100644 --- a/docs/api/jumpscale/data/bcdb/clients.html +++ b/docs/api/jumpscale/data/bcdb/clients.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.clients API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.clients

-Source code + +Expand source code +
from .interfaces import *
 from redis import Redis
 import json
@@ -163,12 +167,13 @@ 

Classes

class JSONSerializer -(*args, **kwargs)
-
+
-Source code + +Expand source code +
class JSONSerializer(SerializerInterface):
     def loads(self, model, s):
         return model.load_obj_from_dict(json.loads(s))
@@ -186,9 +191,11 @@ 

Methods

def dumps(self, model, data)
-
+
-Source code + +Expand source code +
def dumps(self, model, data):
     return json.dumps(model.get_dict(data))
@@ -197,9 +204,11 @@

Methods

def loads(self, model, s)
-
+
-Source code + +Expand source code +
def loads(self, model, s):
     return model.load_obj_from_dict(json.loads(s))
@@ -211,9 +220,11 @@

Methods

(bcdb_namespace, host='localhost', port=6379)
-
+
-Source code + +Expand source code +
class RedisIndexClient(IndexInterface):
     def __init__(self, bcdb_namespace, host="localhost", port=6379):
         self.redis_client = Redis(host=host, port=port)
@@ -238,9 +249,11 @@ 

Methods

def get(self, model, index_prop, index_value)
-
+
-Source code + +Expand source code +
def get(self, model, index_prop, index_value):
     res = self.redis_client.get(f"{self.bcdb_namespace}.indexer.{model.name}.{index_prop}://{index_value}")
     return int(res) if res else None
@@ -250,9 +263,11 @@

Methods

def set(self, model, index_prop, index_value, obj_id, old_value=None)
-
+
-Source code + +Expand source code +
def set(self, model, index_prop, index_value, obj_id, old_value=None):
     if old_value:
         self.redis_client.delete(f"{self.bcdb_namespace}.indexer.{model.name}.{index_prop}://{old_value}")
@@ -266,9 +281,11 @@ 

Methods

(bcdb_namespace, host='localhost', port=6379, serializer=None)
-
+
-Source code + +Expand source code +
class RedisStorageClient(StorageInterface):
     def __init__(self, bcdb_namespace, host="localhost", port=6379, serializer=None):
         self.redis_client = Redis(host=host, port=port)
@@ -307,9 +324,11 @@ 

Methods

def get(self, model, obj_id)
-
+
-Source code + +Expand source code +
def get(self, model, obj_id):
     obj_str = self.redis_client.get(f"{self.bcdb_namespace}.{model.name}://{obj_id}")
     return self.serializer.loads(model, obj_str) if obj_str else None
@@ -319,9 +338,11 @@

Methods

def get_keys_in_model(self, model)
-
+
-Source code + +Expand source code +
def get_keys_in_model(self, model):
     pattern = f"{self.bcdb_namespace}.{model.name}://*"
     result = []
@@ -337,9 +358,11 @@ 

Methods

def incr_id(self, model)
-
+
-Source code + +Expand source code +
def incr_id(self, model):
     return self.redis_client.incr(f"{self.bcdb_namespace}.{model.name}.lastid")
@@ -348,9 +371,11 @@

Methods

def set(self, model, obj_id, value)
-
+
-Source code + +Expand source code +
def set(self, model, obj_id, value):
     return self.redis_client.set(
         f"{self.bcdb_namespace}.{model.name}://{obj_id}", self.serializer.dumps(model, value)
@@ -364,9 +389,11 @@ 

Methods

(bcdb_namespace)
-
+
-Source code + +Expand source code +
class SQLiteIndexSetClient(IndexSetInterface):
     def __init__(self, bcdb_namespace):
         self.bcdb_namespace = bcdb_namespace
@@ -428,9 +455,11 @@ 

Methods

def get(self, model, index_prop, min, max)
-
+
-Source code + +Expand source code +
def get(self, model, index_prop, min, max):
     self._create_if_not_exists(model)
     conn = sqlite3.connect(f"{self.bcdb_namespace}_index.db")
@@ -446,9 +475,11 @@ 

Methods

def set(self, model, obj)
-
+
-Source code + +Expand source code +
def set(self, model, obj):
     self._create_if_not_exists(model)
     conn = sqlite3.connect(f"{self.bcdb_namespace}_index.db")
@@ -473,9 +504,11 @@ 

Methods

(bcdb_namespace)
-
+
-Source code + +Expand source code +
class SonicIndexTextClient(IndexTextInterface):
     def __init__(self, bcdb_namespace):
         self.bcdb_namespace = bcdb_namespace
@@ -504,9 +537,11 @@ 

Methods

def get(self, model, index_prop, pattern)
-
+
-Source code + +Expand source code +
def get(self, model, index_prop, pattern):
     return self.sonic_client.query(self.bcdb_namespace, f"{model.name}_{index_prop}", pattern)
@@ -515,9 +550,11 @@

Methods

def set(self, model, obj)
-
+
-Source code + +Expand source code +
def set(self, model, obj):
     for prop in model.schema.props.values():
         if prop.index_text:
@@ -587,9 +624,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/dumpsql.html b/docs/api/jumpscale/data/bcdb/dumpsql.html index 09940c3b3..81693cd81 100644 --- a/docs/api/jumpscale/data/bcdb/dumpsql.html +++ b/docs/api/jumpscale/data/bcdb/dumpsql.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.dumpsql API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.dumpsql

-Source code + +Expand source code +
def main():
     import sqlite3
     from pprint import pprint
@@ -49,9 +53,11 @@ 

Functions

def main()
-
+
-Source code + +Expand source code +
def main():
     import sqlite3
     from pprint import pprint
@@ -89,9 +95,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/flush.html b/docs/api/jumpscale/data/bcdb/flush.html index 8cb69c6a3..68faff70d 100644 --- a/docs/api/jumpscale/data/bcdb/flush.html +++ b/docs/api/jumpscale/data/bcdb/flush.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.flush API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.flush

-Source code + +Expand source code +
def main():
     import os
     from jumpscale.loader import j
@@ -56,9 +60,11 @@ 

Functions

def main()
-
+
-Source code + +Expand source code +
def main():
     import os
     from jumpscale.loader import j
@@ -103,9 +109,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/index.html b/docs/api/jumpscale/data/bcdb/index.html index 98d904405..350c2fc9a 100644 --- a/docs/api/jumpscale/data/bcdb/index.html +++ b/docs/api/jumpscale/data/bcdb/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb

-Source code + +Expand source code +
from .bcdb import *
@@ -30,27 +34,27 @@

Sub-modules

jumpscale.data.bcdb.bcdb
-
+
jumpscale.data.bcdb.clients
-
+
jumpscale.data.bcdb.dumpsql
-
+
jumpscale.data.bcdb.flush
-
+
jumpscale.data.bcdb.interfaces
-
+
jumpscale.data.bcdb.models
-
+

@@ -86,9 +90,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/interfaces.html b/docs/api/jumpscale/data/bcdb/interfaces.html index 1042bb423..15a40eec2 100644 --- a/docs/api/jumpscale/data/bcdb/interfaces.html +++ b/docs/api/jumpscale/data/bcdb/interfaces.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.interfaces API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.interfaces

-Source code + +Expand source code +
class StorageInterface:
     def get(self, model, obj_id):
         pass
@@ -63,7 +67,7 @@ 

Module jumpscale.data.bcdb.interfaces

pass def get(self, model, index_prop, pattern): - pass + pass class SerializerInterface: def loads(self, model, s): @@ -87,9 +91,11 @@

Classes

(bcdb_namespace)
-
+
-Source code + +Expand source code +
class IndexInterface:
     def __init__(self, bcdb_namespace):
         pass
@@ -110,9 +116,11 @@ 

Methods

def get(self, model, index_prop, index_value)
-
+
-Source code + +Expand source code +
def get(self, model, index_prop, index_value):
     pass
@@ -121,9 +129,11 @@

Methods

def set(self, model, index_prop, index_value, obj_id, old_value=None)
-
+
-Source code + +Expand source code +
def set(self, model, index_prop, index_value, obj_id, old_value=None):
     pass
@@ -135,9 +145,11 @@

Methods

(bcdb_namespace)
-
+
-Source code + +Expand source code +
class IndexSetInterface:
     def __init__(self, bcdb_namespace):
         pass
@@ -158,9 +170,11 @@ 

Methods

def get(self, model, index_prop, min, max)
-
+
-Source code + +Expand source code +
def get(self, model, index_prop, min, max):
     pass
@@ -169,9 +183,11 @@

Methods

def set(self, model, obj)
-
+
-Source code + +Expand source code +
def set(self, model, obj):
     pass
@@ -183,9 +199,11 @@

Methods

(bcdb_namespace)
-
+
-Source code + +Expand source code +
class IndexTextInterface:
     def __init__(self, bcdb_namespace):
         pass
@@ -206,9 +224,11 @@ 

Methods

def get(self, model, index_prop, pattern)
-
+
-Source code + +Expand source code +
def get(self, model, index_prop, pattern):
     pass 
@@ -217,9 +237,11 @@

Methods

def set(self, model, obj)
-
+
-Source code + +Expand source code +
def set(self, model, obj):
    pass
@@ -228,12 +250,13 @@

Methods

class SerializerInterface -(*args, **kwargs)
-
+
-Source code + +Expand source code +
class SerializerInterface:
     def loads(self, model, s):
         pass
@@ -251,9 +274,11 @@ 

Methods

def dumps(self, model, data)
-
+
-Source code + +Expand source code +
def dumps(self, model, data):
     pass
@@ -262,9 +287,11 @@

Methods

def loads(self, model, s)
-
+
-Source code + +Expand source code +
def loads(self, model, s):
     pass
@@ -273,12 +300,13 @@

Methods

class StorageInterface -(*args, **kwargs)
-
+
-Source code + +Expand source code +
class StorageInterface:
     def get(self, model, obj_id):
         pass
@@ -302,9 +330,11 @@ 

Methods

def get(self, model, obj_id)
-
+
-Source code + +Expand source code +
def get(self, model, obj_id):
     pass
@@ -313,9 +343,11 @@

Methods

def get_keys_in_model(self, model)
-
+
-Source code + +Expand source code +
def get_keys_in_model(self, model):
     pass
@@ -324,9 +356,11 @@

Methods

def incr_id(self, model)
-
+
-Source code + +Expand source code +
def incr_id(self, model):
     pass
@@ -335,9 +369,11 @@

Methods

def set(self, model, obj_id, value)
-
+
-Source code + +Expand source code +
def set(self, model, obj_id, value):
     pass
@@ -403,9 +439,7 @@

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/base.html b/docs/api/jumpscale/data/bcdb/models/base.html index dbf6b937c..4d97451fa 100644 --- a/docs/api/jumpscale/data/bcdb/models/base.html +++ b/docs/api/jumpscale/data/bcdb/models/base.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.base API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.base

-Source code + +Expand source code +
from jumpscale.loader import j
 from jumpscale.data.schema import Property
 from jumpscale.data.types import Integer, JSObject
@@ -224,9 +228,11 @@ 

Classes

(model)
-
+
-Source code + +Expand source code +
class JSObjBase:
     def __init__(self, model):
         self.model = model
@@ -246,9 +252,11 @@ 

Methods

def get_dict(self)
-
+
-Source code + +Expand source code +
def get_dict(self):
     return self.model.get_dict(self)
@@ -257,9 +265,11 @@

Methods

def save(self)
-
+
-Source code + +Expand source code +
def save(self):
     return self.model.save_obj(self)
@@ -271,9 +281,11 @@

Methods

(bcdb)
-
+
-Source code + +Expand source code +
class ModelBase:
     _schema = ""
     _name = ""
@@ -443,13 +455,13 @@ 

Methods

Subclasses

Methods

@@ -457,7 +469,7 @@

Methods

def create_obj(self, data)
-

Create a new object and assign a new id to it with the given data dict. +

Create a new object and assign a new id to it with the given data dict. Missing props are defaultly initialized.

Args

@@ -466,11 +478,13 @@

Args

Returns

-
JSObjBase
+
JSObjBase
The newly created
-
+
-Source code + +Expand source code +
def create_obj(self, data):
     """Create a new object and assign a new id to it with the given data dict.
     Missing props are defaultly initialized.
@@ -491,7 +505,7 @@ 

Returns

def get_by(self, key, value)
-

Search for objects whose key equal value. +

Search for objects whose key equal value. 1. It searches in the redis index if key is indexed. 2. Else, It's searched for in the sqlite index if the key is indexed for range search. 3. Else, All objects in the db belonging to the given model is scanned linearly to determine the matching object.

@@ -504,13 +518,18 @@

Args

Raises

-
RuntimeError
+
RuntimeError
If the key is not a part of the schema.

Returns

-

JSObjBase or None: The matched object (o: o.key == val). None if none matched.

+
+
JSObjBase or None
+
The matched object (o: o.key == val). None if none matched.
+
-Source code + +Expand source code +
def get_by(self, key, value):
     """Search for objects whose key equal value.
     1. It searches in the redis index if key is indexed.
@@ -534,19 +553,21 @@ 

Returns

def get_dict(self, obj)
-

Extracts a dict with all attributes from obj.

+

Extracts a dict with all attributes from obj.

Args

-
obj : JSObjBase
+
obj : JSObjBase
The object that the data is extracted from.

Returns

-
dict
+
dict
The data dict.
-
+
-Source code + +Expand source code +
def get_dict(self, obj):
     """Extracts a dict with all attributes from obj.
 
@@ -569,7 +590,7 @@ 

Returns

def get_pattern(self, key, pattern)
-

Searches for objects whose key matches the given pattern in this model. The key must be registered in the text index.

+

Searches for objects whose key matches the given pattern in this model. The key must be registered in the text index.

Args

key : str
@@ -581,15 +602,20 @@

Notes

Currently sonic server matches for some patterns and doesn't for others.

Raises

-
RuntimeError
+
RuntimeError
If the key is not defined in the model.
-
RuntimeError
+
RuntimeError
If the key is not indexed for search

Returns

-

list[JSObjBase]: List of matching objects (o: o.key matches pattern).

+
+
list[JSObjBase]
+
List of matching objects (o: o.key matches pattern).
+
-Source code + +Expand source code +
def get_pattern(self, key, pattern):
     """Searches for objects whose key matches the given pattern in this model. The key must be registered in the text index.
 
@@ -614,9 +640,11 @@ 

Returns

def get_range(self, key, min, max)
-
+
-Source code + +Expand source code +
def get_range(self, key, min, max):
     return self.bcdb.get_item_from_index_set(self, key, min, max)
@@ -625,7 +653,7 @@

Returns

def load_obj_from_dict(self, d)
-

Creates a new object with its data extracted from the d.

+

Creates a new object with its data extracted from the d.

Args

d : dict
@@ -633,11 +661,13 @@

Args

Returns

-
JSObjBase
+
JSObjBase
The newly created object.
-
+
-Source code + +Expand source code +
def load_obj_from_dict(self, d):
     """Creates a new object with its data extracted from the d.
 
@@ -656,14 +686,16 @@ 

Returns

def save_obj(self, obj)
-

Saves the object to the db. It forwards the call to the bcdb client.

+

Saves the object to the db. It forwards the call to the bcdb client.

Args

-
obj : JSObjBase
+
obj : JSObjBase
The object to be saved.
-
+
-Source code + +Expand source code +
def save_obj(self, obj):
     """Saves the object to the db. It forwards the call to the bcdb client.
 
@@ -678,11 +710,11 @@ 

Args

def set_from_dict(self, o, d)
-

Sets the attributes in the object o to the data from the dict d. +

Sets the attributes in the object o to the data from the dict d. Default values is used if it's not present in d.

Args

-
o : JSObjBase
+
o : JSObjBase
The object that will be set.
d : dict
The dict containing the object new data.
@@ -692,16 +724,18 @@

Notes

It was assumed to receive strings convertable to the defined property.

Raises

-
ValueError
+
ValueError
If a value in the dict doesn't conform to the type checking rules imposed by the model's schema.

Returns

-
JSObjBase
+
JSObjBase
The JSObject after setting its data from the dict d.
-
+
-Source code + +Expand source code +
def set_from_dict(self, o, d):
     """Sets the attributes in the object o to the data from the dict d.
     Default values is used if it's not present in d.
@@ -779,9 +813,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/db_model.html b/docs/api/jumpscale/data/bcdb/models/db_model.html index 9268fcfd1..bed186dd2 100644 --- a/docs/api/jumpscale/data/bcdb/models/db_model.html +++ b/docs/api/jumpscale/data/bcdb/models/db_model.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.db_model API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.db_model

-Source code + +Expand source code +
from .base import ModelBase
 
 class DBModel(ModelBase):
@@ -47,9 +51,11 @@ 

Classes

(bcdb)
-
+
-Source code + +Expand source code +
class DBModel(ModelBase):
     _schema = """
     @url = db
@@ -102,9 +108,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/emplyee_model.html b/docs/api/jumpscale/data/bcdb/models/emplyee_model.html index 4d8d739fa..9c2fc5fef 100644 --- a/docs/api/jumpscale/data/bcdb/models/emplyee_model.html +++ b/docs/api/jumpscale/data/bcdb/models/emplyee_model.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.emplyee_model API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.emplyee_model
-Source code + +Expand source code +
from .base import ModelBase
 
 class EmployeeModel(ModelBase):
@@ -48,9 +52,11 @@ 

Classes

(bcdb)
-
+
-Source code + +Expand source code +
class EmployeeModel(ModelBase):
     _schema = """
     @url = employee
@@ -104,9 +110,7 @@ 

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/index.html b/docs/api/jumpscale/data/bcdb/models/index.html index 8f680dca4..0d4f460b7 100644 --- a/docs/api/jumpscale/data/bcdb/models/index.html +++ b/docs/api/jumpscale/data/bcdb/models/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models

-Source code + +Expand source code +
from .model_model import ModelBase
 import os
 import importlib
@@ -44,35 +48,35 @@ 

Sub-modules

jumpscale.data.bcdb.models.base
-
+
jumpscale.data.bcdb.models.db_model
-
+
jumpscale.data.bcdb.models.emplyee_model
-
+
jumpscale.data.bcdb.models.model_model
-
+
jumpscale.data.bcdb.models.post_model
-
+
jumpscale.data.bcdb.models.proj_model
-
+
jumpscale.data.bcdb.models.test_model
-
+
jumpscale.data.bcdb.models.user_model
-
+
@@ -85,9 +89,11 @@

Functions

def add_model(file_name)
-
+
-Source code + +Expand source code +
def add_model(file_name):
     m = importlib.import_module("." + file_name[:-3], "jumpscale.data.bcdb.models")
     for attr in dir(m):
@@ -133,9 +139,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/model_model.html b/docs/api/jumpscale/data/bcdb/models/model_model.html index d3ee67839..32ee6b4b0 100644 --- a/docs/api/jumpscale/data/bcdb/models/model_model.html +++ b/docs/api/jumpscale/data/bcdb/models/model_model.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.model_model API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.model_model

-Source code + +Expand source code +
from jumpscale.loader import j
 
 from .base import ModelBase, JSObjBase
@@ -50,9 +54,11 @@ 

Classes

(bcdb)
-
+
-Source code + +Expand source code +
class ModelModel(ModelBase):
     _schema = """
     @url = model
@@ -105,9 +111,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/post_model.html b/docs/api/jumpscale/data/bcdb/models/post_model.html index 48eda0d2d..06bc8d79f 100644 --- a/docs/api/jumpscale/data/bcdb/models/post_model.html +++ b/docs/api/jumpscale/data/bcdb/models/post_model.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.post_model API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.post_model

-Source code + +Expand source code +
from .base import ModelBase
 
 class QuoteModel(ModelBase):
@@ -47,9 +51,11 @@ 

Classes

(bcdb)
-
+
-Source code + +Expand source code +
class QuoteModel(ModelBase):
     _schema = """
     @url = quote
@@ -102,9 +108,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/proj_model.html b/docs/api/jumpscale/data/bcdb/models/proj_model.html index e97ba4d99..1bbc85440 100644 --- a/docs/api/jumpscale/data/bcdb/models/proj_model.html +++ b/docs/api/jumpscale/data/bcdb/models/proj_model.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.proj_model API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.proj_model

-Source code + +Expand source code +
from .base import ModelBase
 
 class ProjModel(ModelBase):
@@ -48,9 +52,11 @@ 

Classes

(bcdb)
-
+
-Source code + +Expand source code +
class ProjModel(ModelBase):
     _schema = """
     @url = proj
@@ -104,9 +110,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/test_model.html b/docs/api/jumpscale/data/bcdb/models/test_model.html index 641400483..c72769c64 100644 --- a/docs/api/jumpscale/data/bcdb/models/test_model.html +++ b/docs/api/jumpscale/data/bcdb/models/test_model.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.test_model API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.test_model

-Source code + +Expand source code +
from .base import ModelBase
 
 class TestModel(ModelBase):
@@ -46,9 +50,11 @@ 

Classes

(bcdb)
-
+
-Source code + +Expand source code +
class TestModel(ModelBase):
     _schema = """
     @url = test
@@ -100,9 +106,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/bcdb/models/user_model.html b/docs/api/jumpscale/data/bcdb/models/user_model.html index 2031902b8..4e47391c0 100644 --- a/docs/api/jumpscale/data/bcdb/models/user_model.html +++ b/docs/api/jumpscale/data/bcdb/models/user_model.html @@ -3,15 +3,17 @@ - + jumpscale.data.bcdb.models.user_model API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.bcdb.models.user_model

-Source code + +Expand source code +
from .base import ModelBase
 
 class UserModel(ModelBase):
@@ -47,9 +51,11 @@ 

Classes

(bcdb)
-
+
-Source code + +Expand source code +
class UserModel(ModelBase):
     _schema = """
     @url = user
@@ -102,9 +108,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/cache/index.html b/docs/api/jumpscale/data/cache/index.html index b0f10d0ec..d404e754e 100644 --- a/docs/api/jumpscale/data/cache/index.html +++ b/docs/api/jumpscale/data/cache/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.cache API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.cache

-Source code + +Expand source code +
from functools import lru_cache
@@ -49,9 +53,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/encryption/exceptions.html b/docs/api/jumpscale/data/encryption/exceptions.html index 45cda2a58..b6623ad09 100644 --- a/docs/api/jumpscale/data/encryption/exceptions.html +++ b/docs/api/jumpscale/data/encryption/exceptions.html @@ -3,15 +3,17 @@ - + jumpscale.data.encryption.exceptions API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.encryption.exceptions

-Source code + +Expand source code +
from jumpscale.core.exceptions import JSException
 
 
@@ -43,9 +47,11 @@ 

Classes

(message, category=None, level=None, context=None)
-

Common base class for all non-exit exceptions.

+

Common base class for all non-exit exceptions.

-Source code + +Expand source code +
class FailedChecksumError(JSException):
     pass
@@ -81,9 +87,7 @@

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/encryption/index.html b/docs/api/jumpscale/data/encryption/index.html index d4fb43c17..6843c281d 100644 --- a/docs/api/jumpscale/data/encryption/index.html +++ b/docs/api/jumpscale/data/encryption/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.encryption API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.encryption

-Source code + +Expand source code +
from .mnemonic import key_to_mnemonic, mnemonic_to_key, generate_mnemonic
@@ -30,15 +34,15 @@

Sub-modules

jumpscale.data.encryption.exceptions
-
+
jumpscale.data.encryption.mnemonic
-
+
jumpscale.data.encryption.wordlist
-
+

@@ -71,9 +75,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/encryption/mnemonic.html b/docs/api/jumpscale/data/encryption/mnemonic.html index 711d53e88..4df6dbfe8 100644 --- a/docs/api/jumpscale/data/encryption/mnemonic.html +++ b/docs/api/jumpscale/data/encryption/mnemonic.html @@ -3,15 +3,17 @@ - + jumpscale.data.encryption.mnemonic API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.encryption.mnemonic

-Source code + +Expand source code +
import os
 import hashlib
 import binascii
@@ -160,9 +164,11 @@ 

Functions

def binary_search(a, x, lo=0, hi=None)
-
+
-Source code + +Expand source code +
def binary_search(a, x, lo=0, hi=None):  # can't use a to specify default for hi
     hi = hi if hi is not None else len(a)  # hi defaults to len(a)
     pos = bisect.bisect_left(a, x, lo, hi)  # find insertion position
@@ -173,7 +179,7 @@ 

Functions

def entropy(strength=256)
-

Returns random bytes of length strengh/8.

+

Returns random bytes of length strengh/8.

Args

strength : int, optional
@@ -181,11 +187,13 @@

Args

Returns

-
bytes
+
bytes
The generated bytes.
-
+
-Source code + +Expand source code +
def entropy(strength=256):
     """Returns random bytes of length strengh/8.
 
@@ -199,24 +207,26 @@ 

Returns

-def generate_mnemonic(strength=256, wordlist=['abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acoustic', 'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt', 'add', 'addict', 'address', 'adjust', 'admit', 'adult', 'advance', 'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent', 'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album', 'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone', 'alpha', 'already', 'also', 'alter', 'always', 'amateur', 'amazing', 'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle', 'angry', 'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve', 'april', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm', 'armed', 'armor', 'army', 'around', 'arrange', 'arrest', 'arrive', 'arrow', 'art', 'artefact', 'artist', 'artwork', 'ask', 'aspect', 'assault', 'asset', 'assist', 'assume', 'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction', 'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado', 'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis', 'baby', 'bachelor', 'bacon', 'badge', 'bag', 'balance', 'balcony', 'ball', 'bamboo', 'banana', 'banner', 'bar', 'barely', 'bargain', 'barrel', 'base', 'basic', 'basket', 'battle', 'beach', 'bean', 'beauty', 'because', 'become', 'beef', 'before', 'begin', 'behave', 'behind', 'believe', 'below', 'belt', 'bench', 'benefit', 'best', 'betray', 'better', 'between', 'beyond', 'bicycle', 'bid', 'bike', 'bind', 'biology', 'bird', 'birth', 'bitter', 'black', 'blade', 'blame', 'blanket', 'blast', 'bleak', 'bless', 'blind', 'blood', 'blossom', 'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'body', 'boil', 'bomb', 'bone', 'bonus', 'book', 'boost', 'border', 'boring', 'borrow', 'boss', 'bottom', 'bounce', 'box', 'boy', 'bracket', 'brain', 'brand', 'brass', 'brave', 'bread', 'breeze', 'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'broken', 'bronze', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buddy', 'budget', 'buffalo', 'build', 'bulb', 'bulk', 'bullet', 'bundle', 'bunker', 'burden', 'burger', 'burst', 'bus', 'business', 'busy', 'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage', 'cake', 'call', 'calm', 'camera', 'camp', 'can', 'canal', 'cancel', 'candy', 'cannon', 'canoe', 'canvas', 'canyon', 'capable', 'capital', 'captain', 'car', 'carbon', 'card', 'cargo', 'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual', 'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution', 'cave', 'ceiling', 'celery', 'cement', 'census', 'century', 'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chaos', 'chapter', 'charge', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry', 'chest', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose', 'chronic', 'chuckle', 'chunk', 'churn', 'cigar', 'cinnamon', 'circle', 'citizen', 'city', 'civil', 'claim', 'clap', 'clarify', 'claw', 'clay', 'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic', 'clip', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown', 'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'coconut', 'code', 'coffee', 'coil', 'coin', 'collect', 'color', 'column', 'combine', 'come', 'comfort', 'comic', 'common', 'company', 'concert', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core', 'corn', 'correct', 'cost', 'cotton', 'couch', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack', 'cradle', 'craft', 'cram', 'crane', 'crash', 'crater', 'crawl', 'crazy', 'cream', 'credit', 'creek', 'crew', 'cricket', 'crime', 'crisp', 'critic', 'crop', 'cross', 'crouch', 'crowd', 'crucial', 'cruel', 'cruise', 'crumble', 'crunch', 'crush', 'cry', 'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain', 'curve', 'cushion', 'custom', 'cute', 'cycle', 'dad', 'damage', 'damp', 'dance', 'danger', 'daring', 'dash', 'daughter', 'dawn', 'day', 'deal', 'debate', 'debris', 'decade', 'december', 'decide', 'decline', 'decorate', 'decrease', 'deer', 'defense', 'define', 'defy', 'degree', 'delay', 'deliver', 'demand', 'demise', 'denial', 'dentist', 'deny', 'depart', 'depend', 'deposit', 'depth', 'deputy', 'derive', 'describe', 'desert', 'design', 'desk', 'despair', 'destroy', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram', 'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital', 'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover', 'disease', 'dish', 'dismiss', 'disorder', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor', 'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor', 'door', 'dose', 'double', 'dove', 'draft', 'dragon', 'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drill', 'drink', 'drip', 'drive', 'drop', 'drum', 'dry', 'duck', 'dumb', 'dune', 'during', 'dust', 'dutch', 'duty', 'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily', 'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edit', 'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric', 'elegant', 'element', 'elephant', 'elevator', 'elite', 'else', 'embark', 'embody', 'embrace', 'emerge', 'emotion', 'employ', 'empower', 'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy', 'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich', 'enroll', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error', 'erupt', 'escape', 'essay', 'essence', 'estate', 'eternal', 'ethics', 'evidence', 'evil', 'evoke', 'evolve', 'exact', 'example', 'excess', 'exchange', 'excite', 'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exile', 'exist', 'exit', 'exotic', 'expand', 'expect', 'expire', 'explain', 'expose', 'express', 'extend', 'extra', 'eye', 'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'fall', 'false', 'fame', 'family', 'famous', 'fan', 'fancy', 'fantasy', 'farm', 'fashion', 'fat', 'fatal', 'father', 'fatigue', 'fault', 'favorite', 'feature', 'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'festival', 'fetch', 'fever', 'few', 'fiber', 'fiction', 'field', 'figure', 'file', 'film', 'filter', 'final', 'find', 'fine', 'finger', 'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness', 'fix', 'flag', 'flame', 'flash', 'flat', 'flavor', 'flee', 'flight', 'flip', 'float', 'flock', 'floor', 'flower', 'fluid', 'flush', 'fly', 'foam', 'focus', 'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster', 'found', 'fox', 'fragile', 'frame', 'frequent', 'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen', 'fruit', 'fuel', 'fun', 'funny', 'furnace', 'fury', 'future', 'gadget', 'gain', 'galaxy', 'gallery', 'game', 'gap', 'garage', 'garbage', 'garden', 'garlic', 'garment', 'gas', 'gasp', 'gate', 'gather', 'gauge', 'gaze', 'general', 'genius', 'genre', 'gentle', 'genuine', 'gesture', 'ghost', 'giant', 'gift', 'giggle', 'ginger', 'giraffe', 'girl', 'give', 'glad', 'glance', 'glare', 'glass', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow', 'glue', 'goat', 'goddess', 'gold', 'good', 'goose', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab', 'grace', 'grain', 'grant', 'grape', 'grass', 'gravity', 'great', 'green', 'grid', 'grief', 'grit', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess', 'guide', 'guilt', 'guitar', 'gun', 'gym', 'habit', 'hair', 'half', 'hammer', 'hamster', 'hand', 'happy', 'harbor', 'hard', 'harsh', 'harvest', 'hat', 'have', 'hawk', 'hazard', 'head', 'health', 'heart', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help', 'hen', 'hero', 'hidden', 'high', 'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold', 'hole', 'holiday', 'hollow', 'home', 'honey', 'hood', 'hope', 'horn', 'horror', 'horse', 'hospital', 'host', 'hotel', 'hour', 'hover', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred', 'hungry', 'hunt', 'hurdle', 'hurry', 'hurt', 'husband', 'hybrid', 'ice', 'icon', 'idea', 'identify', 'idle', 'ignore', 'ill', 'illegal', 'illness', 'image', 'imitate', 'immense', 'immune', 'impact', 'impose', 'improve', 'impulse', 'inch', 'include', 'income', 'increase', 'index', 'indicate', 'indoor', 'industry', 'infant', 'inflict', 'inform', 'inhale', 'inherit', 'initial', 'inject', 'injury', 'inmate', 'inner', 'innocent', 'input', 'inquiry', 'insane', 'insect', 'inside', 'inspire', 'install', 'intact', 'interest', 'into', 'invest', 'invite', 'involve', 'iron', 'island', 'isolate', 'issue', 'item', 'ivory', 'jacket', 'jaguar', 'jar', 'jazz', 'jealous', 'jeans', 'jelly', 'jewel', 'job', 'join', 'joke', 'journey', 'joy', 'judge', 'juice', 'jump', 'jungle', 'junior', 'junk', 'just', 'kangaroo', 'keen', 'keep', 'ketchup', 'key', 'kick', 'kid', 'kidney', 'kind', 'kingdom', 'kiss', 'kit', 'kitchen', 'kite', 'kitten', 'kiwi', 'knee', 'knife', 'knock', 'know', 'lab', 'label', 'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'laptop', 'large', 'later', 'latin', 'laugh', 'laundry', 'lava', 'law', 'lawn', 'lawsuit', 'layer', 'lazy', 'leader', 'leaf', 'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure', 'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level', 'liar', 'liberty', 'library', 'license', 'life', 'lift', 'light', 'like', 'limb', 'limit', 'link', 'lion', 'liquid', 'list', 'little', 'live', 'lizard', 'load', 'loan', 'lobster', 'local', 'lock', 'logic', 'lonely', 'long', 'loop', 'lottery', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber', 'lunar', 'lunch', 'luxury', 'lyrics', 'machine', 'mad', 'magic', 'magnet', 'maid', 'mail', 'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango', 'mansion', 'manual', 'maple', 'marble', 'march', 'margin', 'marine', 'market', 'marriage', 'mask', 'mass', 'master', 'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow', 'mean', 'measure', 'meat', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member', 'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merry', 'mesh', 'message', 'metal', 'method', 'middle', 'midnight', 'milk', 'million', 'mimic', 'mind', 'minimum', 'minor', 'minute', 'miracle', 'mirror', 'misery', 'miss', 'mistake', 'mix', 'mixed', 'mixture', 'mobile', 'model', 'modify', 'mom', 'moment', 'monitor', 'monkey', 'monster', 'month', 'moon', 'moral', 'more', 'morning', 'mosquito', 'mother', 'motion', 'motor', 'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mule', 'multiply', 'muscle', 'museum', 'mushroom', 'music', 'must', 'mutual', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin', 'narrow', 'nasty', 'nation', 'nature', 'near', 'neck', 'need', 'negative', 'neglect', 'neither', 'nephew', 'nerve', 'nest', 'net', 'network', 'neutral', 'never', 'news', 'next', 'nice', 'night', 'noble', 'noise', 'nominee', 'noodle', 'normal', 'north', 'nose', 'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number', 'nurse', 'nut', 'oak', 'obey', 'object', 'oblige', 'obscure', 'observe', 'obtain', 'obvious', 'occur', 'ocean', 'october', 'odor', 'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive', 'olympic', 'omit', 'once', 'one', 'onion', 'online', 'only', 'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard', 'order', 'ordinary', 'organ', 'orient', 'original', 'orphan', 'ostrich', 'other', 'outdoor', 'outer', 'output', 'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster', 'ozone', 'pact', 'paddle', 'page', 'pair', 'palace', 'palm', 'panda', 'panel', 'panic', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party', 'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave', 'payment', 'peace', 'peanut', 'pear', 'peasant', 'pelican', 'pen', 'penalty', 'pencil', 'people', 'pepper', 'perfect', 'permit', 'person', 'pet', 'phone', 'photo', 'phrase', 'physical', 'piano', 'picnic', 'picture', 'piece', 'pig', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe', 'pistol', 'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please', 'pledge', 'pluck', 'plug', 'plunge', 'poem', 'poet', 'point', 'polar', 'pole', 'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible', 'post', 'potato', 'pottery', 'poverty', 'powder', 'power', 'practice', 'praise', 'predict', 'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary', 'print', 'priority', 'prison', 'private', 'prize', 'problem', 'process', 'produce', 'profit', 'program', 'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide', 'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'punch', 'pupil', 'puppy', 'purchase', 'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality', 'quantum', 'quarter', 'question', 'quick', 'quit', 'quiz', 'quote', 'rabbit', 'raccoon', 'race', 'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp', 'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven', 'raw', 'razor', 'ready', 'real', 'reason', 'rebel', 'rebuild', 'recall', 'receive', 'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region', 'regret', 'regular', 'reject', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remind', 'remove', 'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report', 'require', 'rescue', 'resemble', 'resist', 'resource', 'response', 'result', 'retire', 'retreat', 'return', 'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice', 'rich', 'ride', 'ridge', 'rifle', 'right', 'rigid', 'ring', 'riot', 'ripple', 'risk', 'ritual', 'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance', 'roof', 'rookie', 'room', 'rose', 'rotate', 'rough', 'round', 'route', 'royal', 'rubber', 'rude', 'rug', 'rule', 'run', 'runway', 'rural', 'sad', 'saddle', 'sadness', 'safe', 'sail', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample', 'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale', 'scan', 'scare', 'scatter', 'scene', 'scheme', 'school', 'science', 'scissors', 'scorpion', 'scout', 'scrap', 'screen', 'script', 'scrub', 'sea', 'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed', 'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence', 'series', 'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shaft', 'shallow', 'share', 'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'ship', 'shiver', 'shock', 'shoe', 'shoot', 'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shrug', 'shuffle', 'shy', 'sibling', 'sick', 'side', 'siege', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver', 'similar', 'simple', 'since', 'sing', 'siren', 'sister', 'situate', 'six', 'size', 'skate', 'sketch', 'ski', 'skill', 'skin', 'skirt', 'skull', 'slab', 'slam', 'sleep', 'slender', 'slice', 'slide', 'slight', 'slim', 'slogan', 'slot', 'slow', 'slush', 'small', 'smart', 'smile', 'smoke', 'smooth', 'snack', 'snake', 'snap', 'sniff', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda', 'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song', 'soon', 'sorry', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space', 'spare', 'spatial', 'spawn', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere', 'spice', 'spider', 'spike', 'spin', 'spirit', 'split', 'spoil', 'sponsor', 'spoon', 'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squeeze', 'squirrel', 'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start', 'state', 'stay', 'steak', 'steel', 'stem', 'step', 'stereo', 'stick', 'still', 'sting', 'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street', 'strike', 'strong', 'struggle', 'student', 'stuff', 'stumble', 'style', 'subject', 'submit', 'subway', 'success', 'such', 'sudden', 'suffer', 'sugar', 'suggest', 'suit', 'summer', 'sun', 'sunny', 'sunset', 'super', 'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey', 'suspect', 'sustain', 'swallow', 'swamp', 'swap', 'swarm', 'swear', 'sweet', 'swift', 'swim', 'swing', 'switch', 'sword', 'symbol', 'symptom', 'syrup', 'system', 'table', 'tackle', 'tag', 'tail', 'talent', 'talk', 'tank', 'tape', 'target', 'task', 'taste', 'tattoo', 'taxi', 'teach', 'team', 'tell', 'ten', 'tenant', 'tennis', 'tent', 'term', 'test', 'text', 'thank', 'that', 'theme', 'then', 'theory', 'there', 'they', 'thing', 'this', 'thought', 'three', 'thrive', 'throw', 'thumb', 'thunder', 'ticket', 'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired', 'tissue', 'title', 'toast', 'tobacco', 'today', 'toddler', 'toe', 'together', 'toilet', 'token', 'tomato', 'tomorrow', 'tone', 'tongue', 'tonight', 'tool', 'tooth', 'top', 'topic', 'topple', 'torch', 'tornado', 'tortoise', 'toss', 'total', 'tourist', 'toward', 'tower', 'town', 'toy', 'track', 'trade', 'traffic', 'tragic', 'train', 'transfer', 'trap', 'trash', 'travel', 'tray', 'treat', 'tree', 'trend', 'trial', 'tribe', 'trick', 'trigger', 'trim', 'trip', 'trophy', 'trouble', 'truck', 'true', 'truly', 'trumpet', 'trust', 'truth', 'try', 'tube', 'tuition', 'tumble', 'tuna', 'tunnel', 'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist', 'two', 'type', 'typical', 'ugly', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover', 'under', 'undo', 'unfair', 'unfold', 'unhappy', 'uniform', 'unique', 'unit', 'universe', 'unknown', 'unlock', 'until', 'unusual', 'unveil', 'update', 'upgrade', 'uphold', 'upon', 'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful', 'useless', 'usual', 'utility', 'vacant', 'vacuum', 'vague', 'valid', 'valley', 'valve', 'van', 'vanish', 'vapor', 'various', 'vast', 'vault', 'vehicle', 'velvet', 'vendor', 'venture', 'venue', 'verb', 'verify', 'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory', 'video', 'view', 'village', 'vintage', 'violin', 'virtual', 'virus', 'visa', 'visit', 'visual', 'vital', 'vivid', 'vocal', 'voice', 'void', 'volcano', 'volume', 'vote', 'voyage', 'wage', 'wagon', 'wait', 'walk', 'wall', 'walnut', 'want', 'warfare', 'warm', 'warrior', 'wash', 'wasp', 'waste', 'water', 'wave', 'way', 'wealth', 'weapon', 'wear', 'weasel', 'weather', 'web', 'wedding', 'weekend', 'weird', 'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when', 'where', 'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win', 'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom', 'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wood', 'wool', 'word', 'work', 'world', 'worry', 'worth', 'wrap', 'wreck', 'wrestle', 'wrist', 'write', 'wrong', 'yard', 'year', 'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo']) +def generate_mnemonic(strength=256, wordlist=['abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acoustic', 'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt', 'add', 'addict', 'address', 'adjust', 'admit', 'adult', 'advance', 'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent', 'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album', 'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone', 'alpha', 'already', 'also', 'alter', 'always', 'amateur', 'amazing', 'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle', 'angry', 'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve', 'april', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm', 'armed', 'armor', 'army', 'around', 'arrange', 'arrest', 'arrive', 'arrow', 'art', 'artefact', 'artist', 'artwork', 'ask', 'aspect', 'assault', 'asset', 'assist', 'assume', 'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction', 'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado', 'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis', 'baby', 'bachelor', 'bacon', 'badge', 'bag', 'balance', 'balcony', 'ball', 'bamboo', 'banana', 'banner', 'bar', 'barely', 'bargain', 'barrel', 'base', 'basic', 'basket', 'battle', 'beach', 'bean', 'beauty', 'because', 'become', 'beef', 'before', 'begin', 'behave', 'behind', 'believe', 'below', 'belt', 'bench', 'benefit', 'best', 'betray', 'better', 'between', 'beyond', 'bicycle', 'bid', 'bike', 'bind', 'biology', 'bird', 'birth', 'bitter', 'black', 'blade', 'blame', 'blanket', 'blast', 'bleak', 'bless', 'blind', 'blood', 'blossom', 'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'body', 'boil', 'bomb', 'bone', 'bonus', 'book', 'boost', 'border', 'boring', 'borrow', 'boss', 'bottom', 'bounce', 'box', 'boy', 'bracket', 'brain', 'brand', 'brass', 'brave', 'bread', 'breeze', 'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'broken', 'bronze', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buddy', 'budget', 'buffalo', 'build', 'bulb', 'bulk', 'bullet', 'bundle', 'bunker', 'burden', 'burger', 'burst', 'bus', 'business', 'busy', 'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage', 'cake', 'call', 'calm', 'camera', 'camp', 'can', 'canal', 'cancel', 'candy', 'cannon', 'canoe', 'canvas', 'canyon', 'capable', 'capital', 'captain', 'car', 'carbon', 'card', 'cargo', 'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual', 'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution', 'cave', 'ceiling', 'celery', 'cement', 'census', 'century', 'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chaos', 'chapter', 'charge', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry', 'chest', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose', 'chronic', 'chuckle', 'chunk', 'churn', 'cigar', 'cinnamon', 'circle', 'citizen', 'city', 'civil', 'claim', 'clap', 'clarify', 'claw', 'clay', 'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic', 'clip', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown', 'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'coconut', 'code', 'coffee', 'coil', 'coin', 'collect', 'color', 'column', 'combine', 'come', 'comfort', 'comic', 'common', 'company', 'concert', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core', 'corn', 'correct', 'cost', 'cotton', 'couch', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack', 'cradle', 'craft', 'cram', 'crane', 'crash', 'crater', 'crawl', 'crazy', 'cream', 'credit', 'creek', 'crew', 'cricket', 'crime', 'crisp', 'critic', 'crop', 'cross', 'crouch', 'crowd', 'crucial', 'cruel', 'cruise', 'crumble', 'crunch', 'crush', 'cry', 'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain', 'curve', 'cushion', 'custom', 'cute', 'cycle', 'dad', 'damage', 'damp', 'dance', 'danger', 'daring', 'dash', 'daughter', 'dawn', 'day', 'deal', 'debate', 'debris', 'decade', 'december', 'decide', 'decline', 'decorate', 'decrease', 'deer', 'defense', 'define', 'defy', 'degree', 'delay', 'deliver', 'demand', 'demise', 'denial', 'dentist', 'deny', 'depart', 'depend', 'deposit', 'depth', 'deputy', 'derive', 'describe', 'desert', 'design', 'desk', 'despair', 'destroy', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram', 'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital', 'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover', 'disease', 'dish', 'dismiss', 'disorder', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor', 'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor', 'door', 'dose', 'double', 'dove', 'draft', 'dragon', 'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drill', 'drink', 'drip', 'drive', 'drop', 'drum', 'dry', 'duck', 'dumb', 'dune', 'during', 'dust', 'dutch', 'duty', 'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily', 'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edit', 'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric', 'elegant', 'element', 'elephant', 'elevator', 'elite', 'else', 'embark', 'embody', 'embrace', 'emerge', 'emotion', 'employ', 'empower', 'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy', 'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich', 'enroll', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error', 'erupt', 'escape', 'essay', 'essence', 'estate', 'eternal', 'ethics', 'evidence', 'evil', 'evoke', 'evolve', 'exact', 'example', 'excess', 'exchange', 'excite', 'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exile', 'exist', 'exit', 'exotic', 'expand', 'expect', 'expire', 'explain', 'expose', 'express', 'extend', 'extra', 'eye', 'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'fall', 'false', 'fame', 'family', 'famous', 'fan', 'fancy', 'fantasy', 'farm', 'fashion', 'fat', 'fatal', 'father', 'fatigue', 'fault', 'favorite', 'feature', 'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'festival', 'fetch', 'fever', 'few', 'fiber', 'fiction', 'field', 'figure', 'file', 'film', 'filter', 'final', 'find', 'fine', 'finger', 'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness', 'fix', 'flag', 'flame', 'flash', 'flat', 'flavor', 'flee', 'flight', 'flip', 'float', 'flock', 'floor', 'flower', 'fluid', 'flush', 'fly', 'foam', 'focus', 'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster', 'found', 'fox', 'fragile', 'frame', 'frequent', 'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen', 'fruit', 'fuel', 'fun', 'funny', 'furnace', 'fury', 'future', 'gadget', 'gain', 'galaxy', 'gallery', 'game', 'gap', 'garage', 'garbage', 'garden', 'garlic', 'garment', 'gas', 'gasp', 'gate', 'gather', 'gauge', 'gaze', 'general', 'genius', 'genre', 'gentle', 'genuine', 'gesture', 'ghost', 'giant', 'gift', 'giggle', 'ginger', 'giraffe', 'girl', 'give', 'glad', 'glance', 'glare', 'glass', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow', 'glue', 'goat', 'goddess', 'gold', 'good', 'goose', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab', 'grace', 'grain', 'grant', 'grape', 'grass', 'gravity', 'great', 'green', 'grid', 'grief', 'grit', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess', 'guide', 'guilt', 'guitar', 'gun', 'gym', 'habit', 'hair', 'half', 'hammer', 'hamster', 'hand', 'happy', 'harbor', 'hard', 'harsh', 'harvest', 'hat', 'have', 'hawk', 'hazard', 'head', 'health', 'heart', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help', 'hen', 'hero', 'hidden', 'high', 'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold', 'hole', 'holiday', 'hollow', 'home', 'honey', 'hood', 'hope', 'horn', 'horror', 'horse', 'hospital', 'host', 'hotel', 'hour', 'hover', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred', 'hungry', 'hunt', 'hurdle', 'hurry', 'hurt', 'husband', 'hybrid', 'ice', 'icon', 'idea', 'identify', 'idle', 'ignore', 'ill', 'illegal', 'illness', 'image', 'imitate', 'immense', 'immune', 'impact', 'impose', 'improve', 'impulse', 'inch', 'include', 'income', 'increase', 'index', 'indicate', 'indoor', 'industry', 'infant', 'inflict', 'inform', 'inhale', 'inherit', 'initial', 'inject', 'injury', 'inmate', 'inner', 'innocent', 'input', 'inquiry', 'insane', 'insect', 'inside', 'inspire', 'install', 'intact', 'interest', 'into', 'invest', 'invite', 'involve', 'iron', 'island', 'isolate', 'issue', 'item', 'ivory', 'jacket', 'jaguar', 'jar', 'jazz', 'jealous', 'jeans', 'jelly', 'jewel', 'job', 'join', 'joke', 'journey', 'joy', 'judge', 'juice', 'jump', 'jungle', 'junior', 'junk', 'just', 'kangaroo', 'keen', 'keep', 'ketchup', 'key', 'kick', 'kid', 'kidney', 'kind', 'kingdom', 'kiss', 'kit', 'kitchen', 'kite', 'kitten', 'kiwi', 'knee', 'knife', 'knock', 'know', 'lab', 'label', 'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'laptop', 'large', 'later', 'latin', 'laugh', 'laundry', 'lava', 'law', 'lawn', 'lawsuit', 'layer', 'lazy', 'leader', 'leaf', 'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure', 'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level', 'liar', 'liberty', 'library', 'license', 'life', 'lift', 'light', 'like', 'limb', 'limit', 'link', 'lion', 'liquid', 'list', 'little', 'live', 'lizard', 'load', 'loan', 'lobster', 'local', 'lock', 'logic', 'lonely', 'long', 'loop', 'lottery', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber', 'lunar', 'lunch', 'luxury', 'lyrics', 'machine', 'mad', 'magic', 'magnet', 'maid', 'mail', 'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango', 'mansion', 'manual', 'maple', 'marble', 'march', 'margin', 'marine', 'market', 'marriage', 'mask', 'mass', 'master', 'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow', 'mean', 'measure', 'meat', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member', 'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merry', 'mesh', 'message', 'metal', 'method', 'middle', 'midnight', 'milk', 'million', 'mimic', 'mind', 'minimum', 'minor', 'minute', 'miracle', 'mirror', 'misery', 'miss', 'mistake', 'mix', 'mixed', 'mixture', 'mobile', 'model', 'modify', 'mom', 'moment', 'monitor', 'monkey', 'monster', 'month', 'moon', 'moral', 'more', 'morning', 'mosquito', 'mother', 'motion', 'motor', 'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mule', 'multiply', 'muscle', 'museum', 'mushroom', 'music', 'must', 'mutual', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin', 'narrow', 'nasty', 'nation', 'nature', 'near', 'neck', 'need', 'negative', 'neglect', 'neither', 'nephew', 'nerve', 'nest', 'net', 'network', 'neutral', 'never', 'news', 'next', 'nice', 'night', 'noble', 'noise', 'nominee', 'noodle', 'normal', 'north', 'nose', 'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number', 'nurse', 'nut', 'oak', 'obey', 'object', 'oblige', 'obscure', 'observe', 'obtain', 'obvious', 'occur', 'ocean', 'october', 'odor', 'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive', 'olympic', 'omit', 'once', 'one', 'onion', 'online', 'only', 'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard', 'order', 'ordinary', 'organ', 'orient', 'original', 'orphan', 'ostrich', 'other', 'outdoor', 'outer', 'output', 'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster', 'ozone', 'pact', 'paddle', 'page', 'pair', 'palace', 'palm', 'panda', 'panel', 'panic', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party', 'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave', 'payment', 'peace', 'peanut', 'pear', 'peasant', 'pelican', 'pen', 'penalty', 'pencil', 'people', 'pepper', 'perfect', 'permit', 'person', 'pet', 'phone', 'photo', 'phrase', 'physical', 'piano', 'picnic', 'picture', 'piece', 'pig', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe', 'pistol', 'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please', 'pledge', 'pluck', 'plug', 'plunge', 'poem', 'poet', 'point', 'polar', 'pole', 'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible', 'post', 'potato', 'pottery', 'poverty', 'powder', 'power', 'practice', 'praise', 'predict', 'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary', 'print', 'priority', 'prison', 'private', 'prize', 'problem', 'process', 'produce', 'profit', 'program', 'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide', 'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'punch', 'pupil', 'puppy', 'purchase', 'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality', 'quantum', 'quarter', 'question', 'quick', 'quit', 'quiz', 'quote', 'rabbit', 'raccoon', 'race', 'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp', 'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven', 'raw', 'razor', 'ready', 'real', 'reason', 'rebel', 'rebuild', 'recall', 'receive', 'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region', 'regret', 'regular', 'reject', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remind', 'remove', 'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report', 'require', 'rescue', 'resemble', 'resist', 'resource', 'response', 'result', 'retire', 'retreat', 'return', 'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice', 'rich', 'ride', 'ridge', 'rifle', 'right', 'rigid', 'ring', 'riot', 'ripple', 'risk', 'ritual', 'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance', 'roof', 'rookie', 'room', 'rose', 'rotate', 'rough', 'round', 'route', 'royal', 'rubber', 'rude', 'rug', 'rule', 'run', 'runway', 'rural', 'sad', 'saddle', 'sadness', 'safe', 'sail', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample', 'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale', 'scan', 'scare', 'scatter', 'scene', 'scheme', 'school', 'science', 'scissors', 'scorpion', 'scout', 'scrap', 'screen', 'script', 'scrub', 'sea', 'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed', 'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence', 'series', 'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shaft', 'shallow', 'share', 'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'ship', 'shiver', 'shock', 'shoe', 'shoot', 'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shrug', 'shuffle', 'shy', 'sibling', 'sick', 'side', 'siege', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver', 'similar', 'simple', 'since', 'sing', 'siren', 'sister', 'situate', 'six', 'size', 'skate', 'sketch', 'ski', 'skill', 'skin', 'skirt', 'skull', 'slab', 'slam', 'sleep', 'slender', 'slice', 'slide', 'slight', 'slim', 'slogan', 'slot', 'slow', 'slush', 'small', 'smart', 'smile', 'smoke', 'smooth', 'snack', 'snake', 'snap', 'sniff', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda', 'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song', 'soon', 'sorry', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space', 'spare', 'spatial', 'spawn', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere', 'spice', 'spider', 'spike', 'spin', 'spirit', 'split', 'spoil', 'sponsor', 'spoon', 'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squeeze', 'squirrel', 'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start', 'state', 'stay', 'steak', 'steel', 'stem', 'step', 'stereo', 'stick', 'still', 'sting', 'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street', 'strike', 'strong', 'struggle', 'student', 'stuff', 'stumble', 'style', 'subject', 'submit', 'subway', 'success', 'such', 'sudden', 'suffer', 'sugar', 'suggest', 'suit', 'summer', 'sun', 'sunny', 'sunset', 'super', 'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey', 'suspect', 'sustain', 'swallow', 'swamp', 'swap', 'swarm', 'swear', 'sweet', 'swift', 'swim', 'swing', 'switch', 'sword', 'symbol', 'symptom', 'syrup', 'system', 'table', 'tackle', 'tag', 'tail', 'talent', 'talk', 'tank', 'tape', 'target', 'task', 'taste', 'tattoo', 'taxi', 'teach', 'team', 'tell', 'ten', 'tenant', 'tennis', 'tent', 'term', 'test', 'text', 'thank', 'that', 'theme', 'then', 'theory', 'there', 'they', 'thing', 'this', 'thought', 'three', 'thrive', 'throw', 'thumb', 'thunder', 'ticket', 'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired', 'tissue', 'title', 'toast', 'tobacco', 'today', 'toddler', 'toe', 'together', 'toilet', 'token', 'tomato', 'tomorrow', 'tone', 'tongue', 'tonight', 'tool', 'tooth', 'top', 'topic', 'topple', 'torch', 'tornado', 'tortoise', 'toss', 'total', 'tourist', 'toward', 'tower', 'town', 'toy', 'track', 'trade', 'traffic', 'tragic', 'train', 'transfer', 'trap', 'trash', 'travel', 'tray', 'treat', 'tree', 'trend', 'trial', 'tribe', 'trick', 'trigger', 'trim', 'trip', 'trophy', 'trouble', 'truck', 'true', 'truly', 'trumpet', 'trust', 'truth', 'try', 'tube', 'tuition', 'tumble', 'tuna', 'tunnel', 'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist', 'two', 'type', 'typical', 'ugly', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover', 'under', 'undo', 'unfair', 'unfold', 'unhappy', 'uniform', 'unique', 'unit', 'universe', 'unknown', 'unlock', 'until', 'unusual', 'unveil', 'update', 'upgrade', 'uphold', 'upon', 'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful', 'useless', 'usual', 'utility', 'vacant', 'vacuum', 'vague', 'valid', 'valley', 'valve', 'van', 'vanish', 'vapor', 'various', 'vast', 'vault', 'vehicle', 'velvet', 'vendor', 'venture', 'venue', 'verb', 'verify', 'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory', 'video', 'view', 'village', 'vintage', 'violin', 'virtual', 'virus', 'visa', 'visit', 'visual', 'vital', 'vivid', 'vocal', 'voice', 'void', 'volcano', 'volume', 'vote', 'voyage', 'wage', 'wagon', 'wait', 'walk', 'wall', 'walnut', 'want', 'warfare', 'warm', 'warrior', 'wash', 'wasp', 'waste', 'water', 'wave', 'way', 'wealth', 'weapon', 'wear', 'weasel', 'weather', 'web', 'wedding', 'weekend', 'weird', 'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when', 'where', 'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win', 'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom', 'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wood', 'wool', 'word', 'work', 'world', 'worry', 'worth', 'wrap', 'wreck', 'wrestle', 'wrist', 'write', 'wrong', 'yard', 'year', 'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo'])
-

Generate random mnemonic

+

Generate random mnemonic

Args

strength : int, optional
The number of bits of the generated key. Defaults to 256.
-
wordlist : list[str], optional
+
wordlist : list[str], optional
The Word list used to generate the mnemonic. Defaults to wordlist.

Returns

-
str
+
str
A string of space separated words representing the mnemonic.
-
+
-Source code + +Expand source code +
def generate_mnemonic(strength=256, wordlist=wordlist):
     """Generate random mnemonic
 
@@ -232,24 +242,26 @@ 

Returns

-def key_to_mnemonic(key, wordlist=['abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acoustic', 'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt', 'add', 'addict', 'address', 'adjust', 'admit', 'adult', 'advance', 'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent', 'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album', 'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone', 'alpha', 'already', 'also', 'alter', 'always', 'amateur', 'amazing', 'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle', 'angry', 'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve', 'april', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm', 'armed', 'armor', 'army', 'around', 'arrange', 'arrest', 'arrive', 'arrow', 'art', 'artefact', 'artist', 'artwork', 'ask', 'aspect', 'assault', 'asset', 'assist', 'assume', 'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction', 'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado', 'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis', 'baby', 'bachelor', 'bacon', 'badge', 'bag', 'balance', 'balcony', 'ball', 'bamboo', 'banana', 'banner', 'bar', 'barely', 'bargain', 'barrel', 'base', 'basic', 'basket', 'battle', 'beach', 'bean', 'beauty', 'because', 'become', 'beef', 'before', 'begin', 'behave', 'behind', 'believe', 'below', 'belt', 'bench', 'benefit', 'best', 'betray', 'better', 'between', 'beyond', 'bicycle', 'bid', 'bike', 'bind', 'biology', 'bird', 'birth', 'bitter', 'black', 'blade', 'blame', 'blanket', 'blast', 'bleak', 'bless', 'blind', 'blood', 'blossom', 'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'body', 'boil', 'bomb', 'bone', 'bonus', 'book', 'boost', 'border', 'boring', 'borrow', 'boss', 'bottom', 'bounce', 'box', 'boy', 'bracket', 'brain', 'brand', 'brass', 'brave', 'bread', 'breeze', 'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'broken', 'bronze', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buddy', 'budget', 'buffalo', 'build', 'bulb', 'bulk', 'bullet', 'bundle', 'bunker', 'burden', 'burger', 'burst', 'bus', 'business', 'busy', 'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage', 'cake', 'call', 'calm', 'camera', 'camp', 'can', 'canal', 'cancel', 'candy', 'cannon', 'canoe', 'canvas', 'canyon', 'capable', 'capital', 'captain', 'car', 'carbon', 'card', 'cargo', 'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual', 'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution', 'cave', 'ceiling', 'celery', 'cement', 'census', 'century', 'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chaos', 'chapter', 'charge', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry', 'chest', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose', 'chronic', 'chuckle', 'chunk', 'churn', 'cigar', 'cinnamon', 'circle', 'citizen', 'city', 'civil', 'claim', 'clap', 'clarify', 'claw', 'clay', 'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic', 'clip', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown', 'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'coconut', 'code', 'coffee', 'coil', 'coin', 'collect', 'color', 'column', 'combine', 'come', 'comfort', 'comic', 'common', 'company', 'concert', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core', 'corn', 'correct', 'cost', 'cotton', 'couch', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack', 'cradle', 'craft', 'cram', 'crane', 'crash', 'crater', 'crawl', 'crazy', 'cream', 'credit', 'creek', 'crew', 'cricket', 'crime', 'crisp', 'critic', 'crop', 'cross', 'crouch', 'crowd', 'crucial', 'cruel', 'cruise', 'crumble', 'crunch', 'crush', 'cry', 'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain', 'curve', 'cushion', 'custom', 'cute', 'cycle', 'dad', 'damage', 'damp', 'dance', 'danger', 'daring', 'dash', 'daughter', 'dawn', 'day', 'deal', 'debate', 'debris', 'decade', 'december', 'decide', 'decline', 'decorate', 'decrease', 'deer', 'defense', 'define', 'defy', 'degree', 'delay', 'deliver', 'demand', 'demise', 'denial', 'dentist', 'deny', 'depart', 'depend', 'deposit', 'depth', 'deputy', 'derive', 'describe', 'desert', 'design', 'desk', 'despair', 'destroy', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram', 'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital', 'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover', 'disease', 'dish', 'dismiss', 'disorder', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor', 'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor', 'door', 'dose', 'double', 'dove', 'draft', 'dragon', 'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drill', 'drink', 'drip', 'drive', 'drop', 'drum', 'dry', 'duck', 'dumb', 'dune', 'during', 'dust', 'dutch', 'duty', 'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily', 'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edit', 'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric', 'elegant', 'element', 'elephant', 'elevator', 'elite', 'else', 'embark', 'embody', 'embrace', 'emerge', 'emotion', 'employ', 'empower', 'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy', 'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich', 'enroll', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error', 'erupt', 'escape', 'essay', 'essence', 'estate', 'eternal', 'ethics', 'evidence', 'evil', 'evoke', 'evolve', 'exact', 'example', 'excess', 'exchange', 'excite', 'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exile', 'exist', 'exit', 'exotic', 'expand', 'expect', 'expire', 'explain', 'expose', 'express', 'extend', 'extra', 'eye', 'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'fall', 'false', 'fame', 'family', 'famous', 'fan', 'fancy', 'fantasy', 'farm', 'fashion', 'fat', 'fatal', 'father', 'fatigue', 'fault', 'favorite', 'feature', 'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'festival', 'fetch', 'fever', 'few', 'fiber', 'fiction', 'field', 'figure', 'file', 'film', 'filter', 'final', 'find', 'fine', 'finger', 'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness', 'fix', 'flag', 'flame', 'flash', 'flat', 'flavor', 'flee', 'flight', 'flip', 'float', 'flock', 'floor', 'flower', 'fluid', 'flush', 'fly', 'foam', 'focus', 'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster', 'found', 'fox', 'fragile', 'frame', 'frequent', 'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen', 'fruit', 'fuel', 'fun', 'funny', 'furnace', 'fury', 'future', 'gadget', 'gain', 'galaxy', 'gallery', 'game', 'gap', 'garage', 'garbage', 'garden', 'garlic', 'garment', 'gas', 'gasp', 'gate', 'gather', 'gauge', 'gaze', 'general', 'genius', 'genre', 'gentle', 'genuine', 'gesture', 'ghost', 'giant', 'gift', 'giggle', 'ginger', 'giraffe', 'girl', 'give', 'glad', 'glance', 'glare', 'glass', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow', 'glue', 'goat', 'goddess', 'gold', 'good', 'goose', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab', 'grace', 'grain', 'grant', 'grape', 'grass', 'gravity', 'great', 'green', 'grid', 'grief', 'grit', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess', 'guide', 'guilt', 'guitar', 'gun', 'gym', 'habit', 'hair', 'half', 'hammer', 'hamster', 'hand', 'happy', 'harbor', 'hard', 'harsh', 'harvest', 'hat', 'have', 'hawk', 'hazard', 'head', 'health', 'heart', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help', 'hen', 'hero', 'hidden', 'high', 'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold', 'hole', 'holiday', 'hollow', 'home', 'honey', 'hood', 'hope', 'horn', 'horror', 'horse', 'hospital', 'host', 'hotel', 'hour', 'hover', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred', 'hungry', 'hunt', 'hurdle', 'hurry', 'hurt', 'husband', 'hybrid', 'ice', 'icon', 'idea', 'identify', 'idle', 'ignore', 'ill', 'illegal', 'illness', 'image', 'imitate', 'immense', 'immune', 'impact', 'impose', 'improve', 'impulse', 'inch', 'include', 'income', 'increase', 'index', 'indicate', 'indoor', 'industry', 'infant', 'inflict', 'inform', 'inhale', 'inherit', 'initial', 'inject', 'injury', 'inmate', 'inner', 'innocent', 'input', 'inquiry', 'insane', 'insect', 'inside', 'inspire', 'install', 'intact', 'interest', 'into', 'invest', 'invite', 'involve', 'iron', 'island', 'isolate', 'issue', 'item', 'ivory', 'jacket', 'jaguar', 'jar', 'jazz', 'jealous', 'jeans', 'jelly', 'jewel', 'job', 'join', 'joke', 'journey', 'joy', 'judge', 'juice', 'jump', 'jungle', 'junior', 'junk', 'just', 'kangaroo', 'keen', 'keep', 'ketchup', 'key', 'kick', 'kid', 'kidney', 'kind', 'kingdom', 'kiss', 'kit', 'kitchen', 'kite', 'kitten', 'kiwi', 'knee', 'knife', 'knock', 'know', 'lab', 'label', 'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'laptop', 'large', 'later', 'latin', 'laugh', 'laundry', 'lava', 'law', 'lawn', 'lawsuit', 'layer', 'lazy', 'leader', 'leaf', 'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure', 'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level', 'liar', 'liberty', 'library', 'license', 'life', 'lift', 'light', 'like', 'limb', 'limit', 'link', 'lion', 'liquid', 'list', 'little', 'live', 'lizard', 'load', 'loan', 'lobster', 'local', 'lock', 'logic', 'lonely', 'long', 'loop', 'lottery', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber', 'lunar', 'lunch', 'luxury', 'lyrics', 'machine', 'mad', 'magic', 'magnet', 'maid', 'mail', 'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango', 'mansion', 'manual', 'maple', 'marble', 'march', 'margin', 'marine', 'market', 'marriage', 'mask', 'mass', 'master', 'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow', 'mean', 'measure', 'meat', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member', 'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merry', 'mesh', 'message', 'metal', 'method', 'middle', 'midnight', 'milk', 'million', 'mimic', 'mind', 'minimum', 'minor', 'minute', 'miracle', 'mirror', 'misery', 'miss', 'mistake', 'mix', 'mixed', 'mixture', 'mobile', 'model', 'modify', 'mom', 'moment', 'monitor', 'monkey', 'monster', 'month', 'moon', 'moral', 'more', 'morning', 'mosquito', 'mother', 'motion', 'motor', 'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mule', 'multiply', 'muscle', 'museum', 'mushroom', 'music', 'must', 'mutual', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin', 'narrow', 'nasty', 'nation', 'nature', 'near', 'neck', 'need', 'negative', 'neglect', 'neither', 'nephew', 'nerve', 'nest', 'net', 'network', 'neutral', 'never', 'news', 'next', 'nice', 'night', 'noble', 'noise', 'nominee', 'noodle', 'normal', 'north', 'nose', 'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number', 'nurse', 'nut', 'oak', 'obey', 'object', 'oblige', 'obscure', 'observe', 'obtain', 'obvious', 'occur', 'ocean', 'october', 'odor', 'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive', 'olympic', 'omit', 'once', 'one', 'onion', 'online', 'only', 'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard', 'order', 'ordinary', 'organ', 'orient', 'original', 'orphan', 'ostrich', 'other', 'outdoor', 'outer', 'output', 'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster', 'ozone', 'pact', 'paddle', 'page', 'pair', 'palace', 'palm', 'panda', 'panel', 'panic', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party', 'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave', 'payment', 'peace', 'peanut', 'pear', 'peasant', 'pelican', 'pen', 'penalty', 'pencil', 'people', 'pepper', 'perfect', 'permit', 'person', 'pet', 'phone', 'photo', 'phrase', 'physical', 'piano', 'picnic', 'picture', 'piece', 'pig', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe', 'pistol', 'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please', 'pledge', 'pluck', 'plug', 'plunge', 'poem', 'poet', 'point', 'polar', 'pole', 'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible', 'post', 'potato', 'pottery', 'poverty', 'powder', 'power', 'practice', 'praise', 'predict', 'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary', 'print', 'priority', 'prison', 'private', 'prize', 'problem', 'process', 'produce', 'profit', 'program', 'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide', 'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'punch', 'pupil', 'puppy', 'purchase', 'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality', 'quantum', 'quarter', 'question', 'quick', 'quit', 'quiz', 'quote', 'rabbit', 'raccoon', 'race', 'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp', 'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven', 'raw', 'razor', 'ready', 'real', 'reason', 'rebel', 'rebuild', 'recall', 'receive', 'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region', 'regret', 'regular', 'reject', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remind', 'remove', 'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report', 'require', 'rescue', 'resemble', 'resist', 'resource', 'response', 'result', 'retire', 'retreat', 'return', 'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice', 'rich', 'ride', 'ridge', 'rifle', 'right', 'rigid', 'ring', 'riot', 'ripple', 'risk', 'ritual', 'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance', 'roof', 'rookie', 'room', 'rose', 'rotate', 'rough', 'round', 'route', 'royal', 'rubber', 'rude', 'rug', 'rule', 'run', 'runway', 'rural', 'sad', 'saddle', 'sadness', 'safe', 'sail', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample', 'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale', 'scan', 'scare', 'scatter', 'scene', 'scheme', 'school', 'science', 'scissors', 'scorpion', 'scout', 'scrap', 'screen', 'script', 'scrub', 'sea', 'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed', 'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence', 'series', 'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shaft', 'shallow', 'share', 'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'ship', 'shiver', 'shock', 'shoe', 'shoot', 'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shrug', 'shuffle', 'shy', 'sibling', 'sick', 'side', 'siege', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver', 'similar', 'simple', 'since', 'sing', 'siren', 'sister', 'situate', 'six', 'size', 'skate', 'sketch', 'ski', 'skill', 'skin', 'skirt', 'skull', 'slab', 'slam', 'sleep', 'slender', 'slice', 'slide', 'slight', 'slim', 'slogan', 'slot', 'slow', 'slush', 'small', 'smart', 'smile', 'smoke', 'smooth', 'snack', 'snake', 'snap', 'sniff', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda', 'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song', 'soon', 'sorry', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space', 'spare', 'spatial', 'spawn', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere', 'spice', 'spider', 'spike', 'spin', 'spirit', 'split', 'spoil', 'sponsor', 'spoon', 'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squeeze', 'squirrel', 'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start', 'state', 'stay', 'steak', 'steel', 'stem', 'step', 'stereo', 'stick', 'still', 'sting', 'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street', 'strike', 'strong', 'struggle', 'student', 'stuff', 'stumble', 'style', 'subject', 'submit', 'subway', 'success', 'such', 'sudden', 'suffer', 'sugar', 'suggest', 'suit', 'summer', 'sun', 'sunny', 'sunset', 'super', 'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey', 'suspect', 'sustain', 'swallow', 'swamp', 'swap', 'swarm', 'swear', 'sweet', 'swift', 'swim', 'swing', 'switch', 'sword', 'symbol', 'symptom', 'syrup', 'system', 'table', 'tackle', 'tag', 'tail', 'talent', 'talk', 'tank', 'tape', 'target', 'task', 'taste', 'tattoo', 'taxi', 'teach', 'team', 'tell', 'ten', 'tenant', 'tennis', 'tent', 'term', 'test', 'text', 'thank', 'that', 'theme', 'then', 'theory', 'there', 'they', 'thing', 'this', 'thought', 'three', 'thrive', 'throw', 'thumb', 'thunder', 'ticket', 'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired', 'tissue', 'title', 'toast', 'tobacco', 'today', 'toddler', 'toe', 'together', 'toilet', 'token', 'tomato', 'tomorrow', 'tone', 'tongue', 'tonight', 'tool', 'tooth', 'top', 'topic', 'topple', 'torch', 'tornado', 'tortoise', 'toss', 'total', 'tourist', 'toward', 'tower', 'town', 'toy', 'track', 'trade', 'traffic', 'tragic', 'train', 'transfer', 'trap', 'trash', 'travel', 'tray', 'treat', 'tree', 'trend', 'trial', 'tribe', 'trick', 'trigger', 'trim', 'trip', 'trophy', 'trouble', 'truck', 'true', 'truly', 'trumpet', 'trust', 'truth', 'try', 'tube', 'tuition', 'tumble', 'tuna', 'tunnel', 'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist', 'two', 'type', 'typical', 'ugly', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover', 'under', 'undo', 'unfair', 'unfold', 'unhappy', 'uniform', 'unique', 'unit', 'universe', 'unknown', 'unlock', 'until', 'unusual', 'unveil', 'update', 'upgrade', 'uphold', 'upon', 'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful', 'useless', 'usual', 'utility', 'vacant', 'vacuum', 'vague', 'valid', 'valley', 'valve', 'van', 'vanish', 'vapor', 'various', 'vast', 'vault', 'vehicle', 'velvet', 'vendor', 'venture', 'venue', 'verb', 'verify', 'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory', 'video', 'view', 'village', 'vintage', 'violin', 'virtual', 'virus', 'visa', 'visit', 'visual', 'vital', 'vivid', 'vocal', 'voice', 'void', 'volcano', 'volume', 'vote', 'voyage', 'wage', 'wagon', 'wait', 'walk', 'wall', 'walnut', 'want', 'warfare', 'warm', 'warrior', 'wash', 'wasp', 'waste', 'water', 'wave', 'way', 'wealth', 'weapon', 'wear', 'weasel', 'weather', 'web', 'wedding', 'weekend', 'weird', 'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when', 'where', 'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win', 'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom', 'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wood', 'wool', 'word', 'work', 'world', 'worry', 'worth', 'wrap', 'wreck', 'wrestle', 'wrist', 'write', 'wrong', 'yard', 'year', 'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo']) +def key_to_mnemonic(key, wordlist=['abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acoustic', 'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt', 'add', 'addict', 'address', 'adjust', 'admit', 'adult', 'advance', 'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent', 'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album', 'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone', 'alpha', 'already', 'also', 'alter', 'always', 'amateur', 'amazing', 'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle', 'angry', 'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve', 'april', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm', 'armed', 'armor', 'army', 'around', 'arrange', 'arrest', 'arrive', 'arrow', 'art', 'artefact', 'artist', 'artwork', 'ask', 'aspect', 'assault', 'asset', 'assist', 'assume', 'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction', 'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado', 'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis', 'baby', 'bachelor', 'bacon', 'badge', 'bag', 'balance', 'balcony', 'ball', 'bamboo', 'banana', 'banner', 'bar', 'barely', 'bargain', 'barrel', 'base', 'basic', 'basket', 'battle', 'beach', 'bean', 'beauty', 'because', 'become', 'beef', 'before', 'begin', 'behave', 'behind', 'believe', 'below', 'belt', 'bench', 'benefit', 'best', 'betray', 'better', 'between', 'beyond', 'bicycle', 'bid', 'bike', 'bind', 'biology', 'bird', 'birth', 'bitter', 'black', 'blade', 'blame', 'blanket', 'blast', 'bleak', 'bless', 'blind', 'blood', 'blossom', 'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'body', 'boil', 'bomb', 'bone', 'bonus', 'book', 'boost', 'border', 'boring', 'borrow', 'boss', 'bottom', 'bounce', 'box', 'boy', 'bracket', 'brain', 'brand', 'brass', 'brave', 'bread', 'breeze', 'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'broken', 'bronze', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buddy', 'budget', 'buffalo', 'build', 'bulb', 'bulk', 'bullet', 'bundle', 'bunker', 'burden', 'burger', 'burst', 'bus', 'business', 'busy', 'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage', 'cake', 'call', 'calm', 'camera', 'camp', 'can', 'canal', 'cancel', 'candy', 'cannon', 'canoe', 'canvas', 'canyon', 'capable', 'capital', 'captain', 'car', 'carbon', 'card', 'cargo', 'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual', 'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution', 'cave', 'ceiling', 'celery', 'cement', 'census', 'century', 'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chaos', 'chapter', 'charge', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry', 'chest', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose', 'chronic', 'chuckle', 'chunk', 'churn', 'cigar', 'cinnamon', 'circle', 'citizen', 'city', 'civil', 'claim', 'clap', 'clarify', 'claw', 'clay', 'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic', 'clip', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown', 'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'coconut', 'code', 'coffee', 'coil', 'coin', 'collect', 'color', 'column', 'combine', 'come', 'comfort', 'comic', 'common', 'company', 'concert', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core', 'corn', 'correct', 'cost', 'cotton', 'couch', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack', 'cradle', 'craft', 'cram', 'crane', 'crash', 'crater', 'crawl', 'crazy', 'cream', 'credit', 'creek', 'crew', 'cricket', 'crime', 'crisp', 'critic', 'crop', 'cross', 'crouch', 'crowd', 'crucial', 'cruel', 'cruise', 'crumble', 'crunch', 'crush', 'cry', 'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain', 'curve', 'cushion', 'custom', 'cute', 'cycle', 'dad', 'damage', 'damp', 'dance', 'danger', 'daring', 'dash', 'daughter', 'dawn', 'day', 'deal', 'debate', 'debris', 'decade', 'december', 'decide', 'decline', 'decorate', 'decrease', 'deer', 'defense', 'define', 'defy', 'degree', 'delay', 'deliver', 'demand', 'demise', 'denial', 'dentist', 'deny', 'depart', 'depend', 'deposit', 'depth', 'deputy', 'derive', 'describe', 'desert', 'design', 'desk', 'despair', 'destroy', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram', 'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital', 'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover', 'disease', 'dish', 'dismiss', 'disorder', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor', 'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor', 'door', 'dose', 'double', 'dove', 'draft', 'dragon', 'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drill', 'drink', 'drip', 'drive', 'drop', 'drum', 'dry', 'duck', 'dumb', 'dune', 'during', 'dust', 'dutch', 'duty', 'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily', 'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edit', 'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric', 'elegant', 'element', 'elephant', 'elevator', 'elite', 'else', 'embark', 'embody', 'embrace', 'emerge', 'emotion', 'employ', 'empower', 'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy', 'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich', 'enroll', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error', 'erupt', 'escape', 'essay', 'essence', 'estate', 'eternal', 'ethics', 'evidence', 'evil', 'evoke', 'evolve', 'exact', 'example', 'excess', 'exchange', 'excite', 'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exile', 'exist', 'exit', 'exotic', 'expand', 'expect', 'expire', 'explain', 'expose', 'express', 'extend', 'extra', 'eye', 'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'fall', 'false', 'fame', 'family', 'famous', 'fan', 'fancy', 'fantasy', 'farm', 'fashion', 'fat', 'fatal', 'father', 'fatigue', 'fault', 'favorite', 'feature', 'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'festival', 'fetch', 'fever', 'few', 'fiber', 'fiction', 'field', 'figure', 'file', 'film', 'filter', 'final', 'find', 'fine', 'finger', 'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness', 'fix', 'flag', 'flame', 'flash', 'flat', 'flavor', 'flee', 'flight', 'flip', 'float', 'flock', 'floor', 'flower', 'fluid', 'flush', 'fly', 'foam', 'focus', 'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster', 'found', 'fox', 'fragile', 'frame', 'frequent', 'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen', 'fruit', 'fuel', 'fun', 'funny', 'furnace', 'fury', 'future', 'gadget', 'gain', 'galaxy', 'gallery', 'game', 'gap', 'garage', 'garbage', 'garden', 'garlic', 'garment', 'gas', 'gasp', 'gate', 'gather', 'gauge', 'gaze', 'general', 'genius', 'genre', 'gentle', 'genuine', 'gesture', 'ghost', 'giant', 'gift', 'giggle', 'ginger', 'giraffe', 'girl', 'give', 'glad', 'glance', 'glare', 'glass', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow', 'glue', 'goat', 'goddess', 'gold', 'good', 'goose', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab', 'grace', 'grain', 'grant', 'grape', 'grass', 'gravity', 'great', 'green', 'grid', 'grief', 'grit', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess', 'guide', 'guilt', 'guitar', 'gun', 'gym', 'habit', 'hair', 'half', 'hammer', 'hamster', 'hand', 'happy', 'harbor', 'hard', 'harsh', 'harvest', 'hat', 'have', 'hawk', 'hazard', 'head', 'health', 'heart', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help', 'hen', 'hero', 'hidden', 'high', 'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold', 'hole', 'holiday', 'hollow', 'home', 'honey', 'hood', 'hope', 'horn', 'horror', 'horse', 'hospital', 'host', 'hotel', 'hour', 'hover', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred', 'hungry', 'hunt', 'hurdle', 'hurry', 'hurt', 'husband', 'hybrid', 'ice', 'icon', 'idea', 'identify', 'idle', 'ignore', 'ill', 'illegal', 'illness', 'image', 'imitate', 'immense', 'immune', 'impact', 'impose', 'improve', 'impulse', 'inch', 'include', 'income', 'increase', 'index', 'indicate', 'indoor', 'industry', 'infant', 'inflict', 'inform', 'inhale', 'inherit', 'initial', 'inject', 'injury', 'inmate', 'inner', 'innocent', 'input', 'inquiry', 'insane', 'insect', 'inside', 'inspire', 'install', 'intact', 'interest', 'into', 'invest', 'invite', 'involve', 'iron', 'island', 'isolate', 'issue', 'item', 'ivory', 'jacket', 'jaguar', 'jar', 'jazz', 'jealous', 'jeans', 'jelly', 'jewel', 'job', 'join', 'joke', 'journey', 'joy', 'judge', 'juice', 'jump', 'jungle', 'junior', 'junk', 'just', 'kangaroo', 'keen', 'keep', 'ketchup', 'key', 'kick', 'kid', 'kidney', 'kind', 'kingdom', 'kiss', 'kit', 'kitchen', 'kite', 'kitten', 'kiwi', 'knee', 'knife', 'knock', 'know', 'lab', 'label', 'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'laptop', 'large', 'later', 'latin', 'laugh', 'laundry', 'lava', 'law', 'lawn', 'lawsuit', 'layer', 'lazy', 'leader', 'leaf', 'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure', 'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level', 'liar', 'liberty', 'library', 'license', 'life', 'lift', 'light', 'like', 'limb', 'limit', 'link', 'lion', 'liquid', 'list', 'little', 'live', 'lizard', 'load', 'loan', 'lobster', 'local', 'lock', 'logic', 'lonely', 'long', 'loop', 'lottery', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber', 'lunar', 'lunch', 'luxury', 'lyrics', 'machine', 'mad', 'magic', 'magnet', 'maid', 'mail', 'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango', 'mansion', 'manual', 'maple', 'marble', 'march', 'margin', 'marine', 'market', 'marriage', 'mask', 'mass', 'master', 'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow', 'mean', 'measure', 'meat', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member', 'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merry', 'mesh', 'message', 'metal', 'method', 'middle', 'midnight', 'milk', 'million', 'mimic', 'mind', 'minimum', 'minor', 'minute', 'miracle', 'mirror', 'misery', 'miss', 'mistake', 'mix', 'mixed', 'mixture', 'mobile', 'model', 'modify', 'mom', 'moment', 'monitor', 'monkey', 'monster', 'month', 'moon', 'moral', 'more', 'morning', 'mosquito', 'mother', 'motion', 'motor', 'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mule', 'multiply', 'muscle', 'museum', 'mushroom', 'music', 'must', 'mutual', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin', 'narrow', 'nasty', 'nation', 'nature', 'near', 'neck', 'need', 'negative', 'neglect', 'neither', 'nephew', 'nerve', 'nest', 'net', 'network', 'neutral', 'never', 'news', 'next', 'nice', 'night', 'noble', 'noise', 'nominee', 'noodle', 'normal', 'north', 'nose', 'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number', 'nurse', 'nut', 'oak', 'obey', 'object', 'oblige', 'obscure', 'observe', 'obtain', 'obvious', 'occur', 'ocean', 'october', 'odor', 'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive', 'olympic', 'omit', 'once', 'one', 'onion', 'online', 'only', 'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard', 'order', 'ordinary', 'organ', 'orient', 'original', 'orphan', 'ostrich', 'other', 'outdoor', 'outer', 'output', 'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster', 'ozone', 'pact', 'paddle', 'page', 'pair', 'palace', 'palm', 'panda', 'panel', 'panic', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party', 'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave', 'payment', 'peace', 'peanut', 'pear', 'peasant', 'pelican', 'pen', 'penalty', 'pencil', 'people', 'pepper', 'perfect', 'permit', 'person', 'pet', 'phone', 'photo', 'phrase', 'physical', 'piano', 'picnic', 'picture', 'piece', 'pig', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe', 'pistol', 'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please', 'pledge', 'pluck', 'plug', 'plunge', 'poem', 'poet', 'point', 'polar', 'pole', 'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible', 'post', 'potato', 'pottery', 'poverty', 'powder', 'power', 'practice', 'praise', 'predict', 'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary', 'print', 'priority', 'prison', 'private', 'prize', 'problem', 'process', 'produce', 'profit', 'program', 'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide', 'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'punch', 'pupil', 'puppy', 'purchase', 'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality', 'quantum', 'quarter', 'question', 'quick', 'quit', 'quiz', 'quote', 'rabbit', 'raccoon', 'race', 'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp', 'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven', 'raw', 'razor', 'ready', 'real', 'reason', 'rebel', 'rebuild', 'recall', 'receive', 'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region', 'regret', 'regular', 'reject', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remind', 'remove', 'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report', 'require', 'rescue', 'resemble', 'resist', 'resource', 'response', 'result', 'retire', 'retreat', 'return', 'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice', 'rich', 'ride', 'ridge', 'rifle', 'right', 'rigid', 'ring', 'riot', 'ripple', 'risk', 'ritual', 'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance', 'roof', 'rookie', 'room', 'rose', 'rotate', 'rough', 'round', 'route', 'royal', 'rubber', 'rude', 'rug', 'rule', 'run', 'runway', 'rural', 'sad', 'saddle', 'sadness', 'safe', 'sail', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample', 'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale', 'scan', 'scare', 'scatter', 'scene', 'scheme', 'school', 'science', 'scissors', 'scorpion', 'scout', 'scrap', 'screen', 'script', 'scrub', 'sea', 'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed', 'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence', 'series', 'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shaft', 'shallow', 'share', 'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'ship', 'shiver', 'shock', 'shoe', 'shoot', 'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shrug', 'shuffle', 'shy', 'sibling', 'sick', 'side', 'siege', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver', 'similar', 'simple', 'since', 'sing', 'siren', 'sister', 'situate', 'six', 'size', 'skate', 'sketch', 'ski', 'skill', 'skin', 'skirt', 'skull', 'slab', 'slam', 'sleep', 'slender', 'slice', 'slide', 'slight', 'slim', 'slogan', 'slot', 'slow', 'slush', 'small', 'smart', 'smile', 'smoke', 'smooth', 'snack', 'snake', 'snap', 'sniff', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda', 'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song', 'soon', 'sorry', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space', 'spare', 'spatial', 'spawn', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere', 'spice', 'spider', 'spike', 'spin', 'spirit', 'split', 'spoil', 'sponsor', 'spoon', 'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squeeze', 'squirrel', 'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start', 'state', 'stay', 'steak', 'steel', 'stem', 'step', 'stereo', 'stick', 'still', 'sting', 'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street', 'strike', 'strong', 'struggle', 'student', 'stuff', 'stumble', 'style', 'subject', 'submit', 'subway', 'success', 'such', 'sudden', 'suffer', 'sugar', 'suggest', 'suit', 'summer', 'sun', 'sunny', 'sunset', 'super', 'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey', 'suspect', 'sustain', 'swallow', 'swamp', 'swap', 'swarm', 'swear', 'sweet', 'swift', 'swim', 'swing', 'switch', 'sword', 'symbol', 'symptom', 'syrup', 'system', 'table', 'tackle', 'tag', 'tail', 'talent', 'talk', 'tank', 'tape', 'target', 'task', 'taste', 'tattoo', 'taxi', 'teach', 'team', 'tell', 'ten', 'tenant', 'tennis', 'tent', 'term', 'test', 'text', 'thank', 'that', 'theme', 'then', 'theory', 'there', 'they', 'thing', 'this', 'thought', 'three', 'thrive', 'throw', 'thumb', 'thunder', 'ticket', 'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired', 'tissue', 'title', 'toast', 'tobacco', 'today', 'toddler', 'toe', 'together', 'toilet', 'token', 'tomato', 'tomorrow', 'tone', 'tongue', 'tonight', 'tool', 'tooth', 'top', 'topic', 'topple', 'torch', 'tornado', 'tortoise', 'toss', 'total', 'tourist', 'toward', 'tower', 'town', 'toy', 'track', 'trade', 'traffic', 'tragic', 'train', 'transfer', 'trap', 'trash', 'travel', 'tray', 'treat', 'tree', 'trend', 'trial', 'tribe', 'trick', 'trigger', 'trim', 'trip', 'trophy', 'trouble', 'truck', 'true', 'truly', 'trumpet', 'trust', 'truth', 'try', 'tube', 'tuition', 'tumble', 'tuna', 'tunnel', 'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist', 'two', 'type', 'typical', 'ugly', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover', 'under', 'undo', 'unfair', 'unfold', 'unhappy', 'uniform', 'unique', 'unit', 'universe', 'unknown', 'unlock', 'until', 'unusual', 'unveil', 'update', 'upgrade', 'uphold', 'upon', 'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful', 'useless', 'usual', 'utility', 'vacant', 'vacuum', 'vague', 'valid', 'valley', 'valve', 'van', 'vanish', 'vapor', 'various', 'vast', 'vault', 'vehicle', 'velvet', 'vendor', 'venture', 'venue', 'verb', 'verify', 'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory', 'video', 'view', 'village', 'vintage', 'violin', 'virtual', 'virus', 'visa', 'visit', 'visual', 'vital', 'vivid', 'vocal', 'voice', 'void', 'volcano', 'volume', 'vote', 'voyage', 'wage', 'wagon', 'wait', 'walk', 'wall', 'walnut', 'want', 'warfare', 'warm', 'warrior', 'wash', 'wasp', 'waste', 'water', 'wave', 'way', 'wealth', 'weapon', 'wear', 'weasel', 'weather', 'web', 'wedding', 'weekend', 'weird', 'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when', 'where', 'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win', 'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom', 'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wood', 'wool', 'word', 'work', 'world', 'worry', 'worth', 'wrap', 'wreck', 'wrestle', 'wrist', 'write', 'wrong', 'yard', 'year', 'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo'])
-

Convert the passed key to memorizable mnemonic.

+

Convert the passed key to memorizable mnemonic.

Args

key : bytes
The key to be encoded.
-
wordlist : list[str], optional
+
wordlist : list[str], optional
The wordlist used to generate the mnemonic. Defaults to wordlist.

Returns

-
str
+
str
A string of space separated words representing the mnemonic
-
+
-Source code + +Expand source code +
def key_to_mnemonic(key, wordlist=wordlist):
     """Convert the passed key to memorizable mnemonic.
 
@@ -274,29 +286,31 @@ 

Returns

-def mnemonic_to_key(mnemonic, wordlist=['abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acoustic', 'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt', 'add', 'addict', 'address', 'adjust', 'admit', 'adult', 'advance', 'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent', 'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album', 'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone', 'alpha', 'already', 'also', 'alter', 'always', 'amateur', 'amazing', 'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle', 'angry', 'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve', 'april', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm', 'armed', 'armor', 'army', 'around', 'arrange', 'arrest', 'arrive', 'arrow', 'art', 'artefact', 'artist', 'artwork', 'ask', 'aspect', 'assault', 'asset', 'assist', 'assume', 'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction', 'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado', 'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis', 'baby', 'bachelor', 'bacon', 'badge', 'bag', 'balance', 'balcony', 'ball', 'bamboo', 'banana', 'banner', 'bar', 'barely', 'bargain', 'barrel', 'base', 'basic', 'basket', 'battle', 'beach', 'bean', 'beauty', 'because', 'become', 'beef', 'before', 'begin', 'behave', 'behind', 'believe', 'below', 'belt', 'bench', 'benefit', 'best', 'betray', 'better', 'between', 'beyond', 'bicycle', 'bid', 'bike', 'bind', 'biology', 'bird', 'birth', 'bitter', 'black', 'blade', 'blame', 'blanket', 'blast', 'bleak', 'bless', 'blind', 'blood', 'blossom', 'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'body', 'boil', 'bomb', 'bone', 'bonus', 'book', 'boost', 'border', 'boring', 'borrow', 'boss', 'bottom', 'bounce', 'box', 'boy', 'bracket', 'brain', 'brand', 'brass', 'brave', 'bread', 'breeze', 'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'broken', 'bronze', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buddy', 'budget', 'buffalo', 'build', 'bulb', 'bulk', 'bullet', 'bundle', 'bunker', 'burden', 'burger', 'burst', 'bus', 'business', 'busy', 'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage', 'cake', 'call', 'calm', 'camera', 'camp', 'can', 'canal', 'cancel', 'candy', 'cannon', 'canoe', 'canvas', 'canyon', 'capable', 'capital', 'captain', 'car', 'carbon', 'card', 'cargo', 'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual', 'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution', 'cave', 'ceiling', 'celery', 'cement', 'census', 'century', 'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chaos', 'chapter', 'charge', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry', 'chest', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose', 'chronic', 'chuckle', 'chunk', 'churn', 'cigar', 'cinnamon', 'circle', 'citizen', 'city', 'civil', 'claim', 'clap', 'clarify', 'claw', 'clay', 'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic', 'clip', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown', 'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'coconut', 'code', 'coffee', 'coil', 'coin', 'collect', 'color', 'column', 'combine', 'come', 'comfort', 'comic', 'common', 'company', 'concert', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core', 'corn', 'correct', 'cost', 'cotton', 'couch', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack', 'cradle', 'craft', 'cram', 'crane', 'crash', 'crater', 'crawl', 'crazy', 'cream', 'credit', 'creek', 'crew', 'cricket', 'crime', 'crisp', 'critic', 'crop', 'cross', 'crouch', 'crowd', 'crucial', 'cruel', 'cruise', 'crumble', 'crunch', 'crush', 'cry', 'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain', 'curve', 'cushion', 'custom', 'cute', 'cycle', 'dad', 'damage', 'damp', 'dance', 'danger', 'daring', 'dash', 'daughter', 'dawn', 'day', 'deal', 'debate', 'debris', 'decade', 'december', 'decide', 'decline', 'decorate', 'decrease', 'deer', 'defense', 'define', 'defy', 'degree', 'delay', 'deliver', 'demand', 'demise', 'denial', 'dentist', 'deny', 'depart', 'depend', 'deposit', 'depth', 'deputy', 'derive', 'describe', 'desert', 'design', 'desk', 'despair', 'destroy', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram', 'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital', 'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover', 'disease', 'dish', 'dismiss', 'disorder', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor', 'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor', 'door', 'dose', 'double', 'dove', 'draft', 'dragon', 'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drill', 'drink', 'drip', 'drive', 'drop', 'drum', 'dry', 'duck', 'dumb', 'dune', 'during', 'dust', 'dutch', 'duty', 'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily', 'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edit', 'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric', 'elegant', 'element', 'elephant', 'elevator', 'elite', 'else', 'embark', 'embody', 'embrace', 'emerge', 'emotion', 'employ', 'empower', 'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy', 'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich', 'enroll', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error', 'erupt', 'escape', 'essay', 'essence', 'estate', 'eternal', 'ethics', 'evidence', 'evil', 'evoke', 'evolve', 'exact', 'example', 'excess', 'exchange', 'excite', 'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exile', 'exist', 'exit', 'exotic', 'expand', 'expect', 'expire', 'explain', 'expose', 'express', 'extend', 'extra', 'eye', 'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'fall', 'false', 'fame', 'family', 'famous', 'fan', 'fancy', 'fantasy', 'farm', 'fashion', 'fat', 'fatal', 'father', 'fatigue', 'fault', 'favorite', 'feature', 'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'festival', 'fetch', 'fever', 'few', 'fiber', 'fiction', 'field', 'figure', 'file', 'film', 'filter', 'final', 'find', 'fine', 'finger', 'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness', 'fix', 'flag', 'flame', 'flash', 'flat', 'flavor', 'flee', 'flight', 'flip', 'float', 'flock', 'floor', 'flower', 'fluid', 'flush', 'fly', 'foam', 'focus', 'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster', 'found', 'fox', 'fragile', 'frame', 'frequent', 'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen', 'fruit', 'fuel', 'fun', 'funny', 'furnace', 'fury', 'future', 'gadget', 'gain', 'galaxy', 'gallery', 'game', 'gap', 'garage', 'garbage', 'garden', 'garlic', 'garment', 'gas', 'gasp', 'gate', 'gather', 'gauge', 'gaze', 'general', 'genius', 'genre', 'gentle', 'genuine', 'gesture', 'ghost', 'giant', 'gift', 'giggle', 'ginger', 'giraffe', 'girl', 'give', 'glad', 'glance', 'glare', 'glass', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow', 'glue', 'goat', 'goddess', 'gold', 'good', 'goose', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab', 'grace', 'grain', 'grant', 'grape', 'grass', 'gravity', 'great', 'green', 'grid', 'grief', 'grit', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess', 'guide', 'guilt', 'guitar', 'gun', 'gym', 'habit', 'hair', 'half', 'hammer', 'hamster', 'hand', 'happy', 'harbor', 'hard', 'harsh', 'harvest', 'hat', 'have', 'hawk', 'hazard', 'head', 'health', 'heart', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help', 'hen', 'hero', 'hidden', 'high', 'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold', 'hole', 'holiday', 'hollow', 'home', 'honey', 'hood', 'hope', 'horn', 'horror', 'horse', 'hospital', 'host', 'hotel', 'hour', 'hover', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred', 'hungry', 'hunt', 'hurdle', 'hurry', 'hurt', 'husband', 'hybrid', 'ice', 'icon', 'idea', 'identify', 'idle', 'ignore', 'ill', 'illegal', 'illness', 'image', 'imitate', 'immense', 'immune', 'impact', 'impose', 'improve', 'impulse', 'inch', 'include', 'income', 'increase', 'index', 'indicate', 'indoor', 'industry', 'infant', 'inflict', 'inform', 'inhale', 'inherit', 'initial', 'inject', 'injury', 'inmate', 'inner', 'innocent', 'input', 'inquiry', 'insane', 'insect', 'inside', 'inspire', 'install', 'intact', 'interest', 'into', 'invest', 'invite', 'involve', 'iron', 'island', 'isolate', 'issue', 'item', 'ivory', 'jacket', 'jaguar', 'jar', 'jazz', 'jealous', 'jeans', 'jelly', 'jewel', 'job', 'join', 'joke', 'journey', 'joy', 'judge', 'juice', 'jump', 'jungle', 'junior', 'junk', 'just', 'kangaroo', 'keen', 'keep', 'ketchup', 'key', 'kick', 'kid', 'kidney', 'kind', 'kingdom', 'kiss', 'kit', 'kitchen', 'kite', 'kitten', 'kiwi', 'knee', 'knife', 'knock', 'know', 'lab', 'label', 'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'laptop', 'large', 'later', 'latin', 'laugh', 'laundry', 'lava', 'law', 'lawn', 'lawsuit', 'layer', 'lazy', 'leader', 'leaf', 'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure', 'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level', 'liar', 'liberty', 'library', 'license', 'life', 'lift', 'light', 'like', 'limb', 'limit', 'link', 'lion', 'liquid', 'list', 'little', 'live', 'lizard', 'load', 'loan', 'lobster', 'local', 'lock', 'logic', 'lonely', 'long', 'loop', 'lottery', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber', 'lunar', 'lunch', 'luxury', 'lyrics', 'machine', 'mad', 'magic', 'magnet', 'maid', 'mail', 'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango', 'mansion', 'manual', 'maple', 'marble', 'march', 'margin', 'marine', 'market', 'marriage', 'mask', 'mass', 'master', 'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow', 'mean', 'measure', 'meat', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member', 'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merry', 'mesh', 'message', 'metal', 'method', 'middle', 'midnight', 'milk', 'million', 'mimic', 'mind', 'minimum', 'minor', 'minute', 'miracle', 'mirror', 'misery', 'miss', 'mistake', 'mix', 'mixed', 'mixture', 'mobile', 'model', 'modify', 'mom', 'moment', 'monitor', 'monkey', 'monster', 'month', 'moon', 'moral', 'more', 'morning', 'mosquito', 'mother', 'motion', 'motor', 'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mule', 'multiply', 'muscle', 'museum', 'mushroom', 'music', 'must', 'mutual', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin', 'narrow', 'nasty', 'nation', 'nature', 'near', 'neck', 'need', 'negative', 'neglect', 'neither', 'nephew', 'nerve', 'nest', 'net', 'network', 'neutral', 'never', 'news', 'next', 'nice', 'night', 'noble', 'noise', 'nominee', 'noodle', 'normal', 'north', 'nose', 'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number', 'nurse', 'nut', 'oak', 'obey', 'object', 'oblige', 'obscure', 'observe', 'obtain', 'obvious', 'occur', 'ocean', 'october', 'odor', 'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive', 'olympic', 'omit', 'once', 'one', 'onion', 'online', 'only', 'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard', 'order', 'ordinary', 'organ', 'orient', 'original', 'orphan', 'ostrich', 'other', 'outdoor', 'outer', 'output', 'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster', 'ozone', 'pact', 'paddle', 'page', 'pair', 'palace', 'palm', 'panda', 'panel', 'panic', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party', 'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave', 'payment', 'peace', 'peanut', 'pear', 'peasant', 'pelican', 'pen', 'penalty', 'pencil', 'people', 'pepper', 'perfect', 'permit', 'person', 'pet', 'phone', 'photo', 'phrase', 'physical', 'piano', 'picnic', 'picture', 'piece', 'pig', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe', 'pistol', 'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please', 'pledge', 'pluck', 'plug', 'plunge', 'poem', 'poet', 'point', 'polar', 'pole', 'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible', 'post', 'potato', 'pottery', 'poverty', 'powder', 'power', 'practice', 'praise', 'predict', 'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary', 'print', 'priority', 'prison', 'private', 'prize', 'problem', 'process', 'produce', 'profit', 'program', 'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide', 'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'punch', 'pupil', 'puppy', 'purchase', 'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality', 'quantum', 'quarter', 'question', 'quick', 'quit', 'quiz', 'quote', 'rabbit', 'raccoon', 'race', 'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp', 'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven', 'raw', 'razor', 'ready', 'real', 'reason', 'rebel', 'rebuild', 'recall', 'receive', 'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region', 'regret', 'regular', 'reject', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remind', 'remove', 'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report', 'require', 'rescue', 'resemble', 'resist', 'resource', 'response', 'result', 'retire', 'retreat', 'return', 'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice', 'rich', 'ride', 'ridge', 'rifle', 'right', 'rigid', 'ring', 'riot', 'ripple', 'risk', 'ritual', 'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance', 'roof', 'rookie', 'room', 'rose', 'rotate', 'rough', 'round', 'route', 'royal', 'rubber', 'rude', 'rug', 'rule', 'run', 'runway', 'rural', 'sad', 'saddle', 'sadness', 'safe', 'sail', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample', 'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale', 'scan', 'scare', 'scatter', 'scene', 'scheme', 'school', 'science', 'scissors', 'scorpion', 'scout', 'scrap', 'screen', 'script', 'scrub', 'sea', 'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed', 'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence', 'series', 'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shaft', 'shallow', 'share', 'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'ship', 'shiver', 'shock', 'shoe', 'shoot', 'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shrug', 'shuffle', 'shy', 'sibling', 'sick', 'side', 'siege', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver', 'similar', 'simple', 'since', 'sing', 'siren', 'sister', 'situate', 'six', 'size', 'skate', 'sketch', 'ski', 'skill', 'skin', 'skirt', 'skull', 'slab', 'slam', 'sleep', 'slender', 'slice', 'slide', 'slight', 'slim', 'slogan', 'slot', 'slow', 'slush', 'small', 'smart', 'smile', 'smoke', 'smooth', 'snack', 'snake', 'snap', 'sniff', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda', 'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song', 'soon', 'sorry', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space', 'spare', 'spatial', 'spawn', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere', 'spice', 'spider', 'spike', 'spin', 'spirit', 'split', 'spoil', 'sponsor', 'spoon', 'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squeeze', 'squirrel', 'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start', 'state', 'stay', 'steak', 'steel', 'stem', 'step', 'stereo', 'stick', 'still', 'sting', 'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street', 'strike', 'strong', 'struggle', 'student', 'stuff', 'stumble', 'style', 'subject', 'submit', 'subway', 'success', 'such', 'sudden', 'suffer', 'sugar', 'suggest', 'suit', 'summer', 'sun', 'sunny', 'sunset', 'super', 'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey', 'suspect', 'sustain', 'swallow', 'swamp', 'swap', 'swarm', 'swear', 'sweet', 'swift', 'swim', 'swing', 'switch', 'sword', 'symbol', 'symptom', 'syrup', 'system', 'table', 'tackle', 'tag', 'tail', 'talent', 'talk', 'tank', 'tape', 'target', 'task', 'taste', 'tattoo', 'taxi', 'teach', 'team', 'tell', 'ten', 'tenant', 'tennis', 'tent', 'term', 'test', 'text', 'thank', 'that', 'theme', 'then', 'theory', 'there', 'they', 'thing', 'this', 'thought', 'three', 'thrive', 'throw', 'thumb', 'thunder', 'ticket', 'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired', 'tissue', 'title', 'toast', 'tobacco', 'today', 'toddler', 'toe', 'together', 'toilet', 'token', 'tomato', 'tomorrow', 'tone', 'tongue', 'tonight', 'tool', 'tooth', 'top', 'topic', 'topple', 'torch', 'tornado', 'tortoise', 'toss', 'total', 'tourist', 'toward', 'tower', 'town', 'toy', 'track', 'trade', 'traffic', 'tragic', 'train', 'transfer', 'trap', 'trash', 'travel', 'tray', 'treat', 'tree', 'trend', 'trial', 'tribe', 'trick', 'trigger', 'trim', 'trip', 'trophy', 'trouble', 'truck', 'true', 'truly', 'trumpet', 'trust', 'truth', 'try', 'tube', 'tuition', 'tumble', 'tuna', 'tunnel', 'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist', 'two', 'type', 'typical', 'ugly', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover', 'under', 'undo', 'unfair', 'unfold', 'unhappy', 'uniform', 'unique', 'unit', 'universe', 'unknown', 'unlock', 'until', 'unusual', 'unveil', 'update', 'upgrade', 'uphold', 'upon', 'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful', 'useless', 'usual', 'utility', 'vacant', 'vacuum', 'vague', 'valid', 'valley', 'valve', 'van', 'vanish', 'vapor', 'various', 'vast', 'vault', 'vehicle', 'velvet', 'vendor', 'venture', 'venue', 'verb', 'verify', 'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory', 'video', 'view', 'village', 'vintage', 'violin', 'virtual', 'virus', 'visa', 'visit', 'visual', 'vital', 'vivid', 'vocal', 'voice', 'void', 'volcano', 'volume', 'vote', 'voyage', 'wage', 'wagon', 'wait', 'walk', 'wall', 'walnut', 'want', 'warfare', 'warm', 'warrior', 'wash', 'wasp', 'waste', 'water', 'wave', 'way', 'wealth', 'weapon', 'wear', 'weasel', 'weather', 'web', 'wedding', 'weekend', 'weird', 'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when', 'where', 'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win', 'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom', 'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wood', 'wool', 'word', 'work', 'world', 'worry', 'worth', 'wrap', 'wreck', 'wrestle', 'wrist', 'write', 'wrong', 'yard', 'year', 'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo']) +def mnemonic_to_key(mnemonic, wordlist=['abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acoustic', 'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt', 'add', 'addict', 'address', 'adjust', 'admit', 'adult', 'advance', 'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent', 'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album', 'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone', 'alpha', 'already', 'also', 'alter', 'always', 'amateur', 'amazing', 'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle', 'angry', 'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve', 'april', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm', 'armed', 'armor', 'army', 'around', 'arrange', 'arrest', 'arrive', 'arrow', 'art', 'artefact', 'artist', 'artwork', 'ask', 'aspect', 'assault', 'asset', 'assist', 'assume', 'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction', 'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado', 'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis', 'baby', 'bachelor', 'bacon', 'badge', 'bag', 'balance', 'balcony', 'ball', 'bamboo', 'banana', 'banner', 'bar', 'barely', 'bargain', 'barrel', 'base', 'basic', 'basket', 'battle', 'beach', 'bean', 'beauty', 'because', 'become', 'beef', 'before', 'begin', 'behave', 'behind', 'believe', 'below', 'belt', 'bench', 'benefit', 'best', 'betray', 'better', 'between', 'beyond', 'bicycle', 'bid', 'bike', 'bind', 'biology', 'bird', 'birth', 'bitter', 'black', 'blade', 'blame', 'blanket', 'blast', 'bleak', 'bless', 'blind', 'blood', 'blossom', 'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'body', 'boil', 'bomb', 'bone', 'bonus', 'book', 'boost', 'border', 'boring', 'borrow', 'boss', 'bottom', 'bounce', 'box', 'boy', 'bracket', 'brain', 'brand', 'brass', 'brave', 'bread', 'breeze', 'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'broken', 'bronze', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buddy', 'budget', 'buffalo', 'build', 'bulb', 'bulk', 'bullet', 'bundle', 'bunker', 'burden', 'burger', 'burst', 'bus', 'business', 'busy', 'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage', 'cake', 'call', 'calm', 'camera', 'camp', 'can', 'canal', 'cancel', 'candy', 'cannon', 'canoe', 'canvas', 'canyon', 'capable', 'capital', 'captain', 'car', 'carbon', 'card', 'cargo', 'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual', 'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution', 'cave', 'ceiling', 'celery', 'cement', 'census', 'century', 'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chaos', 'chapter', 'charge', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry', 'chest', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose', 'chronic', 'chuckle', 'chunk', 'churn', 'cigar', 'cinnamon', 'circle', 'citizen', 'city', 'civil', 'claim', 'clap', 'clarify', 'claw', 'clay', 'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic', 'clip', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown', 'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'coconut', 'code', 'coffee', 'coil', 'coin', 'collect', 'color', 'column', 'combine', 'come', 'comfort', 'comic', 'common', 'company', 'concert', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core', 'corn', 'correct', 'cost', 'cotton', 'couch', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack', 'cradle', 'craft', 'cram', 'crane', 'crash', 'crater', 'crawl', 'crazy', 'cream', 'credit', 'creek', 'crew', 'cricket', 'crime', 'crisp', 'critic', 'crop', 'cross', 'crouch', 'crowd', 'crucial', 'cruel', 'cruise', 'crumble', 'crunch', 'crush', 'cry', 'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain', 'curve', 'cushion', 'custom', 'cute', 'cycle', 'dad', 'damage', 'damp', 'dance', 'danger', 'daring', 'dash', 'daughter', 'dawn', 'day', 'deal', 'debate', 'debris', 'decade', 'december', 'decide', 'decline', 'decorate', 'decrease', 'deer', 'defense', 'define', 'defy', 'degree', 'delay', 'deliver', 'demand', 'demise', 'denial', 'dentist', 'deny', 'depart', 'depend', 'deposit', 'depth', 'deputy', 'derive', 'describe', 'desert', 'design', 'desk', 'despair', 'destroy', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram', 'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital', 'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover', 'disease', 'dish', 'dismiss', 'disorder', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor', 'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor', 'door', 'dose', 'double', 'dove', 'draft', 'dragon', 'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drill', 'drink', 'drip', 'drive', 'drop', 'drum', 'dry', 'duck', 'dumb', 'dune', 'during', 'dust', 'dutch', 'duty', 'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily', 'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edit', 'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric', 'elegant', 'element', 'elephant', 'elevator', 'elite', 'else', 'embark', 'embody', 'embrace', 'emerge', 'emotion', 'employ', 'empower', 'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy', 'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich', 'enroll', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error', 'erupt', 'escape', 'essay', 'essence', 'estate', 'eternal', 'ethics', 'evidence', 'evil', 'evoke', 'evolve', 'exact', 'example', 'excess', 'exchange', 'excite', 'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exile', 'exist', 'exit', 'exotic', 'expand', 'expect', 'expire', 'explain', 'expose', 'express', 'extend', 'extra', 'eye', 'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'fall', 'false', 'fame', 'family', 'famous', 'fan', 'fancy', 'fantasy', 'farm', 'fashion', 'fat', 'fatal', 'father', 'fatigue', 'fault', 'favorite', 'feature', 'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'festival', 'fetch', 'fever', 'few', 'fiber', 'fiction', 'field', 'figure', 'file', 'film', 'filter', 'final', 'find', 'fine', 'finger', 'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness', 'fix', 'flag', 'flame', 'flash', 'flat', 'flavor', 'flee', 'flight', 'flip', 'float', 'flock', 'floor', 'flower', 'fluid', 'flush', 'fly', 'foam', 'focus', 'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster', 'found', 'fox', 'fragile', 'frame', 'frequent', 'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen', 'fruit', 'fuel', 'fun', 'funny', 'furnace', 'fury', 'future', 'gadget', 'gain', 'galaxy', 'gallery', 'game', 'gap', 'garage', 'garbage', 'garden', 'garlic', 'garment', 'gas', 'gasp', 'gate', 'gather', 'gauge', 'gaze', 'general', 'genius', 'genre', 'gentle', 'genuine', 'gesture', 'ghost', 'giant', 'gift', 'giggle', 'ginger', 'giraffe', 'girl', 'give', 'glad', 'glance', 'glare', 'glass', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow', 'glue', 'goat', 'goddess', 'gold', 'good', 'goose', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab', 'grace', 'grain', 'grant', 'grape', 'grass', 'gravity', 'great', 'green', 'grid', 'grief', 'grit', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess', 'guide', 'guilt', 'guitar', 'gun', 'gym', 'habit', 'hair', 'half', 'hammer', 'hamster', 'hand', 'happy', 'harbor', 'hard', 'harsh', 'harvest', 'hat', 'have', 'hawk', 'hazard', 'head', 'health', 'heart', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help', 'hen', 'hero', 'hidden', 'high', 'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold', 'hole', 'holiday', 'hollow', 'home', 'honey', 'hood', 'hope', 'horn', 'horror', 'horse', 'hospital', 'host', 'hotel', 'hour', 'hover', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred', 'hungry', 'hunt', 'hurdle', 'hurry', 'hurt', 'husband', 'hybrid', 'ice', 'icon', 'idea', 'identify', 'idle', 'ignore', 'ill', 'illegal', 'illness', 'image', 'imitate', 'immense', 'immune', 'impact', 'impose', 'improve', 'impulse', 'inch', 'include', 'income', 'increase', 'index', 'indicate', 'indoor', 'industry', 'infant', 'inflict', 'inform', 'inhale', 'inherit', 'initial', 'inject', 'injury', 'inmate', 'inner', 'innocent', 'input', 'inquiry', 'insane', 'insect', 'inside', 'inspire', 'install', 'intact', 'interest', 'into', 'invest', 'invite', 'involve', 'iron', 'island', 'isolate', 'issue', 'item', 'ivory', 'jacket', 'jaguar', 'jar', 'jazz', 'jealous', 'jeans', 'jelly', 'jewel', 'job', 'join', 'joke', 'journey', 'joy', 'judge', 'juice', 'jump', 'jungle', 'junior', 'junk', 'just', 'kangaroo', 'keen', 'keep', 'ketchup', 'key', 'kick', 'kid', 'kidney', 'kind', 'kingdom', 'kiss', 'kit', 'kitchen', 'kite', 'kitten', 'kiwi', 'knee', 'knife', 'knock', 'know', 'lab', 'label', 'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'laptop', 'large', 'later', 'latin', 'laugh', 'laundry', 'lava', 'law', 'lawn', 'lawsuit', 'layer', 'lazy', 'leader', 'leaf', 'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure', 'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level', 'liar', 'liberty', 'library', 'license', 'life', 'lift', 'light', 'like', 'limb', 'limit', 'link', 'lion', 'liquid', 'list', 'little', 'live', 'lizard', 'load', 'loan', 'lobster', 'local', 'lock', 'logic', 'lonely', 'long', 'loop', 'lottery', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber', 'lunar', 'lunch', 'luxury', 'lyrics', 'machine', 'mad', 'magic', 'magnet', 'maid', 'mail', 'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango', 'mansion', 'manual', 'maple', 'marble', 'march', 'margin', 'marine', 'market', 'marriage', 'mask', 'mass', 'master', 'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow', 'mean', 'measure', 'meat', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member', 'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merry', 'mesh', 'message', 'metal', 'method', 'middle', 'midnight', 'milk', 'million', 'mimic', 'mind', 'minimum', 'minor', 'minute', 'miracle', 'mirror', 'misery', 'miss', 'mistake', 'mix', 'mixed', 'mixture', 'mobile', 'model', 'modify', 'mom', 'moment', 'monitor', 'monkey', 'monster', 'month', 'moon', 'moral', 'more', 'morning', 'mosquito', 'mother', 'motion', 'motor', 'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mule', 'multiply', 'muscle', 'museum', 'mushroom', 'music', 'must', 'mutual', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin', 'narrow', 'nasty', 'nation', 'nature', 'near', 'neck', 'need', 'negative', 'neglect', 'neither', 'nephew', 'nerve', 'nest', 'net', 'network', 'neutral', 'never', 'news', 'next', 'nice', 'night', 'noble', 'noise', 'nominee', 'noodle', 'normal', 'north', 'nose', 'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number', 'nurse', 'nut', 'oak', 'obey', 'object', 'oblige', 'obscure', 'observe', 'obtain', 'obvious', 'occur', 'ocean', 'october', 'odor', 'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive', 'olympic', 'omit', 'once', 'one', 'onion', 'online', 'only', 'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard', 'order', 'ordinary', 'organ', 'orient', 'original', 'orphan', 'ostrich', 'other', 'outdoor', 'outer', 'output', 'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster', 'ozone', 'pact', 'paddle', 'page', 'pair', 'palace', 'palm', 'panda', 'panel', 'panic', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party', 'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave', 'payment', 'peace', 'peanut', 'pear', 'peasant', 'pelican', 'pen', 'penalty', 'pencil', 'people', 'pepper', 'perfect', 'permit', 'person', 'pet', 'phone', 'photo', 'phrase', 'physical', 'piano', 'picnic', 'picture', 'piece', 'pig', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe', 'pistol', 'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please', 'pledge', 'pluck', 'plug', 'plunge', 'poem', 'poet', 'point', 'polar', 'pole', 'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible', 'post', 'potato', 'pottery', 'poverty', 'powder', 'power', 'practice', 'praise', 'predict', 'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary', 'print', 'priority', 'prison', 'private', 'prize', 'problem', 'process', 'produce', 'profit', 'program', 'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide', 'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'punch', 'pupil', 'puppy', 'purchase', 'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality', 'quantum', 'quarter', 'question', 'quick', 'quit', 'quiz', 'quote', 'rabbit', 'raccoon', 'race', 'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp', 'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven', 'raw', 'razor', 'ready', 'real', 'reason', 'rebel', 'rebuild', 'recall', 'receive', 'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region', 'regret', 'regular', 'reject', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remind', 'remove', 'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report', 'require', 'rescue', 'resemble', 'resist', 'resource', 'response', 'result', 'retire', 'retreat', 'return', 'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice', 'rich', 'ride', 'ridge', 'rifle', 'right', 'rigid', 'ring', 'riot', 'ripple', 'risk', 'ritual', 'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance', 'roof', 'rookie', 'room', 'rose', 'rotate', 'rough', 'round', 'route', 'royal', 'rubber', 'rude', 'rug', 'rule', 'run', 'runway', 'rural', 'sad', 'saddle', 'sadness', 'safe', 'sail', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample', 'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale', 'scan', 'scare', 'scatter', 'scene', 'scheme', 'school', 'science', 'scissors', 'scorpion', 'scout', 'scrap', 'screen', 'script', 'scrub', 'sea', 'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed', 'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence', 'series', 'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shaft', 'shallow', 'share', 'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'ship', 'shiver', 'shock', 'shoe', 'shoot', 'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shrug', 'shuffle', 'shy', 'sibling', 'sick', 'side', 'siege', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver', 'similar', 'simple', 'since', 'sing', 'siren', 'sister', 'situate', 'six', 'size', 'skate', 'sketch', 'ski', 'skill', 'skin', 'skirt', 'skull', 'slab', 'slam', 'sleep', 'slender', 'slice', 'slide', 'slight', 'slim', 'slogan', 'slot', 'slow', 'slush', 'small', 'smart', 'smile', 'smoke', 'smooth', 'snack', 'snake', 'snap', 'sniff', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda', 'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song', 'soon', 'sorry', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space', 'spare', 'spatial', 'spawn', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere', 'spice', 'spider', 'spike', 'spin', 'spirit', 'split', 'spoil', 'sponsor', 'spoon', 'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squeeze', 'squirrel', 'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start', 'state', 'stay', 'steak', 'steel', 'stem', 'step', 'stereo', 'stick', 'still', 'sting', 'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street', 'strike', 'strong', 'struggle', 'student', 'stuff', 'stumble', 'style', 'subject', 'submit', 'subway', 'success', 'such', 'sudden', 'suffer', 'sugar', 'suggest', 'suit', 'summer', 'sun', 'sunny', 'sunset', 'super', 'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey', 'suspect', 'sustain', 'swallow', 'swamp', 'swap', 'swarm', 'swear', 'sweet', 'swift', 'swim', 'swing', 'switch', 'sword', 'symbol', 'symptom', 'syrup', 'system', 'table', 'tackle', 'tag', 'tail', 'talent', 'talk', 'tank', 'tape', 'target', 'task', 'taste', 'tattoo', 'taxi', 'teach', 'team', 'tell', 'ten', 'tenant', 'tennis', 'tent', 'term', 'test', 'text', 'thank', 'that', 'theme', 'then', 'theory', 'there', 'they', 'thing', 'this', 'thought', 'three', 'thrive', 'throw', 'thumb', 'thunder', 'ticket', 'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired', 'tissue', 'title', 'toast', 'tobacco', 'today', 'toddler', 'toe', 'together', 'toilet', 'token', 'tomato', 'tomorrow', 'tone', 'tongue', 'tonight', 'tool', 'tooth', 'top', 'topic', 'topple', 'torch', 'tornado', 'tortoise', 'toss', 'total', 'tourist', 'toward', 'tower', 'town', 'toy', 'track', 'trade', 'traffic', 'tragic', 'train', 'transfer', 'trap', 'trash', 'travel', 'tray', 'treat', 'tree', 'trend', 'trial', 'tribe', 'trick', 'trigger', 'trim', 'trip', 'trophy', 'trouble', 'truck', 'true', 'truly', 'trumpet', 'trust', 'truth', 'try', 'tube', 'tuition', 'tumble', 'tuna', 'tunnel', 'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist', 'two', 'type', 'typical', 'ugly', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover', 'under', 'undo', 'unfair', 'unfold', 'unhappy', 'uniform', 'unique', 'unit', 'universe', 'unknown', 'unlock', 'until', 'unusual', 'unveil', 'update', 'upgrade', 'uphold', 'upon', 'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful', 'useless', 'usual', 'utility', 'vacant', 'vacuum', 'vague', 'valid', 'valley', 'valve', 'van', 'vanish', 'vapor', 'various', 'vast', 'vault', 'vehicle', 'velvet', 'vendor', 'venture', 'venue', 'verb', 'verify', 'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory', 'video', 'view', 'village', 'vintage', 'violin', 'virtual', 'virus', 'visa', 'visit', 'visual', 'vital', 'vivid', 'vocal', 'voice', 'void', 'volcano', 'volume', 'vote', 'voyage', 'wage', 'wagon', 'wait', 'walk', 'wall', 'walnut', 'want', 'warfare', 'warm', 'warrior', 'wash', 'wasp', 'waste', 'water', 'wave', 'way', 'wealth', 'weapon', 'wear', 'weasel', 'weather', 'web', 'wedding', 'weekend', 'weird', 'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when', 'where', 'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win', 'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom', 'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wood', 'wool', 'word', 'work', 'world', 'worry', 'worth', 'wrap', 'wreck', 'wrestle', 'wrist', 'write', 'wrong', 'yard', 'year', 'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo'])
-

Convert mnemonic to key

+

Convert mnemonic to key

Args

mnemonic : str
A string of space separated words representing the mnemonic.
-
wordlist : list[string], optional
+
wordlist : list[string], optional
The Word list used to generate the mnemonic. Defaults to wordlist.

Raises

-
FailedChecksumError
+
FailedChecksumError
Thrown when the checksum validation fails.

Returns

-
bytes
+
bytes
The key
-
+
-Source code + +Expand source code +
def mnemonic_to_key(mnemonic, wordlist=wordlist):
     """Convert mnemonic to key
 
@@ -346,7 +360,7 @@ 

Returns

def to_bin(arr, bytelen=8)
-

Converts an iterable object containing ascii codes to a string of the joint binary representation of each item where each of them is of length bytelen

+

Converts an iterable object containing ascii codes to a string of the joint binary representation of each item where each of them is of length bytelen

Args

arr : iterable
@@ -356,11 +370,13 @@

Args

Returns

-
string
+
string
The binary string representing the array
-
+
-Source code + +Expand source code +
def to_bin(arr, bytelen=8):
     """Converts an iterable object containing ascii codes to a string of the joint binary representation of each item where each of them is of length bytelen
 
@@ -407,9 +423,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/encryption/wordlist.html b/docs/api/jumpscale/data/encryption/wordlist.html index 75105da84..bd637df3a 100644 --- a/docs/api/jumpscale/data/encryption/wordlist.html +++ b/docs/api/jumpscale/data/encryption/wordlist.html @@ -3,15 +3,17 @@ - + jumpscale.data.encryption.wordlist API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.encryption.wordlist

-Source code + +Expand source code +
WORDS = [
     "abandon",
     "ability",
@@ -2098,9 +2102,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/fake/index.html b/docs/api/jumpscale/data/fake/index.html index 6ee3a65e0..821b48ab9 100644 --- a/docs/api/jumpscale/data/fake/index.html +++ b/docs/api/jumpscale/data/fake/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.fake API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.fake

-Source code + +Expand source code +
def export_module_as():
     from faker import Faker
     import sys
@@ -40,9 +44,11 @@ 

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
     from faker import Faker
     import sys
@@ -75,9 +81,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/hash/hash.html b/docs/api/jumpscale/data/hash/hash.html index 8b06cf5df..70471db8a 100644 --- a/docs/api/jumpscale/data/hash/hash.html +++ b/docs/api/jumpscale/data/hash/hash.html @@ -3,15 +3,17 @@ - + jumpscale.data.hash.hash API documentation - - - - - + + + + + + +
@@ -21,47 +23,49 @@

Module jumpscale.data.hash.hash

This module helps with everything related to hashing strings, bytes with popular algorithms like, md5, sha256, sha384, sha512, blake2

-
JS-NG> j.data.hash.md5("abc")                                                                       
+
JS-NG> j.data.hash.md5("abc")
 '900150983cd24fb0d6963f7d28e17f72'
 
-JS-NG> j.data.hash.sha1("abc")                                                                      
+JS-NG> j.data.hash.sha1("abc")
 'a9993e364706816aba3e25717850c26c9cd0d89d'
 
-JS-NG> j.data.hash.sha224("abc")                                                                    
+JS-NG> j.data.hash.sha224("abc")
 '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7'
 
-JS-NG> j.data.hash.sha512("abc")                                                                    
+JS-NG> j.data.hash.sha512("abc")
 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454
 d4423643ce80e2a9ac94fa54ca49f'
 
-JS-NG> j.data.hash.blake2s("abc")                                                                   
+JS-NG> j.data.hash.blake2s("abc")
 '508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982'
 
 JS-NG>
 
-Source code + +Expand source code +
"""This module helps with everything related to hashing strings, bytes with popular algorithms like, md5, sha256, sha384, sha512, blake2
 
 ```
-JS-NG> j.data.hash.md5("abc")                                                                       
+JS-NG> j.data.hash.md5("abc")
 '900150983cd24fb0d6963f7d28e17f72'
 
-JS-NG> j.data.hash.sha1("abc")                                                                      
+JS-NG> j.data.hash.sha1("abc")
 'a9993e364706816aba3e25717850c26c9cd0d89d'
 
-JS-NG> j.data.hash.sha224("abc")                                                                    
+JS-NG> j.data.hash.sha224("abc")
 '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7'
 
-JS-NG> j.data.hash.sha512("abc")                                                                    
+JS-NG> j.data.hash.sha512("abc")
 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454
 d4423643ce80e2a9ac94fa54ca49f'
 
-JS-NG> j.data.hash.blake2s("abc")                                                                   
+JS-NG> j.data.hash.blake2s("abc")
 '508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982'
 
 JS-NG>
-```  
+```
 """
 
 import hashlib
@@ -369,24 +373,23 @@ 

Module jumpscale.data.hash.hash

Functions

-def blake2b(string, encode='utf-8') +def blake2b(string, encode='utf-8')
-

create a blake2b hash string for any string

+

create a blake2b hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def blake2b(string, encode="utf-8"):
     """create a blake2b hash string for any string
 
@@ -403,24 +406,23 @@ 

Returns

-def blake2s(string, encode='utf-8') +def blake2s(string, encode='utf-8')
-

create a blake2s hash string for any string

+

create a blake2s hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def blake2s(string, encode="utf-8"):
     """create a blake2s hash string for any string
 
@@ -440,9 +442,11 @@ 

Returns

def encode_string(obj, encode)
-
+
-Source code + +Expand source code +
def encode_string(obj, encode):
     if isinstance(obj, str):
         return obj.encode(encode)
@@ -453,16 +457,15 @@ 

Returns

def get_list_files(dir_name)
-

returns a list of directories for all files in a root folder

+

returns a list of directories for all files in a root folder

Arguments

dir_name (str) : the directory of the root folder

Returns

-
-
all_files (list) : the list of directories for all files in the root folder
-
 
-
+

all_files (list) : the list of directories for all files in the root folder

-Source code + +Expand source code +
def get_list_files(dir_name):
     """returns a list of directories for all files in a root folder
 
@@ -493,17 +496,19 @@ 

Returns

def hash_alg(name, data, **kwargs)
-

create a hash object

+

create a hash object

Arguments

name (str) : name of algorithm name data (str) : data need to be hashed

Returns

-
list of byte : the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def hash_alg(name, data, **kwargs):
     """create a hash object
 
@@ -521,17 +526,19 @@ 

Returns

def hash_directory(root_dir, hash_type)
-

create hash string list for the files in a folder

+

create hash string list for the files in a folder

Arguments

root_dir (str) : the dir for the root folder hash_type (str) : the type of the hash

Returns

-
dict : the hashes dict, keys are full paths and values are hexdigests
-
 
-
+
dict
+
the hashes dict, keys are full paths and values are hexdigests
+
-Source code + +Expand source code +
def hash_directory(root_dir, hash_type):
     """create hash string list for the files in a folder
 
@@ -552,17 +559,19 @@ 

Returns

def hash_file(path, hash_type)
-

create hash string for a file

+

create hash string for a file

Arguments

path (str) : the path for the file hash_type (str) : the type of the hash

Returns

-
list of byte : the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def hash_file(path, hash_type):
     """create hash string for a file
 
@@ -584,24 +593,23 @@ 

Returns

-def md5(string, encode='utf-8') +def md5(string, encode='utf-8')
-

create a md5 hash string for any string

+

create a md5 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def md5(string, encode="utf-8"):
     """create a md5 hash string for any string
 
@@ -618,24 +626,23 @@ 

Returns

-def sha1(string, encode='utf-8') +def sha1(string, encode='utf-8')
-

create a sha1 hash string for any string

+

create a sha1 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha1(string, encode="utf-8"):
     """create a sha1 hash string for any string
 
@@ -652,24 +659,23 @@ 

Returns

-def sha224(string, encode='utf-8') +def sha224(string, encode='utf-8')
-

create a sha224 hash string for any string

+

create a sha224 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha224(string, encode="utf-8"):
     """create a sha224 hash string for any string
 
@@ -686,24 +692,23 @@ 

Returns

-def sha256(string, encode='utf-8') +def sha256(string, encode='utf-8')
-

create a sha256 hash string for any string

+

create a sha256 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha256(string, encode="utf-8"):
     """create a sha256 hash string for any string
 
@@ -720,24 +725,23 @@ 

Returns

-def sha384(string, encode='utf-8') +def sha384(string, encode='utf-8')
-

create a sha384 hash string for any string

+

create a sha384 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha384(string, encode="utf-8"):
     """create a sha384 hash string for any string
 
@@ -754,24 +758,23 @@ 

Returns

-def sha3_224(string, encode='utf-8') +def sha3_224(string, encode='utf-8')
-

create a sha3_224 hash string for any string

+

create a sha3_224 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha3_224(string, encode="utf-8"):
     """create a sha3_224 hash string for any string
 
@@ -788,24 +791,23 @@ 

Returns

-def sha3_256(string, encode='utf-8') +def sha3_256(string, encode='utf-8')
-

create a sha3_256 hash string for any string

+

create a sha3_256 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha3_256(string, encode="utf-8"):
     """create a sha3_256 hash string for any string
 
@@ -822,24 +824,23 @@ 

Returns

-def sha3_384(string, encode='utf-8') +def sha3_384(string, encode='utf-8')
-

create a sha3_384 hash string for any string

+

create a sha3_384 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha3_384(string, encode="utf-8"):
     """create a sha3_384 hash string for any string
 
@@ -856,24 +857,23 @@ 

Returns

-def sha3_512(string, encode='utf-8') +def sha3_512(string, encode='utf-8')
-

create a sha3_512 hash string for any string

+

create a sha3_512 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha3_512(string, encode="utf-8"):
     """create a sha3_512 hash string for any string
 
@@ -890,24 +890,23 @@ 

Returns

-def sha512(string, encode='utf-8') +def sha512(string, encode='utf-8')
-

create a sha512 hash string for any string

+

create a sha512 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def sha512(string, encode="utf-8"):
     """create a sha512 hash string for any string
 
@@ -924,24 +923,23 @@ 

Returns

-def shake_128(string, encode='utf-8') +def shake_128(string, encode='utf-8')
-

create a shake_128 hash string for any string

+

create a shake_128 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def shake_128(string, encode="utf-8"):
     """create a shake_128 hash string for any string
 
@@ -958,24 +956,23 @@ 

Returns

-def shake_256(string, encode='utf-8') +def shake_256(string, encode='utf-8')
-

create a shake_256 hash string for any string

+

create a shake_256 hash string for any string

Arguments

-
-
string : str
-
the string need to be hashed
-
+

string (str): the string need to be hashed

Keyword Arguments: encode (str): the encoding for the string (default: {"utf-8"})

Returns

-
list of byte: the hash bytes
-
 
-
+
list of byte
+
the hash bytes
+
-Source code + +Expand source code +
def shake_256(string, encode="utf-8"):
     """create a shake_256 hash string for any string
 
@@ -1034,9 +1031,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/hash/index.html b/docs/api/jumpscale/data/hash/index.html index b7cdac903..4f09762a4 100644 --- a/docs/api/jumpscale/data/hash/index.html +++ b/docs/api/jumpscale/data/hash/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.hash API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.hash

-Source code + +Expand source code +
from .hash import *
@@ -30,7 +34,7 @@

Sub-modules

jumpscale.data.hash.hash
-

This module helps with everything related to hashing strings, bytes with popular algorithms like, md5, sha256, sha384, sha512, blake2 …

+

This module helps with everything related to hashing strings, bytes with popular algorithms like, md5, sha256, sha384, sha512, blake2 …

@@ -61,9 +65,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/idgenerator/idgenerator.html b/docs/api/jumpscale/data/idgenerator/idgenerator.html index 271354d4a..e8bd397c4 100644 --- a/docs/api/jumpscale/data/idgenerator/idgenerator.html +++ b/docs/api/jumpscale/data/idgenerator/idgenerator.html @@ -3,15 +3,17 @@ - + jumpscale.data.idgenerator.idgenerator API documentation - - - - - + + + + + + +
@@ -21,39 +23,41 @@

Module jumpscale.data.idgenerator.idgenerator

idgenerator module helps with generating ids, guids, integers, chars, passwords, capnp id, a choice of a sequence

-
JS-NG> j.data.idgenerator.guid()                                                                    
+
JS-NG> j.data.idgenerator.guid()
 'c1d14970-f17f-49a3-aa85-f722013ee448'
 
-JS-NG> j.data.idgenerator.password(5)                                                               
+JS-NG> j.data.idgenerator.password(5)
 'b6~Sl'
 
-JS-NG> j.data.idgenerator.capnp_id()                                                                
+JS-NG> j.data.idgenerator.capnp_id()
 '0xa414b890b73d0940'
 
-JS-NG> j.data.idgenerator.random_int()                                                              
+JS-NG> j.data.idgenerator.random_int()
 7
 
-JS-NG> j.data.idgenerator.random_int(0, 5)                                                          
+JS-NG> j.data.idgenerator.random_int(0, 5)
 2
 
-Source code + +Expand source code +
"""idgenerator module helps with generating ids, guids, integers, chars, passwords, capnp id, a choice of a sequence
 
 ```
-JS-NG> j.data.idgenerator.guid()                                                                    
+JS-NG> j.data.idgenerator.guid()
 'c1d14970-f17f-49a3-aa85-f722013ee448'
 
-JS-NG> j.data.idgenerator.password(5)                                                               
+JS-NG> j.data.idgenerator.password(5)
 'b6~Sl'
 
-JS-NG> j.data.idgenerator.capnp_id()                                                                
+JS-NG> j.data.idgenerator.capnp_id()
 '0xa414b890b73d0940'
 
-JS-NG> j.data.idgenerator.random_int()                                                              
+JS-NG> j.data.idgenerator.random_int()
 7
 
-JS-NG> j.data.idgenerator.random_int(0, 5)                                                          
+JS-NG> j.data.idgenerator.random_int(0, 5)
 2
 ```
 """
@@ -163,17 +167,16 @@ 

Module jumpscale.data.idgenerator.idgenerator

Functions

-def capnp_id() +def capnp_id() ‑> str
-

Generates a valid id for a capnp schema.

+

Generates a valid id for a capnp schema.

Returns

-
-
strcapnp id
-
 
-
+

str – capnp id

-Source code + +Expand source code +
def capnp_id() -> str:
     """
     Generates a valid id for a capnp schema.
@@ -186,19 +189,18 @@ 

Returns

-def chars(nchars) +def chars(nchars: int) ‑> str
-

Gets a random string with length of n

+

Gets a random string with length of n

Arguments

nchars {int} – [description]

Returns

-
-
str – [description]
-
 
-
+

str – [description]

-Source code + +Expand source code +
def chars(nchars: int) -> str:
     """Gets a random string with length of n
 
@@ -213,17 +215,16 @@ 

Returns

-def guid() +def guid() ‑> str
-

Gets a uuid4

+

Gets a uuid4

Returns

-
-
struuid4
-
 
-
+

str – uuid4

-Source code + +Expand source code +
def guid() -> str:
     """Gets a uuid4
 
@@ -237,28 +238,29 @@ 

Returns

def incrementor_id()
-
+
-Source code + +Expand source code +
def incrementor_id():
     # user redis.incr.
     raise NotImplementedError()
-def nbytes(nbytes) +def nbytes(nbytes: int) ‑> bytearray
-

return bytearray of length n

+

return bytearray of length n

Arguments

nbytes {int} – number of bytes to generate

Returns

-
-
bytearrayresult
-
 
-
+

bytearray – result

-Source code + +Expand source code +
def nbytes(nbytes: int) -> bytearray:
     """return bytearray of length n
 
@@ -275,17 +277,19 @@ 

Returns

-def nfromchoices(n, choices) +def nfromchoices(n: int, choices: List[str]) ‑> str
-

Gets string from choices list

+

Gets string from choices list

Arguments

n {int} – how many choices {List[str]} – choices to pick from

Returns

-

str – joined result of n choices.

+

str – joined result of n choices.

-Source code + +Expand source code +
def nfromchoices(n: int, choices: List[str]) -> str:
     """Gets string from choices list
 
@@ -300,19 +304,18 @@ 

Returns

-def password(nchars) +def password(nchars: int) ‑> str
-

Return a password of length nchars

+

Return a password of length nchars

Arguments

nchars {int} – [description]

Returns

-
-
strpassword()
-
 
-
+

str – password

-Source code + +Expand source code +
def password(nchars: int) -> str:
     """Return a password of length nchars
 
@@ -327,20 +330,19 @@ 

Returns

-def random_int(from_=0, to=10) +def random_int(from_: int = 0, to: int = 10) ‑> int
-

Generate random int within range from_, to

+

Generate random int within range from_, to

Arguments

from_ {int} – lower limit, default 0 to {int} – upper limit

Returns

-
-
intrandom number
-
 
-
+

int – random number

-Source code + +Expand source code +
def random_int(from_: int = 0, to: int = 10) -> int:
     """Generate random int within range from_, to
 
@@ -386,9 +388,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/idgenerator/index.html b/docs/api/jumpscale/data/idgenerator/index.html index d74d8d944..0f6bf97c4 100644 --- a/docs/api/jumpscale/data/idgenerator/index.html +++ b/docs/api/jumpscale/data/idgenerator/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.idgenerator API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.idgenerator

-Source code + +Expand source code +
from .idgenerator import *
@@ -30,7 +34,7 @@

Sub-modules

jumpscale.data.idgenerator.idgenerator
-

idgenerator module helps with generating ids, guids, integers, chars, passwords, capnp id, a choice of a sequence …

+

idgenerator module helps with generating ids, guids, integers, chars, passwords, capnp id, a choice of a sequence …

@@ -61,9 +65,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/index.html b/docs/api/jumpscale/data/index.html index 6f8d5236d..a68fa6036 100644 --- a/docs/api/jumpscale/data/index.html +++ b/docs/api/jumpscale/data/index.html @@ -3,15 +3,17 @@ - + jumpscale.data API documentation - - - - - + + + + + + +
@@ -26,73 +28,73 @@

Sub-modules

jumpscale.data.bcdb
-
+
jumpscale.data.cache
-
+
jumpscale.data.encryption
-
+
jumpscale.data.fake
-
+
jumpscale.data.hash
-
+
jumpscale.data.idgenerator
-
+
jumpscale.data.inifile
-
+
jumpscale.data.nacl
-
+
jumpscale.data.platform
-

This module helps with getting all of the information of the platform related to the machine hosting js-ng …

+

This module helps with getting all of the information of the platform related to the machine hosting js-ng …

jumpscale.data.random_names
-

This module helps genearting random names, mainly for container names …

+

This module helps genearting random names, mainly for container names …

jumpscale.data.schema
-
+
jumpscale.data.serializers
-

This module does all the work for serialization/deserialization around pickle, base64, json, msgpack, pickle, dill, toml +

This module does all the work for serialization/deserialization around pickle, base64, json, msgpack, pickle, dill, toml ``` -JS-NG> obj = …

+JS-NG> obj = …

jumpscale.data.tarfile
-
+
jumpscale.data.terminaltable
-

This module helps around creation of terminal tables …

+

This module helps around creation of terminal tables …

jumpscale.data.text
-

helpers around string manipulation …

+

helpers around string manipulation …

jumpscale.data.time
-

Time helpers based on arrow …

+

Time helpers based on arrow …

jumpscale.data.types
-
+
@@ -139,9 +141,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/inifile/index.html b/docs/api/jumpscale/data/inifile/index.html index f4f86ad72..8cdcbcbc9 100644 --- a/docs/api/jumpscale/data/inifile/index.html +++ b/docs/api/jumpscale/data/inifile/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.inifile API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.inifile

-Source code + +Expand source code +
from .inifile import *
@@ -30,7 +34,7 @@

Sub-modules

jumpscale.data.inifile.inifile
-
+
@@ -61,9 +65,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/inifile/inifile.html b/docs/api/jumpscale/data/inifile/inifile.html index 779364475..914549b2a 100644 --- a/docs/api/jumpscale/data/inifile/inifile.html +++ b/docs/api/jumpscale/data/inifile/inifile.html @@ -3,15 +3,17 @@ - + jumpscale.data.inifile.inifile API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.inifile.inifile

-Source code + +Expand source code +
from configparser import ConfigParser
 
 
@@ -177,11 +181,13 @@ 

Classes

(path)
-

the IniFile object parses the content of the file provided by the path argument

+

the IniFile object parses the content of the file provided by the path argument

Args

-

path (str) : the path to file.ini

+

path (str) : the path to file.ini

-Source code + +Expand source code +
class IniFile:
     """
     the IniFile object parses the content of the file provided by the path argument
@@ -325,13 +331,15 @@ 

Methods

def add_property(self, section_name, property_key, property_value)
-

add new property to the file

+

add new property to the file

Args

section_name (str) : the section name property_key (str) : the name of the property -property_value (str) : the value of the property

+property_value (str) : the value of the property

-Source code + +Expand source code +
def add_property(self, section_name, property_key, property_value):
     """
     add new property to the file
@@ -347,11 +355,13 @@ 

Args

def add_section(self, section_name)
-

add an empty section to the file

+

add an empty section to the file

Args

-

section_name (str) : the section name

+

section_name (str) : the section name

-Source code + +Expand source code +
def add_section(self, section_name):
     """
     add an empty section to the file
@@ -365,17 +375,16 @@ 

Args

def check_property(self, section_name, property_name)
-

check the existence of the property in section

+

check the existence of the property in section

Args

section_name (str) : the name of the section where the property is property_name (str) : the property wanted to check

Returns

-
-
boolen expresion
-
 
-
+

boolen expresion

-Source code + +Expand source code +
def check_property(self, section_name, property_name):
     """
     check the existence of the property in section
@@ -392,16 +401,15 @@ 

Returns

def check_section(self, section_name)
-

check the existence of the section

+

check the existence of the section

Args

section_name (str) : the section wanted to check

Returns

-
-
boolen expresion
-
 
-
+

boolen expresion

-Source code + +Expand source code +
def check_section(self, section_name):
     """
     check the existence of the section
@@ -417,17 +425,16 @@ 

Returns

def get_boolen(self, section_name, property_name)
-

gat the value of property as boolen

+

gat the value of property as boolen

Args

section_name (str) : the name of the section where the property is property_name (str) : the property wanted to get its value

Returns

-
-
boolen of the value
-
 
-
+

boolen of the value

-Source code + +Expand source code +
def get_boolen(self, section_name, property_name):
     """
     gat the value of property as boolen
@@ -444,17 +451,16 @@ 

Returns

def get_float(self, section_name, property_name)
-

gat the value of property as float

+

gat the value of property as float

Args

section_name (str) : the name of the section where the property is property_name (str) : the property wanted to get its value

Returns

-
-
float of the value
-
 
-
+

float of the value

-Source code + +Expand source code +
def get_float(self, section_name, property_name):
     """
     gat the value of property as float
@@ -471,17 +477,16 @@ 

Returns

def get_int(self, section_name, property_name)
-

gat the value of property as int

+

gat the value of property as int

Args

section_name (str) : the name of the section where the property is property_name (str) : the property wanted to get its value

Returns

-
-
int of the value
-
 
-
+

int of the value

-Source code + +Expand source code +
def get_int(self, section_name, property_name):
     """
     gat the value of property as int
@@ -498,16 +503,15 @@ 

Returns

def get_properties(self, section_name)
-

get the properties name under the provided section

+

get the properties name under the provided section

Args

section_name (str) : the section name which contains the properties

Returns

-
-
list of all the properties under the section
-
 
-
+

list of all the properties under the section

-Source code + +Expand source code +
def get_properties(self, section_name):
     """
     get the properties name under the provided section
@@ -523,14 +527,13 @@ 

Returns

def get_sections(self)
-

search the file for sections names

+

search the file for sections names

Returns

-
-
a list of the sections
-
 
-
+

a list of the sections

-Source code + +Expand source code +
def get_sections(self):
     """
     search the file for sections names
@@ -544,17 +547,16 @@ 

Returns

def get_value(self, section_name, property_name)
-

gat the value of property as string

+

gat the value of property as string

Args

section_name (str) : the name of the section where the property is property_name (str) : the property wanted to get its value

Returns

-
-
string of the value
-
 
-
+

string of the value

-Source code + +Expand source code +
def get_value(self, section_name, property_name):
     """
     gat the value of property as string
@@ -571,12 +573,14 @@ 

Returns

def remove_property(self, section_name, property_name)
-

delete a property from section

+

delete a property from section

Args

section_name (str) : the section name -property_key (str) : the name of the property

+property_key (str) : the name of the property

-Source code + +Expand source code +
def remove_property(self, section_name, property_name):
     """
     delete a property from section
@@ -591,11 +595,13 @@ 

Args

def remove_section(self, section_name)
-

delete a section and its properties

+

delete a section and its properties

Args

-

section_name (str) : the section name

+

section_name (str) : the section name

-Source code + +Expand source code +
def remove_section(self, section_name):
     """
     delete a section and its properties
@@ -609,9 +615,11 @@ 

Args

def write(self)
-

apply all the changes to the file

+

apply all the changes to the file

-Source code + +Expand source code +
def write(self):
     """
     apply all the changes to the file
@@ -662,9 +670,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/nacl/index.html b/docs/api/jumpscale/data/nacl/index.html index f434e8579..b163331b7 100644 --- a/docs/api/jumpscale/data/nacl/index.html +++ b/docs/api/jumpscale/data/nacl/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.nacl API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.nacl

-Source code + +Expand source code +
from io import BytesIO
 from jumpscale.data.serializers.json import dumps
 from .jsnacl import *
@@ -51,7 +55,7 @@ 

Sub-modules

jumpscale.data.nacl.jsnacl
-
+
@@ -64,9 +68,11 @@

Functions

def payload_build(self, *args)
-

build a bytesIO buffer with all arguments serialized to somethign repeatable

+

build a bytesIO buffer with all arguments serialized to somethign repeatable

-Source code + +Expand source code +
def payload_build(self, *args):
     """
     build a bytesIO buffer with all arguments serialized to somethign repeatable
@@ -116,9 +122,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/nacl/jsnacl.html b/docs/api/jumpscale/data/nacl/jsnacl.html index f4bcc1ce5..36232fe5d 100644 --- a/docs/api/jumpscale/data/nacl/jsnacl.html +++ b/docs/api/jumpscale/data/nacl/jsnacl.html @@ -3,15 +3,17 @@ - + jumpscale.data.nacl.jsnacl API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.nacl.jsnacl

-Source code + +Expand source code +
import binascii
 import nacl.utils
 
@@ -197,16 +201,18 @@ 

Classes

(private_key=None, symmetric_key=None)
-

Constructor for nacl object

+

Constructor for nacl object

Args

private_key : bytes, optional
The private key used to sign and encrypt the data. Generated randomly if not given.
symmetric_key : bytes, optional
The key used for symmetric encryption. Generated randomly if not given.
-
+
-Source code + +Expand source code +
class NACL:
     KEY_SIZE = 32
 
@@ -362,7 +368,7 @@ 

Class variables

var KEY_SIZE
-
+

Methods

@@ -371,7 +377,7 @@

Methods

def decrypt(self, message, sender_public_key)
-

Decrypt a received message. (public key encryption)

+

Decrypt a received message. (public key encryption)

Args

message : bytes
@@ -381,11 +387,13 @@

Args

Returns

-
bytes
+
bytes
The decrypted message
-
+
-Source code + +Expand source code +
def decrypt(self, message, sender_public_key):
     """Decrypt a received message. (public key encryption)
 
@@ -403,7 +411,7 @@ 

Returns

def decrypt_symmetric(self, message, symmetric_key)
-

Decrypt the receiver message. (secret key encryption)

+

Decrypt the receiver message. (secret key encryption)

Args

message : bytes
@@ -411,11 +419,13 @@

Args

Returns

-
bytes
+
bytes
The decrypted message
-
+
-Source code + +Expand source code +
def decrypt_symmetric(self, message, symmetric_key):
     """Decrypt the receiver message. (secret key encryption)
 
@@ -432,7 +442,7 @@ 

Returns

def encrypt(self, message, reciever_public_key)
-

Encrypt the message to send to a receiver. (public key encryption)

+

Encrypt the message to send to a receiver. (public key encryption)

Args

message : bytes
@@ -442,11 +452,13 @@

Args

Returns

-
bytes
+
bytes
The encrypted message
-
+
-Source code + +Expand source code +
def encrypt(self, message, reciever_public_key):
     """Encrypt the message to send to a receiver. (public key encryption)
 
@@ -464,7 +476,7 @@ 

Returns

def encrypt_symmetric(self, message)
-

Encrypt the message to send to a receiver. (secret key encryption)

+

Encrypt the message to send to a receiver. (secret key encryption)

Args

message : bytes
@@ -472,11 +484,13 @@

Args

Returns

-
bytes
+
bytes
The encrypted message
-
+
-Source code + +Expand source code +
def encrypt_symmetric(self, message):
     """Encrypt the message to send to a receiver. (secret key encryption)
 
@@ -493,14 +507,16 @@ 

Returns

def get_private_key(self)
-

Getter for the private key.

+

Getter for the private key.

Returns

-
bytes
+
bytes
The private key.
-
+
-Source code + +Expand source code +
def get_private_key(self):
     """Getter for the private key.
 
@@ -514,14 +530,16 @@ 

Returns

def get_public_key(self)
-

Getter for the public key.

+

Getter for the public key.

Returns

-
bytes
+
bytes
The public key.
-
+
-Source code + +Expand source code +
def get_public_key(self):
     """Getter for the public key.
 
@@ -535,9 +553,11 @@ 

Returns

def get_public_key_hex(self)
-
+
-Source code + +Expand source code +
def get_public_key_hex(self):
     return binascii.hexlify(self.public_key.encode()).decode()
@@ -546,14 +566,16 @@

Returns

def get_signing_seed(self)
-

Returns the signing seed (same as the private key).

+

Returns the signing seed (same as the private key).

Returns

-
bytes
+
bytes
The 32-bit signing key.
-
+
-Source code + +Expand source code +
def get_signing_seed(self):
     """Returns the signing seed (same as the private key).
 
@@ -567,14 +589,16 @@ 

Returns

def get_symmetric_key(self)
-

Getter for the symmetric key.

+

Getter for the symmetric key.

Returns

-
bytes
+
bytes
The symmetric key.
-
+
-Source code + +Expand source code +
def get_symmetric_key(self):
     """Getter for the symmetric key.
 
@@ -588,14 +612,16 @@ 

Returns

def get_verification_key(self)
-

Returns the verification key.

+

Returns the verification key.

Returns

-
bytes
+
bytes
The verification key.
-
+
-Source code + +Expand source code +
def get_verification_key(self):
     """Returns the verification key.
 
@@ -609,9 +635,11 @@ 

Returns

def get_verify_key_hex(self)
-
+
-Source code + +Expand source code +
def get_verify_key_hex(self):
     return binascii.hexlify(self.verify_key.encode()).decode()
@@ -620,16 +648,21 @@

Returns

def sign(self, message)
-

Sign the message and return the messsage and the signature.

+

Sign the message and return the messsage and the signature.

Args

message : bytes
The message to be signed

Returns

-

bytes, bytes: The message and the signature.

+
+
bytes, bytes
+
The message and the signature.
+
-Source code + +Expand source code +
def sign(self, message):
     """Sign the message and return the messsage and the signature.
 
@@ -647,7 +680,7 @@ 

Returns

def sign_hex(self, message)
-

Sign the message and return the messsage and the signature.

+

Sign the message and return the messsage and the signature.

Args

message : bytes
@@ -655,11 +688,13 @@

Args

Returns

-
bytes
+
bytes
The message and the signature.
-
+
-Source code + +Expand source code +
def sign_hex(self, message):
     """Sign the message and return the messsage and the signature.
 
@@ -678,7 +713,7 @@ 

Returns

def verify(self, message, signature, verification_key)
-

Verify that the signature using the verification key

+

Verify that the signature using the verification key

Args

message : bytes
@@ -690,11 +725,13 @@

Args

Returns

-
bool
+
bool
True if the verification succeeds.
-
+
-Source code + +Expand source code +
def verify(self, message, signature, verification_key):
     """Verify that the signature using the verification key
 
@@ -757,9 +794,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/platform/index.html b/docs/api/jumpscale/data/platform/index.html index fd8ac1b0e..0b7e62557 100644 --- a/docs/api/jumpscale/data/platform/index.html +++ b/docs/api/jumpscale/data/platform/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.platform API documentation - - - - - + + + + + + +
@@ -81,7 +83,9 @@

Get the complete profile info

-Source code + +Expand source code +
"""This module helps with getting all of the information of the platform related to the machine hosting js-ng
 
 
@@ -168,7 +172,7 @@ 

Get the complete profile info

import os import sys import time -import pprint +import json import random import socket import struct @@ -367,63 +371,13 @@

Get the complete profile info

return ret -_real_safe_repr = pprint._safe_repr - - -def _fake_json_dumps(val, indent=2): - # never do this. this is a hack for Python 2.4. Python 2.5 added - # the json module for a reason. - def _fake_safe_repr(*a, **kw): - res, is_read, is_rec = _real_safe_repr(*a, **kw) - if res == "None": - res = "null" - if res == "True": - res = "true" - if res == "False": - res = "false" - if not (res.startswith("'") or res.startswith("u'")): - res = res - else: - if res.startswith("u"): - res = res[1:] - - contents = res[1:-1] - contents = contents.replace('"', "").replace(r"\"", "") - res = '"' + contents + '"' - return res, is_read, is_rec - - pprint._safe_repr = _fake_safe_repr - try: - ret = pprint.pformat(val, indent=indent) - finally: - pprint._safe_repr = _real_safe_repr - - return ret - - def get_profile_json(indent=False): + data_dict = get_profile() + if indent: - indent = 2 + return json.dumps(data_dict, sort_keys=True, indent=2) else: - indent = 0 - try: - import json - - def dumps(val, indent): - if indent: - return json.dumps(val, sort_keys=True, indent=indent) - return json.dumps(val, sort_keys=True) - - except ImportError: - - def dumps(val, indent): - ret = _fake_json_dumps(val, indent=indent) - if not indent: - ret = re.sub("\n\s*", " ", ret) - return ret - - data_dict = get_profile() - return dumps(data_dict, indent) + return json.dumps(data_dict, sort_keys=True) def _escape_shell_args(args, sep=" ", style=None): @@ -531,20 +485,22 @@

Functions

def get_profile(scrub=False)
-

The main entrypoint to platform. Calling this will return a +

The main entrypoint to platform. Calling this will return a JSON-serializable dictionary of information about the current process. It is very unlikely that the information returned will change during the lifetime of the process, and in most cases the majority of the information stays the same between runs as well. -:func:get_profile() takes one optional keyword argument, scrub, +:func:get_profile() takes one optional keyword argument, scrub, a :class:bool that, if True, blanks out identifiable information. This includes current working directory, hostname, Python executable path, command-line arguments, and username. Values are replaced with '-', but for compatibility keys -remain in place.

+remain in place.

-Source code + +Expand source code +
def get_profile(scrub=False):
     """The main entrypoint to platform. Calling this will return a
     JSON-serializable dictionary of information about the current
@@ -610,41 +566,29 @@ 

Functions

def get_profile_json(indent=False)
-
+
-Source code + +Expand source code +
def get_profile_json(indent=False):
+    data_dict = get_profile()
+
     if indent:
-        indent = 2
+        return json.dumps(data_dict, sort_keys=True, indent=2)
     else:
-        indent = 0
-    try:
-        import json
-
-        def dumps(val, indent):
-            if indent:
-                return json.dumps(val, sort_keys=True, indent=indent)
-            return json.dumps(val, sort_keys=True)
-
-    except ImportError:
-
-        def dumps(val, indent):
-            ret = _fake_json_dumps(val, indent=indent)
-            if not indent:
-                ret = re.sub("\n\s*", " ", ret)
-            return ret
-
-    data_dict = get_profile()
-    return dumps(data_dict, indent)
+ return json.dumps(data_dict, sort_keys=True)
def get_python_info()
-
+
-Source code + +Expand source code +
def get_python_info():
     ret = {}
     ret["argv"] = _escape_shell_args(sys.argv)
@@ -680,9 +624,11 @@ 

Functions

def is_linux()
-
+
-Source code + +Expand source code +
def is_linux():
     return sys.platform.lower() == "linux"
@@ -691,9 +637,11 @@

Functions

def is_osx()
-
+
-Source code + +Expand source code +
def is_osx():
     return sys.platform.lower() == "darwin"
@@ -702,9 +650,11 @@

Functions

def is_unix()
-
+
-Source code + +Expand source code +
def is_unix():
     return is_linux() or is_osx()
@@ -746,9 +696,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/random_names/index.html b/docs/api/jumpscale/data/random_names/index.html index 25d2e0502..fc560f5e3 100644 --- a/docs/api/jumpscale/data/random_names/index.html +++ b/docs/api/jumpscale/data/random_names/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.random_names API documentation - - - - - + + + + + + +
@@ -21,21 +23,23 @@

Module jumpscale.data.random_names

This module helps genearting random names, mainly for container names.

-
JS-NG> j.data.random_names.random_name()                                                            
+
JS-NG> j.data.random_names.random_name()
 'loving_borg'
 
-JS-NG> j.data.random_names.random_name()                                                            
+JS-NG> j.data.random_names.random_name()
 'quirky_wiles'
 
-Source code + +Expand source code +
"""This module helps genearting random names, mainly for container names.
 
 ```
-JS-NG> j.data.random_names.random_name()                                                            
+JS-NG> j.data.random_names.random_name()
 'loving_borg'
 
-JS-NG> j.data.random_names.random_name()                                                            
+JS-NG> j.data.random_names.random_name()
 'quirky_wiles'
 ```
 
@@ -228,9 +232,11 @@ 

Functions

def random_name()
-

Returns a random name "first name" & "last name

+

Returns a random name "first name" & "last name

-Source code + +Expand source code +
def random_name():
     """ Returns a random name "first name" & "last name """
 
@@ -264,9 +270,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/schema/index.html b/docs/api/jumpscale/data/schema/index.html index 5ff99ae27..72936a644 100644 --- a/docs/api/jumpscale/data/schema/index.html +++ b/docs/api/jumpscale/data/schema/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.schema API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.schema

-Source code + +Expand source code +
from .schema import *
@@ -30,7 +34,7 @@

Sub-modules

jumpscale.data.schema.schema
-
+

@@ -61,9 +65,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/schema/schema.html b/docs/api/jumpscale/data/schema/schema.html index f9d63a493..772a2448d 100644 --- a/docs/api/jumpscale/data/schema/schema.html +++ b/docs/api/jumpscale/data/schema/schema.html @@ -3,15 +3,17 @@ - + jumpscale.data.schema.schema API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.schema.schema

-Source code + +Expand source code +
import re
 from jumpscale.loader import j
 
@@ -299,7 +303,7 @@ 

Functions

def parse_schema(text)
-

Parses a schema from string.

+

Parses a schema from string.

Args

text : str
@@ -307,16 +311,18 @@

Args

Raises

-
RuntimeError
+
RuntimeError
Thrown when the schema can't be parsed.

Returns

-
Schema
+
Schema
Schema object representing the schema.
-
+
-Source code + +Expand source code +
def parse_schema(text):
     """Parses a schema from string.
 
@@ -352,9 +358,11 @@ 

Returns

def pascalify_name(name)
-
+
-Source code + +Expand source code +
def pascalify_name(name):
     return "".join([x.capitalize() for x in name.replace("_", "-").split("-")])
@@ -368,9 +376,11 @@

Classes

class Property
-
+
-Source code + +Expand source code +
class Property:
     def __init__(self):
         self.index = False
@@ -409,9 +419,11 @@ 

Static methods

def get_id_prop()
-
+
-Source code + +Expand source code +
@classmethod
 def get_id_prop(cls):
     prop = cls()
@@ -426,9 +438,11 @@ 

Instance variables

var url_to_class_name
-
+
-Source code + +Expand source code +
@property
 def url_to_class_name(self):
     url = self.defaultvalue
@@ -442,9 +456,11 @@ 

Instance variables

class Schema
-
+
-Source code + +Expand source code +
class Schema:
     def __init__(self):
         self.url = ""
@@ -478,9 +494,11 @@ 

Instance variables

var url_to_class_name
-
+
-Source code + +Expand source code +
@property
 def url_to_class_name(self):
     return "".join(x.capitalize() for x in self.url.split("."))
@@ -493,9 +511,11 @@

Methods

def get_classes_required(self)
-
+
-Source code + +Expand source code +
def get_classes_required(self):
     classes = []
     for prop_name, prop in self.props.items():
@@ -508,9 +528,11 @@ 

Methods

def get_dependencies(self)
-
+
-Source code + +Expand source code +
def get_dependencies(self):
 
     return {enum: self.get_enums_required(), classes: self.get_classes_requireds()}
@@ -520,9 +542,11 @@

Methods

def get_enums_required(self)
-
+
-Source code + +Expand source code +
def get_enums_required(self):
     enums = []
     for prop_name, prop in self.props.items():
@@ -578,9 +602,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/base64.html b/docs/api/jumpscale/data/serializers/base64.html index a13d4607b..8ca88ae5c 100644 --- a/docs/api/jumpscale/data/serializers/base64.html +++ b/docs/api/jumpscale/data/serializers/base64.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.base64 API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.serializers.base64

-Source code + +Expand source code +
import base64
 
 
@@ -66,13 +70,15 @@ 

Functions

def decode(b)
-

decode base64 bytes to original obj

+

decode base64 bytes to original obj

Arguments

b (bytes) : the bytes will be decoded

Returns

-

(string) : the decoded string

+

(string) : the decoded string

-Source code + +Expand source code +
def decode(b):
     """decode base64 bytes to original obj
 
@@ -91,16 +97,18 @@ 

Returns

def encode(s)
-

encode string with base64 algorithm

+

encode string with base64 algorithm

Arguments

s (string) : the string will be encoded

Returns

-
bytes : the encoded bytes
-
 
-
+
bytes
+
the encoded bytes
+

-Source code + +Expand source code +
def encode(s):
     """encode string with base64 algorithm
 
@@ -143,9 +151,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/dill.html b/docs/api/jumpscale/data/serializers/dill.html index df3e31e13..ed9d9753a 100644 --- a/docs/api/jumpscale/data/serializers/dill.html +++ b/docs/api/jumpscale/data/serializers/dill.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.dill API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.serializers.dill

-Source code + +Expand source code +
from dill import dumps, dump, loads, load
@@ -49,9 +53,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/index.html b/docs/api/jumpscale/data/serializers/index.html index e93d754b5..65b75443c 100644 --- a/docs/api/jumpscale/data/serializers/index.html +++ b/docs/api/jumpscale/data/serializers/index.html @@ -3,17 +3,19 @@ - + jumpscale.data.serializers API documentation - - - - - + + + + + + +
@@ -23,18 +25,18 @@

Module jumpscale.data.serializers

This module does all the work for serialization/deserialization around pickle, base64, json, msgpack, pickle, dill, toml

-
JS-NG> obj = {"name":"username", "list":[1,3,4,7], "n":5}                                           
+
JS-NG> obj = {"name":"username", "list":[1,3,4,7], "n":5}
 
-JS-NG> j.data.serializers.json.dumps(obj)                                                           
+JS-NG> j.data.serializers.json.dumps(obj)
 '{"name": "username", "list": [1, 3, 4, 7], "n": 5}'
 
-JS-NG> j.data.serializers.toml.dumps(obj)                                                           
+JS-NG> j.data.serializers.toml.dumps(obj)
 'name = "username"
 list = [1, 3, 4, 7]
 n = 5
 '
 
-JS-NG> j.data.serializers.yaml.dumps(obj)                                                           
+JS-NG> j.data.serializers.yaml.dumps(obj)
 'list:
 - 1
 - 3
@@ -44,25 +46,27 @@ 

Module jumpscale.data.serializers

name: username ' -JS-NG> j.data.serializers.msgpack.dumps(obj) +JS-NG> j.data.serializers.msgpack.dumps(obj) b'ƒ¤name¨username¤list”¡n'
-Source code + +Expand source code +
"""This module does all the work for serialization/deserialization around pickle, base64, json, msgpack, pickle, dill, toml
 ```
-JS-NG> obj = {"name":"username", "list":[1,3,4,7], "n":5}                                           
+JS-NG> obj = {"name":"username", "list":[1,3,4,7], "n":5}
 
-JS-NG> j.data.serializers.json.dumps(obj)                                                           
+JS-NG> j.data.serializers.json.dumps(obj)
 '{"name": "username", "list": [1, 3, 4, 7], "n": 5}'
 
-JS-NG> j.data.serializers.toml.dumps(obj)                                                           
+JS-NG> j.data.serializers.toml.dumps(obj)
 'name = "username"\nlist = [1, 3, 4, 7]\nn = 5\n'
 
-JS-NG> j.data.serializers.yaml.dumps(obj)                                                           
+JS-NG> j.data.serializers.yaml.dumps(obj)
 'list:\n- 1\n- 3\n- 4\n- 7\nn: 5\nname: username\n'
 
-JS-NG> j.data.serializers.msgpack.dumps(obj)                                                        
+JS-NG> j.data.serializers.msgpack.dumps(obj)
 b'\x83\xa4name\xa8username\xa4list\x94\x01\x03\x04\x07\xa1n\x05'
 ```
 """
@@ -82,35 +86,35 @@ 

Sub-modules

jumpscale.data.serializers.base64
-
+
jumpscale.data.serializers.dill
-
+
jumpscale.data.serializers.json
-
+
jumpscale.data.serializers.lzma
-
+
jumpscale.data.serializers.msgpack
-
+
jumpscale.data.serializers.pickle
-
+
jumpscale.data.serializers.toml
-
+
jumpscale.data.serializers.yaml
-
+
@@ -148,9 +152,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/json.html b/docs/api/jumpscale/data/serializers/json.html index fada1115c..7500d904b 100644 --- a/docs/api/jumpscale/data/serializers/json.html +++ b/docs/api/jumpscale/data/serializers/json.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.json API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.serializers.json

-Source code + +Expand source code +
import json
 
 
@@ -84,16 +88,18 @@ 

Functions

def dump_to_file(file_path, obj)
-

Writes the dumped obj to a file

+

Writes the dumped obj to a file

Args

file_path : str
path to write to
obj : dict
the dict which will be dumped
-
+
-Source code + +Expand source code +
def dump_to_file(file_path, obj):
     """Writes the dumped obj to a file
 
@@ -109,16 +115,18 @@ 

Args

def dumps(obj)
-

dump dict object into json stream

+

dump dict object into json stream

Arguments

obj (dict) : the dict which will be dumped

Returns

-
string : the json stream
-
 
-
+
string
+
the json stream
+
-Source code + +Expand source code +
def dumps(obj):
     """dump dict object into json stream
 
@@ -135,14 +143,16 @@ 

Returns

def load_from_file(file_path)
-

Loads data from file to a dict

+

Loads data from file to a dict

Args

file_path : str
path of the json file
-
+
-Source code + +Expand source code +
def load_from_file(file_path):
     """Loads data from file to a dict
 
@@ -158,16 +168,18 @@ 

Args

def loads(s)
-

loads the data from json string into dict

+

loads the data from json string into dict

Arguments

s (string) : the json stream

Returns

-
dict : the loaded data from json stram
-
 
-
+
dict
+
the loaded data from json stram
+
-Source code + +Expand source code +
def loads(s):
     """loads the data from json string into dict
 
@@ -210,9 +222,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/lzma.html b/docs/api/jumpscale/data/serializers/lzma.html index 70e5c561a..1ab1838d6 100644 --- a/docs/api/jumpscale/data/serializers/lzma.html +++ b/docs/api/jumpscale/data/serializers/lzma.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.lzma API documentation - - - - - + + + + + + +
@@ -21,15 +23,17 @@

Module jumpscale.data.serializers.lzma

-Source code + +Expand source code +
import pylzma
 
 def compress(obj):
     """compress string with lzma algorithm
-    
+
     Arguments:
         obj (string) : the string will be encoded
-    
+
     Returns:
         bytes : the compressed bytes
     """
@@ -37,10 +41,10 @@ 

Module jumpscale.data.serializers.lzma

def decompress(s): """decompress lzma bytes to original obj - + Arguments: s (bytes) : the bytes will be compressed - + Returns: (string) : the decompressed string """ @@ -58,22 +62,24 @@

Functions

def compress(obj)
-

compress string with lzma algorithm

+

compress string with lzma algorithm

Arguments

obj (string) : the string will be encoded

Returns

-
bytes : the compressed bytes
-
 
-
+
bytes
+
the compressed bytes
+
-Source code + +Expand source code +
def compress(obj):
     """compress string with lzma algorithm
-    
+
     Arguments:
         obj (string) : the string will be encoded
-    
+
     Returns:
         bytes : the compressed bytes
     """
@@ -84,19 +90,21 @@ 

Returns

def decompress(s)
-

decompress lzma bytes to original obj

+

decompress lzma bytes to original obj

Arguments

s (bytes) : the bytes will be compressed

Returns

-

(string) : the decompressed string

+

(string) : the decompressed string

-Source code + +Expand source code +
def decompress(s):
     """decompress lzma bytes to original obj
-    
+
     Arguments:
         s (bytes) : the bytes will be compressed
-    
+
     Returns:
         (string) : the decompressed string
     """
@@ -129,9 +137,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/msgpack.html b/docs/api/jumpscale/data/serializers/msgpack.html index 2954160cf..bff4401c2 100644 --- a/docs/api/jumpscale/data/serializers/msgpack.html +++ b/docs/api/jumpscale/data/serializers/msgpack.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.msgpack API documentation - - - - - + + + + + + +
@@ -21,16 +23,18 @@

Module jumpscale.data.serializers.msgpack

-Source code + +Expand source code +
import msgpack
 
 
 def dumps(obj):
-    """dump dict object into msgpack stream 
-    
+    """dump dict object into msgpack stream
+
     Arguments:
-        obj (dict) : the dict which will be dumped     
-    
+        obj (dict) : the dict which will be dumped
+
     Returns:
         string : the msgpack stream
     """
@@ -39,10 +43,10 @@ 

Module jumpscale.data.serializers.msgpack

def loads(s): """loads the data from msgpack string into dict - + Arguments: s (string) : the msgpack stream - + Returns: dict : the loaded data from msgpack stram """ @@ -62,23 +66,25 @@

Functions

def dumps(obj)
-

dump dict object into msgpack stream

+

dump dict object into msgpack stream

Arguments

obj (dict) : the dict which will be dumped

Returns

-
string : the msgpack stream
-
 
-
+
string
+
the msgpack stream
+
-Source code + +Expand source code +
def dumps(obj):
-    """dump dict object into msgpack stream 
-    
+    """dump dict object into msgpack stream
+
     Arguments:
-        obj (dict) : the dict which will be dumped     
-    
+        obj (dict) : the dict which will be dumped
+
     Returns:
         string : the msgpack stream
     """
@@ -89,22 +95,24 @@ 

Returns

def loads(s)
-

loads the data from msgpack string into dict

+

loads the data from msgpack string into dict

Arguments

s (string) : the msgpack stream

Returns

-
dict : the loaded data from msgpack stram
-
 
-
+
dict
+
the loaded data from msgpack stram
+
-Source code + +Expand source code +
def loads(s):
     """loads the data from msgpack string into dict
-    
+
     Arguments:
         s (string) : the msgpack stream
-    
+
     Returns:
         dict : the loaded data from msgpack stram
     """
@@ -139,9 +147,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/pickle.html b/docs/api/jumpscale/data/serializers/pickle.html index aa12707f3..67f0663b1 100644 --- a/docs/api/jumpscale/data/serializers/pickle.html +++ b/docs/api/jumpscale/data/serializers/pickle.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.pickle API documentation - - - - - + + + + + + +
@@ -21,16 +23,18 @@

Module jumpscale.data.serializers.pickle

-Source code + +Expand source code +
import pickle
 
 
 def decompress(obj):
-    """dump pickle bytes object into string 
-    
+    """dump pickle bytes object into string
+
     Arguments:
-        obj (pickle bytes) : the pickle bytes which will be dumped     
-    
+        obj (pickle bytes) : the pickle bytes which will be dumped
+
     Returns:
         string : the string
     """
@@ -39,10 +43,10 @@ 

Module jumpscale.data.serializers.pickle

def compress(obj): """loads the data from pickle string into pickle bytes - + Arguments: obj (string) : the string - + Returns: pickle bytes : the loaded data from pickle stram """ @@ -60,22 +64,24 @@

Functions

def compress(obj)
-

loads the data from pickle string into pickle bytes

+

loads the data from pickle string into pickle bytes

Arguments

obj (string) : the string

Returns

-
pickle bytes : the loaded data from pickle stram
-
 
-
+
pickle bytes
+
the loaded data from pickle stram
+
-Source code + +Expand source code +
def compress(obj):
     """loads the data from pickle string into pickle bytes
-    
+
     Arguments:
         obj (string) : the string
-    
+
     Returns:
         pickle bytes : the loaded data from pickle stram
     """
@@ -86,23 +92,25 @@ 

Returns

def decompress(obj)
-

dump pickle bytes object into string

+

dump pickle bytes object into string

Arguments

obj (pickle bytes) : the pickle bytes which will be dumped

Returns

-
string : the string
-
 
-
+
string
+
the string
+
-Source code + +Expand source code +
def decompress(obj):
-    """dump pickle bytes object into string 
-    
+    """dump pickle bytes object into string
+
     Arguments:
-        obj (pickle bytes) : the pickle bytes which will be dumped     
-    
+        obj (pickle bytes) : the pickle bytes which will be dumped
+
     Returns:
         string : the string
     """
@@ -135,9 +143,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/toml.html b/docs/api/jumpscale/data/serializers/toml.html index 910a0f23b..e6fb92892 100644 --- a/docs/api/jumpscale/data/serializers/toml.html +++ b/docs/api/jumpscale/data/serializers/toml.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.toml API documentation - - - - - + + + + + + +
@@ -21,16 +23,18 @@

Module jumpscale.data.serializers.toml

-Source code + +Expand source code +
import pytoml
 
 
 def dumps(d):
-    """dump dict object into toml stream 
-    
+    """dump dict object into toml stream
+
     Arguments:
-        d (dict) : the dict which will be dumped     
-    
+        d (dict) : the dict which will be dumped
+
     Returns:
         string : the toml stream
     """
@@ -40,10 +44,10 @@ 

Module jumpscale.data.serializers.toml

def loads(s): """loads the data from toml string into dict - + Arguments: s (string) : the toml stream - + Returns: dict : the loaded data from toml stram """ @@ -62,23 +66,25 @@

Functions

def dumps(d)
-

dump dict object into toml stream

+

dump dict object into toml stream

Arguments

d (dict) : the dict which will be dumped

Returns

-
string : the toml stream
-
 
-
+
string
+
the toml stream
+
-Source code + +Expand source code +
def dumps(d):
-    """dump dict object into toml stream 
-    
+    """dump dict object into toml stream
+
     Arguments:
-        d (dict) : the dict which will be dumped     
-    
+        d (dict) : the dict which will be dumped
+
     Returns:
         string : the toml stream
     """
@@ -90,22 +96,24 @@ 

Returns

def loads(s)
-

loads the data from toml string into dict

+

loads the data from toml string into dict

Arguments

s (string) : the toml stream

Returns

-
dict : the loaded data from toml stram
-
 
-
+
dict
+
the loaded data from toml stram
+
-Source code + +Expand source code +
def loads(s):
     """loads the data from toml string into dict
-    
+
     Arguments:
         s (string) : the toml stream
-    
+
     Returns:
         dict : the loaded data from toml stram
     """
@@ -139,9 +147,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/serializers/yaml.html b/docs/api/jumpscale/data/serializers/yaml.html index d087d3163..e5056aa0b 100644 --- a/docs/api/jumpscale/data/serializers/yaml.html +++ b/docs/api/jumpscale/data/serializers/yaml.html @@ -3,15 +3,17 @@ - + jumpscale.data.serializers.yaml API documentation - - - - - + + + + + + +
@@ -21,16 +23,18 @@

Module jumpscale.data.serializers.yaml

-Source code + +Expand source code +
import yaml
 
 
 def dumps(obj):
-    """dump dict object into yaml stream 
-    
+    """dump dict object into yaml stream
+
     Arguments:
-        obj (dict) : the dict which will be dumped     
-    
+        obj (dict) : the dict which will be dumped
+
     Returns:
         string : the yaml stream
     """
@@ -39,10 +43,10 @@ 

Module jumpscale.data.serializers.yaml

def loads(s): """loads the data from yaml string into dict - + Arguments: s (string) : the yaml stream - + Returns: dict : the loaded data from yaml stram """ @@ -60,23 +64,25 @@

Functions

def dumps(obj)
-

dump dict object into yaml stream

+

dump dict object into yaml stream

Arguments

obj (dict) : the dict which will be dumped

Returns

-
string : the yaml stream
-
 
-
+
string
+
the yaml stream
+
-Source code + +Expand source code +
def dumps(obj):
-    """dump dict object into yaml stream 
-    
+    """dump dict object into yaml stream
+
     Arguments:
-        obj (dict) : the dict which will be dumped     
-    
+        obj (dict) : the dict which will be dumped
+
     Returns:
         string : the yaml stream
     """
@@ -87,22 +93,24 @@ 

Returns

def loads(s)
-

loads the data from yaml string into dict

+

loads the data from yaml string into dict

Arguments

s (string) : the yaml stream

Returns

-
dict : the loaded data from yaml stram
-
 
-
+
dict
+
the loaded data from yaml stram
+
-Source code + +Expand source code +
def loads(s):
     """loads the data from yaml string into dict
-    
+
     Arguments:
         s (string) : the yaml stream
-    
+
     Returns:
         dict : the loaded data from yaml stram
     """
@@ -135,9 +143,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/tarfile/index.html b/docs/api/jumpscale/data/tarfile/index.html index ef29627ba..dc82c0cba 100644 --- a/docs/api/jumpscale/data/tarfile/index.html +++ b/docs/api/jumpscale/data/tarfile/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.tarfile API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.tarfile

-Source code + +Expand source code +
from .tar_file import *
@@ -30,7 +34,7 @@

Sub-modules

jumpscale.data.tarfile.tar_file
-
+
@@ -61,9 +65,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/tarfile/tar_file.html b/docs/api/jumpscale/data/tarfile/tar_file.html index 13651f9e7..3d715f8e4 100644 --- a/docs/api/jumpscale/data/tarfile/tar_file.html +++ b/docs/api/jumpscale/data/tarfile/tar_file.html @@ -3,15 +3,17 @@ - + jumpscale.data.tarfile.tar_file API documentation - - - - - + + + + + + +
@@ -21,13 +23,15 @@

Module jumpscale.data.tarfile.tar_file

-Source code + +Expand source code +
import tarfile
 
 
 def istar(path):
     """check if the file is .tar format
-    
+
     Arguments:
         path (str) : the path for the file
     """
@@ -36,7 +40,7 @@ 

Module jumpscale.data.tarfile.tar_file

def compress(source, output): """make an archive file from directory or file - + Arguments: source (str) : the path for the file or the directory output (str) : the path for the output @@ -47,7 +51,7 @@

Module jumpscale.data.tarfile.tar_file

class Reader: """handle the reading operation on tar file - + Arguments: path (str) : the path for tar file """ @@ -86,15 +90,17 @@

Functions

def compress(source, output)
-

make an archive file from directory or file

+

make an archive file from directory or file

Arguments

source (str) : the path for the file or the directory -output (str) : the path for the output

+output (str) : the path for the output

-Source code + +Expand source code +
def compress(source, output):
     """make an archive file from directory or file
-    
+
     Arguments:
         source (str) : the path for the file or the directory
         output (str) : the path for the output
@@ -107,14 +113,16 @@ 

Arguments

def istar(path)
-

check if the file is .tar format

+

check if the file is .tar format

Arguments

-

path (str) : the path for the file

+

path (str) : the path for the file

-Source code + +Expand source code +
def istar(path):
     """check if the file is .tar format
-    
+
     Arguments:
         path (str) : the path for the file
     """
@@ -131,14 +139,16 @@ 

Classes

(path)
-

handle the reading operation on tar file

+

handle the reading operation on tar file

Arguments

-

path (str) : the path for tar file

+

path (str) : the path for tar file

-Source code + +Expand source code +
class Reader:
     """handle the reading operation on tar file
-    
+
     Arguments:
         path (str) : the path for tar file
     """
@@ -171,11 +181,13 @@ 

Methods

def extract(self, output)
-

extract all the files from the archive to a directory.

+

extract all the files from the archive to a directory.

Args

-

output (str) : the path for the output folder

+

output (str) : the path for the output folder

-Source code + +Expand source code +
def extract(self, output):
     """extract all the files from the archive to a directory.
     Args:
@@ -188,9 +200,11 @@ 

Args

def get_content(self)
-

get list of the content in tar file

+

get list of the content in tar file

-Source code + +Expand source code +
def get_content(self):
     """get list of the content in tar file"""
     return self.file.getnames()
@@ -233,9 +247,7 @@

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/terminaltable/index.html b/docs/api/jumpscale/data/terminaltable/index.html index 8742a88a1..773c49f7f 100644 --- a/docs/api/jumpscale/data/terminaltable/index.html +++ b/docs/api/jumpscale/data/terminaltable/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.terminaltable API documentation - - - - - + + + + + + +
@@ -48,10 +50,12 @@

Module jumpscale.data.terminaltable

| xmonader | +----+----------+

-Source code + +Expand source code +
"""This module helps around creation of terminal tables
 
-JS-NG> j.data.terminaltable.print_table("users", [ ["id", "name"], ["1", "ahmed"], ["2", "xmonader"]])           
+JS-NG> j.data.terminaltable.print_table("users", [ ["id", "name"], ["1", "ahmed"], ["2", "xmonader"]])
 +users----------+
 | id | name     |
 +----+----------+
@@ -59,8 +63,8 @@ 

Module jumpscale.data.terminaltable

| 2 | xmonader | +----+----------+ -JS-NG> tbl = j.data.terminaltable.create("users", [ ["id", "name"], ["1", "ahmed"], ["2", "xmonader"]]) -JS-NG> print(tbl) +JS-NG> tbl = j.data.terminaltable.create("users", [ ["id", "name"], ["1", "ahmed"], ["2", "xmonader"]]) +JS-NG> print(tbl) +users----------+ | id | name | +----+----------+ @@ -96,12 +100,14 @@

Module jumpscale.data.terminaltable

Functions

-def create(title, data, type_='ascii') +def create(title, data, type_='ascii')
-
+
-Source code + +Expand source code +
def create(title, data, type_="ascii"):
 
     table_type = TABLE_TYPES.get(type_)
@@ -114,12 +120,14 @@ 

Functions

-def print_table(title, data, type_='ascii') +def print_table(title, data, type_='ascii')
-
+
-Source code + +Expand source code +
def print_table(title, data, type_="ascii"):
     print(create(title, data, type_))
@@ -150,9 +158,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/text/index.html b/docs/api/jumpscale/data/text/index.html index 20cfaab08..e278e3f4f 100644 --- a/docs/api/jumpscale/data/text/index.html +++ b/docs/api/jumpscale/data/text/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.text API documentation - - - - - + + + + + + +
@@ -22,28 +24,30 @@

Module jumpscale.data.text

helpers around string manipulation.

Remove prefix

-
JS-NG> j.data.text.removeprefix("ahhmed", "ah")                                                                                                                                          
+
JS-NG> j.data.text.removeprefix("ahhmed", "ah")
 'hmed'
 

Remove suffix

-
JS-NG> j.data.text.removesuffix("ahhmed.3bot", ".3bot")                                                                                                                                  
+
JS-NG> j.data.text.removesuffix("ahhmed.3bot", ".3bot")
 'ahhmed'
 
-Source code + +Expand source code +
"""helpers around string manipulation.
 
 
-## Remove prefix 
+## Remove prefix
 ```
-JS-NG> j.data.text.removeprefix("ahhmed", "ah")                                                                                                                                          
+JS-NG> j.data.text.removeprefix("ahhmed", "ah")
 'hmed'
 ```
 
 ## Remove suffix
 
 ```
-JS-NG> j.data.text.removesuffix("ahhmed.3bot", ".3bot")                                                                                                                                  
+JS-NG> j.data.text.removesuffix("ahhmed.3bot", ".3bot")
 'ahhmed'
 ```
 """
@@ -90,10 +94,10 @@ 

Remove suffix

Functions

-def removeprefix(s, prefix) +def removeprefix(s: str, prefix: str) ‑> str
-

Remove a prefix string prefix from a string s.

+

Remove a prefix string prefix from a string s.

Args

s : str
@@ -103,11 +107,13 @@

Args

Returns

-
str
+
str
string without the prefix part
-
+
-Source code + +Expand source code +
def removeprefix(s: str, prefix: str) -> str:
     """Remove a prefix string `prefix` from a string `s`.
 
@@ -126,10 +132,10 @@ 

Returns

-def removesuffix(s, suffix) +def removesuffix(s: str, suffix: str) ‑> str
-

Remove a suffix string suffix from a string s.

+

Remove a suffix string suffix from a string s.

Args

s : str
@@ -139,11 +145,13 @@

Args

Returns

-
str
+
str
string without the suffix part
-
+
-Source code + +Expand source code +
def removesuffix(s: str, suffix: str) -> str:
     """Remove a suffix string `suffix` from a string `s`.
 
@@ -190,9 +198,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/time/index.html b/docs/api/jumpscale/data/time/index.html index 01e1c8cfc..d72f02b30 100644 --- a/docs/api/jumpscale/data/time/index.html +++ b/docs/api/jumpscale/data/time/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.time API documentation - - - - - + + + + + + +
@@ -22,7 +24,7 @@

Module jumpscale.data.time

Time helpers based on arrow

TODO: add more explanation here.

-
>>> j.data.time.get('2013-05-11T21:23:58.970460+07:00')
+
>>> j.data.time.get('2013-05-11T21:23:58.970460+07:00')
 <Arrow [2013-05-11T21:23:58.970460+07:00]>
 
 >>> utc = j.data.time.utcnow()
@@ -33,89 +35,82 @@ 

TODO: add more explanation here.

>>> utc <Arrow [2013-05-11T20:23:58.970460+00:00]> ->>> j.data.time.now() +>>> j.data.time.now() <Arrow [2020-04-09T10:19:19.013636+02:00]> ->>> j.data.time.now().shift(hours=15) +>>> j.data.time.now().shift(hours=15) <Arrow [2020-04-10T01:19:23.225311+02:00]> +>>> local = utc.to('US/Pacific') +>>> local +<Arrow [2013-05-11T13:23:58.970460-07:00]> - >>> local = utc.to('US/Pacific') - >>> local - <Arrow [2013-05-11T13:23:58.970460-07:00]> - - >>> local.timestamp - 1368303838 - - >>> local.format() - '2013-05-11 13:23:58 -07:00' - - >>> local.format('YYYY-MM-DD HH:mm:ss ZZ') - '2013-05-11 13:23:58 -07:00' - - >>> local.humanize() - 'an hour ago' - - >>> local.humanize(locale='ko_kr') - '1시간 전' - - - - +>>> local.timestamp +1368303838 - >>> j.data.time.utcnow() - <Arrow [2013-05-07T04:20:39.369271+00:00]> +>>> local.format() +'2013-05-11 13:23:58 -07:00' - >>> j.data.time.now() - <Arrow [2013-05-06T21:20:40.841085-07:00]> +>>> local.format('YYYY-MM-DD HH:mm:ss ZZ') +'2013-05-11 13:23:58 -07:00' - >>> j.data.time.now('US/Pacific') - <Arrow [2013-05-06T21:20:44.761511-07:00]> +>>> local.humanize() +'an hour ago' - >>> j.data.time.get(1367900664) - <Arrow [2013-05-07T04:24:24+00:00]> +>>> local.humanize(locale='ko_kr') +'1시간 전' - >>> j.data.time.get(1367900664.152325) - <Arrow [2013-05-07T04:24:24.152325+00:00]> - >>> j.data.time.get(datetime.utcnow()) - <Arrow [2013-05-07T04:24:24.152325+00:00]> +>>> j.data.time.utcnow() +<Arrow [2013-05-07T04:20:39.369271+00:00]> - >>> j.data.time.get(datetime(2013, 5, 5), 'US/Pacific') - <Arrow [2013-05-05T00:00:00-07:00]> +>>> j.data.time.now() +<Arrow [2013-05-06T21:20:40.841085-07:00]> - >>> from dateutil import tz - >>> j.data.time.get(datetime(2013, 5, 5), tz.gettz('US/Pacific')) - <Arrow [2013-05-05T00:00:00-07:00]> +>>> j.data.time.now('US/Pacific') +<Arrow [2013-05-06T21:20:44.761511-07:00]> - >>> j.data.time.get(datetime.now(tz.gettz('US/Pacific'))) - <Arrow [2013-05-06T21:24:49.552236-07:00]> +>>> j.data.time.get(1367900664) +<Arrow [2013-05-07T04:24:24+00:00]> - >>> j.data.time.get('2013-05-05 12:30:45', 'YYYY-MM-DD HH:mm:ss') - <Arrow [2013-05-05T12:30:45+00:00]> +>>> j.data.time.get(1367900664.152325) +<Arrow [2013-05-07T04:24:24.152325+00:00]> - >>> j.data.time.get('June was born in May 1980', 'MMMM YYYY') - <Arrow [1980-05-01T00:00:00+00:00]> +>>> j.data.time.get(datetime.utcnow()) +<Arrow [2013-05-07T04:24:24.152325+00:00]> +>>> j.data.time.get(datetime(2013, 5, 5), 'US/Pacific') +<Arrow [2013-05-05T00:00:00-07:00]> +>>> from dateutil import tz +>>> j.data.time.get(datetime(2013, 5, 5), tz.gettz('US/Pacific')) +<Arrow [2013-05-05T00:00:00-07:00]> +>>> j.data.time.get(datetime.now(tz.gettz('US/Pacific'))) +<Arrow [2013-05-06T21:24:49.552236-07:00]> +>>> j.data.time.get('2013-05-05 12:30:45', 'YYYY-MM-DD HH:mm:ss') +<Arrow [2013-05-05T12:30:45+00:00]> - >>> arw = j.data.time.utcnow() - >>> arw - <Arrow [2013-05-12T03:29:35.334214+00:00]> +>>> j.data.time.get('June was born in May 1980', 'MMMM YYYY') +<Arrow [1980-05-01T00:00:00+00:00]> - >>> arw.replace(hour=4, minute=40) - <Arrow [2013-05-12T04:40:35.334214+00:00]> - >>> arw.shift(weeks=+3) - <Arrow [2013-06-02T03:29:35.334214+00:00]> +>>> arw = j.data.time.utcnow() +>>> arw +<Arrow [2013-05-12T03:29:35.334214+00:00]> +>>> arw.replace(hour=4, minute=40) +<Arrow [2013-05-12T04:40:35.334214+00:00]> +>>> arw.shift(weeks=+3) +<Arrow [2013-06-02T03:29:35.334214+00:00]>
-Source code + +Expand source code +
"""
 Time helpers based on arrow
 
@@ -133,10 +128,10 @@ 

TODO: add more explanation here.

>>> utc <Arrow [2013-05-11T20:23:58.970460+00:00]> ->>> j.data.time.now() +>>> j.data.time.now() <Arrow [2020-04-09T10:19:19.013636+02:00]> ->>> j.data.time.now().shift(hours=15) +>>> j.data.time.now().shift(hours=15) <Arrow [2020-04-10T01:19:23.225311+02:00]> @@ -237,9 +232,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/types/index.html b/docs/api/jumpscale/data/types/index.html index 6f62e773b..5b640776d 100644 --- a/docs/api/jumpscale/data/types/index.html +++ b/docs/api/jumpscale/data/types/index.html @@ -3,15 +3,17 @@ - + jumpscale.data.types API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.types

-Source code + +Expand source code +
from .types import *
@@ -30,11 +34,11 @@

Sub-modules

jumpscale.data.types.pritypes
-
+
jumpscale.data.types.types
-
+
@@ -66,9 +70,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/types/pritypes.html b/docs/api/jumpscale/data/types/pritypes.html index c9dfa0051..716122332 100644 --- a/docs/api/jumpscale/data/types/pritypes.html +++ b/docs/api/jumpscale/data/types/pritypes.html @@ -3,15 +3,17 @@ - + jumpscale.data.types.pritypes API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.types.pritypes

-Source code + +Expand source code +
import ast
 
 
@@ -48,7 +52,7 @@ 

Module jumpscale.data.types.pritypes

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -60,7 +64,7 @@

Module jumpscale.data.types.pritypes

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -107,7 +111,7 @@

Module jumpscale.data.types.pritypes

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -119,7 +123,7 @@

Module jumpscale.data.types.pritypes

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -136,7 +140,7 @@

Module jumpscale.data.types.pritypes

def check(self, value): """Check whether provided string represent JSObject value. (Any string will do). - + Arguments: value (str) """ @@ -144,7 +148,7 @@

Module jumpscale.data.types.pritypes

def from_str(self, value): """Return value as is. - + Arguments: value (str) """ @@ -159,10 +163,10 @@

Module jumpscale.data.types.pritypes

def _deep_check(self, value): """Check that the value represents a list with proper elements of the specified subtype. - + Args: value (list): The list to be checked. - + Returns: Boolean: True if the list is valid. """ @@ -177,10 +181,10 @@

Module jumpscale.data.types.pritypes

def check(self, value): """Check that the value represents a list with proper elements of the specified subtype. - + Args: value (list): The list to be checked. - + Returns: Boolean: True if the list is valid. """ @@ -195,10 +199,10 @@

Module jumpscale.data.types.pritypes

def _deep_parse(self, value): """parses the subelements (if they are of different python type it's converted using the subtype parser) - + Args: value (list): The list to be parsed. - + Returns: list: The parsed list. """ @@ -213,10 +217,10 @@

Module jumpscale.data.types.pritypes

def from_str(self, value): """parses the string value into a list. - + Args: value (str): The string to be parsed. - + Returns: list: The parsed list. """ @@ -236,11 +240,11 @@

Module jumpscale.data.types.pritypes

4. "F" -> Float 5. "L.*" -> List with subtype .* 6. "" -> empty defaults to String - + Args: type_str (str): type description. default_value (any, optional): The default value. Defaults to None. - + Returns: Object: A js type object. """ @@ -263,7 +267,7 @@

Functions

def get_js_type(type_str, default_value=None)
-

Gets the js type from a string.

+

Gets the js type from a string.

  1. "S" -> String
  2. "B" -> Boolean
  3. @@ -282,11 +286,13 @@

    Args

    Returns

    -
    Object
    +
    Object
    A js type object.
    -
+
-Source code + +Expand source code +
def get_js_type(type_str, default_value=None):
     """Gets the js type from a string.
 
@@ -297,11 +303,11 @@ 

Returns

4. "F" -> Float 5. "L.*" -> List with subtype .* 6. "" -> empty defaults to String - + Args: type_str (str): type description. default_value (any, optional): The default value. Defaults to None. - + Returns: Object: A js type object. """ @@ -323,9 +329,11 @@

Classes

(default=None)
-
+
-Source code + +Expand source code +
class Boolean:
     def __init__(self, default=None):
         if not default:
@@ -360,11 +368,13 @@ 

Methods

def check(self, value)
-

Check whether provided string represent Boolean expresion

+

Check whether provided string represent Boolean expresion

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided string represent Boolean expresion
 
@@ -379,11 +389,13 @@ 

Arguments

def from_str(self, value)
-

Get the Boolean value from the string

+

Get the Boolean value from the string

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """Get the Boolean value from the string
 
@@ -405,9 +417,11 @@ 

Arguments

(default=None)
-
+
-Source code + +Expand source code +
class Float:
     def __init__(self, default=None):
         if not default:
@@ -416,7 +430,7 @@ 

Arguments

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -428,7 +442,7 @@

Arguments

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -443,14 +457,16 @@

Methods

def check(self, value)
-

Check whether provided string represent integer value

+

Check whether provided string represent integer value

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided string represent integer value
-    
+
     Arguments:
         value (str)
     """
@@ -465,14 +481,16 @@ 

Arguments

def from_str(self, value)
-

get integer value from tha string

+

get integer value from tha string

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get integer value from tha string
-    
+
     Arguments:
         value (str)
     """
@@ -489,9 +507,11 @@ 

Arguments

(default=None)
-
+
-Source code + +Expand source code +
class Integer:
     def __init__(self, default=None):
         if not default:
@@ -500,7 +520,7 @@ 

Arguments

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -512,7 +532,7 @@

Arguments

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -527,14 +547,16 @@

Methods

def check(self, value)
-

Check whether provided string represent integer value

+

Check whether provided string represent integer value

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided string represent integer value
-    
+
     Arguments:
         value (str)
     """
@@ -549,14 +571,16 @@ 

Arguments

def from_str(self, value)
-

get integer value from tha string

+

get integer value from tha string

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get integer value from tha string
-    
+
     Arguments:
         value (str)
     """
@@ -573,9 +597,11 @@ 

Arguments

(default=None)
-
+
-Source code + +Expand source code +
class JSObject:
     def __init__(self, default=None):
         default = default or ""
@@ -583,7 +609,7 @@ 

Arguments

def check(self, value): """Check whether provided string represent JSObject value. (Any string will do). - + Arguments: value (str) """ @@ -591,7 +617,7 @@

Arguments

def from_str(self, value): """Return value as is. - + Arguments: value (str) """ @@ -603,14 +629,16 @@

Methods

def check(self, value)
-

Check whether provided string represent JSObject value. (Any string will do).

+

Check whether provided string represent JSObject value. (Any string will do).

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided string represent JSObject value. (Any string will do).
-    
+
     Arguments:
         value (str)
     """
@@ -621,14 +649,16 @@ 

Arguments

def from_str(self, value)
-

Return value as is.

+

Return value as is.

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """Return value as is.
-    
+
     Arguments:
         value (str)
     """
@@ -642,9 +672,11 @@ 

Arguments

(default, subtype)
-
+
-Source code + +Expand source code +
class List:
     def __init__(self, default, subtype):
         self.subtype = subtype
@@ -653,10 +685,10 @@ 

Arguments

def _deep_check(self, value): """Check that the value represents a list with proper elements of the specified subtype. - + Args: value (list): The list to be checked. - + Returns: Boolean: True if the list is valid. """ @@ -671,10 +703,10 @@

Arguments

def check(self, value): """Check that the value represents a list with proper elements of the specified subtype. - + Args: value (list): The list to be checked. - + Returns: Boolean: True if the list is valid. """ @@ -689,10 +721,10 @@

Arguments

def _deep_parse(self, value): """parses the subelements (if they are of different python type it's converted using the subtype parser) - + Args: value (list): The list to be parsed. - + Returns: list: The parsed list. """ @@ -707,10 +739,10 @@

Arguments

def from_str(self, value): """parses the string value into a list. - + Args: value (str): The string to be parsed. - + Returns: list: The parsed list. """ @@ -725,7 +757,7 @@

Methods

def check(self, value)
-

Check that the value represents a list with proper elements of the specified subtype.

+

Check that the value represents a list with proper elements of the specified subtype.

Args

value : list
@@ -733,17 +765,19 @@

Args

Returns

-
Boolean
+
Boolean
True if the list is valid.
-
+
-Source code + +Expand source code +
def check(self, value):
     """Check that the value represents a list with proper elements of the specified subtype.
-    
+
     Args:
         value (list): The list to be checked.
-    
+
     Returns:
         Boolean: True if the list is valid.
     """
@@ -761,7 +795,7 @@ 

Returns

def from_str(self, value)
-

parses the string value into a list.

+

parses the string value into a list.

Args

value : str
@@ -769,17 +803,19 @@

Args

Returns

-
list
+
list
The parsed list.
-
+
-Source code + +Expand source code +
def from_str(self, value):
     """parses the string value into a list.
-    
+
     Args:
         value (str): The string to be parsed.
-    
+
     Returns:
         list: The parsed list.
     """
@@ -796,9 +832,11 @@ 

Returns

(default=None)
-
+
-Source code + +Expand source code +
class String:
     def __init__(self, default=None):
         if not default:
@@ -819,9 +857,11 @@ 

Methods

def check(self, value)
-

Check whether provided value is a string

+

Check whether provided value is a string

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a string"""
     return isinstance(value, str)
@@ -831,9 +871,11 @@

Methods

def from_str(self, value)
-

return string from a string (is basically no more than a check)

+

return string from a string (is basically no more than a check)

-Source code + +Expand source code +
def from_str(self, value):
     """return string from a string (is basically no more than a check)"""
     return value
@@ -910,9 +952,7 @@

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/data/types/types.html b/docs/api/jumpscale/data/types/types.html index f089f5f5a..50cc410cc 100644 --- a/docs/api/jumpscale/data/types/types.html +++ b/docs/api/jumpscale/data/types/types.html @@ -3,15 +3,17 @@ - + jumpscale.data.types.types API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.data.types.types

-Source code + +Expand source code +
import ast
 import re
 
@@ -517,7 +521,7 @@ 

Functions

def get_js_type(type_str, default_value=None)
-

Gets the js type from a string.

+

Gets the js type from a string.

  1. "S" -> String
  2. "B" -> Boolean
  3. @@ -537,11 +541,13 @@

    Args

    Returns

    -
    Object
    +
    Object
    A js type object.
    -
+
-Source code + +Expand source code +
def get_js_type(type_str, default_value=None):
     """Gets the js type from a string.
 
@@ -600,9 +606,11 @@ 

Classes

(default=None)
-
+
-Source code + +Expand source code +
class Boolean:
     def __init__(self, default=None):
         if not default:
@@ -637,11 +645,13 @@ 

Methods

def check(self, value)
-

Check whether provided string represent Boolean expresion

+

Check whether provided string represent Boolean expresion

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided string represent Boolean expresion
 
@@ -656,11 +666,13 @@ 

Arguments

def from_str(self, value)
-

Get the Boolean value from the string

+

Get the Boolean value from the string

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """Get the Boolean value from the string
 
@@ -682,9 +694,11 @@ 

Arguments

(default=None)
-

Support yyyy-mm-dd format

+

Support yyyy-mm-dd format

-Source code + +Expand source code +
class Date:
     """Support yyyy-mm-dd format"""
 
@@ -716,13 +730,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid date representation

+

Check whether provided value is a valid date representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid date representation
     Arguments:
@@ -736,13 +752,15 @@ 

Returbs

def from_str(self, value)
-

get the value from the string

+

get the value from the string

Arguments

value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get the value from the string
     Arguments:
@@ -759,9 +777,11 @@ 

Returbs

(default=None)
-

Supported format: yyyy-mm-dd hh:mm

+

Supported format: yyyy-mm-dd hh:mm

-Source code + +Expand source code +
class DateTime:
     """Supported format: yyyy-mm-dd hh:mm"""
 
@@ -793,13 +813,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid datetime representation

+

Check whether provided value is a valid datetime representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid datetime representation
     Arguments:
@@ -813,13 +835,15 @@ 

Returbs

def from_str(self, value)
-

get the value from the string

+

get the value from the string

Arguments

value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get the value from the string
     Arguments:
@@ -836,9 +860,11 @@ 

Returbs

(default=None)
-

Supported format : (n)y (n)m (n)d (n)h (n)m (n)s

+

Supported format : (n)y (n)m (n)d (n)h (n)m (n)s

-Source code + +Expand source code +
class Duration:
     """Supported format : (n)y (n)m (n)d (n)h (n)m (n)s"""
 
@@ -869,13 +895,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid duration representation

+

Check whether provided value is a valid duration representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid duration representation
     Arguments:
@@ -889,12 +917,14 @@ 

Returbs

def from_str(self, value)
-

Get the value from string +

Get the value from string value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """Get the value from string
         value (str)
@@ -910,9 +940,11 @@ 

Returbs

(default=None)
-
+
-Source code + +Expand source code +
class Email:
     def __init__(self, default=None):
         if not default:
@@ -942,13 +974,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid email representation

+

Check whether provided value is a valid email representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid email representation
     Arguments:
@@ -962,13 +996,15 @@ 

Returbs

def from_str(self, value)
-

get the value from the string

+

get the value from the string

Arguments

value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get the value from the string
     Arguments:
@@ -985,9 +1021,11 @@ 

Returbs

(default=None)
-
+
-Source code + +Expand source code +
class Float:
     def __init__(self, default=None):
         if not default:
@@ -1023,11 +1061,13 @@ 

Methods

def check(self, value)
-

Check whether provided string represent integer value

+

Check whether provided string represent integer value

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided string represent integer value
 
@@ -1045,11 +1085,13 @@ 

Arguments

def from_str(self, value)
-

get integer value from tha string

+

get integer value from tha string

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get integer value from tha string
 
@@ -1069,9 +1111,11 @@ 

Arguments

(default=None)
-
+
-Source code + +Expand source code +
class IPAddress:
     def __init__(self, default=None):
         if not default:
@@ -1106,16 +1150,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid IPaddress representation

+

Check whether provided value is a valid IPaddress representation

Arguments

value (str)

Returns

-
-
Boolean expresion
-
 
-
+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid IPaddress representation
     Arguments:
@@ -1135,16 +1178,15 @@ 

Returns

def from_str(self, value)
-

get the value from the string

+

get the value from the string

Arguments

value (str)

Returns

-
-
value (str)
-
 
-
+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get the value from the string
     Arguments:
@@ -1161,9 +1203,11 @@ 

Returns

(default=None)
-
+
-Source code + +Expand source code +
class Integer:
     def __init__(self, default=None):
         if not default:
@@ -1199,11 +1243,13 @@ 

Methods

def check(self, value)
-

Check whether provided string represent integer value

+

Check whether provided string represent integer value

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided string represent integer value
 
@@ -1221,11 +1267,13 @@ 

Arguments

def from_str(self, value)
-

get integer value from tha string

+

get integer value from tha string

Arguments

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get integer value from tha string
 
@@ -1245,9 +1293,11 @@ 

Arguments

(default=None)
-
+
-Source code + +Expand source code +
class JSObject:
     def __init__(self, default=None):
         default = default or ""
@@ -1265,9 +1315,11 @@ 

Methods

def check(self, value)
-
+
-Source code + +Expand source code +
def check(self, value):
     return True
@@ -1276,9 +1328,11 @@

Methods

def from_str(self, value)
-
+
-Source code + +Expand source code +
def from_str(self, value):
     return value
@@ -1290,9 +1344,11 @@

Methods

(default, subtype)
-
+
-Source code + +Expand source code +
class List:
     def __init__(self, default, subtype):
         self.subtype = subtype
@@ -1364,7 +1420,12 @@ 

Methods

""" # print(f"from str-> value {value}") # print(f"subtype {self.subtype}") - return object()
+ return object() + # if isinstance(self.subtype, JSObject): + # print("returning noww") + # return object() + # else: + # return self._deep_parse(ast.literal_eval(value))

Methods

@@ -1372,7 +1433,7 @@

Methods

def check(self, value)
-

Check that the value represents a list with proper elements of the specified subtype.

+

Check that the value represents a list with proper elements of the specified subtype.

Args

value : list
@@ -1380,11 +1441,13 @@

Args

Returns

-
Boolean
+
Boolean
True if the list is valid.
-
+
-Source code + +Expand source code +
def check(self, value):
     """Check that the value represents a list with proper elements of the specified subtype.
 
@@ -1408,7 +1471,7 @@ 

Returns

def from_str(self, value)
-

parses the string value into a list.

+

parses the string value into a list.

Args

value : str
@@ -1416,11 +1479,13 @@

Args

Returns

-
list
+
list
The parsed list.
-
+
-Source code + +Expand source code +
def from_str(self, value):
     """parses the string value into a list.
 
@@ -1432,7 +1497,12 @@ 

Returns

""" # print(f"from str-> value {value}") # print(f"subtype {self.subtype}") - return object()
+ return object() + # if isinstance(self.subtype, JSObject): + # print("returning noww") + # return object() + # else: + # return self._deep_parse(ast.literal_eval(value))
@@ -1442,9 +1512,11 @@

Returns

(default=None)
-
+
-Source code + +Expand source code +
class Path:
     def __init__(self, default=None):
         if not default:
@@ -1474,13 +1546,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid path representation

+

Check whether provided value is a valid path representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid path representation
     Arguments:
@@ -1494,13 +1568,15 @@ 

Returbs

def from_str(self, value)
-

get the value from the string

+

get the value from the string

Arguments

value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get the value from the string
     Arguments:
@@ -1517,9 +1593,11 @@ 

Returbs

(default=None)
-
+
-Source code + +Expand source code +
class String:
     def __init__(self, default=None):
         if not default:
@@ -1540,9 +1618,11 @@ 

Methods

def check(self, value)
-

Check whether provided value is a string

+

Check whether provided value is a string

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a string"""
     return isinstance(value, str)
@@ -1552,9 +1632,11 @@

Methods

def from_str(self, value)
-

return string from a string (is basically no more than a check)

+

return string from a string (is basically no more than a check)

-Source code + +Expand source code +
def from_str(self, value):
     """return string from a string (is basically no more than a check)"""
     return value
@@ -1567,9 +1649,11 @@

Methods

(default=None)
-
+
-Source code + +Expand source code +
class Tel:
     def __init__(self, default=None):
         if not default:
@@ -1609,13 +1693,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid Telephone number representation

+

Check whether provided value is a valid Telephone number representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid Telephone number representation
     Arguments:
@@ -1630,13 +1716,15 @@ 

Returbs

def from_str(self, value)
-

get the value from the string

+

get the value from the string

Arguments

value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get the value from the string
     Arguments:
@@ -1653,9 +1741,11 @@ 

Returbs

(default=None)
-

Supported format : hh:mm

+

Supported format : hh:mm

-Source code + +Expand source code +
class Time:
     """Supported format : hh:mm"""
 
@@ -1686,13 +1776,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid time representation

+

Check whether provided value is a valid time representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid time representation
     Arguments:
@@ -1706,12 +1798,14 @@ 

Returbs

def from_str(self, value)
-

Get the value from string +

Get the value from string value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """Get the value from string
         value (str)
@@ -1727,9 +1821,11 @@ 

Returbs

(default=None)
-
+
-Source code + +Expand source code +
class URL:
     def __init__(self, default=None):
         if not default:
@@ -1759,13 +1855,15 @@ 

Methods

def check(self, value)
-

Check whether provided value is a valid URL representation

+

Check whether provided value is a valid URL representation

Arguments

value (str)

Returbs

-

Boolean expresion

+

Boolean expresion

-Source code + +Expand source code +
def check(self, value):
     """Check whether provided value is a valid URL representation
     Arguments:
@@ -1779,13 +1877,15 @@ 

Returbs

def from_str(self, value)
-

get the value from the string

+

get the value from the string

Arguments

value (str)

Returbs

-

value (str)

+

value (str)

-Source code + +Expand source code +
def from_str(self, value):
     """get the value from the string
     Arguments:
@@ -1929,9 +2029,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/entry_points/index.html b/docs/api/jumpscale/entry_points/index.html index ba9395744..17a7e0e7e 100644 --- a/docs/api/jumpscale/entry_points/index.html +++ b/docs/api/jumpscale/entry_points/index.html @@ -3,15 +3,17 @@ - + jumpscale.entry_points API documentation - - - - - + + + + + + +
@@ -26,22 +28,22 @@

Sub-modules

jumpscale.entry_points.jsctl
-
+
jumpscale.entry_points.jsng
-
+
jumpscale.entry_points.jsync
-

jumpscale.entry_points.jsync is syncing tool to sync over certain set of directories against remote machine. +

jumpscale.entry_points.jsync is syncing tool to sync over certain set of directories against remote machine. list available clients ``` -~> poetry run jsync …

+~> poetry run jsync …

jumpscale.entry_points.usershell
-
+

@@ -75,9 +77,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/entry_points/jsctl.html b/docs/api/jumpscale/entry_points/jsctl.html index 1102955a1..75286403a 100644 --- a/docs/api/jumpscale/entry_points/jsctl.html +++ b/docs/api/jumpscale/entry_points/jsctl.html @@ -3,15 +3,17 @@ - + jumpscale.entry_points.jsctl API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.entry_points.jsctl

-Source code + +Expand source code +
import click
 
 from jumpscale.core.config import get_default_config, update_config, get_config
@@ -149,9 +153,11 @@ 

Functions

def decode_toml_value(s)
-
+
-Source code + +Expand source code +
def decode_toml_value(s):
     try:
         return toml.TomlDecoder().load_value(s)[0]
@@ -163,9 +169,11 @@ 

Functions

def encode_toml_value(s)
-
+
-Source code + +Expand source code +
def encode_toml_value(s):
     return toml.TomlEncoder().dump_value(s)
@@ -174,9 +182,11 @@

Functions

def format_config(config)
-
+
-Source code + +Expand source code +
def format_config(config):
     print_dict(config, "")
@@ -185,9 +195,11 @@

Functions

def format_config_parameter(name, value)
-
+
-Source code + +Expand source code +
def format_config_parameter(name, value):
     if isinstance(value, dict):
         print_dict(value, f"{name}.")
@@ -199,9 +211,11 @@ 

Functions

def print_dict(data, path)
-
+
-Source code + +Expand source code +
def print_dict(data, path):
     for name, value in data.items():
         if isinstance(value, dict):
@@ -215,9 +229,11 @@ 

Functions

def traverse_config(name)
-
+
-Source code + +Expand source code +
def traverse_config(name):
     path = name.split(".")
     config = get_config()
@@ -231,9 +247,11 @@ 

Functions

def validate_type(a, b)
-
+
-Source code + +Expand source code +
def validate_type(a, b):
     typea = type(a).__name__
     typeb = type(b).__name__
@@ -272,9 +290,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/entry_points/jsng.html b/docs/api/jumpscale/entry_points/jsng.html index ccf569bf5..62e1cf752 100644 --- a/docs/api/jumpscale/entry_points/jsng.html +++ b/docs/api/jumpscale/entry_points/jsng.html @@ -3,15 +3,17 @@ - + jumpscale.entry_points.jsng API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.entry_points.jsng

-Source code + +Expand source code +
from gevent import monkey
 
 monkey.patch_all(subprocess=False)  # noqa: E402
@@ -84,9 +88,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/entry_points/jsync.html b/docs/api/jumpscale/entry_points/jsync.html index e5baaf4e5..4a004024e 100644 --- a/docs/api/jumpscale/entry_points/jsync.html +++ b/docs/api/jumpscale/entry_points/jsync.html @@ -3,18 +3,20 @@ - + jumpscale.entry_points.jsync API documentation - - - - - + + + + + + +
@@ -33,7 +35,9 @@

sync with a client certain set ['xmonader'] {'~/wspace/tq': '~/wspace/tq', '/tmp/proj': '/tmp/proj2'}

-Source code + +Expand source code +
"""`jsync` is syncing tool to sync over certain set of directories against remote machine.
 ## list available clients
 ```
@@ -119,9 +123,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/entry_points/usershell.html b/docs/api/jumpscale/entry_points/usershell.html index bbd226de1..767d0895f 100644 --- a/docs/api/jumpscale/entry_points/usershell.html +++ b/docs/api/jumpscale/entry_points/usershell.html @@ -3,15 +3,17 @@ - + jumpscale.entry_points.usershell API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.entry_points.usershell

-Source code + +Expand source code +
import os
 import re
 import time
@@ -282,9 +286,11 @@ 

Functions

def get_binary_link()
-
+
-Source code + +Expand source code +
def get_binary_link():
     resp = requests.get("https://api.github.com/repos/threefoldtech/js-ng/releases/latest")
     resp = resp.json()
@@ -301,9 +307,11 @@ 

Functions

def noexpert_error(error)
-
+
-Source code + +Expand source code +
def noexpert_error(error):
     reports_location = f"{os.environ.get('HOME', os.environ.get('USERPROFILE', ''))}/sandbox/reports"
     error_file_location = f"{reports_location}/jsngreport_{time.strftime('%d%H%M%S')}.log"
@@ -321,9 +329,11 @@ 

Functions

def partition_line(line)
-
+
-Source code + +Expand source code +
def partition_line(line):
     def replacer(m):
         return m.group().replace(" ", "\0").strip("\"'")
@@ -339,9 +349,11 @@ 

Functions

def print_error(error)
-
+
-Source code + +Expand source code +
def print_error(error):
     print_formatted_text(HTML("<ansired>{}</ansired>".format(cgi.html.escape(str(error)))))
@@ -350,9 +362,11 @@

Functions

def run()
-
+
-Source code + +Expand source code +
def run():
     parser = argparse.ArgumentParser()
     parser.add_argument("--update", action="store_true", help="Update 3sdk")
@@ -371,9 +385,11 @@ 

Functions

def update()
-
+
-Source code + +Expand source code +
def update():
     print("checking for updates")
     latest_version, binary_link = get_binary_link()
@@ -399,16 +415,18 @@ 

Classes

class Shell
-

Abstract base class for an input validator.

+

Abstract base class for an input validator.

A validator is typically created in one of the following two ways:

  • Either by overriding this class and implementing the validate method.
  • Or by passing a callable to Validator.from_callable.

If the validation takes some time and needs to happen in a background -thread, this can be wrapped in a :class:.ThreadedValidator.

+thread, this can be wrapped in a :class:.ThreadedValidator.

-Source code + +Expand source code +
class Shell(Validator):
     def __init__(self):
         self._prompt = PromptSession()
@@ -552,9 +570,11 @@ 

Methods

def bottom_toolbar(self)
-
+
-Source code + +Expand source code +
def bottom_toolbar(self):
     return [("class:bottom-toolbar", self.toolbarmsg)]
@@ -563,9 +583,11 @@

Methods

def execute(self, cmd)
-
+
-Source code + +Expand source code +
def execute(self, cmd):
     if not cmd.strip():
         return
@@ -588,9 +610,11 @@ 

Methods

def get_completions_async(self, document, complete_event)
-
+
-Source code + +Expand source code +
def get_completions_async(self, document, complete_event):
     text = document.current_line_before_cursor
     parts = partition_line(text)
@@ -646,9 +670,11 @@ 

Methods

def get_func_kwargs(self, cmd)
-
+
-Source code + +Expand source code +
def get_func_kwargs(self, cmd):
     parts = partition_line(cmd)
     root, extra = parts[0], parts[1:]
@@ -664,9 +690,11 @@ 

Methods

def get_kwargs(self, func, *args)
-
+
-Source code + +Expand source code +
def get_kwargs(self, func, *args):
     funcspec = inspect.getfullargspec(func)
     kwargs = {}
@@ -686,9 +714,11 @@ 

Methods

def make_prompt(self)
-
+
-Source code + +Expand source code +
def make_prompt(self):
     root = ("class:default", "3sdk>")
     while True:
@@ -703,9 +733,11 @@ 

Methods

def prompt(self, msg)
-
+
-Source code + +Expand source code +
def prompt(self, msg):
     return self._prompt.prompt(
         msg, completer=self, validator=self, style=style, bottom_toolbar=self.bottom_toolbar,
@@ -716,11 +748,13 @@ 

Methods

def validate(self, document)
-

Validate the input. +

Validate the input. If invalid, this should raise a :class:.ValidationError.

-

:param document: :class:~prompt_toolkit.document.Document instance.

+

:param document: :class:~prompt_toolkit.document.Document instance.

-Source code + +Expand source code +
def validate(self, document):
     text = document.current_line_before_cursor
     if not text:
@@ -788,9 +822,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/index.html b/docs/api/jumpscale/index.html index 8cf46f502..bbf6a37c3 100644 --- a/docs/api/jumpscale/index.html +++ b/docs/api/jumpscale/index.html @@ -3,15 +3,17 @@ - + jumpscale API documentation - - - - - + + + + + + +
@@ -26,43 +28,43 @@

Sub-modules

jumpscale.clients
-
+
jumpscale.core
-
+
jumpscale.data
-
+
jumpscale.entry_points
-
+
jumpscale.loader
-

This module exposes a j object, which contains a reference to all sub namespaces and modules available under jumpscale …

+

This module exposes a j object, which contains a reference to all sub namespaces and modules available under jumpscale …

jumpscale.sals
-
+
jumpscale.servers
-
+
jumpscale.shell
-

This module defines all of js-ng specific shell features …

+

This module defines all of js-ng specific shell features …

jumpscale.threesdk
-
+
jumpscale.tools
-
+

@@ -97,9 +99,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/loader.html b/docs/api/jumpscale/loader.html index 5e2744dfa..3c7cbaed6 100644 --- a/docs/api/jumpscale/loader.html +++ b/docs/api/jumpscale/loader.html @@ -3,15 +3,17 @@ - + jumpscale.loader API documentation - - - - - + + + + + + +
@@ -24,7 +26,9 @@

Module jumpscale.loader

It creates a container classes/types dynamically, inject attributes into these classes with references to sub namespaces and modules, and at the end, create an instance from this container class.

-Source code + +Expand source code +
"""
 This module exposes a j object, which contains a reference to all sub namespaces and modules available under jumpscale
 
@@ -138,19 +142,21 @@ 

Module jumpscale.loader

Functions

-def expose_all(root_module, container_type) +def expose_all(root_module: module, container_type: type)
-

exposes all sub-modules and namespaces to be available under given container type (class)

+

exposes all sub-modules and namespaces to be available under given container type (class)

Args

root_module : types.ModuleType
module
ns_type : type
namepace type (class)
-
+
-Source code + +Expand source code +
def expose_all(root_module: types.ModuleType, container_type: type):
     """
     exposes all sub-modules and namespaces to be available under given container type (class)
@@ -170,10 +176,10 @@ 

Args

-def get_container_type(full_name) +def get_container_type(full_name: str) ‑> type
-

get a new type to be used as a container

+

get a new type to be used as a container

Args

full_name : str
@@ -181,11 +187,13 @@

Args

Returns

-
type
+
type
a new type
-
+
-Source code + +Expand source code +
def get_container_type(full_name: str) -> type:
     """
     get a new type to be used as a container
@@ -205,9 +213,11 @@ 

Returns

def get_lazy_import_property(name, root_module, container_type)
-
+
-Source code + +Expand source code +
def get_lazy_import_property(name, root_module, container_type):
     def getter(self):
         inner_name = f"__{name}"
@@ -242,12 +252,13 @@ 

Classes

class J -(*args, **kwargs)
-
+
-Source code + +Expand source code +
class J:
     @property
     def logger(self):
@@ -269,9 +280,11 @@ 

Instance variables

var application
-
+
-Source code + +Expand source code +
@property
 def application(self):
     return self.core.application
@@ -279,9 +292,11 @@

Instance variables

var clients
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -308,9 +323,11 @@ 

Instance variables

var config
-
+
-Source code + +Expand source code +
@property
 def config(self):
     return self.core.config
@@ -318,9 +335,11 @@

Instance variables

var core
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -347,9 +366,11 @@ 

Instance variables

var data
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -376,9 +397,11 @@ 

Instance variables

var entry_points
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -405,9 +428,11 @@ 

Instance variables

var exceptions
-
+
-Source code + +Expand source code +
@property
 def exceptions(self):
     return self.core.exceptions
@@ -415,9 +440,11 @@

Instance variables

var install
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -444,9 +471,11 @@ 

Instance variables

var logger
-
+
-Source code + +Expand source code +
@property
 def logger(self):
     return self.core.logging
@@ -454,9 +483,11 @@

Instance variables

var sals
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -483,9 +514,11 @@ 

Instance variables

var servers
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -512,9 +545,11 @@ 

Instance variables

var shell
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -541,9 +576,11 @@ 

Instance variables

var threesdk
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -570,9 +607,11 @@ 

Instance variables

var tools
-
+
-Source code + +Expand source code +
def getter(self):
     inner_name = f"__{name}"
     if hasattr(self, inner_name):
@@ -647,9 +686,7 @@ 

J<

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/fs/index.html b/docs/api/jumpscale/sals/fs/index.html index 6fa101e6c..725c99bfd 100644 --- a/docs/api/jumpscale/sals/fs/index.html +++ b/docs/api/jumpscale/sals/fs/index.html @@ -3,16 +3,18 @@ - + jumpscale.sals.fs API documentation - - - - - + + + + + + +
@@ -63,7 +65,7 @@

File paths exists or not

True

Reading/Writing to a file

-

There're some helpers around reading/writing text, binary like read_text, read_binary, read_file, write_text, write_binary, touch

+

There're some helpers around reading/writing text, binary like read_text(), read_bytes(), read_text(), write_text(), write_bytes(), touch()

Touching a new file

> j.sals.fs.touch("/home/rafy/testing_touch")
 
@@ -144,7 +146,7 @@

Walk over on files only

Walk over on dirs only

for el in walk('/tmp', filter_fun=j.sals.fs.is_dir) : ..
 
-

or more specific function walk_dirs

+

or more specific function walk_dirs()

for el in walk_dirs('/tmp') : ..
 
 
@@ -154,7 +156,9 @@

walk over with a bit complex filter

There are more functionality available in the SAL j.sals.fs make sure you check the API documentation for more.

-Source code + +Expand source code +
"""This module is providing everything needed for decent filesystem management
 # Using System Fs
 
@@ -1303,10 +1307,10 @@ 

walk over with a bit complex filter

Functions

-def absolute(path) +def absolute(path: str) ‑> str
-

[summary] +

[summary] e.g j.sals.fs.absolute(".") -> '/home/xmonader/js-ng'

Args

@@ -1316,11 +1320,13 @@

Args

Returns

-
str
+
str
the absolute path for relative path.
-
+
-Source code + +Expand source code +
def absolute(path: str) -> str:
     """[summary]
     e.g
@@ -1335,10 +1341,10 @@ 

Returns

-def change_dir(path) +def change_dir(path: str) ‑> str
-

Change current working directory to path +

Change current working directory to path e.g j.sals.fs.change_dir("/home/rafy/Documents") -> '/home/rafy/Documents'

@@ -1349,11 +1355,13 @@

Args

Returns

-
str
+
str
new current working dir
-
+
-Source code + +Expand source code +
def change_dir(path: str) -> str:
     """Change current working directory to `path`
     e.g
@@ -1373,18 +1381,20 @@ 

Returns

def change_filenames(from_, to, where)
-
+
-Source code + +Expand source code +
def change_filenames(from_, to, where):
     pass
-def chmod(path, mode) +def chmod(path: str, mode)
-

change file mode for path to mode +

change file mode for path to mode e.g j.sals.fs.chmod("/home/rafy/testing_dir",777)

Args

@@ -1393,9 +1403,11 @@

Args

path
mode : int
file mode
-
+
-Source code + +Expand source code +
def chmod(path: str, mode):
     """change file mode for path to mode
     e.g
@@ -1413,18 +1425,20 @@ 

Args

def chown()
-
+
-Source code + +Expand source code +
def chown():
     raise NotImplementedError()
-def copy_file(src, dst, times=False, perms=False) +def copy_file(src: str, dst: str, times=False, perms=False)
-

Copy the file, optionally copying the permission bits (mode) and +

Copy the file, optionally copying the permission bits (mode) and last access/modify time. If the destination file exists, it will be replaced. Raises OSError if the destination is a directory. If the platform does not have the ability to set the permission or times, @@ -1440,9 +1454,11 @@

Args

source path
dst : str
destination
-
+
-Source code + +Expand source code +
def copy_file(src: str, dst: str, times=False, perms=False):
     """Copy the file, optionally copying the permission bits (mode) and
         last access/modify time. If the destination file exists, it will be
@@ -1466,10 +1482,10 @@ 

Args

-def copy_stat(src, dst, times=True, perms=True) +def copy_stat(src: str, dst: str, times=True, perms=True)
-

Copy stat of src to dst

+

Copy stat of src to dst

Args

src : str
@@ -1480,9 +1496,11 @@

Args

Defaults to True.
perms : bool, optional
permissions Defaults to True.
-
+
-Source code + +Expand source code +
def copy_stat(src: str, dst: str, times=True, perms=True):
     """Copy stat of src to dst
 
@@ -1501,20 +1519,22 @@ 

Args

-def cwd() +def cwd() ‑> str
-

Return current working directory. +

Return current working directory. e.g j.sals.fs.cwd() -> '/home/rafy'

Returns

-
str
+
str
current directory
-
+
-Source code + +Expand source code +
def cwd() -> str:
     """Return current working directory.
     e.g
@@ -1531,18 +1551,20 @@ 

Returns

def default_filter_fun(entry)
-
+
-Source code + +Expand source code +
def default_filter_fun(entry):
     return True
-def exists(path) +def exists(path: str) ‑> bool
-

Checks if path exists +

Checks if path exists e.g j.sals.fs.exists("/home/rafy/testing_make_dir/test1") -> True @@ -1555,11 +1577,13 @@

Args

Returns

-
bool
+
bool
True if exists
-
+
-Source code + +Expand source code +
def exists(path: str) -> bool:
     """Checks if path exists
     e.g
@@ -1576,10 +1600,10 @@ 

Returns

-def expanduser(path) +def expanduser(path: str) ‑> str
-

Expands the tilde ~ to username +

Expands the tilde ~ to username e.g j.sals.fs.expanduser("~/work") -> '/home/xmonader/work'

Args

@@ -1589,11 +1613,13 @@

Args

Returns

-
str
+
str
path with tilde ~ resolved.
-
+
-Source code + +Expand source code +
def expanduser(path: str) -> str:
     """Expands the tilde `~` to username
     e.g
@@ -1608,10 +1634,10 @@ 

Returns

-def ext(path, include_dot=True) +def ext(path: str, include_dot=True)
-

Gets the extension of path +

Gets the extension of path e.g '/home/ahmed/myfile.py' -> .py if include_dot else py

Args

@@ -1623,11 +1649,13 @@

Args

Returns

-
str
+
str
extension
-
+
-Source code + +Expand source code +
def extension(path: str, include_dot=True):
     """Gets the extension of path
     e.g
@@ -1652,10 +1680,10 @@ 

Returns

-def extension(path, include_dot=True) +def extension(path: str, include_dot=True)
-

Gets the extension of path +

Gets the extension of path e.g '/home/ahmed/myfile.py' -> .py if include_dot else py

Args

@@ -1667,11 +1695,13 @@

Args

Returns

-
str
+
str
extension
-
+
-Source code + +Expand source code +
def extension(path: str, include_dot=True):
     """Gets the extension of path
     e.g
@@ -1699,7 +1729,7 @@ 

Returns

def fs_check(**arguments)
-

Abstracts common checks over your file system related functions. +

Abstracts common checks over your file system related functions. To reduce the boilerplate of expanding paths, checking for existence or ensuring non empty values.

Checks are defined for each argument separately in a form of a set e.g @@ -1709,14 +1739,16 @@

Returns

- required: ensures the argument is passed with a non-empty value. - expand : expands the tilde ~ in path. -- exists() +- exists() : the path exists. - file : the path is a file. - dir -: the path is a dir.

+: the path is a dir.

-Source code + +Expand source code +
def fs_check(**arguments):
     """Abstracts common checks over your file system related functions.
     To reduce the boilerplate of expanding paths, checking for existence or ensuring non empty values.
@@ -1797,29 +1829,31 @@ 

Returns

-def get_temp_dirname(suffix=None, prefix=None, dir=None) +def get_temp_dirname(suffix=None, prefix=None, dir=None) ‑> str
-

Get temp directory name +

Get temp directory name e.g j.sals.fs.get_temp_dirname(dir="/home/rafy") -> '/home/rafy/tmpntm2ptqy'

Args

-
suffix : [type], optional
+
suffix : [type], optional
ending suffix. Defaults to None.
-
prefix : [type], optional
+
prefix : [type], optional
prefix . Defaults to None.
-
dir : [type], optional
+
dir : [type], optional
where to create the directory. Defaults to None.

Returns

-
str
+
str
temp directory name.
-
+
-Source code + +Expand source code +
def get_temp_dirname(suffix=None, prefix=None, dir=None) -> str:
     """Get temp directory name
     e.g
@@ -1838,10 +1872,10 @@ 

Returns

-def get_temp_filename(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None) +def get_temp_filename(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None) ‑> str
-

Get temp filename +

Get temp filename e.g j.sals.fs.get_temp_filename(dir="/home/rafy/") -> '/home/rafy/tmp6x7w71ml'

@@ -1851,21 +1885,26 @@

Args

[description]. Defaults to "w+b".
buffering : int, optional
buffering. Defaults to -1.
-
encoding : [type], optional
+
encoding : [type], optional
encoding . Defaults to None.
-
newline : [type], optional
+
newline : [type], optional
Defaults to None.
-
suffix : [type], optional
+
suffix : [type], optional
ending suffix. Defaults to None.
-
prefix : [type], optional
+
prefix : [type], optional
prefix . Defaults to None.
-
dir : [type], optional
+
dir : [type], optional
where to create the file. Defaults to None.

Returns

-

[str]: temp filename

+
+
[str]
+
temp filename
+
-Source code + +Expand source code +
def get_temp_filename(mode="w+b", buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None) -> str:
     """Get temp filename
     e.g
@@ -1887,20 +1926,22 @@ 

Returns

-def home() +def home() ‑> str
-

Return the home directory +

Return the home directory e.g j.sals.fs.home() -> '/home/rafy'

Returns

-
str
+
str
home directory.
-
+
-Source code + +Expand source code +
def home() -> str:
     """Return the home directory
     e.g
@@ -1913,10 +1954,10 @@ 

Returns

-def is_absolute(path) +def is_absolute(path: str) ‑> bool
-

Checks if path is absolute +

Checks if path is absolute e.g j.sals.fs.is_absolute('/home/rafy/') -> True @@ -1929,11 +1970,13 @@

Args

Returns

-
bool
+
bool
True if absolute
-
+
-Source code + +Expand source code +
def is_absolute(path: str) -> bool:
     """Checks if path is absolute
     e.g
@@ -1950,10 +1993,10 @@ 

Returns

-def is_ascii_file(path, checksize=4096) +def is_ascii_file(path: str, checksize=4096) ‑> bool
-

Checks if file path is ascii +

Checks if file path is ascii e.g j.sals.fs.is_ascii_file(path="/home/rafy/testfile") -> True

@@ -1966,11 +2009,13 @@

Args

Returns

-
bool
+
bool
True if ascii file
-
+
-Source code + +Expand source code +
def is_ascii_file(path: str, checksize=4096) -> bool:
     """Checks if file `path` is ascii
     e.g
@@ -1996,17 +2041,19 @@ 

Returns

def is_binary_file(path)
-
+
-Source code + +Expand source code +
is_binary_file = lambda path: not is_ascii_file(path)
-

Checks if path is a broken symlink

+

Checks if path is a broken symlink

Args

path : str
@@ -2014,12 +2061,14 @@

Args

Returns

-
bool
+
bool
True if path is a broken symlink False if path not found or symlink is not broken
-
+
-Source code + +Expand source code +
def is_broken_link(path: str) -> bool:
     """Checks if path is a broken symlink
 
@@ -2034,10 +2083,10 @@ 

Returns

-def is_dir(path) +def is_dir(path: str) ‑> bool
-

Checks if path is a dir +

Checks if path is a dir e.g j.sals.fs.is_dir(path= '/home/rafy') -> True @@ -2050,11 +2099,13 @@

Args

Returns

-
bool
+
bool
True if is dir and False otherwise
-
+
-Source code + +Expand source code +
def is_dir(path: str) -> bool:
     """Checks if path is a dir
     e.g
@@ -2070,10 +2121,10 @@ 

Returns

-def is_empty_dir(path) +def is_empty_dir(path: str) ‑> bool
-

Checks if path is emptry directory +

Checks if path is emptry directory e.g j.sals.fs.is_empty_dir("/home/rafy/empty_dir") -> True @@ -2086,11 +2137,13 @@

Args

Returns

-
bool
+
bool
True if path is emptry directory
-
+
-Source code + +Expand source code +
def is_empty_dir(path: str) -> bool:
     """Checks if path is emptry directory
     e.g
@@ -2115,10 +2168,10 @@ 

Returns

-def is_file(path) +def is_file(path: str) ‑> bool
-

Checks if path is a file +

Checks if path is a file e.g j.sals.fs.is_file(path= '/home/rafy') -> False @@ -2131,11 +2184,13 @@

Args

Returns

-
bool
+
bool
True if is file and False otherwise
-
+
-Source code + +Expand source code +
def is_file(path: str) -> bool:
     """Checks if path is a file
     e.g
@@ -2152,10 +2207,10 @@ 

Returns

-def is_mount(path) +def is_mount(path: str) ‑> bool
-

Checks if path is mount

+

Checks if path is mount

Args

path : str
@@ -2163,11 +2218,13 @@

Args

Returns

-
bool
+
bool
True if mount
-
+
-Source code + +Expand source code +
def is_mount(path: str) -> bool:
     # TODO add example here
     """Checks if path is mount
@@ -2183,10 +2240,10 @@ 

Returns

-

Checks if path symlink +

Checks if path symlink e.g j.sals.fs.is_symlink('/home/rafy/testfile3') -> True @@ -2199,11 +2256,13 @@

Args

Returns

-
bool
+
bool
True if symlink False otherwise
-
+
-Source code + +Expand source code +
def is_symlink(path: str) -> bool:
     """Checks if path symlink
     e.g
@@ -2220,10 +2279,10 @@ 

Returns

-def join_paths(*paths) +def join_paths(*paths) ‑> str
-

Convert tuple of path parts into a path string +

Convert tuple of path parts into a path string e.g j.sals.fs.join_paths("home","rafy") -> 'home/rafy'

@@ -2234,11 +2293,13 @@

Args

Returns

-
str
+
str
joined path parts
-
+
-Source code + +Expand source code +
def join_paths(*paths) -> str:
     """
     Convert tuple of path parts into a path string
@@ -2257,19 +2318,21 @@ 

Returns

-def lchmod(path, mode) +def lchmod(path: str, mode)
-

change file mode for path to mode (handles links too)

+

change file mode for path to mode (handles links too)

Args

path : str
path
mode : int
file mode
-
+
-Source code + +Expand source code +
def lchmod(path: str, mode):
     """change file mode for path to mode (handles links too)
 
@@ -2282,10 +2345,10 @@ 

Args

-def lstat(path) +def lstat(path: str)
-

Gets stat of path path (handles links) +

Gets stat of path path (handles links) e.g j.sals.fs.lstat("/home/rafy/testing_link") -> os.stat_result(st_mode=41471, st_ino=7081257, st_dev=2049, st_nlink=1, st_uid=1000, st_gid=1000, st_size=16, st_atime=1586445737, st_mtime=1586445734, st_ctime=1586445734)

@@ -2296,11 +2359,13 @@

Args

Returns

-
stat_result
+
stat_result
returns stat struct.
-
+
-Source code + +Expand source code +
def lstat(path: str):
     """Gets stat of path `path` (handles links)
     e.g
@@ -2320,14 +2385,16 @@ 

Returns

def make_path(path)
-

to ensure the given path, create it if it does not exist

+

to ensure the given path, create it if it does not exist

Args

path : str
path
-
+
-Source code + +Expand source code +
def make_path(path):
     """
     to ensure the given path, create it if it does not exist
@@ -2341,10 +2408,10 @@ 

Args

-def makedirs(path, exist_ok=True) +def makedirs(path: str, exist_ok=True)
-

Creates dir as well as all non exisitng parents in the path +

Creates dir as well as all non exisitng parents in the path e.g j.sals.fs.mkdirs("/home/rafy/testing_make_dir/test1/test2",exist_ok=False) j.sals.fs.mkdirs("/home/rafy/testing_make_dir/test1/test2",exist_ok=True) @@ -2357,9 +2424,11 @@

Args

path to create dir at
exist_ok : bool, optional
won't fail if directory exists. Defaults to True.
-
+
-Source code + +Expand source code +
def mkdirs(path: str, exist_ok=True):
     """Creates dir as well as all non exisitng parents in the path
     e.g
@@ -2375,10 +2444,10 @@ 

Args

-def mkdir(path, exist_ok=True) +def mkdir(path: str, exist_ok=True)
-

Makes directory at path +

Makes directory at path e.g j.sals.fs.mkdir("/home/rafy/testing_make_dir") j.sals.fs.mkdir("/home/rafy/testing_make_dir",exist_ok=True) @@ -2391,9 +2460,15 @@

Args

exist_ok : bool, optional
won't fail if directory exists. Defaults to True.
-

Returns

+

Returns

+
+
[type]
+
[description]
+
-Source code + +Expand source code +
def mkdir(path: str, exist_ok=True):
     """Makes directory at path
     e.g
@@ -2412,10 +2487,10 @@ 

Returns

-def mkdirs(path, exist_ok=True) +def mkdirs(path: str, exist_ok=True)
-

Creates dir as well as all non exisitng parents in the path +

Creates dir as well as all non exisitng parents in the path e.g j.sals.fs.mkdirs("/home/rafy/testing_make_dir/test1/test2",exist_ok=False) j.sals.fs.mkdirs("/home/rafy/testing_make_dir/test1/test2",exist_ok=True) @@ -2428,9 +2503,11 @@

Args

path to create dir at
exist_ok : bool, optional
won't fail if directory exists. Defaults to True.
-
+
-Source code + +Expand source code +
def mkdirs(path: str, exist_ok=True):
     """Creates dir as well as all non exisitng parents in the path
     e.g
@@ -2446,10 +2523,10 @@ 

Args

-def parent(path) +def parent(path: str) ‑> str
-

Get path's parent +

Get path's parent e.g j.sals.fs.parent("/home/rafy/testing_make_dir/test1") -> '/home/rafy/testing_make_dir'

@@ -2460,11 +2537,13 @@

Args

Returns

-
str
+
str
parent path.
-
+
-Source code + +Expand source code +
def parent(path: str) -> str:
     """Get path's parent
     e.g
@@ -2480,10 +2559,10 @@ 

Returns

-def parents(path) +def parents(path: str) ‑> List[str]
-

Get parents list

+

Get parents list

e.g j.sals.fs.parents("/tmp/home/ahmed/myfile.py") -> [PosixPath('/tmp/home/ahmed'), @@ -2497,11 +2576,13 @@

Args

Returns

-
List[str]: list of parents()
-
 
-
+
List[str]
+
list of parents
+
-Source code + +Expand source code +
def parents(path: str) -> List[str]:
     """Get parents list
 
@@ -2523,25 +2604,27 @@ 

Returns

-def parts_to_path(parts) +def parts_to_path(parts: List[str]) ‑> str
-

Convert list of path parts into a path string +

Convert list of path parts into a path string e.g j.sals.fs.parts_to_path(["home","rafy"]) -> 'home/rafy'

Args

-
parts : List[str]
+
parts : List[str]
path parts

Returns

-
str
+
str
joined path parts
-
+
-Source code + +Expand source code +
def parts_to_path(parts: List[str]) -> str:
     """Convert list of path parts into a path string
     e.g
@@ -2560,10 +2643,10 @@ 

Returns

-def path_parts(path) +def path_parts(path: str) ‑> List[str]
-

Convert path to a list of parts +

Convert path to a list of parts e.g '/tmp/tmp-5383p1GOmMOOwvfi.tpl' -> ('/', 'tmp', 'tmp-5383p1GOmMOOwvfi.tpl')

@@ -2573,9 +2656,14 @@

Args

path to convert to parts

Returns

-

List[str]: path parts.

+
+
List[str]
+
path parts.
+
-Source code + +Expand source code +
def path_parts(path: str) -> List[str]:
     """Convert path to a list of parts
     e.g
@@ -2590,10 +2678,10 @@ 

Returns

-def read_ascii(path) +def read_ascii(path: str) ‑> str
-

read ascii content at path +

read ascii content at path e.g j.sals.fs.read_text("/home/rafy/testing_text.txt") -> 'hello world @@ -2603,9 +2691,11 @@

Returns

Returns: str: ascii content in path -
+
-Source code + +Expand source code +
def read_text(path: str) -> str:
     """read ascii content at `path`
     e.g
@@ -2621,10 +2711,10 @@ 

Returns

-def read_binary(path) +def read_binary(path: str) ‑> bytes
-

read binary content at path +

read binary content at path e.g j.sals.fs.read_bytes("/home/rafy/testing_text.txt") -> b'hello world @@ -2634,9 +2724,11 @@

Returns

Returns: bytes: binary content in path -
+
-Source code + +Expand source code +
def read_bytes(path: str) -> bytes:
     """read binary content at `path`
     e.g
@@ -2652,10 +2744,10 @@ 

Returns

-def read_bytes(path) +def read_bytes(path: str) ‑> bytes
-

read binary content at path +

read binary content at path e.g j.sals.fs.read_bytes("/home/rafy/testing_text.txt") -> b'hello world @@ -2665,9 +2757,11 @@

Returns

Returns: bytes: binary content in path -
+
-Source code + +Expand source code +
def read_bytes(path: str) -> bytes:
     """read binary content at `path`
     e.g
@@ -2683,10 +2777,10 @@ 

Returns

-def read_file(path) +def read_file(path: str) ‑> str
-

read ascii content at path +

read ascii content at path e.g j.sals.fs.read_text("/home/rafy/testing_text.txt") -> 'hello world @@ -2696,9 +2790,11 @@

Returns

Returns: str: ascii content in path -
+
-Source code + +Expand source code +
def read_text(path: str) -> str:
     """read ascii content at `path`
     e.g
@@ -2714,10 +2810,10 @@ 

Returns

-def read_file_binary(path) +def read_file_binary(path: str) ‑> bytes
-

read binary content at path +

read binary content at path e.g j.sals.fs.read_bytes("/home/rafy/testing_text.txt") -> b'hello world @@ -2727,9 +2823,11 @@

Returns

Returns: bytes: binary content in path -
+
-Source code + +Expand source code +
def read_bytes(path: str) -> bytes:
     """read binary content at `path`
     e.g
@@ -2748,18 +2846,20 @@ 

Returns

def read_link(path)
-
+
-Source code + +Expand source code +
def read_link(path):
     raise NotImplementedError()
-def read_text(path) +def read_text(path: str) ‑> str
-

read ascii content at path +

read ascii content at path e.g j.sals.fs.read_text("/home/rafy/testing_text.txt") -> 'hello world @@ -2769,9 +2869,11 @@

Returns

Returns: str: ascii content in path -
+
-Source code + +Expand source code +
def read_text(path: str) -> str:
     """read ascii content at `path`
     e.g
@@ -2790,18 +2892,20 @@ 

Returns

def remove_links(path)
-
+
-Source code + +Expand source code +
def remove_links(path):
     raise NotImplementedError()
-def rename(path1, path2) +def rename(path1: str, path2: str)
-

Rename path1 to path2 +

Rename path1 to path2 e.g j.sals.fs.rename("/home/rafy/testing_make_dir","/home/rafy/testing_dir")

Args

@@ -2810,9 +2914,11 @@

Args

source path
path2 : str
dest path
-
+
-Source code + +Expand source code +
def rename(path1: str, path2: str):
     """Rename path1 to path2
     e.g
@@ -2830,18 +2936,20 @@ 

Args

def replace_words_in_files(from_, to, where)
-
+
-Source code + +Expand source code +
def replace_words_in_files(from_, to, where):
     pass
-def resolve(path) +def resolve(path: str) ‑> str
-

resolve . and .. in path +

resolve . and .. in path e.g j.sals.fs.resolve("") -> PosixPath('/home/rafy/Documents') @@ -2854,11 +2962,13 @@

Args

Returns

-
str
+
str
resolved path
-
+
-Source code + +Expand source code +
def resolve(path: str) -> str:
     """resolve `.` and `..` in path
     e.g
@@ -2875,10 +2985,10 @@ 

Returns

-

Remove broken symlink

+

Remove broken symlink

Args

path : str
@@ -2886,11 +2996,13 @@

Args

Returns

-
bool
+
bool
True if broken symlink removed
-
+
-Source code + +Expand source code +
def rm_broken_link(path: str) -> bool:
     """Remove broken symlink
 
@@ -2908,19 +3020,21 @@ 

Returns

-def rm_emptry_dir(path) +def rm_emptry_dir(path: str)
-

Remove empty directory if the directory is not empty it will throw exception (Directory not empty) +

Remove empty directory if the directory is not empty it will throw exception (Directory not empty) e.g j.sals.fs.rm_emptry_dir("/home/rafy/empty_dir")

Args

path : str
path to remove.
-
+
-Source code + +Expand source code +
def rm_emptry_dir(path: str):
     """Remove empty directory if the directory is not empty it will throw exception (Directory not empty)
     e.g
@@ -2934,17 +3048,19 @@ 

Args

-def rmtree(path) +def rmtree(path: str)
-

Remove directory tree

+

Remove directory tree

Args

path : str
path to remove
-
+
-Source code + +Expand source code +
def rmtree(path: str):
     """Remove directory tree
     Args:
@@ -2958,10 +3074,10 @@ 

Args

-def stat(path) +def stat(path: str)
-

Gets stat of path path +

Gets stat of path path e.g j.sals.fs.stat("/home/rafy/test_dir/test") -> os.stat_result(st_mode=33204, st_ino=795348, st_dev=2049, st_nlink=1, st_uid=1000, st_gid=1000, st_size=0, st_atime=1586445434, st_mtime=1586445434, st_ctime=1586445434)

@@ -2972,11 +3088,13 @@

Args

Returns

-
stat_result
+
stat_result
returns stat struct.
-
+
-Source code + +Expand source code +
def stat(path: str):
     """Gets stat of path `path`
     e.g
@@ -2992,10 +3110,10 @@ 

Returns

-def stem(path) +def stem(path: str) ‑> str
-

returns the stem of a path (path without parent directory and without extension) +

returns the stem of a path (path without parent directory and without extension) e.g j.sals.fs.stem("/tmp/tmp-5383p1GOmMOOwvfi.tpl") -> 'tmp-5383p1GOmMOOwvfi'

@@ -3006,11 +3124,13 @@

Args

Returns

-
str
+
str
path without parent directory and without extension
-
+
-Source code + +Expand source code +
def stem(path: str) -> str:
     """returns the stem of a path (path without parent directory and without extension)
     e.g
@@ -3026,10 +3146,10 @@ 

Returns

-

Create a symbolic link. +

Create a symbolic link. e.g j.sals.fs.symlink(src="/home/rafy/testing_text.txt",dst="/home/rafy/link_test")

Args

@@ -3040,9 +3160,11 @@

Args

Destination path of link
overwrite : bool, optional
If link exists will delete it. Defaults to False.
-
+
-Source code + +Expand source code +
def symlink(src: str, dst: str, overwrite=False):
     """Create a symbolic link.
     e.g
@@ -3060,19 +3182,21 @@ 

Args

-def touch(path) +def touch(path: str)
-

create file +

create file e.g j.sals.fs.touch("/home/rafy/testing_touch")

Args

path : str
path to create file
-
+
-Source code + +Expand source code +
def touch(path: str):
     """create file
     e.g
@@ -3086,19 +3210,21 @@ 

Args

-

unlink path +

unlink path e.g j.sals.fs.unlink("/home/rafy/testfile3")

Args

path : str
path to unlink
-
+
-Source code + +Expand source code +
def unlink(path: str):
     """unlink path
     e.g
@@ -3110,10 +3236,10 @@ 

Args

-def walk(path, pat='*', filter_fun=<function default_filter_fun>) +def walk(path: str, pat='*', filter_fun=<function default_filter_fun>)
-

walk recursively on path +

walk recursively on path e.g for el in walk('/tmp', filter_fun=j.sals.fs.is_file) : .. for el in walk('/tmp', filter_fun=j.sals.fs.is_dir) : .. @@ -3126,9 +3252,11 @@

Args

pattern to match against. Defaults to "*".
filter_fun : Function, optional
filtering function. Defaults to default_filter_fun which accepts anything.
-
+
-Source code + +Expand source code +
def walk(path: str, pat="*", filter_fun=default_filter_fun):
     """walk recursively on path
     e.g
@@ -3153,7 +3281,7 @@ 

Args

def walk_dirs(path, recursive=True)
-

walk over directories in path and applies function fun +

walk over directories in path and applies function fun e.g

for el in walk_dirs('/tmp') : ..
 
@@ -3163,9 +3291,11 @@

Args

path to walk over
recursive : bool, optional
recursive or not. Defaults to True.
-
+
-Source code + +Expand source code +
def walk_dirs(path, recursive=True):
     """
         walk over directories in path and applies function `fun`
@@ -3187,10 +3317,10 @@ 

Args

-def walk_files(path, recursive=True) +def walk_files(path: str, recursive=True)
-

walk over files in path and applies function fun +

walk over files in path and applies function fun e.g

for el in walk_files('/tmp') : ..
 
@@ -3200,9 +3330,11 @@

Args

path to walk over
recursive : bool, optional
recursive or not. Defaults to True.
-
+
-Source code + +Expand source code +
def walk_files(path: str, recursive=True):
     """
     walk over files in path and applies function `fun`
@@ -3224,10 +3356,10 @@ 

Args

-def walk_non_recursive(path, filter_fun=<function default_filter_fun>) +def walk_non_recursive(path: str, filter_fun=<function default_filter_fun>)
-

walks non recursively on path +

walks non recursively on path e.g for el in walk('/tmp', filter=j.sals.fs.is_file) : .. for el in walk('/tmp', filter=j.sals.fs.is_dir) : .. @@ -3240,9 +3372,11 @@

Args

pattern to match against. Defaults to "*".
filter_fun : Function, optional
filtering function. Defaults to default_filter_fun which accepts anything.
-
+
-Source code + +Expand source code +
def walk_non_recursive(path: str, filter_fun=default_filter_fun):
     """walks non recursively on path
     e.g
@@ -3263,10 +3397,10 @@ 

Args

-def write_ascii(path, data, encoding=None, append=False) +def write_ascii(path: str, data: str, encoding=None, append=False)
-

write text data to path path with encoding +

write text data to path path with encoding e.g j.sals.fs.write_text(path="/home/rafy/testing_text.txt",data="hello world") -> 11

@@ -3276,18 +3410,20 @@

Args

path to write to
data : str
ascii content
-
encoding : [type], optional
+
encoding : [type], optional
encoding. Defaults to None.
append : bool, optional
indicate whether to open the file in append mode or not.

Returns

-
int
+
int
returning the number of characters written.
-
+
-Source code + +Expand source code +
def write_text(path: str, data: str, encoding=None, append=False):
     """write text `data` to path `path` with encoding
     e.g
@@ -3310,10 +3446,10 @@ 

Returns

-def write_binary(path, data, append=False) +def write_binary(path: str, data: bytes, append=False)
-

write binary data to path path

+

write binary data to path path

If file does not exist, it creates a new file. If file exists it truncates the file unless append arg is True e.g j.sals.fs.write_bytes(path="/home/rafy/testing_text.txt",data=b"hello world") @@ -3329,11 +3465,13 @@

Args

Returns

-
int
+
int
returning the number of characters written.
-
+
-Source code + +Expand source code +
def write_bytes(path: str, data: bytes, append=False):
     """write binary `data` to path `path`
 
@@ -3356,10 +3494,10 @@ 

Returns

-def write_bytes(path, data, append=False) +def write_bytes(path: str, data: bytes, append=False)
-

write binary data to path path

+

write binary data to path path

If file does not exist, it creates a new file. If file exists it truncates the file unless append arg is True e.g j.sals.fs.write_bytes(path="/home/rafy/testing_text.txt",data=b"hello world") @@ -3375,11 +3513,13 @@

Args

Returns

-
int
+
int
returning the number of characters written.
-
+
-Source code + +Expand source code +
def write_bytes(path: str, data: bytes, append=False):
     """write binary `data` to path `path`
 
@@ -3402,10 +3542,10 @@ 

Returns

-def write_file(path, data, encoding=None, append=False) +def write_file(path: str, data: str, encoding=None, append=False)
-

write text data to path path with encoding +

write text data to path path with encoding e.g j.sals.fs.write_text(path="/home/rafy/testing_text.txt",data="hello world") -> 11

@@ -3415,18 +3555,20 @@

Args

path to write to
data : str
ascii content
-
encoding : [type], optional
+
encoding : [type], optional
encoding. Defaults to None.
append : bool, optional
indicate whether to open the file in append mode or not.

Returns

-
int
+
int
returning the number of characters written.
-
+
-Source code + +Expand source code +
def write_text(path: str, data: str, encoding=None, append=False):
     """write text `data` to path `path` with encoding
     e.g
@@ -3449,10 +3591,10 @@ 

Returns

-def write_file_binary(path, data, append=False) +def write_file_binary(path: str, data: bytes, append=False)
-

write binary data to path path

+

write binary data to path path

If file does not exist, it creates a new file. If file exists it truncates the file unless append arg is True e.g j.sals.fs.write_bytes(path="/home/rafy/testing_text.txt",data=b"hello world") @@ -3468,11 +3610,13 @@

Args

Returns

-
int
+
int
returning the number of characters written.
-
+
-Source code + +Expand source code +
def write_bytes(path: str, data: bytes, append=False):
     """write binary `data` to path `path`
 
@@ -3495,10 +3639,10 @@ 

Returns

-def write_text(path, data, encoding=None, append=False) +def write_text(path: str, data: str, encoding=None, append=False)
-

write text data to path path with encoding +

write text data to path path with encoding e.g j.sals.fs.write_text(path="/home/rafy/testing_text.txt",data="hello world") -> 11

@@ -3508,18 +3652,20 @@

Args

path to write to
data : str
ascii content
-
encoding : [type], optional
+
encoding : [type], optional
encoding. Defaults to None.
append : bool, optional
indicate whether to open the file in append mode or not.

Returns

-
int
+
int
returning the number of characters written.
-
+
-Source code + +Expand source code +
def write_text(path: str, data: str, encoding=None, append=False):
     """write text `data` to path `path` with encoding
     e.g
@@ -3666,9 +3812,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/hostsfile/index.html b/docs/api/jumpscale/sals/hostsfile/index.html index 06ca28424..ead294107 100644 --- a/docs/api/jumpscale/sals/hostsfile/index.html +++ b/docs/api/jumpscale/sals/hostsfile/index.html @@ -3,15 +3,17 @@ - + jumpscale.sals.hostsfile API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.sals.hostsfile

-Source code + +Expand source code +
import re
 
 
@@ -77,7 +81,7 @@ 

Module jumpscale.sals.hostsfile

update the hostname for ip Args: ip (str) : the ip address - domain (str) : the host name + domain (str) : the host name """ self.content[ip] = domain @@ -116,9 +120,11 @@

Classes

(hosts_file_path)
-
+
-Source code + +Expand source code +
class HostsFile:
     def __init__(self, hosts_file_path):
         self.path = hosts_file_path
@@ -171,7 +177,7 @@ 

Classes

update the hostname for ip Args: ip (str) : the ip address - domain (str) : the host name + domain (str) : the host name """ self.content[ip] = domain @@ -201,12 +207,14 @@

Methods

def add(self, ip, domain)
-

add new entry to the hosts file

+

add new entry to the hosts file

Args

ip (str) : the ip address -domain (str) : the host name

+domain (str) : the host name

-Source code + +Expand source code +
def add(self, ip, domain):
     """
     add new entry to the hosts file
@@ -221,13 +229,15 @@ 

Args

def exists(self, ip)
-

check for the existence of the ip in hosts file.

+

check for the existence of the ip in hosts file.

Args

ip (str) : the ip address

Return

-

boolen expression

+

boolen expression

-Source code + +Expand source code +
def exists(self, ip):
     """
     check for the existence of the ip in hosts file.
@@ -243,16 +253,15 @@ 

Return

def get_hostname(self, ip)
-

get the hostname for ip

+

get the hostname for ip

Args

ip (str) : the ip address

Returns

-
-
the hostname for the ip address
-
 
-
+

the hostname for the ip address

-Source code + +Expand source code +
def get_hostname(self, ip):
     """
     get the hostname for ip
@@ -268,11 +277,13 @@ 

Returns

def remove(self, ip)
-

remove the ip and its hostname from hosts file

+

remove the ip and its hostname from hosts file

Args

-

ip (str) : the ip address

+

ip (str) : the ip address

-Source code + +Expand source code +
def remove(self, ip):
     """
     remove the ip and its hostname from hosts file
@@ -286,18 +297,20 @@ 

Args

def set_hostname(self, ip, domain)
-

update the hostname for ip

+

update the hostname for ip

Args

ip (str) : the ip address -domain (str) : the host name

+domain (str) : the host name

-Source code + +Expand source code +
def set_hostname(self, ip, domain):
     """
     update the hostname for ip
     Args:
         ip (str) : the ip address
-        domain (str) : the host name           
+        domain (str) : the host name
     """
     self.content[ip] = domain
@@ -306,9 +319,11 @@

Args

def write(self)
-

write the changes into the file.

+

write the changes into the file.

-Source code + +Expand source code +
def write(self):
     """
     write the changes into the file.
@@ -355,9 +370,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/index.html b/docs/api/jumpscale/sals/index.html index 0430e07ae..5d6ddb85b 100644 --- a/docs/api/jumpscale/sals/index.html +++ b/docs/api/jumpscale/sals/index.html @@ -3,15 +3,17 @@ - + jumpscale.sals API documentation - - - - - + + + + + + +
@@ -26,28 +28,28 @@

Sub-modules

jumpscale.sals.fs
-

This module is providing everything needed for decent filesystem management -Using System Fs …

+

This module is providing everything needed for decent filesystem management +Using System Fs …

jumpscale.sals.hostsfile
-
+
jumpscale.sals.nettools
-

This module contains a collection of functions which help in manage network connections and interfaces …

+

This module contains a collection of functions which help in manage network connections and interfaces …

jumpscale.sals.process
-

This module execute process on system and manage them …

+

This module execute process on system and manage them …

jumpscale.sals.testdocs
-
+
jumpscale.sals.unix
-
+

@@ -83,9 +85,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/nettools/index.html b/docs/api/jumpscale/sals/nettools/index.html index f4953f145..7566febf9 100644 --- a/docs/api/jumpscale/sals/nettools/index.html +++ b/docs/api/jumpscale/sals/nettools/index.html @@ -3,15 +3,17 @@ - + jumpscale.sals.nettools API documentation - - - - - + + + + + + +
@@ -28,7 +30,9 @@

Module jumpscale.sals.nettools

For deterministic behavior use a numeric address in host portion. https://docs.python.org/3/library/socket.html

-Source code + +Expand source code +
"""This module contains a collection of functions which help in manage network connections and interfaces.
 
 General Note on python socket operations:
@@ -722,10 +726,10 @@ 

Module jumpscale.sals.nettools

Functions

-def check_url_reachable(url, timeout=5, verify=True, fake_user_agent=True) +def check_url_reachable(url: str, timeout: Optional[int] = 5, verify: Optional[bool] = True, fake_user_agent: Optional[bool] = True) ‑> bool
-

Check that given url is reachable

+

Check that given url is reachable

Args

url : str
@@ -739,16 +743,18 @@

Args

Raises

-
ValueError
+
ValueError
raises if not correct url

Returns

-
bool
+
bool
True if the test succeeds, False otherwise
-
+
-Source code + +Expand source code +
def check_url_reachable(
     url: str, timeout: Optional[int] = 5, verify: Optional[bool] = True, fake_user_agent: Optional[bool] = True
 ) -> bool:
@@ -793,10 +799,10 @@ 

Returns

-def download(url, localpath='', username=None, passwd=None, overwrite=True, append_to_home=False, name_from_url=True) +def download(url: str, localpath: Optional[str] = '', username: Optional[str] = None, passwd: Optional[str] = None, overwrite: Optional[bool] = True, append_to_home: Optional[bool] = False, name_from_url: Optional[bool] = True)
-

Download a url to a file or a directory, supported protocols: http, https, ftp, file

+

Download a url to a file or a directory, supported protocols: http, https, ftp, file

Args

url : str
@@ -820,20 +826,20 @@

Args

Raises

-
PermissionError
+
PermissionError
[description]
-
FileNotFoundError
+
FileNotFoundError
[description]
-
FileExistsError
+
FileExistsError
[description]
-
ValueError
+
ValueError
[description]
-
URLError
+
URLError
[description]

Returns

-
namedtuple
+
namedtuple
namedtuple('DownloadResult', ['localpath', 'content', content_length]) - localpath (pathlib.Path) - content (bytes): only if localpath is None else it will be None always @@ -847,11 +853,13 @@

Todo

Examples

use default values for args will download the url to cwd and get the name from the url,

if the file already exists, it will overwritten.

-
>>> nettools.download('https://www.7-zip.org/a/7z1900-extra.7z')
+
>>> nettools.download('https://www.7-zip.org/a/7z1900-extra.7z')
 DownloadResult(localpath=PosixPath('/home/sameh/projects/js-ng/7z1900-extra.7z'), content=None, content_length='929117')
-
+

-Source code + +Expand source code +
def download(
     url: str,
     localpath: Optional[str] = "",
@@ -977,10 +985,10 @@ 

if the file already exis

-def get_default_ip_config(ip='8.8.8.8') +def get_default_ip_config(ip: Optional[str] = '8.8.8.8') ‑> tuple
-

get default nic and address, by default, the one exposed to internet

+

get default nic and address, by default, the one exposed to internet

Args

ip : str
@@ -988,18 +996,20 @@

Args

Raises

-
ValueError
+
ValueError
if address does not represent a valid IPv4 or IPv6 address.
-
RuntimeError
+
RuntimeError
if can't connect

Returns

-
tuple
+
tuple
default nic name and its ip address
-
+
-Source code + +Expand source code +
def get_default_ip_config(ip: Optional[str] = "8.8.8.8") -> tuple:
     """get default nic and address, by default, the one exposed to internet
 
@@ -1028,10 +1038,10 @@ 

Returns

-def get_free_port(ipv6=False, udp=False, return_socket=False) +def get_free_port(ipv6: Optional[bool] = False, udp: Optional[bool] = False, return_socket: Optional[bool] = False)
-

Bind an ipv4 or ipv6 socket to port 0 to make OS pick a random, free and +

Bind an ipv4 or ipv6 socket to port 0 to make OS pick a random, free and available port from 1024 to 65535.

you can optionally choose to reuse the socket by set return_socket to True (preferred to To prevent race conditions from occurring) but then it is your responsibility to close @@ -1048,27 +1058,29 @@

Args

Returns

-
int
+
int
returns a random free port from 1024 to 65535 range.
+
Optional[socket]
+
in the case of return_socket set to True, socket will be returned alongside the port in a tuple.
-

Optional[socket]: in the case of return_socket set to True, socket will be returned alongside the port in a tuple.

Example

get a free TCP port that currently not binded to 127.0.0.1

-
>>> port = get_free_port()
+
>>> port = get_free_port()
 # get a free UDP port that currently not binded to 127.0.0.1
 >>> port = get_free_port(udp=True)
 # get a free TCP port that currently not binded to ::1
 >>> port = get_free_port(ipv6=True)
 # get a free TCP port that currently not binded to 127.0.0.1
-
-

and reuse the socket instead of creating a socket and bind it to selected port

-
>>> port, sock = get_free_port(return_socket=True)
+# and reuse the socket instead of creating a socket and bind it to selected port
+>>> port, sock = get_free_port(return_socket=True)
 >>> sock.listen()
 ..
 >>> sock.close()
-
+
-Source code + +Expand source code +
def get_free_port(ipv6: Optional[bool] = False, udp: Optional[bool] = False, return_socket: Optional[bool] = False):
     """Bind an ipv4 or ipv6 socket to port 0 to make OS pick a random, free and
     available port from 1024 to 65535.
@@ -1117,10 +1129,10 @@ 

-def get_host_by_name(dnsHostname) +def get_host_by_name(dnsHostname: str) ‑> str
-

get host address by its name

+

get host address by its name

Args

dnsHostname : str
@@ -1128,11 +1140,13 @@

Args

Returns

-
str
+
str
host address
-
+
-Source code + +Expand source code +
def get_host_by_name(dnsHostname: str) -> str:  # pragma: no cover - we're just proxying
     """get host address by its name
 
@@ -1146,17 +1160,19 @@ 

Returns

-def get_host_name() +def get_host_name() ‑> str
-

Get hostname of the machine

+

Get hostname of the machine

Returns

-
str
+
str
host name
-
+
-Source code + +Expand source code +
def get_host_name() -> str:  # pragma: no cover - we're just proxying
     """Get hostname of the machine
 
@@ -1167,10 +1183,10 @@ 

Returns

-def get_mac_address(interface) +def get_mac_address(interface: str) ‑> str
-

Return the MAC address of this interface

+

Return the MAC address of this interface

Args

interface : str
@@ -1178,11 +1194,13 @@

Args

Returns

-
str
+
str
mac of the interface
-
+
-Source code + +Expand source code +
def get_mac_address(interface: str) -> str:
     """Return the MAC address of this interface
 
@@ -1196,10 +1214,10 @@ 

Returns

-def get_network_info(device=None) +def get_network_info(device: Optional[str] = None) ‑> list
-

Get network info

+

Get network info

Args

device : str, optional
@@ -1207,23 +1225,25 @@

Args

Raises

-
Runtime
+
Runtime
if it could not find the specified device
-
NotImplementedError
+
NotImplementedError
if the function runs on unsupported OS

Returns

-
Dict, or list of dicts if device arg used: network info
-
 
+
Dict, or list of dicts if device arg used
+
network info

[{'ip': [('127.0.0.1', 8)], 'ip6': [('::1', 128)], 'mac': '00:00:00:00:00:00', 'name': 'lo'}, {'ip': [('192.168.1.6', 24)], 'ip6': [('fdb4:f58e:3c34:300:91f0:9c76:e1fb:d060', 64), …], 'mac': 'd8:9c:67:2a:f2:53', -'name': 'wlp3s0'}, …]

+'name': 'wlp3s0'}, …]

-Source code + +Expand source code +
def get_network_info(device: Optional[str] = None) -> list:
     """Get network info
 
@@ -1293,17 +1313,19 @@ 

Returns

-def get_nic_names() +def get_nic_names() ‑> list
-

Get Nics on this machine

+

Get Nics on this machine

Returns

-
list
+
list
list of all availabe nics
-
+
-Source code + +Expand source code +
def get_nic_names() -> list:
     """Get Nics on this machine
 
@@ -1314,10 +1336,10 @@ 

Returns

-def get_nic_type(interface) +def get_nic_type(interface: str) ‑> str
-

Get Nic Type on a certain interface

+

Get Nic Type on a certain interface

Args

interface : str
@@ -1325,18 +1347,20 @@

Args

Raises

-
Runtime
+
Runtime
if ethtool not installed on the system
-
Value
+
Value
if interface given is invalid

Returns

-
str
+
str
type of the interface
-
+
-Source code + +Expand source code +
def get_nic_type(interface: str) -> str:
     """Get Nic Type on a certain interface
 
@@ -1399,10 +1423,10 @@ 

Returns

-def get_reachable_ip_address(ip, port=0) +def get_reachable_ip_address(ip: str, port: Optional[int] = 0) ‑> str
-

figures out what source address would be used if some traffic were to be sent out to specified ip. +

figures out what source address would be used if some traffic were to be sent out to specified ip. compatible with both IPv4 and IPv6.

Args

@@ -1413,18 +1437,20 @@

Args

Raises

-
ValueError
+
ValueError
if address does not represent a valid IPv4 or IPv6 address, or port is invalid.
-
RuntimeError
+
RuntimeError
if can't connect

Returns

-
str
+
str
ip that can connect to the specified ip
-
+
-Source code + +Expand source code +
def get_reachable_ip_address(ip: str, port: Optional[int] = 0) -> str:
     """figures out what source address would be used if some traffic were to be sent out to specified ip.
     compatible with both IPv4 and IPv6.
@@ -1462,10 +1488,10 @@ 

Returns

-def is_nic_connected(interface) +def is_nic_connected(interface: str) ‑> bool
-

check if interface is connected

+

check if interface is connected

Args

interface : str
@@ -1473,11 +1499,13 @@

Args

Returns

-
bool
+
bool
whether it is connected or not
-
+
-Source code + +Expand source code +
def is_nic_connected(interface: str) -> bool:
     """check if interface is connected
 
@@ -1507,26 +1535,28 @@ 

Returns

-def netrange_get(device, skip_begin=10, skip_end=10) +def netrange_get(device: str, skip_begin: Optional[int] = 10, skip_end: Optional[int] = 10) ‑> tuple
-

Get ($fromip,$topip) from range attached to device, skip the mentioned ip addresses.

+

Get ($fromip,$topip) from range attached to device, skip the mentioned ip addresses.

Args

device : str
[description]
-
skip_begin : Optional[int], optional
+
skip_begin : Optional[int], optional
ips to skip from the begining of the range, Defaults to 10.
-
skip_end : Optional[int], optional
+
skip_end : Optional[int], optional
ips to skip from the end of the range, Defaults to 10.

Returns

-
tuple
+
tuple
ip range for this device
-
+
-Source code + +Expand source code +
def netrange_get(device: str, skip_begin: Optional[int] = 10, skip_end: Optional[int] = 10) -> tuple:
     """Get ($fromip,$topip) from range attached to device, skip the mentioned ip addresses.
 
@@ -1543,10 +1573,10 @@ 

Returns

-def ping_machine(ip, timeout=60, allowhostname=True) +def ping_machine(ip: str, timeout: Optional[int] = 60, allowhostname: Optional[bool] = True) ‑> bool
-

Ping a machine to check if it's up/running and accessible +

Ping a machine to check if it's up/running and accessible Note: Any well-behaved device on an LAN or WAN is free to ignore nearly any traffic, so PINGs, port scans, and the like are all unreliable.

Args

@@ -1560,18 +1590,20 @@

Args

Raises

-
ValueError
+
ValueError
if ip is Invalid ip address
-
NotImplementedError
+
NotImplementedError
if the function runs on unsupported system

Returns

-
bool
+
bool
True if machine is pingable, False otherwise
-
+
-Source code + +Expand source code +
def ping_machine(ip: str, timeout: Optional[int] = 60, allowhostname: Optional[bool] = True) -> bool:
     """Ping a machine to check if it's up/running and accessible
     Note: Any well-behaved device on an LAN or WAN is free to ignore nearly any traffic,
@@ -1612,14 +1644,18 @@ 

Returns

-def tcp_connection_test(ipaddr, port, timeout=None) +def tcp_connection_test(ipaddr: str, port: int, timeout: Optional[int] = None) ‑> bool
-

tests tcp connection on specified port, compatible with both IPv4 and IPv6. +

tests tcp connection on specified port, compatible with both IPv4 and IPv6. ensures that each side of the connection is reachable in the network.

Raises

-

socket.gaierror: raised for address-related errors. -socket.herror: raised for address-related errors.

+
+
socket.gaierror
+
raised for address-related errors.
+
socket.herror
+
raised for address-related errors.
+

Args

ipaddr : str
@@ -1631,11 +1667,13 @@

Args

Returns

-
bool
+
bool
True if the test succeeds, False otherwise
-
+
-Source code + +Expand source code +
def tcp_connection_test(ipaddr: str, port: int, timeout: Optional[int] = None) -> bool:
     """tests tcp connection on specified port, compatible with both IPv4 and IPv6.
     ensures that each side of the connection is reachable in the network.
@@ -1660,10 +1698,10 @@ 

Returns

-def udp_connection_test(ipaddr, port, timeout=1, message=b'') +def udp_connection_test(ipaddr: str, port: int, timeout: Optional[int] = 1, message: Optional[bytes] = b'') ‑> bool
-

tests udp connection on specified port by sending specified message and expecting +

tests udp connection on specified port by sending specified message and expecting to receive at least one byte from the socket as an indicator of connection success

Args

@@ -1678,16 +1716,18 @@

Args

Raises

-
ValueError
+
ValueError
raises if invalid ip address was used

Returns

-
bool
+
bool
True if the test succeeds, False otherwise
-
+
-Source code + +Expand source code +
def udp_connection_test(ipaddr: str, port: int, timeout: Optional[int] = 1, message: Optional[bytes] = b"") -> bool:
     """tests udp connection on specified port by sending specified message and expecting
     to receive at least one byte from the socket as an indicator of connection success
@@ -1724,10 +1764,10 @@ 

Returns

-def wait_connection_test(ipaddr, port, timeout=6) +def wait_connection_test(ipaddr: str, port: int, timeout: Optional[int] = 6) ‑> bool
-

Will wait until port listens on the specified address or timeout sec elapsed

+

Will wait until port listens on the specified address or timeout sec elapsed

under the hood the function will try to connect every interval sec, if waiting time timeout set to value <= 2, interval is 1 sec, otherwise 2.

Args

@@ -1742,11 +1782,13 @@

Args

Returns

-
bool
+
bool
True if the test succeeds, False otherwise
-
+
-Source code + +Expand source code +
def wait_connection_test(ipaddr: str, port: int, timeout: Optional[int] = 6) -> bool:
     """Will wait until port listens on the specified address or `timeout` sec elapsed
 
@@ -1777,10 +1819,10 @@ 

Returns

-def wait_http_test(url, timeout=60, verify=True, interval_time=2) +def wait_http_test(url: str, timeout: Optional[int] = 60, verify: Optional[bool] = True, interval_time: Optional[int] = 2) ‑> bool
-

Will keep try to reach specified url every {interval_time} sec until url become reachable or {timeout} sec elapsed

+

Will keep try to reach specified url every {interval_time} sec until url become reachable or {timeout} sec elapsed

Args

url : str
@@ -1794,16 +1836,18 @@

Args

Raises

-
ValueError
+
ValueError
raises if not correct url

Returns

-
bool
+
bool
true if the test succeeds
-
+
-Source code + +Expand source code +
def wait_http_test(
     url: str, timeout: Optional[int] = 60, verify: Optional[bool] = True, interval_time: Optional[int] = 2
 ) -> bool:
@@ -1875,9 +1919,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/process/index.html b/docs/api/jumpscale/sals/process/index.html index 66ad1a23b..a4cbb3330 100644 --- a/docs/api/jumpscale/sals/process/index.html +++ b/docs/api/jumpscale/sals/process/index.html @@ -3,15 +3,17 @@ - + jumpscale.sals.process API documentation - - - - - + + + + + + +
@@ -23,91 +25,88 @@

Module jumpscale.sals.process

This module execute process on system and manage them

below are some examples of the functions included in this module (not all inclusive.):

Examples

-

```

-
-
-
-

from jumpscale.loader import j -import signal

-
-
-
+
```python-repl
+>>> from jumpscale.loader import j
+>>> import signal
+

to create a process

-
>>> rc, out, err = j.sals.process.execute("ls", cwd="/tmp", showout=True)
-# this executes ls command on dir "/tmp" showing output from stdout
+
>>> rc, out, err = j.sals.process.execute("ls", cwd="/tmp", showout=True)
+# this executes ls command on dir "/tmp" showing output from stdout
+# rc -> contains exit status
+# out -> the actual output
+# err -> in case an error happened this var will contains the error msg
 
-

rc -> contains exit status

-

out -> the actual output

-

err -> in case an error happened this var will contains the error msg

checks if a process with this pid is exists in the current process list

-
>>> j.sals.process.is_alive(10022)
+
>>> j.sals.process.is_alive(10022)
 

Checks if a specific command is available on the system

-
>>> j.sals.process.is_installed('top')
+
>>> j.sals.process.is_installed('top')
 

kill a process with pid 10022 with SIGTERM

-
>>> j.sals.process.kill(10022)
+
>>> j.sals.process.kill(10022)
 

kill a process with pid 10022 with SIGTERM, wait 3 seconds for it to disappear, then if still alive kill it with SIGKILL

-
>>> j.sals.process.kill(10022, timeout=3, sure_kill=True)
+
>>> j.sals.process.kill(10022, timeout=3, sure_kill=True)
 

Check if there is any running process that match the given name.

-
>>> j.sals.process.ps_find('python3')
+
>>> j.sals.process.ps_find('python3')
 

gets pid of the process listenning on port TCP 8000 ipv4 localhost address

-
>>> j.sals.process.get_pid_by_port(8000)
+
>>> j.sals.process.get_pid_by_port(8000)
 

gets pid of the process listenning on port UDP 8000 ipv6 localhost address

-
>>> j.sals.process.get_pid_by_port(8000, ipv6=True, udp=True)
+
>>> j.sals.process.get_pid_by_port(8000, ipv6=True, udp=True)
 

Returns the psutil.Process object that is listening on the given port

-
>>> j.sals.process.get_process_by_port(8000, ipv6=True, udp=True)
+
>>> j.sals.process.get_process_by_port(8000, ipv6=True, udp=True)
 

Get pids of process by a filter string and sort by cpu utilization descendingly

-
>>> j.sals.process.get_pids_filtered_sorted('chrome', sort='%cpu', desc=True)
+
>>> j.sals.process.get_pids_filtered_sorted('chrome', sort='%cpu', desc=True)
 

Return a list of processes ID(s) matching the given name.

-
>>> j.sals.process.get_pids('code')
+
>>> j.sals.process.get_pids('code')
 

Return a list of processes ID(s) matching the given name, including the result of matching againest the full command line.

-
>>> j.sals.process.get_pids('http.server', full_cmd_line=True)
+
>>> j.sals.process.get_pids('http.server', full_cmd_line=True)
 

Return a list of processes ID(s) matching the given name, including any zombie processes

-
>>> j.sals.process.get_pids('python3', include_zombie=False)
+
>>> j.sals.process.get_pids('python3', include_zombie=False)
 

get processes info about top 3 processes which consumed the most memory

-
>>> j.sals.process.get_processes_info(limit=3)
+
>>> j.sals.process.get_processes_info(limit=3)
 

get processes info about top 3 processes which consumed the most cpu time

-
>>> j.sals.process.get_processes_info(sort='cpu_time', limit=3)
+
>>> j.sals.process.get_processes_info(sort='cpu_time', limit=3)
 

get processes info about last process started

-
>>> j.sals.process.get_processes_info(sort='create_time', limit=1)
+
>>> j.sals.process.get_processes_info(sort='create_time', limit=1)
 

get processes info sorted by pid ascending limited to 10 processes

-
>>> j.sals.process.get_processes_info(sort='pid', limit=10, desc=False)
+
>>> j.sals.process.get_processes_info(sort='pid', limit=10, desc=False)
 

Kill a process and its children (including grandchildren) with SIGTERM and fallback to SIGKILL when needed

-
>>> j.sals.process.kill_proc_tree(20778, sure_kill=True)
+
>>> j.sals.process.kill_proc_tree(20778, sure_kill=True)
 

send SIGTERM to all processes spawned by a given process, but leave the process itself.

-
>>> j.sals.process.kill_proc_tree(20778, include_parent=False)
+
>>> j.sals.process.kill_proc_tree(20778, include_parent=False)
 

Terminate a list of processes with a given list of pids, fallback to SIGKILL after 1 seconds.

-
>>> j.sals.process.kill_all_pids([3067, 7888, 10221], timeout=1, sure_kill=True)
+
>>> j.sals.process.kill_all_pids([3067, 7888, 10221], timeout=1, sure_kill=True)
 

terminate a process that listen to a given tcp port on ipv4 address

-
>>> j.sals.process.kill_process_by_port(8000)
+
>>> j.sals.process.kill_process_by_port(8000)
 

terminate a process that listen to a given udp port on ipv6 address, fallback to SIGKILL after 3 sec

-
>>> j.sals.process.kill_process_by_port(8000, udp=True, ipv6=True, timeout=3, sure_kill=True)
+
>>> j.sals.process.kill_process_by_port(8000, udp=True, ipv6=True, timeout=3, sure_kill=True)
 

Terminate all processes owned by a given user name, fallback to SIGKILL when needed

-
>>> j.sals.process.kill_user_processes('sameh', sure_kill=True)
-```
+
>>> j.sals.process.kill_user_processes('sameh', sure_kill=True)
 
+

```

-Source code + +Expand source code +
"""This module execute process on system and manage them
 
 below are some examples of the functions included in this module (not all inclusive.):
@@ -1159,7 +1158,7 @@ 

Functions

def check_process_for_pid(pid, process_name)
-

Check whether a given pid actually does belong to a given process name.

+

Check whether a given pid actually does belong to a given process name.

Args

pid : int
@@ -1169,11 +1168,13 @@

Args

Returns

-
bool
+
bool
True if process_name matched process name of the pid, False otherwise.
-
+
-Source code + +Expand source code +
def check_process_for_pid(pid, process_name):
     """Check whether a given pid actually does belong to a given process name.
 
@@ -1195,7 +1196,7 @@ 

Returns

def check_running(process_name, min=1)
-

Check if there are a specific number of running processes that match the given name.

+

Check if there are a specific number of running processes that match the given name.

Function will check string against Process.name(), Process.exe() and Process.cmdline().

Args

@@ -1206,11 +1207,13 @@

Args

Returns

-
bool
+
bool
true if process is running, otherwise False
-
+
-Source code + +Expand source code +
def check_running(process_name, min=1):
     """Check if there are a specific number of running processes that match the given name.
 
@@ -1231,7 +1234,7 @@ 

Returns

def check_start(cmd, filterstr, n_instances=1, retry=1, timeout=2, delay=0.5)
-

Run command (possibly multiple times) and check if it is started based on filterstr

+

Run command (possibly multiple times) and check if it is started based on filterstr

Args

cmd : str or list of str
@@ -1248,9 +1251,14 @@

Args

how long the function should delay the checking process after the process finished or timeout exceeded (in case the first process started another one).

Raises

-

j.exceptions.Runtime: will be raised if we didn't reach number of required instances.

+
+
j.exceptions.Runtime
+
will be raised if we didn't reach number of required instances.
+
-Source code + +Expand source code +
def check_start(cmd, filterstr, n_instances=1, retry=1, timeout=2, delay=0.5):
     """Run command (possibly multiple times) and check if it is started based on filterstr
 
@@ -1294,7 +1302,7 @@ 

Raises

def check_stop(cmd, filterstr, retry=1, n_instances=0, timeout=2, delay=0.5)
-

Executes a stop command (possibly multiple times) and check if it is already stopped based on filterstr

+

Executes a stop command (possibly multiple times) and check if it is already stopped based on filterstr

Args

cmd : str
@@ -1312,11 +1320,13 @@

Args

Raises

-
j.exceptions.Runtime: if number of instances not matched
-
 
-
+
j.exceptions.Runtime
+
if number of instances not matched
+
-Source code + +Expand source code +
def check_stop(cmd, filterstr, retry=1, n_instances=0, timeout=2, delay=0.5):
     """Executes a stop command (possibly multiple times) and check if it is already stopped based on filterstr
 
@@ -1361,10 +1371,10 @@ 

Raises

-def execute(cmd, showout=False, cwd=None, shell='/bin/bash', timeout=600, asynchronous=False, env=None, replace_env=False, die=False) +def execute(cmd, showout=False, cwd=None, shell='/bin/bash', timeout=600, asynchronous=False, env=None, replace_env=False, die=False)
-

Execute a command.

+

Execute a command.

Accepts command as a list too, with auto-escaping.

Args

@@ -1389,11 +1399,13 @@

Args

Returns

-
tuple
+
tuple
tuple[return_code: int, stdout: str, stderr: str]
-
+
-Source code + +Expand source code +
def execute(
     cmd,
     showout=False,
@@ -1440,11 +1452,16 @@ 

Returns

def get_defunct_processes()
-

Gets defunct (zombie) processes.

+

Gets defunct (zombie) processes.

Returns

-

list of int: List of processes ID(s).

+
+
list of int
+
List of processes ID(s).
+
-Source code + +Expand source code +
def get_defunct_processes():
     """Gets defunct (zombie) processes.
 
@@ -1465,22 +1482,28 @@ 

Returns

def get_environ(pid)
-

Gets env vars for a specific process based on pid

+

Gets env vars for a specific process based on pid

Args

pid : int
process pid

Raises

-

j.exceptions.NotFound: if the process is no longer exists. -j.exceptions.Permission: if the process is not accessible by the user.

+
+
j.exceptions.NotFound
+
if the process is no longer exists.
+
j.exceptions.Permission
+
if the process is not accessible by the user.
+

Returns

-
dict
+
dict
dict of env variables
-
+
-Source code + +Expand source code +
def get_environ(pid):
     """Gets env vars for a specific process based on pid
 
@@ -1507,21 +1530,23 @@ 

Returns

def get_filtered_pids(filterstr, excludes=None)
-

Get pids filtered by filterstr and excludes, matching against the full command line used to start the process.

+

Get pids filtered by filterstr and excludes, matching against the full command line used to start the process.

Args

filterstr : str
the String to filter based on.
-
excludes : list[str]
+
excludes : list[str]
exclude list. Defaults to None.

Returns

-
list of int: List of the processes IDs
-
 
-
+
list of int
+
List of the processes IDs
+
-Source code + +Expand source code +
def get_filtered_pids(filterstr, excludes=None):
     """Get pids filtered by filterstr and excludes, matching against the full command line used to start the process.
 
@@ -1555,18 +1580,20 @@ 

Returns

def get_memory_usage()
-

Get memory status

+

Get memory status

Returns

-
dict
+
dict
Memory status info, available keys ('total', 'used', 'percent') 'total': total physical memory in Gb (exclusive swap). 'used': memory used in Gb, calculated differently depending on the platform and designed for informational purposes only. total - free does not necessarily match used. 'percent': the percentage of used memory.
-
+
-Source code + +Expand source code +
def get_memory_usage():
     """Get memory status
 
@@ -1591,11 +1618,16 @@ 

Returns

def get_my_process()
-

Get psutil.Process object of the current process.

+

Get psutil.Process object of the current process.

Returns

-

psutil.Process: Process object of the current process.

+
+
psutil.Process
+
Process object of the current process.
+
-Source code + +Expand source code +
def get_my_process():
     """Get psutil.Process object of the current process.
 
@@ -1609,7 +1641,7 @@ 

Returns

def get_pid_by_port(port, ipv6=False, udp=False)
-

Returns the PID of the process that is listening on the given port

+

Returns the PID of the process that is listening on the given port

Args

port : int
@@ -1620,9 +1652,14 @@

Args

Whether to search the connections for UDP port instead of TCP. Defaults to False.

Returns

-

int or None: PID for the proceses that listen on that port.

+
+
int or None
+
PID for the proceses that listen on that port.
+
-Source code + +Expand source code +
def get_pid_by_port(port, ipv6=False, udp=False):
     """Returns the PID of the process that is listening on the given port
 
@@ -1644,7 +1681,7 @@ 

Returns

def get_pids(process_name, match_predicate=None, limit=0, include_zombie=False, full_cmd_line=False)
-

Return a list of processes ID(s) matching a given process name.

+

Return a list of processes ID(s) matching a given process name.

Function will check string against Process.name(), Process.exe() and Process.cmdline()

Args

@@ -1665,9 +1702,14 @@

Args

if full_cmd_line is set to True, the full command line is used. Defaults to False.

Returns

-

list of int: List of the processes IDs.

+
+
list of int
+
List of the processes IDs.
+
-Source code + +Expand source code +
def get_pids(process_name, match_predicate=None, limit=0, _alt_source=None, include_zombie=False, full_cmd_line=False):
     """Return a list of processes ID(s) matching a given process name.
 
@@ -1730,16 +1772,21 @@ 

Returns

def get_pids_filtered_by_regex(regex_list)
-

Get pids of a process filtered by Regex list, matching against the full command line used to start the process.

+

Get pids of a process filtered by Regex list, matching against the full command line used to start the process.

Args

-
regex_list : list[str]
+
regex_list : list[str]
List of regex expressions.

Returns

-

list of int: List of the processes IDs.

+
+
list of int
+
List of the processes IDs.
+
-Source code + +Expand source code +
def get_pids_filtered_by_regex(regex_list):
     """Get pids of a process filtered by Regex list, matching against the full command line used to start the process.
 
@@ -1763,7 +1810,7 @@ 

Returns

def get_pids_filtered_sorted(filterstr, sortkey=None, desc=False)
-

Get pids of process by a filter string and optionally sort by sortkey

+

Get pids of process by a filter string and optionally sort by sortkey

Args

filterstr : str
@@ -1804,11 +1851,13 @@

Args

Returns

-
list of int: list of the processes IDs
-
 
-
+
list of int
+
list of the processes IDs
+
-Source code + +Expand source code +
def get_pids_filtered_sorted(filterstr, sortkey=None, desc=False):
     """Get pids of process by a filter string and optionally sort by sortkey
 
@@ -1854,17 +1903,17 @@ 

Returns

-def get_ports_mapping(status='LISTEN') +def get_ports_mapping(status='LISTEN')
-

Get a mapping for process to ports with a status filter

+

Get a mapping for process to ports with a status filter

It will skip any process in case of errors (e.g. permission error)

Example

-
>>> from jumpscale.loader import j
+
>>> from jumpscale.loader import j
 >>> import psutil
 >>> j.sals.process.get_ports_mapping(psutil.CONN_ESTABLISHED)
 >>> # or
->>> j.sals.process.get_ports_mapping("ESTABLISHED")
+>>> j.sals.process.get_ports_mapping("ESTABLISHED")
 

Args

@@ -1873,11 +1922,13 @@

Args

Returns

-
defaultdict
+
defaultdict
a mapping between process and ports
-
+
-Source code + +Expand source code +
def get_ports_mapping(status=psutil.CONN_LISTEN):
     """Get a mapping for process to ports with a status filter
 
@@ -1916,7 +1967,7 @@ 

Returns

def get_process_by_port(port, ipv6=False, udp=False)
-

Returns the psutil.Process object that is listening on the given port.

+

Returns the psutil.Process object that is listening on the given port.

Args

port : int
@@ -1927,16 +1978,23 @@

Args

Whether to search the connections for UDP port instead of TCP. Defaults to False.

Raises

-

j.exceptions.Runtime: pid is not retrievable. -j.exceptions.NotFound: if the process is no longer exists. -j.exceptions.Permission: if the process is not accessible by the user.

+
+
j.exceptions.Runtime
+
pid is not retrievable.
+
j.exceptions.NotFound
+
if the process is no longer exists.
+
j.exceptions.Permission
+
if the process is not accessible by the user.
+

Returns

-
psutil.Process: process object if found, otherwise None
-
 
-
+
psutil.Process
+
process object if found, otherwise None
+
-Source code + +Expand source code +
def get_process_by_port(port, ipv6=False, udp=False):
     """Returns the psutil.Process object that is listening on the given port.
 
@@ -1977,7 +2035,7 @@ 

Returns

def get_process_object(pid, die=False)
-

Get psutil.Process object of a given process ID (PID).

+

Get psutil.Process object of a given process ID (PID).

Args

pid : int
@@ -1987,12 +2045,21 @@

Args

current process list or not. Defaults to False.

Raises

-

psutil.NoSuchProcess: If process with the given PID is not found and die set to True. -psutil.AccessDenied: If permission denied.

+
+
psutil.NoSuchProcess
+
If process with the given PID is not found and die set to True.
+
psutil.AccessDenied
+
If permission denied.
+

Returns

-

psutil.Process or None: The Process object of the given PID if found, otherwise None, if die set to False.

+
+
psutil.Process or None
+
The Process object of the given PID if found, otherwise None, if die set to False.
+
-Source code + +Expand source code +
def get_process_object(pid, die=False):
     """Get psutil.Process object of a given process ID (PID).
 
@@ -2022,14 +2089,16 @@ 

Returns

def get_processes()
-

Get an interator for all running processes

+

Get an interator for all running processes

Yields

-
psutil.Process: for all processes running
-
 
-
+
psutil.Process
+
for all processes running
+
-Source code + +Expand source code +
def get_processes():
     """Get an interator for all running processes
 
@@ -2040,13 +2109,13 @@ 

Yields

-def get_processes_info(user=None, sort='mem', filterstr=None, limit=25, desc=True) +def get_processes_info(user=None, sort='mem', filterstr=None, limit=25, desc=True)
-

Get information for top running processes sorted by memory usage or CPU usage.

+

Get information for top running processes sorted by memory usage or CPU usage.

Args

-
user : [type], optional
+
user : [type], optional
filter the processes by username. Defaults to None.
sort : str, optional
sort processes by resource usage, Defaults to 'mem'. @@ -2074,7 +2143,7 @@

Args

Returns

-
dict
+
dict
processes info as a dictionary available keys [ "cpu_num", @@ -2093,9 +2162,11 @@

Returns

"cpu_time", "ports" ]
-
+
-Source code + +Expand source code +
def get_processes_info(user=None, sort="mem", filterstr=None, limit=25, desc=True):
     """Get information for top running processes sorted by memory usage or CPU usage.
 
@@ -2220,7 +2291,7 @@ 

Returns

def get_similar_processes(target_proc=None)
-

Gets similar processes to current process, started with same command line and same options.

+

Gets similar processes to current process, started with same command line and same options.

Args

target_proc : int or psutil.Process, optional
@@ -2228,9 +2299,14 @@

Args

if None then pid for current process will be used. Defaults to None.

Yields

-

psutil.Process: psutil.Process object for all processes similar to a given process.

+
+
psutil.Process
+
psutil.Process object for all processes similar to a given process.
+
-Source code + +Expand source code +
def get_similar_processes(target_proc=None):
     """Gets similar processes to current process, started with same command line and same options.
 
@@ -2257,16 +2333,21 @@ 

Yields

def get_user_processes(user)
-

Get all process for a specific user.

+

Get all process for a specific user.

Args

user : str
The user name to match against.

Yields

-

psutil.Process: process object for all processes owned by user.

+
+
psutil.Process
+
process object for all processes owned by user.
+
-Source code + +Expand source code +
def get_user_processes(user):
     """Get all process for a specific user.
 
@@ -2288,14 +2369,16 @@ 

Yields

def in_docker()
-

will check if we are in a docker.

+

will check if we are in a docker.

Returns

-
bool
+
bool
True if in docker. False otherwise.
-
+
-Source code + +Expand source code +
def in_docker():
     """will check if we are in a docker.
 
@@ -2310,14 +2393,16 @@ 

Returns

def in_host()
-

Will check if we are in a host.

+

Will check if we are in a host.

Returns

-
bool
+
bool
True if in host. False otherwise.
-
+
-Source code + +Expand source code +
def in_host():
     """Will check if we are in a host.
 
@@ -2331,7 +2416,7 @@ 

Returns

def is_alive(pid)
-

Check whether the given PID exists in the current process list.

+

Check whether the given PID exists in the current process list.

Args

pid : int
@@ -2339,11 +2424,13 @@

Args

Returns

-
bool
+
bool
True if the given PID exists in the current process list, False otherwise.
-
+
-Source code + +Expand source code +
def is_alive(pid):
     """Check whether the given PID exists in the current process list.
 
@@ -2360,7 +2447,7 @@ 

Returns

def is_installed(cmd)
-

Checks if a specific command is available on system e.g. curl.

+

Checks if a specific command is available on system e.g. curl.

Args

cmd : str
@@ -2368,11 +2455,13 @@

Args

Returns

-
bool
+
bool
True if command is available, False otherwise.
-
+
-Source code + +Expand source code +
def is_installed(cmd):
     """Checks if a specific command is available on system e.g. curl.
 
@@ -2390,7 +2479,7 @@ 

Returns

def is_port_listening(port, ipv6=False)
-

Check if the TCP port is being used by any process

+

Check if the TCP port is being used by any process

Args

port : int
@@ -2400,11 +2489,13 @@

Args

Returns

-
bool
+
bool
True if port is used, False otherwise.
-
+
-Source code + +Expand source code +
def is_port_listening(port, ipv6=False):
     """Check if the TCP port is being used by any process
 
@@ -2423,10 +2514,10 @@ 

Returns

-def kill(proc, sig=<Signals.SIGTERM: 15>, timeout=5, sure_kill=False) +def kill(proc, sig=Signals.SIGTERM, timeout=5, sure_kill=False)
-

Kill a process with a specified signal.

+

Kill a process with a specified signal.

Args

proc : int or psutil.Process
@@ -2440,10 +2531,16 @@

Args

Whether to fallback to SIGKILL if the timeout exceeded for the terminate operation or not. Defaults to False.

Raises

-

j.exceptions.Runtime: In case killing the process failed. -j.exceptions.Permission: In case the permission to perform this action is denied.

+
+
j.exceptions.Runtime
+
In case killing the process failed.
+
j.exceptions.Permission
+
In case the permission to perform this action is denied.
+
-Source code + +Expand source code +
def kill(proc, sig=signal.SIGTERM, timeout=5, sure_kill=False):
     """Kill a process with a specified signal.
 
@@ -2497,10 +2594,10 @@ 

Raises

-def kill_all_pids(pids, sig=<Signals.SIGTERM: 15>, timeout=5, sure_kill=False) +def kill_all_pids(pids, sig=Signals.SIGTERM, timeout=5, sure_kill=False)
-

Kill all processes with given pids.

+

Kill all processes with given pids.

Args

pids : list of int
@@ -2514,9 +2611,14 @@

Args

Whether to fallback to SIGKILL if the timeout exceeded for the terminate operation or not. Defaults to False.

Returns

-

list of int: represents the IDs of the processes remaning alive if any.

+
+
list of int
+
represents the IDs of the processes remaning alive if any.
+
-Source code + +Expand source code +
def kill_all_pids(pids, sig=signal.SIGTERM, timeout=5, sure_kill=False):
     """Kill all processes with given pids.
 
@@ -2541,10 +2643,10 @@ 

Returns

-def kill_proc_tree(parent, sig=<Signals.SIGTERM: 15>, include_parent=True, include_grand_children=True, timeout=5, sure_kill=False) +def kill_proc_tree(parent, sig=Signals.SIGTERM, include_parent=True, include_grand_children=True, timeout=5, sure_kill=False)
-

Kill a process and its children (including grandchildren) with signal sig

+

Kill a process and its children (including grandchildren) with signal sig

Args

proc : int or psutil.Process
@@ -2560,14 +2662,19 @@

Args

Whether to fallback to SIGKILL if the timeout exceeded for the terminate operation or not. Defaults to False.

Returns

-

list of psutil.Process: represents the objects of the processes remaning alive if any.

+
+
list of psutil.Process
+
represents the objects of the processes remaning alive if any.
+

Raises

-
AssertionError
+
AssertionError
in case the given parent is the current process
-
+
-Source code + +Expand source code +
def kill_proc_tree(
     parent, sig=signal.SIGTERM, include_parent=True, include_grand_children=True, timeout=5, sure_kill=False
 ):
@@ -2616,10 +2723,10 @@ 

Raises

-def kill_process_by_name(process_name, sig=<Signals.SIGTERM: 15>, match_predicate=None, timeout=5, sure_kill=False) +def kill_process_by_name(process_name, sig=Signals.SIGTERM, match_predicate=None, timeout=5, sure_kill=False)
-

Kill all processes that match 'process_name'.

+

Kill all processes that match 'process_name'.

Args

process_name : str
@@ -2637,9 +2744,14 @@

Args

Whether to fallback to SIGKILL if the timeout exceeded for the terminate operation or not. Defaults to False.

Returns

-

list of int: represents the IDs of the processes remaning alive if any.

+
+
list of int
+
represents the IDs of the processes remaning alive if any.
+
-Source code + +Expand source code +
def kill_process_by_name(process_name, sig=signal.SIGTERM, match_predicate=None, timeout=5, sure_kill=False):
     """Kill all processes that match 'process_name'.
 
@@ -2667,10 +2779,10 @@ 

Returns

-def kill_process_by_port(port, ipv6=False, udp=False, sig=<Signals.SIGTERM: 15>, timeout=5, sure_kill=False) +def kill_process_by_port(port, ipv6=False, udp=False, sig=Signals.SIGTERM, timeout=5, sure_kill=False)
-

Kill process by port.

+

Kill process by port.

Args

port : int
@@ -2688,10 +2800,16 @@

Args

Whether to fallback to SIGKILL if the timeout exceeded for the terminate operation or not. Defaults to False.

Raises

-

j.exceptions.Runtime: In case killing the process failed. -j.exceptions.Permission: In case the permission to perform this action is denied.

+
+
j.exceptions.Runtime
+
In case killing the process failed.
+
j.exceptions.Permission
+
In case the permission to perform this action is denied.
+
-Source code + +Expand source code +
def kill_process_by_port(port, ipv6=False, udp=False, sig=signal.SIGTERM, timeout=5, sure_kill=False):
     """Kill process by port.
 
@@ -2713,10 +2831,10 @@ 

Raises

-def kill_user_processes(user, sig=<Signals.SIGTERM: 15>, timeout=5, sure_kill=False) +def kill_user_processes(user, sig=Signals.SIGTERM, timeout=5, sure_kill=False)
-

Kill all processes for a specific user.

+

Kill all processes for a specific user.

Args

user : str
@@ -2729,9 +2847,11 @@

Args

Whether to fallback to SIGKILL if the timeout exceeded for the terminate operation or not. Defaults to False.

Returns

-

list of psutil.Process): list of process objects that remain alive if any.

+

list of psutil.Process): list of process objects that remain alive if any.

-Source code + +Expand source code +
def kill_user_processes(user, sig=signal.SIGTERM, timeout=5, sure_kill=False):
     """Kill all processes for a specific user.
 
@@ -2763,7 +2883,7 @@ 

Returns

def ps_find(process_name)
-

Check if there is any running process that match the given name.

+

Check if there is any running process that match the given name.

Args

process_name : str
@@ -2771,11 +2891,13 @@

Args

Returns

-
bool
+
bool
True if process is found, False otherwise.
-
+
-Source code + +Expand source code +
def ps_find(process_name):
     """Check if there is any running process that match the given name.
 
@@ -2792,7 +2914,7 @@ 

Returns

def set_env_var(var_names, var_values)
-

Set the value of the environment variables {varnames}. Existing variable are overwritten

+

Set the value of the environment variables {varnames}. Existing variable are overwritten

Such changes to the environment affect subprocesses started with os.system(), popen() or fork() and execv()

Args

@@ -2803,11 +2925,13 @@

Args

Raises

-
j.exceptions.RuntimeError: if error happened during setting the environment variables
-
 
-
+
j.exceptions.RuntimeError
+
if error happened during setting the environment variables
+
-Source code + +Expand source code +
def set_env_var(var_names, var_values):
     """Set the value of the environment variables {varnames}. Existing variable are overwritten
 
@@ -2886,9 +3010,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/testdocs/index.html b/docs/api/jumpscale/sals/testdocs/index.html index 4afb685fe..ec25dd209 100644 --- a/docs/api/jumpscale/sals/testdocs/index.html +++ b/docs/api/jumpscale/sals/testdocs/index.html @@ -3,15 +3,17 @@ - + jumpscale.sals.testdocs API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.sals.testdocs

-Source code + +Expand source code +
import pytest
 from jumpscale.loader import j
 
@@ -177,7 +181,7 @@ 

Functions

def generate_tests_docs(source, target, clean=False)
-

Generate a markdown docs for tests from its docstring.

+

Generate a markdown docs for tests from its docstring.

Args

source : str
@@ -186,9 +190,11 @@

Args

Target docs path.
clean : bool
To clean the target path before start.
-
+
-Source code + +Expand source code +
def generate_tests_docs(source, target, clean=False):
     """Generate a markdown docs for tests from its docstring.
 
@@ -216,9 +222,11 @@ 

Classes

(source, target)
-
+
-Source code + +Expand source code +
class Collector:
     def __init__(self, source, target):
         self.tests_docs_locations = []
@@ -334,14 +342,16 @@ 

Methods

def pytest_collection_modifyitems(self, items)
-

This method is a pytest hook which can modify the items has been collected.

+

This method is a pytest hook which can modify the items has been collected.

Args

items : list
Tests objects has been collected.
-
+
-Source code + +Expand source code +
def pytest_collection_modifyitems(self, items):
     """This method is a pytest hook which can modify the items has been collected.
 
@@ -387,9 +397,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/unix/index.html b/docs/api/jumpscale/sals/unix/index.html index 70ef0839a..ab45ce610 100644 --- a/docs/api/jumpscale/sals/unix/index.html +++ b/docs/api/jumpscale/sals/unix/index.html @@ -3,15 +3,17 @@ - + jumpscale.sals.unix API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.sals.unix

-Source code + +Expand source code +
from .user import *
@@ -30,7 +34,7 @@

Sub-modules

jumpscale.sals.unix.user
-
+

@@ -61,9 +65,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/sals/unix/user.html b/docs/api/jumpscale/sals/unix/user.html index da1257d78..e6f37e8ec 100644 --- a/docs/api/jumpscale/sals/unix/user.html +++ b/docs/api/jumpscale/sals/unix/user.html @@ -3,15 +3,17 @@ - + jumpscale.sals.unix.user API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.sals.unix.user

-Source code + +Expand source code +
import os, pwd, grp
 
 __all__ = ["get_user_pwd", "get_current_pwd", "get_group_grp", "get_current_grp"]
@@ -78,14 +82,13 @@ 

Functions

def get_current_grp()
-

get current group info

+

get current group info

Returns

-
-
grp.struct_group
-
 
-
+

grp.struct_group

-Source code + +Expand source code +
def get_current_grp():
     """get current group info
 
@@ -99,14 +102,13 @@ 

Returns

def get_current_pwd()
-

get current user passwd record

+

get current user passwd record

Returns

-
-
pwd.struct_passwd
-
 
-
+

pwd.struct_passwd

-Source code + +Expand source code +
def get_current_pwd():
     """get current user passwd record
 
@@ -120,19 +122,18 @@ 

Returns

def get_group_grp(gid)
-

get group info

+

get group info

Args

gid : int
gid of the group

Returns

-
-
grp.struct_group
-
 
-
+

grp.struct_group

-Source code + +Expand source code +
def get_group_grp(gid):
     """get group info
     Args:
@@ -148,19 +149,18 @@ 

Returns

def get_user_pwd(uid)
-

get user passwd record

+

get user passwd record

Args

uid : int
uid of the user

Returns

-
-
pwd.struct_passwd
-
 
-
+

pwd.struct_passwd

-Source code + +Expand source code +
def get_user_pwd(uid):
     """get user passwd record
     Args:
@@ -200,9 +200,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/servers/index.html b/docs/api/jumpscale/servers/index.html index 73dcf60a8..714d4ee17 100644 --- a/docs/api/jumpscale/servers/index.html +++ b/docs/api/jumpscale/servers/index.html @@ -3,15 +3,17 @@ - + jumpscale.servers API documentation - - - - - + + + + + + +
@@ -26,11 +28,11 @@

Sub-modules

jumpscale.servers.openresty
-
+
jumpscale.servers.rack
-
+
@@ -62,9 +64,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/servers/openresty/index.html b/docs/api/jumpscale/servers/openresty/index.html index 5a97f1349..b58315462 100644 --- a/docs/api/jumpscale/servers/openresty/index.html +++ b/docs/api/jumpscale/servers/openresty/index.html @@ -3,15 +3,17 @@ - + jumpscale.servers.openresty API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.servers.openresty

-Source code + +Expand source code +
def export_module_as():
     from jumpscale.core.base import StoredFactory
     from .server import OpenRestyServer
@@ -34,15 +38,15 @@ 

Sub-modules

jumpscale.servers.openresty.location
-
+
jumpscale.servers.openresty.server
-
+
jumpscale.servers.openresty.utils
-
+
@@ -55,9 +59,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
     from jumpscale.core.base import StoredFactory
     from .server import OpenRestyServer
@@ -97,9 +103,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/servers/openresty/location.html b/docs/api/jumpscale/servers/openresty/location.html index 438110a02..723dfd515 100644 --- a/docs/api/jumpscale/servers/openresty/location.html +++ b/docs/api/jumpscale/servers/openresty/location.html @@ -3,15 +3,17 @@ - + jumpscale.servers.openresty.location API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.servers.openresty.location

-Source code + +Expand source code +
from jumpscale.loader import j
 from jumpscale.core.base import Base, fields
 from .utils import render_config_template
@@ -89,11 +93,11 @@ 

Classes

(parent_=None, instance_name_=None, **values)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -108,9 +112,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class Location(Base):
     name = fields.String()
     path_url = fields.String()
@@ -167,16 +173,18 @@ 

Instance variables

var config
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -192,16 +200,18 @@ 

Returns

var connection_type
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -217,16 +227,18 @@ 

Returns

var force_https
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -242,16 +254,18 @@ 

Returns

var index
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -267,16 +281,18 @@ 

Returns

var ipaddr_dest
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -292,16 +308,18 @@ 

Returns

var is_auth
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -317,16 +335,18 @@ 

Returns

var location_type
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -342,16 +362,18 @@ 

Returns

var name
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -367,9 +389,11 @@ 

Returns

var path_cfg
-
+
-Source code + +Expand source code +
@property
 def path_cfg(self):
     return f"{self.path_cfg_dir}/{self.instance_name}.conf"
@@ -377,9 +401,11 @@

Returns

var path_cfg_dir
-
+
-Source code + +Expand source code +
@property
 def path_cfg_dir(self):
     return f"{self.parent.path_cfg_dir}/{self.parent.instance_name}_locations"
@@ -387,16 +413,18 @@

Returns

var path_dest
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -412,16 +440,18 @@ 

Returns

var path_location
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -437,16 +467,18 @@ 

Returns

var path_url
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -462,9 +494,11 @@ 

Returns

var path_web
-
+
-Source code + +Expand source code +
@property
 def path_web(self):
     return self.parent.path_web
@@ -472,16 +506,18 @@

Returns

var port_dest
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -497,16 +533,18 @@ 

Returns

var scheme
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -522,16 +560,18 @@ 

Returns

var use_weblibs
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -552,9 +592,11 @@ 

Methods

def configure(self)
-

Config is a server config file of nginx (in text format)

+

Config is a server config file of nginx (in text format)

-Source code + +Expand source code +
def configure(self):
     """Config is a server config file of nginx (in text format)
     """
@@ -571,12 +613,14 @@ 

Methods

-def write_config(self, content='') +def write_config(self, content='')
-
+
-Source code + +Expand source code +
def write_config(self, content=""):
     if not content:
         content = render_config_template(f"location_{self.location_type}", obj=self)
@@ -641,9 +685,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/servers/openresty/server.html b/docs/api/jumpscale/servers/openresty/server.html index 86d1e7e43..ef967bad8 100644 --- a/docs/api/jumpscale/servers/openresty/server.html +++ b/docs/api/jumpscale/servers/openresty/server.html @@ -3,15 +3,17 @@ - + jumpscale.servers.openresty.server API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.servers.openresty.server

-Source code + +Expand source code +
from jumpscale.loader import j
 from enum import Enum
 from jumpscale.core.base import Base, fields
@@ -199,11 +203,11 @@ 

Classes

(**kwargs)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -218,9 +222,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class OpenRestyServer(Base):
     status = fields.Enum(Status)
     websites = fields.Factory(Website)
@@ -347,9 +353,11 @@ 

Instance variables

var logs_dir
-
+
-Source code + +Expand source code +
@property
 def logs_dir(self):
     if not self._logs_dir:
@@ -360,9 +368,11 @@ 

Instance variables

var path_cfg
-
+
-Source code + +Expand source code +
@property
 def path_cfg(self):
     return j.sals.fs.join_paths(self.path_cfg_dir, "nginx.conf")
@@ -370,9 +380,11 @@

Instance variables

var path_cfg_dir
-
+
-Source code + +Expand source code +
@property
 def path_cfg_dir(self):
     if not self._path_cfg_dir:
@@ -383,9 +395,11 @@ 

Instance variables

var path_web
-
+
-Source code + +Expand source code +
@property
 def path_web(self):
     if not self._path_web:
@@ -396,9 +410,11 @@ 

Instance variables

var startup_cmd
-
+
-Source code + +Expand source code +
@property
 def startup_cmd(self):
     pass
@@ -406,16 +422,18 @@

Instance variables

var status
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -431,16 +449,18 @@ 

Returns

var websites
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -461,9 +481,11 @@ 

Methods

def cleanup(self)
-
+
-Source code + +Expand source code +
def cleanup(self):
     j.sals.fs.rmtree(f"{self.path_cfg_dir}/servers")
@@ -472,9 +494,11 @@

Methods

def configure(self)
-
+
-Source code + +Expand source code +
def configure(self):
     # clean old websites config
     self.cleanup()
@@ -491,7 +515,7 @@ 

Methods

def get_from_port(self, port, domain=None, ssl=None)
-

will try to get a website listening on port, if it doesn't exist it will create one

+

will try to get a website listening on port, if it doesn't exist it will create one

Args

port : int
@@ -503,11 +527,13 @@

Args

Returns

-
Website
+
Website
A new or an old website instance with the needed port
-
+
-Source code + +Expand source code +
def get_from_port(self, port, domain=None, ssl=None):
     """will try to get a website listening on port, if it doesn't exist it will create one
 
@@ -539,14 +565,16 @@ 

Returns

def install(self, reset=False)
-

Install required deps for openresty

+

Install required deps for openresty

Args

reset : bool, optional
If true will redo the installation. Defaults to False.
-
+
-Source code + +Expand source code +
def install(self, reset=False):
     """Install required deps for openresty
 
@@ -574,9 +602,11 @@ 

Args

def is_running(self)
-
+
-Source code + +Expand source code +
def is_running(self):
     pass
@@ -585,9 +615,11 @@

Args

def reload(self)
-
+
-Source code + +Expand source code +
def reload(self):
     self.configure()
     j.sals.process.execute("lapis build", cwd=self.path_cfg_dir)
@@ -597,9 +629,11 @@

Args

def start(self, reset=False)
-
+
-Source code + +Expand source code +
def start(self, reset=False):
     pass
@@ -608,9 +642,11 @@

Args

def stop(self)
-
+
-Source code + +Expand source code +
def stop(self):
     pass
@@ -629,12 +665,14 @@

Inherited members

class Status -(*args, **kwargs) +(value, names=None, *, module=None, qualname=None, type=None, start=1)
-

An enumeration.

+

An enumeration.

-Source code + +Expand source code +
class Status(Enum):
     INIT = "init"
     INSTALLED = "installed"
@@ -647,11 +685,11 @@

Class variables

var INIT
-
+
var INSTALLED
-
+
@@ -660,11 +698,11 @@

Class variables

(parent_=None, instance_name_=None, **values)
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -679,9 +717,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class Website(Base):
 
     port = fields.Integer(default=80)
@@ -723,16 +763,18 @@ 

Instance variables

var domain
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -748,16 +790,18 @@ 

Returns

var locations
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -773,16 +817,18 @@ 

Returns

var path
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -798,9 +844,11 @@ 

Returns

var path_cfg
-
+
-Source code + +Expand source code +
@property
 def path_cfg(self):
     return f"{self.path_cfg_dir}/{self.instance_name}.http.conf"
@@ -808,9 +856,11 @@

Returns

var path_cfg_dir
-
+
-Source code + +Expand source code +
@property
 def path_cfg_dir(self):
     return f"{self.parent.path_cfg_dir}/servers"
@@ -818,9 +868,11 @@

Returns

var path_web
-
+
-Source code + +Expand source code +
@property
 def path_web(self):
     return self.parent.path_web
@@ -828,16 +880,18 @@

Returns

var port
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -853,16 +907,18 @@ 

Returns

var ssl
-

getter method this property

+

getter method this property

will call _get_value, which would if the value is already defined and will get the default value if not

Returns

-
any
+
any
the field value
-
+
-Source code + +Expand source code +
def getter(self):
     """
     getter method this property
@@ -883,9 +939,11 @@ 

Methods

def configure(self)
-

Writes configuration of the website and its locations

+

Writes configuration of the website and its locations

-Source code + +Expand source code +
def configure(self):
     """Writes configuration of the website and its locations
     """
@@ -974,9 +1032,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/servers/openresty/utils.html b/docs/api/jumpscale/servers/openresty/utils.html index 62b6e55d1..b7f297d24 100644 --- a/docs/api/jumpscale/servers/openresty/utils.html +++ b/docs/api/jumpscale/servers/openresty/utils.html @@ -3,15 +3,17 @@ - + jumpscale.servers.openresty.utils API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.servers.openresty.utils

-Source code + +Expand source code +
from jumpscale.loader import j
 
 
@@ -44,9 +48,11 @@ 

Functions

def render_config_template(name, **kwargs)
-
+
-Source code + +Expand source code +
def render_config_template(name, **kwargs):
     return env.get_template(f"{name}.conf").render(**kwargs)
@@ -76,9 +82,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/servers/rack/index.html b/docs/api/jumpscale/servers/rack/index.html index baf9b9eb7..580003f9f 100644 --- a/docs/api/jumpscale/servers/rack/index.html +++ b/docs/api/jumpscale/servers/rack/index.html @@ -3,15 +3,17 @@ - + jumpscale.servers.rack API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.servers.rack

-Source code + +Expand source code +
def export_module_as():
     from .rack import ServerRack
     return ServerRack()
@@ -32,7 +36,7 @@

Sub-modules

jumpscale.servers.rack.rack
-
+
@@ -45,9 +49,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
     from .rack import ServerRack
     return ServerRack()
@@ -83,9 +89,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/servers/rack/rack.html b/docs/api/jumpscale/servers/rack/rack.html index 450c27e8b..76d2fed4a 100644 --- a/docs/api/jumpscale/servers/rack/rack.html +++ b/docs/api/jumpscale/servers/rack/rack.html @@ -3,15 +3,17 @@ - + jumpscale.servers.rack.rack API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.servers.rack.rack

-Source code + +Expand source code +
from gevent import event
 
 from jumpscale.core.base import Base
@@ -119,11 +123,11 @@ 

Classes

class ServerRack
-

A simple attribute-based namespace.

+

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

any instance can have an optional name and a parent.

-
class Person(Base):
+
class Person(Base):
     name = fields.String()
     age = fields.Float()
 
@@ -138,9 +142,11 @@ 

Args

instance name. Defaults to None.
**values
any given field values to initiate the instance with
-
+
-Source code + +Expand source code +
class ServerRack(Base):
     def __init__(self):
         super().__init__()
@@ -230,16 +236,18 @@ 

Methods

def add(self, server_name, server)
-

Add new server to the rack

+

Add new server to the rack

Args

name : str
server name
server : object
server object
-
+
-Source code + +Expand source code +
def add(self, server_name, server):
     """Add new server to the rack
 
@@ -257,25 +265,29 @@ 

Args

def is_running(self, server_name)
-
+
-Source code + +Expand source code +
def is_running(self, server_name):
     return server_name in self._started
-def remove(self, server_name) +def remove(self, server_name: str)
-

Remove server (Stop it first if running)

+

Remove server (Stop it first if running)

Args

server_name : str
server name
-
+
-Source code + +Expand source code +
def remove(self, server_name: str):
     """Remove server (Stop it first if running)
 
@@ -292,17 +304,19 @@ 

Args

-def start(self, server_name=None, wait=False) +def start(self, server_name: str = None, wait: bool = False)
-

Start server by its name or start all servers

+

Start server by its name or start all servers

Args

server_name : str, optional
server name, if None will start all the servers. Defaults to None.
-
+
-Source code + +Expand source code +
def start(self, server_name: str = None, wait: bool = False):
     """Start server by its name or start all servers
 
@@ -324,17 +338,19 @@ 

Args

-def stop(self, server_name=None) +def stop(self, server_name: str = None)
-

Stop server by its name or stop all running servers

+

Stop server by its name or stop all running servers

Args

server_name : str, optional
server name, if None will stop all running servers. Defaults to None.
-
+
-Source code + +Expand source code +
def stop(self, server_name: str = None):
     """Stop server by its name or stop all running servers
 
@@ -393,9 +409,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/shell/config.html b/docs/api/jumpscale/shell/config.html index 5504b94ac..e64f061a1 100644 --- a/docs/api/jumpscale/shell/config.html +++ b/docs/api/jumpscale/shell/config.html @@ -3,15 +3,17 @@ - + jumpscale.shell.config API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.shell.config

-Source code + +Expand source code +
import better_exceptions
 import pudb
 import sys
@@ -300,11 +304,13 @@ 

Functions

def get_completions(self, document, complete_event)
-

get completions filtered and colored

+

get completions filtered and colored

To filter and color completions on type, we try get jedi completions first -and check their type, because prompt-toolkit.completion.Completion does not contain type information

+and check their type, because prompt-toolkit.completion.Completion does not contain type information

-Source code + +Expand source code +
def get_completions(self, document, complete_event):
     """
     get completions filtered and colored
@@ -341,9 +347,11 @@ 

Functions

def get_style_for_completion(completion)
-
+
-Source code + +Expand source code +
def get_style_for_completion(completion):
     base = "bg:%s fg:ansiblack"
     if completion.type == "function":
@@ -358,11 +366,13 @@ 

Functions

def patched_handle_exception(self, e)
-

a new handler for ptpython repl exceptions +

a new handler for ptpython repl exceptions it will call excepthook after ommitting all this framework's calls from traceback

-

for the original, see ptpython.repl.PythonInput._handle_exception

+

for the original, see ptpython.repl.PythonInput._handle_exception

-Source code + +Expand source code +
def patched_handle_exception(self, e):
     """
     a new handler for ptpython repl exceptions
@@ -398,9 +408,11 @@ 

Functions

def ptconfig(repl)
-
+
-Source code + +Expand source code +
def ptconfig(repl):
     repl.exit_message = "Bye!"
     repl.show_docstring = True
@@ -562,7 +574,7 @@ 

Functions

def sort_completions_key(completion)
-

sort completions according to their type

+

sort completions according to their type

Args

completion : jedi.api.classes.Completion
@@ -570,11 +582,13 @@

Args

Returns

-
int
+
int
sorting order
-
+
-Source code + +Expand source code +
def sort_completions_key(completion):
     """
     sort completions according to their type
@@ -622,9 +636,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/shell/index.html b/docs/api/jumpscale/shell/index.html index f120f5ba3..e40142a20 100644 --- a/docs/api/jumpscale/shell/index.html +++ b/docs/api/jumpscale/shell/index.html @@ -3,15 +3,17 @@ - + jumpscale.shell API documentation - - - - - + + + + + + +
@@ -23,7 +25,9 @@

Module jumpscale.shell

This module defines all of js-ng specific shell features

TODO outline.

-Source code + +Expand source code +
"""This module defines all of js-ng specific shell features
 
 # TODO outline.
@@ -37,7 +41,7 @@ 

Sub-modules

jumpscale.shell.config
-
+

@@ -70,9 +74,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/threesdk/container.html b/docs/api/jumpscale/threesdk/container.html index f85a2febd..510eccd9a 100644 --- a/docs/api/jumpscale/threesdk/container.html +++ b/docs/api/jumpscale/threesdk/container.html @@ -3,15 +3,17 @@ - + jumpscale.threesdk.container API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.threesdk.container

-Source code + +Expand source code +
from jumpscale.clients.docker.docker import DockerClient
 from jumpscale.core.dirs.dirs import Dirs
 from jumpscale.core.exceptions import Value
@@ -111,12 +115,13 @@ 

Classes

class Container -(*args, **kwargs)
-

Container management

+

Container management

-Source code + +Expand source code +
class Container:
     """Container management
     """
@@ -196,9 +201,11 @@ 

Static methods

def delete(name)
-
+
-Source code + +Expand source code +
@staticmethod
 def delete(name):
     Container.stop(name)
@@ -209,16 +216,18 @@ 

Static methods

def exec(name, cmd)
-

Execute command in container

+

Execute command in container

Args

name : str
name of the container
cmd : str or list
command to execute
-
+
-Source code + +Expand source code +
@staticmethod
 def exec(name, cmd):
     """Execute command in container
@@ -236,10 +245,10 @@ 

Args

-def install(name, image, development=False, volumes=None) +def install(name, image, development: bool = False, volumes=None)
-

Creates a container

+

Creates a container

Args

name : str
@@ -253,11 +262,13 @@

Args

Raises

-
Value
+
Value
Container with specified name already exists
-
+
-Source code + +Expand source code +
@staticmethod
 def install(name, image, development: bool = False, volumes=None):
     """Creates a container
@@ -286,14 +297,16 @@ 

Raises

def start(name)
-

Starts an existing container

+

Starts an existing container

Args

name : str
name of the container
-
+
-Source code + +Expand source code +
@staticmethod
 def start(name):
     """Starts an existing container
@@ -310,14 +323,16 @@ 

Args

def stop(name)
-

Stops an existing container

+

Stops an existing container

Args

name : str
name of the container
-
+
-Source code + +Expand source code +
@staticmethod
 def stop(name):
     """Stops an existing container
@@ -364,9 +379,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/threesdk/identitymanager.html b/docs/api/jumpscale/threesdk/identitymanager.html index 7abba8995..8f60cf0d0 100644 --- a/docs/api/jumpscale/threesdk/identitymanager.html +++ b/docs/api/jumpscale/threesdk/identitymanager.html @@ -3,15 +3,17 @@ - + jumpscale.threesdk.identitymanager API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.threesdk.identitymanager

-Source code + +Expand source code +
import binascii
 
 import requests
@@ -196,10 +200,10 @@ 

Classes

class IdentityInfo -(*args, **kwargs) +(identity, email, words, explorer)
-

IdentityInfo(identity, email, words, explorer)

+

IdentityInfo(identity, email, words, explorer)

Ancestors

  • builtins.tuple
  • @@ -208,30 +212,32 @@

    Instance variables

    var email
    -

    Alias for field number 1

    +

    Alias for field number 1

    var explorer
    -

    Alias for field number 3

    +

    Alias for field number 3

    var identity
    -

    Alias for field number 0

    +

    Alias for field number 0

    var words
    -

    Alias for field number 2

    +

    Alias for field number 2

class IdentityManager -(identity='', email=None, words=None, explorer=None) +(identity: str = '', email: str = None, words: str = None, explorer: str = None)
-
+
-Source code + +Expand source code +
class IdentityManager:
     def __init__(self, identity: str = "", email: str = None, words: str = None, explorer: str = None):
         self.identity = identity
@@ -380,9 +386,11 @@ 

Methods

def ask_identity(self, identity=None, explorer=None)
-
+
-Source code + +Expand source code +
def ask_identity(self, identity=None, explorer=None):
     def _fill_identity_args(identity, explorer):
         def fill_words():
@@ -465,9 +473,11 @@ 

Methods

def reset(self)
-
+
-Source code + +Expand source code +
def reset(self):
     self.identity = ""
     self.email = ""
@@ -515,9 +525,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/threesdk/index.html b/docs/api/jumpscale/threesdk/index.html index b50ba38bb..6cf3f611c 100644 --- a/docs/api/jumpscale/threesdk/index.html +++ b/docs/api/jumpscale/threesdk/index.html @@ -3,15 +3,17 @@ - + jumpscale.threesdk API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.threesdk

-Source code + +Expand source code +
from .threebot import ThreeBot as threebot
 import inspect
 import cgi
@@ -105,15 +109,15 @@ 

Sub-modules

jumpscale.threesdk.container
-
+
jumpscale.threesdk.identitymanager
-
+
jumpscale.threesdk.settings
-
+
@@ -126,9 +130,11 @@

Functions

def info()
-
+
-Source code + +Expand source code +
def info():
     print_formatted_text(HTML(_get_doc(__all__)))
@@ -140,12 +146,13 @@

Classes

class threebot -(*args, **kwargs)
-

Manage your threebot

+

Manage your threebot

-Source code + +Expand source code +
class ThreeBot(Container):
     """
     Manage your threebot
@@ -250,10 +257,10 @@ 

Ancestors

Static methods

-def install(name=None, image=None, identity=None, email=None, words=None, explorer=None, development=None) +def install(name=None, image=None, identity=None, email=None, words=None, explorer=None, development: bool = None)
-

Creates a threebot container

+

Creates a threebot container

Args

name : str, optional
@@ -273,13 +280,15 @@

Args

Raises

-
Value
+
Value
Container with specified name already exists
-
Value
+
Value
explorer not in mainnet, testnet, devnet
-
+
-Source code + +Expand source code +
@staticmethod
 def install(
     name=None, image=None, identity=None, email=None, words=None, explorer=None, development: bool = None,
@@ -323,17 +332,19 @@ 

Raises

-def jsng(name='3bot-ng') +def jsng(name='3bot-ng')
-

Get's shell in threebot

+

Get's shell in threebot

Args

name : str
name of the container (default: 3bot-ng)
-
+
-Source code + +Expand source code +
@staticmethod
 def jsng(name=DEFAULT_CONTAINER_NAME):
     """Get's shell in threebot
@@ -345,17 +356,19 @@ 

Args

-def restart(name='3bot-ng') +def restart(name='3bot-ng')
-

restart threebot installation with container

+

restart threebot installation with container

Args

name : str
name of the container (default: 3bot-ng)
-
+

-Source code + +Expand source code +
@staticmethod
 def restart(name=DEFAULT_CONTAINER_NAME):
     """restart threebot installation with container
@@ -368,17 +381,19 @@ 

Args

-def shell(name='3bot-ng') +def shell(name='3bot-ng')
-

Get's shell in threebot

+

Get's shell in threebot

Args

name : str
name of the container (default: 3bot-ng)
-
+
-Source code + +Expand source code +
@staticmethod
 def shell(name=DEFAULT_CONTAINER_NAME):
     """Get's shell in threebot
@@ -390,17 +405,19 @@ 

Args

-def start(name='3bot-ng') +def start(name='3bot-ng')
-

Start threebot container with threebot server

+

Start threebot container with threebot server

Args

name : str
name of the container (default: 3bot-ng)
-
+
-Source code + +Expand source code +
@staticmethod
 def start(name=DEFAULT_CONTAINER_NAME):
     """Start threebot container with threebot server
@@ -413,17 +430,19 @@ 

Args

-def stop(name='3bot-ng') +def stop(name='3bot-ng')
-

Stop threebot installation with container

+

Stop threebot installation with container

Args

name : str
name of the container (default: 3bot-ng)
-
+
-Source code + +Expand source code +
@staticmethod
 def stop(name=DEFAULT_CONTAINER_NAME):
     """Stop threebot installation with container
@@ -493,9 +512,7 @@ 

-

Generated by pdoc 0.6.4.

+

Generated by pdoc 0.10.0.

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/threesdk/settings.html b/docs/api/jumpscale/threesdk/settings.html index 75decc271..02559f717 100644 --- a/docs/api/jumpscale/threesdk/settings.html +++ b/docs/api/jumpscale/threesdk/settings.html @@ -3,15 +3,17 @@ - + jumpscale.threesdk.settings API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.threesdk.settings

-Source code + +Expand source code +
expert = False
@@ -49,9 +53,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/alerthandler/alerthandler.html b/docs/api/jumpscale/tools/alerthandler/alerthandler.html index 74bf7b7ef..bb937eb3d 100644 --- a/docs/api/jumpscale/tools/alerthandler/alerthandler.html +++ b/docs/api/jumpscale/tools/alerthandler/alerthandler.html @@ -3,15 +3,17 @@ - + jumpscale.tools.alerthandler.alerthandler API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.tools.alerthandler.alerthandler<
-Source code + +Expand source code +
from jumpscale.loader import j
 import gevent
 
@@ -305,9 +309,11 @@ 

Classes

class Alert
-
+
-Source code + +Expand source code +
class Alert:
     def __init__(self):
         self.id = None
@@ -349,9 +355,11 @@ 

Static methods

def loads(value)
-
+
-Source code + +Expand source code +
@classmethod
 def loads(cls, value):
     json = j.data.serializers.json.loads(value)
@@ -365,9 +373,11 @@ 

Instance variables

var identifier
-
+
-Source code + +Expand source code +
@property
 def identifier(self):
     return _get_identifier(self.app_name, self.message, self.public_message, self.category, self.type)
@@ -375,9 +385,11 @@

Instance variables

var json
-
+
-Source code + +Expand source code +
@property
 def json(self):
     return self.__dict__
@@ -390,9 +402,11 @@

Methods

def dumps(self)
-
+
-Source code + +Expand source code +
def dumps(self):
     return j.data.serializers.json.dumps(self.__dict__)
@@ -403,9 +417,11 @@

Methods

class AlertsHandler
-
+
-Source code + +Expand source code +
class AlertsHandler:
     def __init__(self):
         self._rkey = "alerts"
@@ -635,9 +651,11 @@ 

Instance variables

var db
-
+
-Source code + +Expand source code +
@property
 def db(self):
     if self._db is None:
@@ -649,25 +667,24 @@ 

Instance variables

Methods

-def alert_raise(self, app_name, message, public_message='', category='', alert_type='event_system', level=40, data=None, timestamp=None, traceback=None) +def alert_raise(self, app_name, message, public_message: str = '', category: str = '', alert_type: str = 'event_system', level: int = 40, data: dict = None, timestamp: float = None, traceback: dict = None) ‑> Alert
-

Raise a new alert

+

Raise a new alert

Arguments

-

message {str} – alert message -Keyword Arguments: +

message {str} – alert message

+

Keyword Arguments: public_message {str} – alert public message (default: {""}) category {str} – alert category (default: {""}) alert_type {str} – alert type (default: {"event_system"}) level {int} – alert level (default: {40}) traceback {dict} – alert traceback (default: {None})

Returns

-
-
Alertalert object
-
 
-
+

Alert – alert object

-Source code + +Expand source code +
def alert_raise(
     self,
     app_name,
@@ -733,17 +750,16 @@ 

Returns

-def count(self) +def count(self) ‑> int
-

Gets alerts count

+

Gets alerts count

Returns

-
-
inttotal number of alerts
-
 
-
+

int – total number of alerts

-Source code + +Expand source code +
def count(self) -> int:
     """Gets alerts count
 
@@ -754,20 +770,22 @@ 

Returns

-def delete(self, alert_id=None, identifier=None) +def delete(self, alert_id: int = None, identifier: str = None)
-

Delete alert by its id or identifier

+

Delete alert by its id or identifier

Raises

-
j.core.exceptions.Value: invalid arguments
-
 
-
Keyword Arguments:
-
alert_id {int} – alert id (default: {None}) -identifier {str} – alert identifier (default: {None})
-
+
j.core.exceptions.Value
+
invalid arguments
+
+

Keyword Arguments: +alert_id {int} – alert id (default: {None}) +identifier {str} – alert identifier (default: {None})

-Source code + +Expand source code +
def delete(self, alert_id: int = None, identifier: str = None):
     """Delete alert by its id or identifier
 
@@ -790,19 +808,21 @@ 

Raises

def delete_all(self)
-

Deletes all alerts

+

Deletes all alerts

-Source code + +Expand source code +
def delete_all(self):
     """Deletes all alerts"""
     self.db.delete(self._rkey, self._rkey_id)
-def find(self, app_name='', category='', message='', pid=None, start_time=None, end_time=None) +def find(self, app_name: str = '', category: str = '', message: str = '', pid: int = None, start_time: int = None, end_time: int = None) ‑> list
-

Find alerts

+

Find alerts

Keyword Arguments: app_name (str): filter by allert app name (default: {""}) @@ -812,12 +832,11 @@

Raises

start_time {int} – filter by start time (default: {None}) end_time {int} – filter by end time (default: {None})

Returns

-
-
list of Alert objects
-
 
-
+

list of Alert objects

-Source code + +Expand source code +
def find(
     self,
     app_name: str = "",
@@ -881,28 +900,27 @@ 

Returns

-def get(self, alert_id=None, identifier=None, die=True) +def get(self, alert_id: int = None, identifier: str = None, die: bool = True) ‑> Alert
-

Get alert by its id or identifier

+

Get alert by its id or identifier

Keyword Arguments: alert_id {int} – alert id (default: {None}) identifier {str} – alert identifier (default: {None}) die {bool} – flag to rasie exception if alert is not found (default: {True})

Raises

-
j.core.exceptions.NotFound: alert is not found
-
 
-
j.core.exceptions.Value: invalid arguments
-
 
+
j.core.exceptions.NotFound
+
alert is not found
+
j.core.exceptions.Value
+
invalid arguments

Returns

-
-
Alert – [description]
-
 
-
+

Alert – [description]

-Source code + +Expand source code +
def get(self, alert_id: int = None, identifier: str = None, die: bool = True) -> Alert:
     """Get alert by its id or identifier
 
@@ -931,19 +949,18 @@ 

Returns

-def register_handler(self, handler, level=40) +def register_handler(self, handler: , level: int = 40)
-

Register new alert handler

+

Register new alert handler

Arguments

-
-
handler : callable
-
error handler callable
-
+

handler (callable): error handler callable

Keyword Arguments: -level (int): exception level (default: {40})

+level (int): exception level (default: {40})

-Source code + +Expand source code +
def register_handler(self, handler: callable, level: int = 40):
     """Register new alert handler
 
@@ -961,9 +978,11 @@ 

Arguments

def reset(self)
-

Delete all alerts and reset the db

+

Delete all alerts and reset the db

-Source code + +Expand source code +
def reset(self):
     """Delete all alerts and reset the db"""
     self.delete_all()
@@ -1017,9 +1036,7 @@ 

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/alerthandler/index.html b/docs/api/jumpscale/tools/alerthandler/index.html index cb5266efb..46e79c620 100644 --- a/docs/api/jumpscale/tools/alerthandler/index.html +++ b/docs/api/jumpscale/tools/alerthandler/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.alerthandler API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.tools.alerthandler

-Source code + +Expand source code +
def export_module_as():
     from .alerthandler import AlertsHandler
     return AlertsHandler()
@@ -32,7 +36,7 @@

Sub-modules

jumpscale.tools.alerthandler.alerthandler
-
+
@@ -45,9 +49,11 @@

Functions

def export_module_as()
-
+
-Source code + +Expand source code +
def export_module_as():
     from .alerthandler import AlertsHandler
     return AlertsHandler()
@@ -83,9 +89,7 @@

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/codeloader/index.html b/docs/api/jumpscale/tools/codeloader/index.html index dc841d903..89f6ca247 100644 --- a/docs/api/jumpscale/tools/codeloader/index.html +++ b/docs/api/jumpscale/tools/codeloader/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.codeloader API documentation - - - - - + + + + + + +
@@ -28,12 +30,14 @@

Module jumpscale.tools.codeloader

z = a+b

Using the codeloader tool

-
JS-NG> m = j.tools.codeloader.load_python_module("/tmp/hello.py")
+
JS-NG> m = j.tools.codeloader.load_python_module("/tmp/hello.py")
 JS-NG> m.a
 5
 
-Source code + +Expand source code +
"""Loads a module from path
 
 Let's make sure we have a python module in path `/tmp/hello.py`
@@ -94,10 +98,10 @@ 

Using the codeloader tool

Functions

-def load_python_module(module_path, force_reload=False) +def load_python_module(module_path: str, force_reload: bool = False) ‑> module
-

Loads python module by path

+

Loads python module by path

Args

module_path : str
@@ -107,11 +111,13 @@

Args

Returns

-
types.ModuleType: module object
-
 
-
+
types.ModuleType
+
module object
+
-Source code + +Expand source code +
def load_python_module(module_path: str, force_reload: bool = False) -> types.ModuleType:
     """
     Loads python module by path
@@ -164,9 +170,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/console/index.html b/docs/api/jumpscale/tools/console/index.html index 605f7d437..1d72f308e 100644 --- a/docs/api/jumpscale/tools/console/index.html +++ b/docs/api/jumpscale/tools/console/index.html @@ -3,17 +3,19 @@ - + jumpscale.tools.console API documentation - - - - - + + + + + + +
@@ -23,15 +25,17 @@

Module jumpscale.tools.console

Console module helps with coloring in the console and asking for input from the user.

-
JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{WHITE}OK")                                                                     
-JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{RESET}{WHITE}OK")                                                              
+
JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{WHITE}OK")
+JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{RESET}{WHITE}OK")
 
-Source code + +Expand source code +
"""Console module helps with coloring in the console and asking for input from the user.
 ```
-JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{WHITE}OK")                                                                     
-JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{RESET}{WHITE}OK")                                                              
+JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{WHITE}OK")
+JS-NG> j.tools.console.printcolors("{RED}Hello{BGRED}What{RESET}{WHITE}OK")
 ```
 
 """
@@ -73,11 +77,11 @@ 

Module jumpscale.tools.console

def ask_password(prompt="Password : ", forbiddens=[]): """Prompt the user for a password without echoing - + Keyword Arguments: prompt {str} -- the question message (default: {"Password : "}) forbiddens {list} -- the list of bad passwords (default: {[]}) - + Returns: str -- the appropriate input password """ @@ -90,12 +94,12 @@

Module jumpscale.tools.console

def ask_yes_no(prompt="[y/n] :", default="y", valid=["y", "n"]): """Display a yes/no question and loop until a valid answer is entered - + Keyword Arguments: prompt {str} -- the question message (default: {'[y/n] :'}) default {str} -- the default answer if there is no answer (default: {"y"}) valid {list} -- the list of appropriate answers (default: {["y", "n"]}) - + Returns: str -- the answer """ @@ -118,14 +122,14 @@

Module jumpscale.tools.console

def ask_int_in_range(mini, maxi, prompt="Type int :"): """Get an integer response between two integer on asked question - + Arguments: mini {int} -- the minimum value for the number maxi {int} -- the maximum value for the number - + Keyword Arguments: prompt {str} -- the question message (default: {"Type int :"}) - + Returns: int -- the input number on the range provided """ @@ -148,14 +152,14 @@

Module jumpscale.tools.console

def ask_float_in_range(mini, maxi, prompt="Type float :"): """Get an float response between two float on asked question - + Arguments: mini {float} -- the minimum value for the number maxi {float} -- the maximum value for the number - + Keyword Arguments: prompt {str} -- the question message (default: {"Type float :"}) - + Returns: float -- the input number on the range provided """ @@ -180,11 +184,11 @@

Module jumpscale.tools.console

def ask_choice(prompt="Type choice number : ", choices_list=[]): """Get an option from provided list - + Keyword Arguments: prompt {str} -- the question message (default: {"Type choice number : "}) choices_list {list} -- the available options (default: {[]}) - + Returns: str -- the chosen option """ @@ -198,13 +202,13 @@

Module jumpscale.tools.console

def ask_multi_choices(prompt="Add to choices : ", choices_list=[], to_save="s", to_quit="q"): """Collect multi choices from list - + Keyword Arguments: prompt {str} -- the question method (default: {"Add to choices : "}) choices_list {list} -- the available options (default: {[]}) to_save {str} -- escape and save choices (default: {"s"}) to_quit {str} -- escape without saving (default: {"q"}) - + Returns: list -- list of the selected choices """ @@ -227,11 +231,11 @@

Module jumpscale.tools.console

def ask_multi_lines(prompt="Type :", escape_string="."): """Get input from user provided multilines - + Keyword Arguments: prompt {str} -- the question message (default: {"Type :"}) escape_string {str} -- escape character (default: {"."}) - + Returns: str -- the text seperated by lines """ @@ -245,10 +249,10 @@

Module jumpscale.tools.console

def ask_string(prompt="Type :"): """Just input function - + Keyword Arguments: prompt {str} -- the question message (default: {"Type :"}) - + Returns: str -- the string input """ @@ -271,27 +275,26 @@

Module jumpscale.tools.console

Functions

-def ask_choice(prompt='Type choice number : ', choices_list=[]) +def ask_choice(prompt='Type choice number : ', choices_list=[])
-

Get an option from provided list

+

Get an option from provided list

Keyword Arguments: prompt {str} – the question message (default: {"Type choice number : "}) choices_list {list} – the available options (default: {[]})

Returns

-
-
strthe chosen option
-
 
-
+

str – the chosen option

-Source code + +Expand source code +
def ask_choice(prompt="Type choice number : ", choices_list=[]):
     """Get an option from provided list
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {"Type choice number : "})
         choices_list {list} -- the available options (default: {[]})
-    
+
     Returns:
         str -- the chosen option
     """
@@ -304,12 +307,14 @@ 

Returns

-def ask_float(prompt='Type float :') +def ask_float(prompt='Type float :')
-
+
-Source code + +Expand source code +
def ask_float(prompt="Type float :"):
     try:
         return float(input(prompt))
@@ -318,32 +323,31 @@ 

Returns

-def ask_float_in_range(mini, maxi, prompt='Type float :') +def ask_float_in_range(mini, maxi, prompt='Type float :')
-

Get an float response between two float on asked question

+

Get an float response between two float on asked question

Arguments

mini {float} – the minimum value for the number -maxi {float} – the maximum value for the number -Keyword Arguments: +maxi {float} – the maximum value for the number

+

Keyword Arguments: prompt {str} – the question message (default: {"Type float :"})

Returns

-
-
floatthe input number on the range provided
-
 
-
+

float – the input number on the range provided

-Source code + +Expand source code +
def ask_float_in_range(mini, maxi, prompt="Type float :"):
     """Get an float response between two float on asked question
-    
+
     Arguments:
         mini {float} -- the minimum value for the number
         maxi {float} -- the maximum value for the number
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {"Type float :"})
-    
+
     Returns:
         float -- the input number on the range provided
     """
@@ -358,12 +362,14 @@ 

Returns

-def ask_int(prompt='Type int :') +def ask_int(prompt='Type int :')
-
+
-Source code + +Expand source code +
def ask_int(prompt="Type int :"):
     try:
         return int(input(prompt))
@@ -372,32 +378,31 @@ 

Returns

-def ask_int_in_range(mini, maxi, prompt='Type int :') +def ask_int_in_range(mini, maxi, prompt='Type int :')
-

Get an integer response between two integer on asked question

+

Get an integer response between two integer on asked question

Arguments

mini {int} – the minimum value for the number -maxi {int} – the maximum value for the number -Keyword Arguments: +maxi {int} – the maximum value for the number

+

Keyword Arguments: prompt {str} – the question message (default: {"Type int :"})

Returns

-
-
intthe input number on the range provided
-
 
-
+

int – the input number on the range provided

-Source code + +Expand source code +
def ask_int_in_range(mini, maxi, prompt="Type int :"):
     """Get an integer response between two integer on asked question
-    
+
     Arguments:
         mini {int} -- the minimum value for the number
         maxi {int} -- the maximum value for the number
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {"Type int :"})
-    
+
     Returns:
         int -- the input number on the range provided
     """
@@ -412,31 +417,30 @@ 

Returns

-def ask_multi_choices(prompt='Add to choices : ', choices_list=[], to_save='s', to_quit='q') +def ask_multi_choices(prompt='Add to choices : ', choices_list=[], to_save='s', to_quit='q')
-

Collect multi choices from list

+

Collect multi choices from list

Keyword Arguments: prompt {str} – the question method (default: {"Add to choices : "}) choices_list {list} – the available options (default: {[]}) to_save {str} – escape and save choices (default: {"s"}) to_quit {str} – escape without saving (default: {"q"})

Returns

-
-
listlist of the selected choices
-
 
-
+

list – list of the selected choices

-Source code + +Expand source code +
def ask_multi_choices(prompt="Add to choices : ", choices_list=[], to_save="s", to_quit="q"):
     """Collect multi choices from list
-    
+
     Keyword Arguments:
         prompt {str} -- the question method (default: {"Add to choices : "})
         choices_list {list} -- the available options (default: {[]})
         to_save {str} -- escape and save choices (default: {"s"})
         to_quit {str} -- escape without saving (default: {"q"})
-    
+
     Returns:
         list -- list of the selected choices
     """
@@ -458,27 +462,26 @@ 

Returns

-def ask_multi_lines(prompt='Type :', escape_string='.') +def ask_multi_lines(prompt='Type :', escape_string='.')
-

Get input from user provided multilines

+

Get input from user provided multilines

Keyword Arguments: prompt {str} – the question message (default: {"Type :"}) escape_string {str} – escape character (default: {"."})

Returns

-
-
strthe text seperated by lines
-
 
-
+

str – the text seperated by lines

-Source code + +Expand source code +
def ask_multi_lines(prompt="Type :", escape_string="."):
     """Get input from user provided multilines
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {"Type :"})
         escape_string {str} -- escape character (default: {"."})
-    
+
     Returns:
         str -- the text seperated by lines
     """
@@ -491,27 +494,26 @@ 

Returns

-def ask_password(prompt='Password : ', forbiddens=[]) +def ask_password(prompt='Password : ', forbiddens=[])
-

Prompt the user for a password without echoing

+

Prompt the user for a password without echoing

Keyword Arguments: prompt {str} – the question message (default: {"Password : "}) forbiddens {list} – the list of bad passwords (default: {[]})

Returns

-
-
strthe appropriate input password
-
 
-
+

str – the appropriate input password

-Source code + +Expand source code +
def ask_password(prompt="Password : ", forbiddens=[]):
     """Prompt the user for a password without echoing
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {"Password : "})
         forbiddens {list} -- the list of bad passwords (default: {[]})
-    
+
     Returns:
         str -- the appropriate input password
     """
@@ -523,25 +525,24 @@ 

Returns

-def ask_string(prompt='Type :') +def ask_string(prompt='Type :')
-

Just input function

+

Just input function

Keyword Arguments: prompt {str} – the question message (default: {"Type :"})

Returns

-
-
strthe string input
-
 
-
+

str – the string input

-Source code + +Expand source code +
def ask_string(prompt="Type :"):
     """Just input function
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {"Type :"})
-    
+
     Returns:
         str -- the string input
     """
@@ -551,29 +552,28 @@ 

Returns

-def ask_yes_no(prompt='[y/n] :', default='y', valid=['y', 'n']) +def ask_yes_no(prompt='[y/n] :', default='y', valid=['y', 'n'])
-

Display a yes/no question and loop until a valid answer is entered

+

Display a yes/no question and loop until a valid answer is entered

Keyword Arguments: prompt {str} – the question message (default: {'[y/n] :'}) default {str} – the default answer if there is no answer (default: {"y"}) valid {list} – the list of appropriate answers (default: {["y", "n"]})

Returns

-
-
strthe answer
-
 
-
+

str – the answer

-Source code + +Expand source code +
def ask_yes_no(prompt="[y/n] :", default="y", valid=["y", "n"]):
     """Display a yes/no question and loop until a valid answer is entered
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {'[y/n] :'})
         default {str} -- the default answer if there is no answer (default: {"y"})
         valid {list} -- the list of appropriate answers (default: {["y", "n"]})
-    
+
     Returns:
         str -- the answer
     """
@@ -591,9 +591,11 @@ 

Returns

def format(s)
-
+
-Source code + +Expand source code +
def format(s):
     return s.format(**NAMES_TO_COLORS)
@@ -602,15 +604,17 @@

Returns

def printcolors(s)
-
>>> j.tools.console.printcolors("{RED}Hello world")
+
>>> j.tools.console.printcolors("{RED}Hello world")
 Hello world
->>> j.tools.console.printcolors("{GREEN}Hello world")
+>>> j.tools.console.printcolors("{GREEN}Hello world")
 Hello world
 

Arguments: -s {[type]} – [description]

+s {[type]} – [description]

-Source code + +Expand source code +
def printcolors(s):
     """
         >>> j.tools.console.printcolors("{RED}Hello world")
@@ -628,9 +632,11 @@ 

Returns

def printobj(obj)
-
+
-Source code + +Expand source code +
def printobj(obj):
     from pprint import pprint
 
@@ -674,9 +680,7 @@ 

Index

- - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/depsresolver/depsresolver.html b/docs/api/jumpscale/tools/depsresolver/depsresolver.html index 677cc1ec8..84492d7e6 100644 --- a/docs/api/jumpscale/tools/depsresolver/depsresolver.html +++ b/docs/api/jumpscale/tools/depsresolver/depsresolver.html @@ -3,15 +3,17 @@ - + jumpscale.tools.depsresolver.depsresolver API documentation - - - - - + + + + + + +
@@ -21,7 +23,9 @@

Module jumpscale.tools.depsresolver.depsresolver<
-Source code + +Expand source code +
from dataclasses import dataclass, field
 from typing import List, Dict, Tuple, Callable
 from enum import Enum
@@ -150,12 +154,14 @@ 

Module jumpscale.tools.depsresolver.depsresolver<

Functions

-def graph_has_cycle(graph) +def graph_has_cycle(graph: Dict[str, List[str]]) ‑> Tuple[bool, Dict[str, str]]
-
+
-Source code + +Expand source code +
def graph_has_cycle(graph: Dict[str, List[str]]) -> Tuple[bool, Dict[str, str]]:
     colors: Dict[str, NodeColor] = {}
     for node in graph:
@@ -173,12 +179,14 @@ 

Functions

-def has_cycle_dfs(graph, node, colors, has_cycle, parent_map) +def has_cycle_dfs(graph: Dict[str, List[str]], node: str, colors: Dict[str, NodeColor], has_cycle: List[bool], parent_map: Dict[str, str])
-
+
-Source code + +Expand source code +
def has_cycle_dfs(
     graph: Dict[str, List[str]],
     node: str,
@@ -208,13 +216,16 @@ 

Classes

class DepsResolver -(tasksgraph=, tasks=) +(tasksgraph: Dict[str, List[str]] = <factory>, tasks: Dict[str, Task] = <factory>)
-

DepsResolver(tasksgraph: Dict[str, List[str]] = , tasks: Dict[str, jumpscale.tools.depsresolver.depsresolver.Task] = )

+

DepsResolver(tasksgraph: Dict[str, List[str]] = , tasks: Dict[str, jumpscale.tools.depsresolver.depsresolver.Task] = )

-Source code -
class DepsResolver:
+
+Expand source code
+
+
@dataclass
+class DepsResolver:
     tasksgraph: Dict[str, List[str]] = field(default_factory=dict)
     tasks: Dict[str, Task] = field(default_factory=dict)
 
@@ -249,15 +260,28 @@ 

Classes

self._run_task_helper(subtask, deps, seen) deps.append(task_name)
+

Class variables

+
+
var tasks : Dict[str, Task]
+
+
+
+
var tasksgraph : Dict[str, List[str]]
+
+
+
+

Methods

-def add_task(self, task_name, deps, action) +def add_task(self, task_name: str, deps: List[str], action: str)
-
+
-Source code + +Expand source code +
def add_task(self, task_name: str, deps: List[str], action: str):
     thetask = Task(task_name, deps, action)
     self.tasksgraph[task_name] = deps
@@ -265,12 +289,14 @@ 

Methods

-def run_task(self, task_name) +def run_task(self, task_name: str)
-
+
-Source code + +Expand source code +
def run_task(self, task_name: str):
     has_cycle, parent_map = graph_has_cycle(self.tasksgraph)
     if has_cycle:
@@ -292,12 +318,14 @@ 

Methods

class NodeColor -(*args, **kwargs) +(value, names=None, *, module=None, qualname=None, type=None, start=1)
-

An enumeration.

+

An enumeration.

-Source code + +Expand source code +
class NodeColor(Enum):
     White = 0
     Gray = 1
@@ -311,31 +339,49 @@ 

Class variables

var Black
-
+
var Gray
-
+
var White
-
+
class Task -(name, requires, action) +(name: str, requires: List[str], action: Callable)
-

Task(name: str, requires: List[str], action: Callable)

+

Task(name: str, requires: List[str], action: Callable)

-Source code -
class Task:
+
+Expand source code
+
+
@dataclass
+class Task:
     name: str
     requires: List[str]
     action: Callable
+

Class variables

+
+
var action : Callable
+
+
+
+
var name : str
+
+
+
+
var requires : List[str]
+
+
+
+
@@ -364,6 +410,8 @@

  • add_task
  • run_task
  • +
  • tasks
  • +
  • tasksgraph
  • @@ -376,6 +424,11 @@

    Task

    +
  • @@ -383,9 +436,7 @@

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/depsresolver/index.html b/docs/api/jumpscale/tools/depsresolver/index.html index a0a05f71e..29d10d4f9 100644 --- a/docs/api/jumpscale/tools/depsresolver/index.html +++ b/docs/api/jumpscale/tools/depsresolver/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.depsresolver API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.depsresolver

    -Source code + +Expand source code +
    def export_module_as():
         from .depsresolver import DepsResolver
     
    @@ -33,7 +37,7 @@ 

    Sub-modules

    jumpscale.tools.depsresolver.depsresolver
    -
    +
    @@ -46,9 +50,11 @@

    Functions

    def export_module_as()
    -
    +
    -Source code + +Expand source code +
    def export_module_as():
         from .depsresolver import DepsResolver
     
    @@ -85,9 +91,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/errorhandler/errorhandler.html b/docs/api/jumpscale/tools/errorhandler/errorhandler.html index 9673c0b38..0fcc1d12d 100644 --- a/docs/api/jumpscale/tools/errorhandler/errorhandler.html +++ b/docs/api/jumpscale/tools/errorhandler/errorhandler.html @@ -3,15 +3,17 @@ - + jumpscale.tools.errorhandler.errorhandler API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.errorhandler.errorhandler<
    -Source code + +Expand source code +
    import inspect
     import sys
     import traceback
    @@ -176,9 +180,11 @@ 

    Classes

    class ErrorHandler
    -
    +
    -Source code + +Expand source code +
    class ErrorHandler:
         def __init__(self):
             self.handlers = []
    @@ -318,9 +324,11 @@ 

    Methods

    def excepthook(self, ttype, tvalue, tb)
    -

    exception hook handler

    +

    exception hook handler

    -Source code + +Expand source code +
    def excepthook(self, ttype, tvalue, tb):
         """exception hook handler"""
         self._handle_exception(ttype, tvalue, tb)
    @@ -330,8 +338,8 @@

    Methods

    def get_traceback(self, exc_info=None)
    -

    Get a trackback information as a dict, suitable to used with error/alert handlers

    -
        if `exe_info` is not passed, `sys.exc_info()` will be used instead.
    +

    Get a trackback information as a dict, suitable to used with error/alert handlers

    +
        if <code>exe\_info</code> is not passed, <code>sys.exc\_info()</code> will be used instead.
     
         Example traceback information:
     
    @@ -358,9 +366,11 @@ 

    Methods

    Returns: dict: raw and stacktrace information as a dict, alongside process id -
    +
    -Source code + +Expand source code +
    def get_traceback(self, exc_info=None):
         """Get a trackback information as a dict, suitable to used with error/alert handlers
     
    @@ -402,19 +412,21 @@ 

    Methods

    -def handle_exception(self, exception, level=40, die=False, log=True, category='', data=None) +def handle_exception(self, exception: Exception, level: int = 40, die: bool = False, log: bool = True, category: str = '', data: dict = None)
    -

    Hndler exception

    +

    Hndler exception

    Arguments

    -

    exception {Exception} – the exception object to handle -Keyword Arguments: +

    exception {Exception} – the exception object to handle

    +

    Keyword Arguments: level {int} – exception level (default: {40}) die {bool} – optional flag to exit after handling the exception (default: {True}) log {bool} – option flag to log the exception (default: {True}) -category {str} – category (default: {""})

    +category {str} – category (default: {""})

    -Source code + +Expand source code +
    def handle_exception(
         self,
         exception: Exception,
    @@ -440,16 +452,18 @@ 

    Arguments

    -def register_handler(self, handler, level=40) +def register_handler(self, handler: , level: int = 40)
    -

    Register new error handler

    +

    Register new error handler

    Arguments

    -

    handler {callable} – error handler callable -Keyword Arguments: -level {int} – exception level (default: {40})

    +

    handler {callable} – error handler callable

    +

    Keyword Arguments: +level {int} – exception level (default: {40})

    -Source code + +Expand source code +
    def register_handler(self, handler: callable, level: int = 40):
         """Register new error handler
     
    @@ -496,9 +510,7 @@ 

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/errorhandler/index.html b/docs/api/jumpscale/tools/errorhandler/index.html index 142bbeb81..26b974391 100644 --- a/docs/api/jumpscale/tools/errorhandler/index.html +++ b/docs/api/jumpscale/tools/errorhandler/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.errorhandler API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.errorhandler

    -Source code + +Expand source code +
    def export_module_as():
         from .errorhandler import ErrorHandler
     
    @@ -33,7 +37,7 @@ 

    Sub-modules

    jumpscale.tools.errorhandler.errorhandler
    -
    +
    @@ -46,9 +50,11 @@

    Functions

    def export_module_as()
    -
    +
    -Source code + +Expand source code +
    def export_module_as():
         from .errorhandler import ErrorHandler
     
    @@ -85,9 +91,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/git/index.html b/docs/api/jumpscale/tools/git/index.html index 7f211aad0..2cafb61ac 100644 --- a/docs/api/jumpscale/tools/git/index.html +++ b/docs/api/jumpscale/tools/git/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.git API documentation - - - - - + + + + + + +
    @@ -23,7 +25,9 @@

    Module jumpscale.tools.git

    Git module helps with everything around git management like pulling, cloning .. etc

    TODO: examples

    -Source code + +Expand source code +
    """Git module helps with everything around git management like pulling, cloning .. etc
     
     # TODO: examples
    @@ -231,7 +235,7 @@ 

    TODO: examples

    def get_latest_remote_tag(repo_path): """ - Get the latest tag of a remote repository + retrive the latest tag of a remote upstream repository Args: repo_path (str): path to the local git repository @@ -239,13 +243,12 @@

    TODO: examples

    Returns: str: the latest tag of the remote repository """ - try: - _, out, _ = j.sals.process.execute( - "git ls-remote --tags --refs --sort='v:refname' | tail -n1 | sed 's/.*\///'", cwd=repo_path - ) - latest_remote_tag = out.rstrip("\n") - except Exception as e: - raise j.exceptions.Runtime(f"Failed to fetch remote releases. {str(e)}") + rc, out, err = j.sals.process.execute( + "git ls-remote --tags --refs | sort -t '/' -k 3 -V | tail -n1 | sed 's/.*\///'", cwd=repo_path + ) + if rc != 0: + raise j.exceptions.Runtime(f"Failed to fetch latest remote release. {err}") + latest_remote_tag = out.rstrip("\n") return latest_remote_tag

    @@ -257,10 +260,10 @@

    TODO: examples

    Functions

    -def clone_repo(url, dest, branch_or_tag='', depth=0, commit_id='') +def clone_repo(url: str, dest: str, branch_or_tag='', depth=0, commit_id='')
    -

    Clones repo with sepcified url at specified dest

    +

    Clones repo with sepcified url at specified dest

    Args

    url : str
    @@ -273,9 +276,11 @@

    Args

    specify the depth of the clone. Defaults to 0.
    commit_id : int, optional
    commit to checkout to. Defauls to "".
    -
    +
    -Source code + +Expand source code +
    def clone_repo(url: str, dest: str, branch_or_tag="", depth=0, commit_id=""):
         """Clones repo with sepcified url at specified dest
     
    @@ -307,10 +312,10 @@ 

    Args

    -def ensure_repo(url, dest='', branch_or_tag='', commit_id='', discard_changes=False, depth=0) +def ensure_repo(url: str, dest='', branch_or_tag='', commit_id='', discard_changes=False, depth=0)
    -

    Makes sure that repo exists in specified dest with correct branch

    +

    Makes sure that repo exists in specified dest with correct branch

    Args

    url : str
    @@ -325,9 +330,11 @@

    Args

    Will remove changes in repo if True during pull. Defaults to False.
    depth : int, optional
    specify the depth of the clone. Defaults to 0.
    -
    +
    -Source code + +Expand source code +
    def ensure_repo(url: str, dest="", branch_or_tag="", commit_id="", discard_changes=False, depth=0):
         """Makes sure that repo exists in specified dest with correct branch
     
    @@ -350,10 +357,10 @@ 

    Args

    -def find(account='', name='') +def find(account='', name='')
    -

    find all repo paths in j.core.dirs.CODEDIR

    +

    find all repo paths in j.core.dirs.CODEDIR

    Args

    account : str, optional
    @@ -363,11 +370,13 @@

    Args

    Returns

    -
    list
    +
    list
    list of repos path
    -
    +
    -Source code + +Expand source code +
    def find(account="", name=""):
         """find all repo paths in j.core.dirs.CODEDIR
     
    @@ -396,12 +405,14 @@ 

    Returns

    def find_git_path(path, die=True)
    -

    given a path, check if this path or any of its parents is a git repo, return the first git repo +

    given a path, check if this path or any of its parents is a git repo, return the first git repo :param path: (String) path from where to start search :returns (String) the first path which is a git repo -:raises Exception when no git path can be found

    +:raises Exception when no git path can be found

    -Source code + +Expand source code +
    def find_git_path(path, die=True):
         """
         given a path, check if this path or any of its parents is a git repo, return the first git repo
    @@ -421,7 +432,7 @@ 

    Returns

    def get_latest_remote_tag(repo_path)
    -

    Get the latest tag of a remote repository

    +

    retrive the latest tag of a remote upstream repository

    Args

    repo_path : str
    @@ -429,14 +440,16 @@

    Args

    Returns

    -
    str
    +
    str
    the latest tag of the remote repository
    -
    +
    -Source code + +Expand source code +
    def get_latest_remote_tag(repo_path):
         """
    -    Get the latest tag of a remote repository
    +    retrive the latest tag of a remote upstream repository
     
         Args:
             repo_path (str): path to the local git repository
    @@ -444,28 +457,29 @@ 

    Returns

    Returns: str: the latest tag of the remote repository """ - try: - _, out, _ = j.sals.process.execute( - "git ls-remote --tags --refs --sort='v:refname' | tail -n1 | sed 's/.*\///'", cwd=repo_path - ) - latest_remote_tag = out.rstrip("\n") - except Exception as e: - raise j.exceptions.Runtime(f"Failed to fetch remote releases. {str(e)}") + rc, out, err = j.sals.process.execute( + "git ls-remote --tags --refs | sort -t '/' -k 3 -V | tail -n1 | sed 's/.*\///'", cwd=repo_path + ) + if rc != 0: + raise j.exceptions.Runtime(f"Failed to fetch latest remote release. {err}") + latest_remote_tag = out.rstrip("\n") return latest_remote_tag
    -def get_path_from_url(url) +def get_path_from_url(url: str)
    -

    returns repo path in the filesystem based on the urk

    +

    returns repo path in the filesystem based on the urk

    Args

    url : str
    repo url
    -
    +
    -Source code + +Expand source code +
    def get_path_from_url(url: str):
         """returns repo path in the filesystem based on the urk
     
    @@ -491,7 +505,7 @@ 

    Args

    def giturl_parse(url)
    -

    :return +

    +- https://github.com/threefoldtech/jumpscale_/jumpscaleX_core/tree/master/lib/Jumpscale/tools/docsite/macros

    -Source code + +Expand source code +
    def giturl_parse(url):
         """
         :return
    @@ -538,10 +554,10 @@ 

    Args

    -def pull_repo(path, discard_changes=False, revision='') +def pull_repo(path: str, discard_changes=False, revision='')
    -

    Pull repo at the given path

    +

    Pull repo at the given path

    Args

    path : str
    @@ -550,9 +566,11 @@

    Args

    Will remove changes in repo if True. Defaults to False.
    revision : str, optional
    change to specified branch, tag, commit. Defaults to "".
    -
    +
    -Source code + +Expand source code +
    def pull_repo(path: str, discard_changes=False, revision=""):
         """Pull repo at the given path
     
    @@ -573,10 +591,12 @@ 

    Args

    def rewrite_git_https_url_to_ssh(url)
    -

    :param url: (str) https url to rewrite as ssh -:return (tuple) repo name and rewritten ssh url

    +

    :param url: (str) https url to rewrite as ssh +:return (tuple) repo name and rewritten ssh url

    -Source code + +Expand source code +
    def rewrite_git_https_url_to_ssh(url):
         """
         :param url: (str) https url to rewrite as ssh
    @@ -592,12 +612,14 @@ 

    Args

    def rewrite_git_ssh_url_to_https(url, login=None, passwd=None)
    -

    :param url: (str) ssh url to rewrite ass https +

    :param url: (str) ssh url to rewrite ass https :param login: (str) authentication login name :param passwd: (str) authentication login password -:return (tuple) repo name and rewritten https url

    +:return (tuple) repo name and rewritten https url

    -Source code + +Expand source code +
    def rewrite_git_ssh_url_to_https(url, login=None, passwd=None):
         """
         :param url: (str) ssh url to rewrite ass https
    @@ -654,9 +676,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/highlighter/index.html b/docs/api/jumpscale/tools/highlighter/index.html index 4920d186f..71b242f78 100644 --- a/docs/api/jumpscale/tools/highlighter/index.html +++ b/docs/api/jumpscale/tools/highlighter/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.highlighter API documentation - - - - - + + + + + + +
    @@ -62,7 +64,9 @@

    Module jumpscale.tools.highlighter

    print_highlighted(C)
    -Source code + +Expand source code +
    '''Highlighter module helps with formatting text to be highlighted in terminal and in web
     
     example:
    @@ -73,7 +77,7 @@ 

    Module jumpscale.tools.highlighter

    def _init(self,**kwargs): self.lexers = Lexers() self.formatters = Formatters() - + def print_python(self,text,formatter="terminal"): C=Tools.text_replace(text) @@ -102,7 +106,7 @@

    Module jumpscale.tools.highlighter

    ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true - + """ print_toml(C) print_highlighted(C) @@ -127,7 +131,7 @@

    Module jumpscale.tools.highlighter

    def _init(self,**kwargs): self.lexers = Lexers() self.formatters = Formatters() - + def print_python(self,text,formatter="terminal"): C=Tools.text_replace(text) @@ -156,7 +160,7 @@

    Module jumpscale.tools.highlighter

    ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true - + """ print_toml(C) print_highlighted(C)
    @@ -170,36 +174,42 @@

    Module jumpscale.tools.highlighter

    Functions

    -def print_highlighted(txt, lexer=None, formatter='terminal') +def print_highlighted(txt, lexer=None, formatter='terminal')
    -
    +
    -Source code + +Expand source code +
    def print_highlighted(txt, lexer=None, formatter="terminal"):
         lexer = find_lexer_class_by_name(lexer) if lexer else guess_lexer(txt)
         print(pygments.highlight(txt, lexer, get_formatter_by_name(formatter)))
    -def print_python(txt, lexer=None, formatter='terminal') +def print_python(txt, lexer=None, formatter='terminal')
    -
    +
    -Source code + +Expand source code +
    def print_highlighted(txt, lexer=None, formatter="terminal"):
         lexer = find_lexer_class_by_name(lexer) if lexer else guess_lexer(txt)
         print(pygments.highlight(txt, lexer, get_formatter_by_name(formatter)))
    -def print_toml(txt, lexer=None, formatter='terminal') +def print_toml(txt, lexer=None, formatter='terminal')
    -
    +
    -Source code + +Expand source code +
    def print_highlighted(txt, lexer=None, formatter="terminal"):
         lexer = find_lexer_class_by_name(lexer) if lexer else guess_lexer(txt)
         print(pygments.highlight(txt, lexer, get_formatter_by_name(formatter)))
    @@ -209,15 +219,17 @@

    Functions

    def test()
    -
    +
    -Source code + +Expand source code +
    def test():
         C = """
         def _init(self,**kwargs):
             self.lexers = Lexers()
             self.formatters = Formatters()
    -        
    +
     
         def print_python(self,text,formatter="terminal"):
             C=Tools.text_replace(text)
    @@ -246,7 +258,7 @@ 

    Functions

    ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true - + """ print_toml(C) print_highlighted(C)
    @@ -280,9 +292,7 @@

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/http/index.html b/docs/api/jumpscale/tools/http/index.html index ab18659b7..f92a9b4f2 100644 --- a/docs/api/jumpscale/tools/http/index.html +++ b/docs/api/jumpscale/tools/http/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.http API documentation - - - - - + + + + + + +
    @@ -23,7 +25,9 @@

    Module jumpscale.tools.http

    This module wraps requests framework for http calls

    TODO: examples

    -Source code + +Expand source code +
    """This module wraps requests framework for http calls
     
     #TODO: examples
    @@ -58,9 +62,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/index.html b/docs/api/jumpscale/tools/index.html index 049874c2c..43b7cb62c 100644 --- a/docs/api/jumpscale/tools/index.html +++ b/docs/api/jumpscale/tools/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools API documentation - - - - - + + + + + + +
    @@ -26,64 +28,64 @@

    Sub-modules

    jumpscale.tools.alerthandler
    -
    +
    jumpscale.tools.codeloader
    -

    Loads a module from path …

    +

    Loads a module from path …

    jumpscale.tools.console
    -

    Console module helps with coloring in the console and asking for input from the user. +

    Console module helps with coloring in the console and asking for input from the user. ``` -JS-NG> …

    +JS-NG> …

    jumpscale.tools.depsresolver
    -
    +
    jumpscale.tools.errorhandler
    -
    +
    jumpscale.tools.git
    -

    Git module helps with everything around git management like pulling, cloning .. etc …

    +

    Git module helps with everything around git management like pulling, cloning .. etc …

    jumpscale.tools.highlighter
    -

    Highlighter module helps with formatting text to be highlighted in terminal and in web …

    +

    Highlighter module helps with formatting text to be highlighted in terminal and in web …

    jumpscale.tools.http
    -

    This module wraps requests framework for http calls …

    +

    This module wraps requests framework for http calls …

    jumpscale.tools.jinja2
    -

    This module helps with the common operations of jinja2 and reduces the boilerplate around it …

    +

    This module helps with the common operations of jinja2 and reduces the boilerplate around it …

    jumpscale.tools.keygen
    -
    +
    jumpscale.tools.schemac
    -

    schemac …

    +

    schemac …

    jumpscale.tools.startupcmd
    -
    +
    jumpscale.tools.syncer
    -

    Module to help syncing multiple machines with specific directories you have. +

    Module to help syncing multiple machines with specific directories you have. used in the jsync tool. ``` -JS-NG> xmonader = …

    +JS-NG> xmonader = …

    jumpscale.tools.timer
    -

    Helps with timing functions and see how long they took …

    +

    Helps with timing functions and see how long they took …

    @@ -127,9 +129,7 @@

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/jinja2/index.html b/docs/api/jumpscale/tools/jinja2/index.html index 2c220f495..4810fc8b4 100644 --- a/docs/api/jumpscale/tools/jinja2/index.html +++ b/docs/api/jumpscale/tools/jinja2/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.jinja2 API documentation - - - - - + + + + + + +
    @@ -22,7 +24,7 @@

    Module jumpscale.tools.jinja2

    This module helps with the common operations of jinja2 and reduces the boilerplate around it

    Getting environment

    -
    from jinja2 import (
    +
    from jinja2 import (
         Environment,
         FileSystemLoader,
         select_autoescape,
    @@ -38,7 +40,7 @@ 

    Getting a template from path or te

    Rendering a template with data

    you can render from a file path or a text directly using j.tools.jinja2.render_template and pass template_text in case of a string or template_path in case of a file path.

    e.g

    -
            data = dict(
    +
            data = dict(
                 generated_class_name=schema.url_to_class_name,
                 generated_properties=schema.props,
                 types_map=self._types_map,
    @@ -49,7 +51,9 @@ 

    Rendering a template with data

    return j.tools.jinja2.render_template(template_text=self._single_template, **data)
    -Source code + +Expand source code +
    """This module helps with the common operations of jinja2 and reduces the boilerplate around it
     
     
    @@ -184,7 +188,7 @@ 

    Functions

    def get_env(templates_path)
    -

    get an environment from templates root path

    +

    get an environment from templates root path

    Args

    templates_path : str
    @@ -192,11 +196,13 @@

    Args

    Returns

    -
    jinja2.Environment: Jinja2 env
    -
     
    -
    +
    jinja2.Environment
    +
    Jinja2 env
    +
    -Source code + +Expand source code +
    def get_env(templates_path):
         """get an environment from templates root path
     
    @@ -213,7 +219,7 @@ 

    Returns

    def get_template(template_path=None, template_text=None)
    -

    returns jinja2 template

    +

    returns jinja2 template

    Args

    template_path : str, optional
    @@ -223,18 +229,20 @@

    Args

    Raises

    -
    j.exceptions.Input: If both template_path and template_text are specified
    -
     
    -
    j.exceptions.Input: If no input was specified
    -
     
    +
    j.exceptions.Input
    +
    If both template_path and template_text are specified
    +
    j.exceptions.Input
    +
    If no input was specified

    Returns

    -
    jinja2.Template: Jinja2 template
    -
     
    -
    +
    jinja2.Template
    +
    Jinja2 template
    +
    -Source code + +Expand source code +
    def get_template(template_path=None, template_text=None):
         """returns jinja2 template
     
    @@ -265,9 +273,11 @@ 

    Returns

    def render_code_python(obj_key=None, template_path=None, template_text=None, dest=None, objForHash=None, name=None, **kwargs)
    -
    +
    -Source code + +Expand source code +
    def render_code_python(
         obj_key=None, template_path=None, template_text=None, dest=None, objForHash=None, name=None, **kwargs,
     ):
    @@ -279,7 +289,7 @@ 

    Returns

    def render_template(template_path=None, template_text=None, dest=None, **kwargs)
    -

    load the template if dest is specified will write in specified path, renders with specified kwargs

    +

    load the template if dest is specified will write in specified path, renders with specified kwargs

    Args

    template_path : str, optional
    @@ -291,16 +301,18 @@

    Args

    Raises

    -
    j.exceptions.Base: If rendering failed
    -
     
    +
    j.exceptions.Base
    +
    If rendering failed

    Returns

    -
    str
    +
    str
    Rendered template
    -
    +
    -Source code + +Expand source code +
    def render_template(template_path=None, template_text=None, dest=None, **kwargs):
         """load the template if dest is specified will write in specified path, renders with specified kwargs
     
    @@ -360,9 +372,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/keygen/index.html b/docs/api/jumpscale/tools/keygen/index.html index 077444136..a715d7102 100644 --- a/docs/api/jumpscale/tools/keygen/index.html +++ b/docs/api/jumpscale/tools/keygen/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.keygen API documentation - - - - - + + + + + + +
    @@ -26,7 +28,7 @@

    Sub-modules

    jumpscale.tools.keygen.keygen
    -
    +
    @@ -57,9 +59,7 @@

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/keygen/keygen.html b/docs/api/jumpscale/tools/keygen/keygen.html index 28f87786a..0134df051 100644 --- a/docs/api/jumpscale/tools/keygen/keygen.html +++ b/docs/api/jumpscale/tools/keygen/keygen.html @@ -3,15 +3,17 @@ - + jumpscale.tools.keygen.keygen API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.keygen.keygen

    -Source code + +Expand source code +
    print("keygen..")
    @@ -49,9 +53,7 @@

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/schemac/compiler.html b/docs/api/jumpscale/tools/schemac/compiler.html index cb5555cde..337c0a7ed 100644 --- a/docs/api/jumpscale/tools/schemac/compiler.html +++ b/docs/api/jumpscale/tools/schemac/compiler.html @@ -3,15 +3,17 @@ - + jumpscale.tools.schemac.compiler API documentation - - - - - + + + + + + +
    @@ -22,7 +24,9 @@

    Module jumpscale.tools.schemac.compiler

    The compiler that parses JSX schema and generates a suitable backend in a supported lanaguage.

    -Source code + +Expand source code +
    """The compiler that parses JSX schema and generates a suitable backend in a supported lanaguage.
     
     """
    @@ -92,16 +96,18 @@ 

    Module jumpscale.tools.schemac.compiler

    Functions

    -def generator_by_name(language_name='python') +def generator_by_name(language_name='python')
    -

    Gets a generator by name

    +

    Gets a generator by name

    Keyword Arguments: language_name (str) – suitable generator (default: {"python"})

    Returns

    -

    (jumpscale.tools.schema.SchemaGenerator.Plugin) – The generator to use. Default

    +

    (jumpscale.tools.schema.SchemaGenerator.Plugin) – The generator to use. Default

    -Source code + +Expand source code +
    def generator_by_name(language_name="python"):
         """Gets a generator by name
     
    @@ -124,12 +130,14 @@ 

    Classes

    (lang='python', schema_text='')
    -

    Compiler class responsible for parsing schema_text and creating Parsed Schema objects with all metadata information needed.

    +

    Compiler class responsible for parsing schema_text and creating Parsed Schema objects with all metadata information needed.

    Keyword Arguments: lang (str)– language to generate for (default: {"python"}) -schema_text (str)– the schema text.

    +schema_text (str)– the schema text.

    -Source code + +Expand source code +
    class Compiler:
         def __init__(self, lang="python", schema_text=""):
             """Compiler class responsible for parsing schema_text and creating Parsed Schema objects with all metadata information needed.
    @@ -169,9 +177,11 @@ 

    Instance variables

    var generator
    -

    Gets generator by self.lang.

    +

    Gets generator by self.lang.

    -Source code + +Expand source code +
    @property
     def generator(self):
         """Gets generator by `self.lang`."""
    @@ -185,9 +195,11 @@ 

    Methods

    def parse(self)
    -

    Parses all the schemas in self._schema_text and returns Schema objects for generation

    +

    Parses all the schemas in self._schema_text and returns Schema objects for generation

    -Source code + +Expand source code +
    def parse(self):
         """Parses all the schemas in `self._schema_text` and returns Schema objects for generation"""
         schemas_texts = []
    @@ -243,9 +255,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/schemac/index.html b/docs/api/jumpscale/tools/schemac/index.html index 77bbefb51..8123f226b 100644 --- a/docs/api/jumpscale/tools/schemac/index.html +++ b/docs/api/jumpscale/tools/schemac/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.schemac API documentation - - - - - + + + + + + +
    @@ -25,7 +27,7 @@

    schemac

    Example

    In this example there're bunch of types (bools, int, string, dict, time, date, enumerations, objects, list of objects, email) defined in jsx old style.

    jsx schema

    -
    schema = """
    +
    schema = """
     @url = despiegk.test
     listany = (LO)
     llist2 = "" (LS) #L means = list, S=String
    @@ -34,7 +36,7 @@ 

    jsx schema

    now = (T) info = (dict) theemail = (email) -status = "on,off" (E) +status = "on,off" (E) happy = "yes, no" (E) &nr = 4 obj = (O)!hamada.test @@ -59,7 +61,7 @@

    jsx schema

    Converting to the new system

    We expect that to expand or convert to plain old python classes, with dependency resolution.

    -
        c = j.tools.schemac.get_compiler(schema, "python")
    +
        c = j.tools.schemac.get_compiler(schema, "python")
         assert c
     
         assert c._schema_text
    @@ -70,7 +72,7 @@ 

    Converting to the new system

    print(generated_python)

    Generated file

    -
    #GENERATED CLASS DONT EDIT
    +
    #GENERATED CLASS DONT EDIT
     from jumpscale.core.base import Base, fields
     from enum import Enum
     
    @@ -121,9 +123,11 @@ 

    Generated file

    -Source code + +Expand source code +
    '''
    -# schemac 
    +# schemac
     
     Schemac is a tool used to convert (transpile) the schemas defined in jsx systems into the new objects definitions in js-ng
     
    @@ -143,7 +147,7 @@ 

    Generated file

    now = (T) info = (dict) theemail = (email) -status = "on,off" (E) +status = "on,off" (E) happy = "yes, no" (E) &nr = 4 obj = (O)!hamada.test @@ -251,11 +255,11 @@

    Sub-modules

    jumpscale.tools.schemac.compiler
    -

    The compiler that parses JSX schema and generates a suitable backend in a supported lanaguage.

    +

    The compiler that parses JSX schema and generates a suitable backend in a supported lanaguage.

    jumpscale.tools.schemac.plugins
    -
    +

    @@ -265,12 +269,14 @@

    Sub-modules

    Functions

    -def get_compiler(schema_text, lang='python') +def get_compiler(schema_text, lang='python')
    -
    +
    -Source code + +Expand source code +
    def get_compiler(schema_text, lang="python"):
         from .compiler import Compiler
     
    @@ -318,9 +324,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/schemac/plugins/crystal.html b/docs/api/jumpscale/tools/schemac/plugins/crystal.html index db0cd5b51..42e63cddf 100644 --- a/docs/api/jumpscale/tools/schemac/plugins/crystal.html +++ b/docs/api/jumpscale/tools/schemac/plugins/crystal.html @@ -3,15 +3,17 @@ - + jumpscale.tools.schemac.plugins.crystal API documentation - - - - - + + + + + + +
    @@ -22,7 +24,9 @@

    Module jumpscale.tools.schemac.plugins.crystal

    Generator for crystal language. Takes in parsed schemas and generates crystal language classes.

    -Source code + +Expand source code +
    """Generator for crystal language. Takes in parsed schemas and generates crystal language classes.
     """
     from .plugin import Plugin
    @@ -126,9 +130,11 @@ 

    Functions

    def get_prop_line(prop)
    -
    +
    -Source code + +Expand source code +
    def get_prop_line(prop):
         prop_type = prop.prop_type
         crystal_type = types_map.get(prop_type)
    @@ -172,9 +178,11 @@ 

    Classes

    class CrystalGenerator
    -
    +
    -Source code + +Expand source code +
    class CrystalGenerator(Plugin):
         def __init__(self):
             super().__init__()
    @@ -227,9 +235,7 @@ 

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/schemac/plugins/index.html b/docs/api/jumpscale/tools/schemac/plugins/index.html index c5d631d5d..ea69666d9 100644 --- a/docs/api/jumpscale/tools/schemac/plugins/index.html +++ b/docs/api/jumpscale/tools/schemac/plugins/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.schemac.plugins API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.schemac.plugins

    -Source code + +Expand source code +
    from .jsng import JSNGGenerator
     from .crystal import CrystalGenerator
    @@ -31,19 +35,19 @@

    Sub-modules

    jumpscale.tools.schemac.plugins.crystal
    -

    Generator for crystal language. Takes in parsed schemas and generates crystal language classes.

    +

    Generator for crystal language. Takes in parsed schemas and generates crystal language classes.

    jumpscale.tools.schemac.plugins.jsng
    -

    Generator based on JS-NG fields. takes in parsed schemas and generates Python classes based on JS-NG fields.

    +

    Generator based on JS-NG fields. takes in parsed schemas and generates Python classes based on JS-NG fields.

    jumpscale.tools.schemac.plugins.plugin
    -
    +
    jumpscale.tools.schemac.plugins.utils
    -
    +
    @@ -77,9 +81,7 @@

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/schemac/plugins/jsng.html b/docs/api/jumpscale/tools/schemac/plugins/jsng.html index ce6590060..bcb66d431 100644 --- a/docs/api/jumpscale/tools/schemac/plugins/jsng.html +++ b/docs/api/jumpscale/tools/schemac/plugins/jsng.html @@ -3,15 +3,17 @@ - + jumpscale.tools.schemac.plugins.jsng API documentation - - - - - + + + + + + +
    @@ -22,7 +24,9 @@

    Module jumpscale.tools.schemac.plugins.jsng

    Generator based on JS-NG fields. takes in parsed schemas and generates Python classes based on JS-NG fields.

    -Source code + +Expand source code +
    """Generator based on JS-NG fields. takes in parsed schemas and generates Python classes based on JS-NG fields.
     
     """
    @@ -148,9 +152,11 @@ 

    Functions

    def get_prop_line(prop)
    -
    +
    -Source code + +Expand source code +
    def get_prop_line(prop):
         prop_type = prop.prop_type
         if prop_type == "B":
    @@ -204,9 +210,11 @@ 

    Classes

    class JSNGGenerator
    -
    +
    -Source code + +Expand source code +
    class JSNGGenerator(Plugin):
         def __init__(self):
             super().__init__()
    @@ -259,9 +267,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/schemac/plugins/plugin.html b/docs/api/jumpscale/tools/schemac/plugins/plugin.html index 440c04964..ffe958f50 100644 --- a/docs/api/jumpscale/tools/schemac/plugins/plugin.html +++ b/docs/api/jumpscale/tools/schemac/plugins/plugin.html @@ -3,15 +3,17 @@ - + jumpscale.tools.schemac.plugins.plugin API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.schemac.plugins.plugin

    -Source code + +Expand source code +
    from jumpscale.loader import j
     
     
    @@ -91,12 +95,13 @@ 

    Classes

    class Plugin -(*args, **kwargs)
    -
    +
    -Source code + +Expand source code +
    class Plugin:
         def _generate_single(self, schema):
             """Generates a single schema template
    @@ -153,8 +158,8 @@ 

    Classes

    Subclasses

    Methods

    @@ -162,13 +167,15 @@

    Methods

    def generate(self, parsed_schemas)
    -

    Generates a string has all the enumerations and classes in the target language.

    +

    Generates a string has all the enumerations and classes in the target language.

    Arguments

    parsed_schemas (Dict[str, jumpscale.data.Schema]) – a dict of schema name to schema object

    Returns

    -

    (str) – Compiled string of all enumerations and classes in the target language.

    +

    (str) – Compiled string of all enumerations and classes in the target language.

    -Source code + +Expand source code +
    def generate(self, parsed_schemas):
         """Generates a string has all the enumerations and classes in the target language.
     
    @@ -234,9 +241,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/schemac/plugins/utils.html b/docs/api/jumpscale/tools/schemac/plugins/utils.html index 442bc56a6..5a1008fa5 100644 --- a/docs/api/jumpscale/tools/schemac/plugins/utils.html +++ b/docs/api/jumpscale/tools/schemac/plugins/utils.html @@ -3,15 +3,17 @@ - + jumpscale.tools.schemac.plugins.utils API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.schemac.plugins.utils

    -Source code + +Expand source code +
    def convert_url_to_class_name(url):
         urlparts = url.split(".")
         return "".join(x.capitalize() for x in urlparts)
    @@ -38,9 +42,11 @@

    Functions

    def convert_url_to_class_name(url)
    -
    +
    -Source code + +Expand source code +
    def convert_url_to_class_name(url):
         urlparts = url.split(".")
         return "".join(x.capitalize() for x in urlparts)
    @@ -71,9 +77,7 @@

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/startupcmd/index.html b/docs/api/jumpscale/tools/startupcmd/index.html index 1f31d66be..e64ec1a88 100644 --- a/docs/api/jumpscale/tools/startupcmd/index.html +++ b/docs/api/jumpscale/tools/startupcmd/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.startupcmd API documentation - - - - - + + + + + + +
    @@ -21,7 +23,9 @@

    Module jumpscale.tools.startupcmd

    -Source code + +Expand source code +
    def export_module_as():
         from jumpscale.core.base import StoredFactory
         from .startupcmd import StartupCmd
    @@ -34,7 +38,7 @@ 

    Sub-modules

    jumpscale.tools.startupcmd.startupcmd
    -

    This module manages long running commands …

    +

    This module manages long running commands …

    @@ -47,9 +51,11 @@

    Functions

    def export_module_as()
    -
    +
    -Source code + +Expand source code +
    def export_module_as():
         from jumpscale.core.base import StoredFactory
         from .startupcmd import StartupCmd
    @@ -87,9 +93,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/startupcmd/startupcmd.html b/docs/api/jumpscale/tools/startupcmd/startupcmd.html index 60ebfe06a..d826eacfb 100644 --- a/docs/api/jumpscale/tools/startupcmd/startupcmd.html +++ b/docs/api/jumpscale/tools/startupcmd/startupcmd.html @@ -3,15 +3,17 @@ - + jumpscale.tools.startupcmd.startupcmd API documentation - - - - - + + + + + + +
    @@ -42,7 +44,9 @@

    Module jumpscale.tools.startupcmd.startupcmd

    you can add cmd.ports, cmd.process_strings_regex or cmd.process_strings_regex to reach the process pid

    -Source code + +Expand source code +
    """This module manages long running commands
     
     To start a python http server
    @@ -370,12 +374,14 @@ 

    Classes

    class Executor -(*args, **kwargs) +(value, names=None, *, module=None, qualname=None, type=None, start=1)
    -

    An enumeration.

    +

    An enumeration.

    -Source code + +Expand source code +
    class Executor(Enum):
         TMUX = "tmux"
         FOREGROUND = "foreground"
    @@ -388,11 +394,11 @@

    Class variables

    var FOREGROUND
    -
    +
    var TMUX
    -
    +
    @@ -401,11 +407,11 @@

    Class variables

    (*args, **kwargs)
    -

    A simple attribute-based namespace.

    +

    A simple attribute-based namespace.

    SimpleNamespace(**kwargs)

    base class implementation for any class with fields which supports getting/setting raw data for any instance fields.

    any instance can have an optional name and a parent.

    -
    class Person(Base):
    +
    class Person(Base):
         name = fields.String()
         age = fields.Float()
     
    @@ -420,9 +426,11 @@ 

    Args

    instance name. Defaults to None.
    **values
    any given field values to initiate the instance with
    -

    +
    -Source code + +Expand source code +
    class StartupCmd(Base):
         start_cmd = fields.String()
         ports = fields.List(fields.Integer())
    @@ -704,16 +712,18 @@ 

    Instance variables

    var check_cmd
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -729,9 +739,11 @@ 

    Returns

    var cmd_path
    -
    +
    -Source code + +Expand source code +
    @property
     def cmd_path(self):
         if not self._cmd_path:
    @@ -742,16 +754,18 @@ 

    Returns

    var env
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -767,16 +781,18 @@ 

    Returns

    var executor
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -792,16 +808,18 @@ 

    Returns

    var path
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -817,9 +835,11 @@ 

    Returns

    var pid
    -
    +
    -Source code + +Expand source code +
    @property
     def pid(self):
         if not self._pid:
    @@ -831,16 +851,18 @@ 

    Returns

    var ports
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -856,9 +878,11 @@ 

    Returns

    var process
    -
    +
    -Source code + +Expand source code +
    @property
     def process(self):
         if not self._process:
    @@ -875,16 +899,18 @@ 

    Returns

    var process_strings
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -900,16 +926,18 @@ 

    Returns

    var process_strings_regex
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -925,16 +953,18 @@ 

    Returns

    var start_cmd
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -950,16 +980,18 @@ 

    Returns

    var stop_cmd
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -975,16 +1007,18 @@ 

    Returns

    var timeout
    -

    getter method this property

    +

    getter method this property

    will call _get_value, which would if the value is already defined and will get the default value if not

    Returns

    -
    any
    +
    any
    the field value
    -
    +
    -Source code + +Expand source code +
    def getter(self):
         """
         getter method this property
    @@ -1005,14 +1039,16 @@ 

    Methods

    def is_running(self)
    -

    Checks if startup cmd is running. Will use check_cmd property if defined or check based on objet properties

    +

    Checks if startup cmd is running. Will use check_cmd property if defined or check based on objet properties

    Returns

    -
    bool
    +
    bool
    True if it is running
    -
    +
    -Source code + +Expand source code +
    def is_running(self):
         """Checks if startup cmd is running. Will use `check_cmd` property if defined or check based on objet properties
     
    @@ -1033,9 +1069,11 @@ 

    Returns

    def reset(self)
    -
    +
    -Source code + +Expand source code +
    def reset(self):
         self._process = None
         self._pid = None
    @@ -1045,9 +1083,11 @@

    Returns

    def start(self)
    -

    Starts the process

    +

    Starts the process

    -Source code + +Expand source code +
    def start(self):
         """Starts the process
         """
    @@ -1095,7 +1135,7 @@ 

    Returns

    def stop(self, force=True, wait_for_stop=True, die=True, timeout=None)
    -

    Stops the running command

    +

    Stops the running command

    Args

    force : bool, optional
    @@ -1106,9 +1146,11 @@

    Args

    If True will raise if timeout is exceeded for stop. Defaults to True.
    timeout : int, optional
    Timeout for stop wait.If not set will use timeout property. Defaults to None.
    -
    +
    -Source code + +Expand source code +
    def stop(self, force=True, wait_for_stop=True, die=True, timeout=None):
         """Stops the running command
     
    @@ -1137,7 +1179,7 @@ 

    Args

    def wait_for_running(self, die=True, timeout=10)
    -

    Wait for start to finishes

    +

    Wait for start to finishes

    Args

    die : bool, optional
    @@ -1146,9 +1188,14 @@

    Args

    Timeout for wait operation. Defaults to None.

    Raises

    -

    j.exceptions.Timeout: If timeout is exceeded.

    +
    +
    j.exceptions.Timeout
    +
    If timeout is exceeded.
    +
    -Source code + +Expand source code +
    def wait_for_running(self, die=True, timeout=10):
         """Wait for start to finishes
     
    @@ -1166,7 +1213,7 @@ 

    Raises

    def wait_for_stop(self, die=True, timeout=10)
    -

    Wait for stop to finishes

    +

    Wait for stop to finishes

    Args

    die : bool, optional
    @@ -1175,9 +1222,14 @@

    Args

    Timeout for wait operation. Defaults to None.

    Raises

    -

    j.exceptions.Timeout: If timeout is exceeded.

    +
    +
    j.exceptions.Timeout
    +
    If timeout is exceeded.
    +
    -Source code + +Expand source code +
    def wait_for_stop(self, die=True, timeout=10):
         """Wait for stop to finishes
     
    @@ -1256,9 +1308,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/syncer/index.html b/docs/api/jumpscale/tools/syncer/index.html index 9faccc119..56704ff96 100644 --- a/docs/api/jumpscale/tools/syncer/index.html +++ b/docs/api/jumpscale/tools/syncer/index.html @@ -3,18 +3,20 @@ - + jumpscale.tools.syncer API documentation - - - - - + + + + + + +
    @@ -36,7 +38,9 @@

    Module jumpscale.tools.syncer

    2019-09-03T11:38:47.183394+0200 - paths: {'/home/xmonader/wspace/tfchain-py': '/tmp/tfchain-py'}

    -Source code + +Expand source code +
    """Module to help syncing multiple machines with specific directories you have.
     used in the jsync tool.
     ```
    @@ -281,27 +285,26 @@ 

    Classes

    class Syncer -(sshclients_names, paths, patterns=None, ignore_patterns=None, ignore_directories=False, case_sensitive=True) +(sshclients_names: List[str], paths: Dict[str, str], patterns: Optional[List[str]] = None, ignore_patterns: Optional[List[str]] = None, ignore_directories: Optional[List[str]] = False, case_sensitive: bool = True)
    -

    Matches given patterns with file paths associated with occurring events.

    +

    Matches given patterns with file paths associated with occurring events.

    Creates new syncer tool

    Arguments

    sshclients_names {List[str]} – list of sshclient names -paths {Dict[str, str]} – paths to watch src/dest form of dict {'/tmp/myproj':'/root/proj'} -Keyword Arguments: +paths {Dict[str, str]} – paths to watch src/dest form of dict {'/tmp/myproj':'/root/proj'}

    +

    Keyword Arguments: patterns {Optional[List[str]]} – optional list of patterns to watch (default: {None}) ignore_patterns {Optional[List[str]]} – patterns to ignore, e.g .git, pycache (default: {None}) ignore_directories {Optional[List[str]]} – directories to ignore (default: {False}) case_sensitive {bool} – case sensitive watching (default: {True})

    Returns

    -
    -
    SyncerSyncer object
    -
     
    -
    +

    Syncer – Syncer object

    -Source code + +Expand source code +
    class Syncer(PatternMatchingEventHandler):
         def __init__(
             self,
    @@ -521,13 +524,15 @@ 

    Methods

    def on_created(self, event)
    -

    Called when a file or directory is created.

    +

    Called when a file or directory is created.

    :param event: Event representing file/directory creation. :type event: -:class:DirCreatedEvent or :class:FileCreatedEvent

    +:class:DirCreatedEvent or :class:FileCreatedEvent

    -Source code + +Expand source code +
    def on_created(self, event):
         super().on_created(event)
         what = "directory" if event.is_directory else "file"
    @@ -552,13 +557,15 @@ 

    Methods

    def on_deleted(self, event)
    -

    Called when a file or directory is deleted.

    +

    Called when a file or directory is deleted.

    :param event: Event representing file/directory deletion. :type event: -:class:DirDeletedEvent or :class:FileDeletedEvent

    +:class:DirDeletedEvent or :class:FileDeletedEvent

    -Source code + +Expand source code +
    def on_deleted(self, event):
         super().on_deleted(event)
     
    @@ -581,13 +588,15 @@ 

    Methods

    def on_modified(self, event)
    -

    Called when a file or directory is modified.

    +

    Called when a file or directory is modified.

    :param event: Event representing file/directory modification. :type event: -:class:DirModifiedEvent or :class:FileModifiedEvent

    +:class:DirModifiedEvent or :class:FileModifiedEvent

    -Source code + +Expand source code +
    def on_modified(self, event):
         super().on_modified(event)
         what = "directory" if event.is_directory else "file"
    @@ -610,13 +619,15 @@ 

    Methods

    def on_moved(self, event)
    -

    Called when a file or a directory is moved or renamed.

    +

    Called when a file or a directory is moved or renamed.

    :param event: Event representing file/directory movement. :type event: -:class:DirMovedEvent or :class:FileMovedEvent

    +:class:DirMovedEvent or :class:FileMovedEvent

    -Source code + +Expand source code +
    def on_moved(self, event):
         super().on_moved(event)
     
    @@ -642,11 +653,13 @@ 

    Methods

    def start(self, sync=True)
    -

    Start syncing/watching paths to remote machines

    +

    Start syncing/watching paths to remote machines

    Keyword Arguments: -sync {bool} – sync dirs/files first (default: {True})

    +sync {bool} – sync dirs/files first (default: {True})

    -Source code + +Expand source code +
    def start(self, sync=True):
         """Start syncing/watching paths to remote machines
     
    @@ -673,9 +686,11 @@ 

    Methods

    def sync(self)
    -

    Sync directory structure and files

    +

    Sync directory structure and files

    -Source code + +Expand source code +
    def sync(self):
         """Sync directory structure and files
     
    @@ -752,9 +767,7 @@ 

    -

    Generated by pdoc 0.6.4.

    +

    Generated by pdoc 0.10.0.

    - - - \ No newline at end of file + diff --git a/docs/api/jumpscale/tools/timer/index.html b/docs/api/jumpscale/tools/timer/index.html index f953c4b74..460aa9259 100644 --- a/docs/api/jumpscale/tools/timer/index.html +++ b/docs/api/jumpscale/tools/timer/index.html @@ -3,15 +3,17 @@ - + jumpscale.tools.timer API documentation - - - - - + + + + + + +
    @@ -46,7 +48,9 @@

    Module jumpscale.tools.timer

    120

    -Source code + +Expand source code +
    """Helps with timing functions and see how long they took
     
     example
    @@ -103,9 +107,11 @@ 

    Functions

    def timeit(func)
    -
    +
    -Source code + +Expand source code +
    def timeit(func):
         def wrapper(*args, **kwargs):
             start_time = time.time()
    @@ -143,9 +149,7 @@ 

    Index

    - - - \ No newline at end of file + diff --git a/poetry.lock b/poetry.lock index 5e8ac9f97..87748e819 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6,14 +6,6 @@ category = "dev" optional = false python-versions = "*" -[[package]] -name = "argh" -version = "0.26.2" -description = "An unobtrusive argparse wrapper with natural syntax" -category = "main" -optional = false -python-versions = "*" - [[package]] name = "arrow" version = "0.15.8" @@ -677,21 +669,13 @@ category = "dev" optional = false python-versions = ">=3.7" -[[package]] -name = "pathtools" -version = "0.1.2" -description = "File system general utilities" -category = "main" -optional = false -python-versions = "*" - [[package]] name = "pdoc3" -version = "0.6.4" +version = "0.10.0" description = "Auto-generate API documentation for Python projects." category = "main" optional = false -python-versions = ">= 3.5" +python-versions = ">= 3.6" [package.dependencies] mako = "*" @@ -1108,16 +1092,14 @@ python-versions = "*" [[package]] name = "watchdog" -version = "0.9.0" +version = "2.1.9" description = "Filesystem events monitoring" category = "main" optional = false -python-versions = "*" +python-versions = ">=3.6" -[package.dependencies] -argh = ">=0.24.1" -pathtools = ">=0.1.1" -PyYAML = ">=3.10" +[package.extras] +watchmedo = ["PyYAML (>=3.10)"] [[package]] name = "wcwidth" @@ -1205,17 +1187,13 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "1.1" python-versions = ">=3.7,<4.0" -content-hash = "b24aea3b56d8c2a0a08f57ac5ead41759296250bf44dd36b65e52751afc38e9d" +content-hash = "82a17f140463e8075bf0a6ef1d0dd1090aaab462bdbf8c019d820ac552720568" [metadata.files] appnope = [ {file = "appnope-0.1.3-py2.py3-none-any.whl", hash = "sha256:265a455292d0bd8a72453494fa24df5a11eb18373a60c7c0430889f22548605e"}, {file = "appnope-0.1.3.tar.gz", hash = "sha256:02bd91c4de869fbb1e1c50aafc4098827a7a54ab2f39d9dcba6c9547ed920e24"}, ] -argh = [ - {file = "argh-0.26.2-py2.py3-none-any.whl", hash = "sha256:a9b3aaa1904eeb78e32394cd46c6f37ac0fb4af6dc488daa58971bdc7d7fcaf3"}, - {file = "argh-0.26.2.tar.gz", hash = "sha256:e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65"}, -] arrow = [ {file = "arrow-0.15.8-py2.py3-none-any.whl", hash = "sha256:271b8e05174d48e50324ed0dc5d74796c839c7e579a4f21cf1a7394665f9e94f"}, {file = "arrow-0.15.8.tar.gz", hash = "sha256:edc31dc051db12c95da9bac0271cd1027b8e36912daf6d4580af53b23e62721a"}, @@ -1729,11 +1707,9 @@ pathspec = [ {file = "pathspec-0.10.1-py3-none-any.whl", hash = "sha256:46846318467efc4556ccfd27816e004270a9eeeeb4d062ce5e6fc7a87c573f93"}, {file = "pathspec-0.10.1.tar.gz", hash = "sha256:7ace6161b621d31e7902eb6b5ae148d12cfd23f4a249b9ffb6b9fee12084323d"}, ] -pathtools = [ - {file = "pathtools-0.1.2.tar.gz", hash = "sha256:7c35c5421a39bb82e58018febd90e3b6e5db34c5443aaaf742b3f33d4655f1c0"}, -] pdoc3 = [ - {file = "pdoc3-0.6.4.tar.gz", hash = "sha256:85cbb0de17d1306157d19b08b67ad84817098c12ad9f92ec203b79d0307b6a25"}, + {file = "pdoc3-0.10.0-py3-none-any.whl", hash = "sha256:ba45d1ada1bd987427d2bf5cdec30b2631a3ff5fb01f6d0e77648a572ce6028b"}, + {file = "pdoc3-0.10.0.tar.gz", hash = "sha256:5f22e7bcb969006738e1aa4219c75a32f34c2d62d46dc9d2fb2d3e0b0287e4b7"}, ] pexpect = [ {file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"}, @@ -1987,7 +1963,31 @@ urwid = [ {file = "urwid-2.1.2.tar.gz", hash = "sha256:588bee9c1cb208d0906a9f73c613d2bd32c3ed3702012f51efe318a3f2127eae"}, ] watchdog = [ - {file = "watchdog-0.9.0.tar.gz", hash = "sha256:965f658d0732de3188211932aeb0bb457587f04f63ab4c1e33eab878e9de961d"}, + {file = "watchdog-2.1.9-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a735a990a1095f75ca4f36ea2ef2752c99e6ee997c46b0de507ba40a09bf7330"}, + {file = "watchdog-2.1.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6b17d302850c8d412784d9246cfe8d7e3af6bcd45f958abb2d08a6f8bedf695d"}, + {file = "watchdog-2.1.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ee3e38a6cc050a8830089f79cbec8a3878ec2fe5160cdb2dc8ccb6def8552658"}, + {file = "watchdog-2.1.9-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:64a27aed691408a6abd83394b38503e8176f69031ca25d64131d8d640a307591"}, + {file = "watchdog-2.1.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:195fc70c6e41237362ba720e9aaf394f8178bfc7fa68207f112d108edef1af33"}, + {file = "watchdog-2.1.9-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:bfc4d351e6348d6ec51df007432e6fe80adb53fd41183716017026af03427846"}, + {file = "watchdog-2.1.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8250546a98388cbc00c3ee3cc5cf96799b5a595270dfcfa855491a64b86ef8c3"}, + {file = "watchdog-2.1.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:117ffc6ec261639a0209a3252546b12800670d4bf5f84fbd355957a0595fe654"}, + {file = "watchdog-2.1.9-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:97f9752208f5154e9e7b76acc8c4f5a58801b338de2af14e7e181ee3b28a5d39"}, + {file = "watchdog-2.1.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:247dcf1df956daa24828bfea5a138d0e7a7c98b1a47cf1fa5b0c3c16241fcbb7"}, + {file = "watchdog-2.1.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:226b3c6c468ce72051a4c15a4cc2ef317c32590d82ba0b330403cafd98a62cfd"}, + {file = "watchdog-2.1.9-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:d9820fe47c20c13e3c9dd544d3706a2a26c02b2b43c993b62fcd8011bcc0adb3"}, + {file = "watchdog-2.1.9-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:70af927aa1613ded6a68089a9262a009fbdf819f46d09c1a908d4b36e1ba2b2d"}, + {file = "watchdog-2.1.9-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:ed80a1628cee19f5cfc6bb74e173f1b4189eb532e705e2a13e3250312a62e0c9"}, + {file = "watchdog-2.1.9-py3-none-manylinux2014_aarch64.whl", hash = "sha256:9f05a5f7c12452f6a27203f76779ae3f46fa30f1dd833037ea8cbc2887c60213"}, + {file = "watchdog-2.1.9-py3-none-manylinux2014_armv7l.whl", hash = "sha256:255bb5758f7e89b1a13c05a5bceccec2219f8995a3a4c4d6968fe1de6a3b2892"}, + {file = "watchdog-2.1.9-py3-none-manylinux2014_i686.whl", hash = "sha256:d3dda00aca282b26194bdd0adec21e4c21e916956d972369359ba63ade616153"}, + {file = "watchdog-2.1.9-py3-none-manylinux2014_ppc64.whl", hash = "sha256:186f6c55abc5e03872ae14c2f294a153ec7292f807af99f57611acc8caa75306"}, + {file = "watchdog-2.1.9-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:083171652584e1b8829581f965b9b7723ca5f9a2cd7e20271edf264cfd7c1412"}, + {file = "watchdog-2.1.9-py3-none-manylinux2014_s390x.whl", hash = "sha256:b530ae007a5f5d50b7fbba96634c7ee21abec70dc3e7f0233339c81943848dc1"}, + {file = "watchdog-2.1.9-py3-none-manylinux2014_x86_64.whl", hash = "sha256:4f4e1c4aa54fb86316a62a87b3378c025e228178d55481d30d857c6c438897d6"}, + {file = "watchdog-2.1.9-py3-none-win32.whl", hash = "sha256:5952135968519e2447a01875a6f5fc8c03190b24d14ee52b0f4b1682259520b1"}, + {file = "watchdog-2.1.9-py3-none-win_amd64.whl", hash = "sha256:7a833211f49143c3d336729b0020ffd1274078e94b0ae42e22f596999f50279c"}, + {file = "watchdog-2.1.9-py3-none-win_ia64.whl", hash = "sha256:ad576a565260d8f99d97f2e64b0f97a48228317095908568a9d5c786c829d428"}, + {file = "watchdog-2.1.9.tar.gz", hash = "sha256:43ce20ebb36a51f21fa376f76d1d4692452b2527ccd601950d69ed36b9e21609"}, ] wcwidth = [ {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, diff --git a/pyproject.toml b/pyproject.toml index f68b12fa9..9ac47f22b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.7,<4.0" -pdoc3 = "^0.6.3" +pdoc3 = "^0.10.0" pytoml = "^0.1.21" secretconf = "^0.1.2" better-exceptions = "^0.2.2" @@ -30,7 +30,7 @@ distro = "^1.4" libtmux = "^0.8.2" redis = "^3.3" dill = "^0.3.0" -watchdog = "^0.9.0" +watchdog = "^2.1.9" GitPython = "^3.0" docker = "^4.2.0" Jinja2 = "^3.1.2"