diff --git a/.github/workflows/black-docstr.yml b/.github/workflows/black-docstr.yml index 2273644a0..4e007a920 100644 --- a/.github/workflows/black-docstr.yml +++ b/.github/workflows/black-docstr.yml @@ -2,18 +2,18 @@ name: black-docstr on: pull_request jobs: - black-docstr: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y git python3-pip - sudo pip3 install black==22.10.0 docstr-coverage - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - - name: Running black and docstr-coverage check - run: | - FILES="$(git diff --name-only --diff-filter=A --diff-filter=M "origin/${{github.base_ref}}" '*.py')" - black --check -l 120 -t py37 --exclude 'templates' $FILES - for FILE in $FILES; do echo $FILE; docstr-coverage $FILE || true; done + black-docstr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y git python3-pip + sudo pip3 install black==22.10.0 docstr-coverage + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + - name: Running black and docstr-coverage check + run: | + FILES="$(git diff --name-only --diff-filter=A --diff-filter=M "origin/${{github.base_ref}}" '*.py')" + [ ! -z "$FILES" ] && black --check -l 120 -t py37 --exclude 'templates' $FILES + for FILE in $FILES; do echo $FILE; docstr-coverage $FILE || true; done diff --git a/docs/api/jumpscale/clients/redis/redis.html b/docs/api/jumpscale/clients/redis/redis.html index 20e3acc34..a35f36cf8 100644 --- a/docs/api/jumpscale/clients/redis/redis.html +++ b/docs/api/jumpscale/clients/redis/redis.html @@ -74,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() @@ -154,7 +154,7 @@

Args

self.__client = Redis(self.hostname, self.port) return self.__client - + def is_running(self): try: return self.redis_client.ping() diff --git a/docs/api/jumpscale/clients/sshclient/sshclient.html b/docs/api/jumpscale/clients/sshclient/sshclient.html index 3e5c81f42..126853c60 100644 --- a/docs/api/jumpscale/clients/sshclient/sshclient.html +++ b/docs/api/jumpscale/clients/sshclient/sshclient.html @@ -107,7 +107,7 @@

Creating sshcl @property def _sshkey(self): - """ Get sshkey client that you have loaded + """Get sshkey client that you have loaded e.g JS-NG> localconnection = j.clients.sshclient.new("localconnection") JS-NG> localconnection.sshkey = "xmonader" @@ -138,7 +138,7 @@

Creating sshcl return self.__client def reset_connection(self): - """ Reset the connection + """Reset the connection e.g localconnection = j.clients.sshclient.new("localconnection") localconnection.reset_connection() @@ -224,7 +224,7 @@

Args

@property def _sshkey(self): - """ Get sshkey client that you have loaded + """Get sshkey client that you have loaded e.g JS-NG> localconnection = j.clients.sshclient.new("localconnection") JS-NG> localconnection.sshkey = "xmonader" @@ -255,7 +255,7 @@

Args

return self.__client def reset_connection(self): - """ Reset the connection + """Reset the connection e.g localconnection = j.clients.sshclient.new("localconnection") localconnection.reset_connection() @@ -531,7 +531,7 @@

Methods

Expand source code
def reset_connection(self):
-    """ Reset the connection
+    """Reset the connection
     e.g
         localconnection = j.clients.sshclient.new("localconnection")
         localconnection.reset_connection()
diff --git a/docs/api/jumpscale/clients/sshkey/sshkey.html b/docs/api/jumpscale/clients/sshkey/sshkey.html
index f15385dc2..84ea5aef8 100644
--- a/docs/api/jumpscale/clients/sshkey/sshkey.html
+++ b/docs/api/jumpscale/clients/sshkey/sshkey.html
@@ -91,7 +91,7 @@ 

Writing ssh keys to files system

self.load_from_file_system() 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() @@ -122,7 +122,7 @@

Writing ssh keys to files system

@property def public_key_path(self): - """ 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" @@ -133,7 +133,7 @@

Writing ssh keys to files system

return "{}.pub".format(self.private_key_path) 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() @@ -204,7 +204,7 @@

Args

self.load_from_file_system() 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() @@ -235,7 +235,7 @@

Args

@property def public_key_path(self): - """ 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" @@ -246,7 +246,7 @@

Args

return "{}.pub".format(self.private_key_path) 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() @@ -448,7 +448,7 @@

Returns

@property
 def public_key_path(self):
-    """ 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"
@@ -522,7 +522,7 @@ 

Methods

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
+    """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()
@@ -544,7 +544,7 @@ 

Methods

Expand source code
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()
diff --git a/docs/api/jumpscale/core/base/factory.html b/docs/api/jumpscale/core/base/factory.html
index 8ba56c1be..3b4e3b86b 100644
--- a/docs/api/jumpscale/core/base/factory.html
+++ b/docs/api/jumpscale/core/base/factory.html
@@ -603,7 +603,7 @@ 

Module jumpscale.core.base.factory

raise ValueError("at least one query parameter is required, e.g. age=10") new_cursor, count, result = self.store.find(cursor_=cursor_, limit_=limit_, **query) - return new_cursor, count, (self._get_object_from_config(data[KEY_FIELD_NAME], data) for data in result) + return (new_cursor, count, (self._get_object_from_config(data[KEY_FIELD_NAME], data) for data in result)) def list_all(self): """ @@ -1478,7 +1478,7 @@

Args

raise ValueError("at least one query parameter is required, e.g. age=10") new_cursor, count, result = self.store.find(cursor_=cursor_, limit_=limit_, **query) - return new_cursor, count, (self._get_object_from_config(data[KEY_FIELD_NAME], data) for data in result) + return (new_cursor, count, (self._get_object_from_config(data[KEY_FIELD_NAME], data) for data in result)) def list_all(self): """ @@ -1657,7 +1657,7 @@

Returns

raise ValueError("at least one query parameter is required, e.g. age=10") new_cursor, count, result = self.store.find(cursor_=cursor_, limit_=limit_, **query) - return new_cursor, count, (self._get_object_from_config(data[KEY_FIELD_NAME], data) for data in result)
+ return (new_cursor, count, (self._get_object_from_config(data[KEY_FIELD_NAME], data) for data in result))
diff --git a/docs/api/jumpscale/core/base/store/whooshfts.html b/docs/api/jumpscale/core/base/store/whooshfts.html index 6f8beb309..bb6353e57 100644 --- a/docs/api/jumpscale/core/base/store/whooshfts.html +++ b/docs/api/jumpscale/core/base/store/whooshfts.html @@ -106,9 +106,7 @@

Module jumpscale.core.base.store.whooshfts

return self.location.type._fields.items() def get_schema(self): - schema_fields = { - KEY_FIELD_NAME: fields.ID(unique=True, stored=True), - } + schema_fields = {KEY_FIELD_NAME: fields.ID(unique=True, stored=True)} for name, field in self.type_fields: field_type_name = field.__class__.__name__ @@ -288,9 +286,7 @@

Args

return self.location.type._fields.items() def get_schema(self): - schema_fields = { - KEY_FIELD_NAME: fields.ID(unique=True, stored=True), - } + schema_fields = {KEY_FIELD_NAME: fields.ID(unique=True, stored=True)} for name, field in self.type_fields: field_type_name = field.__class__.__name__ @@ -498,9 +494,7 @@

Methods

Expand source code
def get_schema(self):
-    schema_fields = {
-        KEY_FIELD_NAME: fields.ID(unique=True, stored=True),
-    }
+    schema_fields = {KEY_FIELD_NAME: fields.ID(unique=True, stored=True)}
 
     for name, field in self.type_fields:
         field_type_name = field.__class__.__name__
diff --git a/docs/api/jumpscale/core/config/config.html b/docs/api/jumpscale/core/config/config.html
index 88f9667e1..360cefd68 100644
--- a/docs/api/jumpscale/core/config/config.html
+++ b/docs/api/jumpscale/core/config/config.html
@@ -186,10 +186,7 @@ 

Get/Set

"debug": True, "shell": "ptpython", "logging": { - "default": { - "enabled": True, - "level": 10, - }, + "default": {"enabled": True, "level": 10}, "redis": { "enabled": True, "level": 15, @@ -214,9 +211,7 @@

Get/Set

}, "factory": {"always_reload": False}, "store": "filesystem", - "threebot": { - "default": "", - }, + "threebot": {"default": ""}, } @@ -444,10 +439,7 @@

Returns

"debug": True, "shell": "ptpython", "logging": { - "default": { - "enabled": True, - "level": 10, - }, + "default": {"enabled": True, "level": 10}, "redis": { "enabled": True, "level": 15, @@ -472,9 +464,7 @@

Returns

}, "factory": {"always_reload": False}, "store": "filesystem", - "threebot": { - "default": "", - }, + "threebot": {"default": ""}, }
diff --git a/docs/api/jumpscale/core/logging/logging.html b/docs/api/jumpscale/core/logging/logging.html index 58b7a6317..48e7b3c0d 100644 --- a/docs/api/jumpscale/core/logging/logging.html +++ b/docs/api/jumpscale/core/logging/logging.html @@ -39,13 +39,7 @@

Module jumpscale.core.logging.logging

from jumpscale.loader import j -LEVELS = { - 10: "DEBUG", - 20: "INFO", - 30: "WARNING", - 40: "ERROR", - 50: "CRITICAL", -} +LEVELS = {10: "DEBUG", 20: "INFO", 30: "WARNING", 40: "ERROR", 50: "CRITICAL"} # init is kept as a name for backward compatibility DEFAULT_APP_NAME = "init" diff --git a/docs/api/jumpscale/data/bcdb/bcdb.html b/docs/api/jumpscale/data/bcdb/bcdb.html index ccfd2bcb3..86a63e0e6 100644 --- a/docs/api/jumpscale/data/bcdb/bcdb.html +++ b/docs/api/jumpscale/data/bcdb/bcdb.html @@ -31,6 +31,7 @@

Module jumpscale.data.bcdb.bcdb

from jumpscale.data.bcdb import models as models from .clients import RedisStorageClient, RedisIndexClient, SonicIndexTextClient, SQLiteIndexSetClient + class BCDB: def __init__(self, ns): self.ns = ns @@ -38,12 +39,8 @@

Module jumpscale.data.bcdb.bcdb

self.indexer = RedisIndexClient(ns) self.indexer_set = SQLiteIndexSetClient(ns) self.indexer_text = SonicIndexTextClient(ns) - self.models = { - - } - self.loaded_models = { - - } + self.models = {} + self.loaded_models = {} self.detect_models() self.model_model = self.models["model"](self) @@ -53,10 +50,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. @@ -64,7 +61,7 @@

Module jumpscale.data.bcdb.bcdb

self.indexer_set.set(model, obj) self.indexer_text.set(model, obj) for prop in model.schema.props.values(): - old_obj = model.get_by('id', obj.id) + old_obj = model.get_by("id", obj.id) prop_name = prop.name index_prop = getattr(obj, prop.name) old_index = getattr(old_obj, prop.name) if old_obj else None @@ -75,10 +72,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 """ @@ -86,11 +83,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. """ @@ -100,16 +97,17 @@

Module jumpscale.data.bcdb.bcdb

"""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. - + 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. """ @@ -128,17 +126,18 @@

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. - + 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,24 +148,23 @@

Module jumpscale.data.bcdb.bcdb

else: result = [] for obj in self.storage.get_keys_in_model(model): - obj_val = getattr(obj, key) - if obj_val >= min and obj_val <= max: - result.append(obj) + obj_val = getattr(obj, key) + 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) """ @@ -178,18 +176,19 @@

Module jumpscale.data.bcdb.bcdb

return self.get_item_by_id(model, keyid) if keyid else None 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): 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) """ @@ -198,23 +197,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. - + """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). """ @@ -226,13 +225,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. """ @@ -269,12 +268,8 @@

Classes

self.indexer = RedisIndexClient(ns) self.indexer_set = SQLiteIndexSetClient(ns) self.indexer_text = SonicIndexTextClient(ns) - self.models = { - - } - self.loaded_models = { - - } + self.models = {} + self.loaded_models = {} self.detect_models() self.model_model = self.models["model"](self) @@ -284,10 +279,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. @@ -295,7 +290,7 @@

Classes

self.indexer_set.set(model, obj) self.indexer_text.set(model, obj) for prop in model.schema.props.values(): - old_obj = model.get_by('id', obj.id) + old_obj = model.get_by("id", obj.id) prop_name = prop.name index_prop = getattr(obj, prop.name) old_index = getattr(old_obj, prop.name) if old_obj else None @@ -306,10 +301,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 """ @@ -317,11 +312,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. """ @@ -331,16 +326,17 @@

Classes

"""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. - + 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. """ @@ -359,17 +355,18 @@

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. - + 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) """ @@ -380,24 +377,23 @@

Classes

else: result = [] for obj in self.storage.get_keys_in_model(model): - obj_val = getattr(obj, key) - if obj_val >= min and obj_val <= max: - result.append(obj) + obj_val = getattr(obj, key) + 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) """ @@ -409,18 +405,19 @@

Classes

return self.get_item_by_id(model, keyid) if keyid else None 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): 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) """ @@ -429,23 +426,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. - + """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). """ @@ -457,13 +454,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. """ @@ -499,7 +496,8 @@

Methods

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.

+3. Else, All objects in the db belonging to the given model +is scanned linearly to determine the matching object.

Args

model : ModelObj
@@ -527,16 +525,17 @@

Returns

"""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. - + 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. """ @@ -577,11 +576,11 @@

Returns

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.
     """
@@ -620,16 +619,16 @@ 

Returns

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)
     """
@@ -645,7 +644,8 @@ 

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
@@ -674,18 +674,19 @@

Returns

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.
-    
+    """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)
     """
@@ -700,7 +701,8 @@ 

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
@@ -729,20 +731,21 @@

Returns

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.
-    
+    """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).
     """
@@ -779,13 +782,13 @@ 

Returns

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.
     """
@@ -801,7 +804,8 @@ 

Returns

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.

+It tries to search for it in the index. +If the key is not indexed it loops through all the objects.

Args

model : ModelObj
@@ -829,17 +833,18 @@

Returns

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.
-    
+    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)
     """
@@ -850,9 +855,9 @@ 

Returns

else: result = [] for obj in self.storage.get_keys_in_model(model): - obj_val = getattr(obj, key) - if obj_val >= min and obj_val <= max: - result.append(obj) + obj_val = getattr(obj, key) + if obj_val >= min and obj_val <= max: + result.append(obj) return result
@@ -879,10 +884,10 @@

Returns

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
     """
@@ -907,7 +912,7 @@ 

Args

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.
@@ -915,7 +920,7 @@ 

Args

self.indexer_set.set(model, obj) self.indexer_text.set(model, obj) for prop in model.schema.props.values(): - old_obj = model.get_by('id', obj.id) + old_obj = model.get_by("id", obj.id) prop_name = prop.name index_prop = getattr(obj, prop.name) old_index = getattr(old_obj, prop.name) if old_obj else None diff --git a/docs/api/jumpscale/data/bcdb/interfaces.html b/docs/api/jumpscale/data/bcdb/interfaces.html index 00f8e0779..dc6bd0380 100644 --- a/docs/api/jumpscale/data/bcdb/interfaces.html +++ b/docs/api/jumpscale/data/bcdb/interfaces.html @@ -39,6 +39,7 @@

Module jumpscale.data.bcdb.interfaces

def incr_id(self, model): pass + class IndexInterface: def __init__(self, bcdb_namespace): pass @@ -49,6 +50,7 @@

Module jumpscale.data.bcdb.interfaces

def set(self, model, index_prop, index_value, obj_id, old_value=None): pass + class IndexSetInterface: def __init__(self, bcdb_namespace): pass @@ -59,15 +61,17 @@

Module jumpscale.data.bcdb.interfaces

def set(self, model, obj): pass + class IndexTextInterface: def __init__(self, bcdb_namespace): pass def set(self, model, obj): - pass + pass def get(self, model, index_prop, pattern): - pass + pass + class SerializerInterface: def loads(self, model, s): @@ -209,10 +213,10 @@

Methods

pass def set(self, model, obj): - pass + pass def get(self, model, index_prop, pattern): - pass
+ pass

Subclasses

    @@ -230,7 +234,7 @@

    Methods

    Expand source code
    def get(self, model, index_prop, pattern):
    -    pass 
    + pass
@@ -243,7 +247,7 @@

Methods

Expand source code
def set(self, model, obj):
-   pass
+ pass
diff --git a/docs/api/jumpscale/data/bcdb/models/db_model.html b/docs/api/jumpscale/data/bcdb/models/db_model.html index 01bca65b4..bc8df904e 100644 --- a/docs/api/jumpscale/data/bcdb/models/db_model.html +++ b/docs/api/jumpscale/data/bcdb/models/db_model.html @@ -28,6 +28,7 @@

Module jumpscale.data.bcdb.models.db_model

from .base import ModelBase
 
+
 class DBModel(ModelBase):
     _schema = """
     @url = db
diff --git a/docs/api/jumpscale/data/bcdb/models/emplyee_model.html b/docs/api/jumpscale/data/bcdb/models/emplyee_model.html
index 0cb3cf4b8..14a6985ae 100644
--- a/docs/api/jumpscale/data/bcdb/models/emplyee_model.html
+++ b/docs/api/jumpscale/data/bcdb/models/emplyee_model.html
@@ -28,6 +28,7 @@ 

Module jumpscale.data.bcdb.models.emplyee_model
from .base import ModelBase
 
+
 class EmployeeModel(ModelBase):
     _schema = """
     @url = employee
diff --git a/docs/api/jumpscale/data/bcdb/models/index.html b/docs/api/jumpscale/data/bcdb/models/index.html
index 52eef71e2..8775ac6be 100644
--- a/docs/api/jumpscale/data/bcdb/models/index.html
+++ b/docs/api/jumpscale/data/bcdb/models/index.html
@@ -30,6 +30,7 @@ 

Module jumpscale.data.bcdb.models

import os import importlib + def add_model(file_name): m = importlib.import_module("." + file_name[:-3], "jumpscale.data.bcdb.models") for attr in dir(m): @@ -37,6 +38,7 @@

Module jumpscale.data.bcdb.models

if isinstance(pyattr, type) and issubclass(pyattr, ModelBase): globals()[attr] = pyattr + files = os.listdir(os.path.dirname(__file__)) for f in files: if f.endswith("_model.py"): diff --git a/docs/api/jumpscale/data/bcdb/models/post_model.html b/docs/api/jumpscale/data/bcdb/models/post_model.html index c7d771f46..b23690d80 100644 --- a/docs/api/jumpscale/data/bcdb/models/post_model.html +++ b/docs/api/jumpscale/data/bcdb/models/post_model.html @@ -28,6 +28,7 @@

Module jumpscale.data.bcdb.models.post_model

from .base import ModelBase
 
+
 class QuoteModel(ModelBase):
     _schema = """
     @url = quote
diff --git a/docs/api/jumpscale/data/bcdb/models/proj_model.html b/docs/api/jumpscale/data/bcdb/models/proj_model.html
index 3b60a5b64..14a7c41e4 100644
--- a/docs/api/jumpscale/data/bcdb/models/proj_model.html
+++ b/docs/api/jumpscale/data/bcdb/models/proj_model.html
@@ -28,6 +28,7 @@ 

Module jumpscale.data.bcdb.models.proj_model

from .base import ModelBase
 
+
 class ProjModel(ModelBase):
     _schema = """
     @url = proj
diff --git a/docs/api/jumpscale/data/bcdb/models/test_model.html b/docs/api/jumpscale/data/bcdb/models/test_model.html
index 94e5bd8ef..74dae1bbd 100644
--- a/docs/api/jumpscale/data/bcdb/models/test_model.html
+++ b/docs/api/jumpscale/data/bcdb/models/test_model.html
@@ -28,6 +28,7 @@ 

Module jumpscale.data.bcdb.models.test_model

from .base import ModelBase
 
+
 class TestModel(ModelBase):
     _schema = """
     @url = test
diff --git a/docs/api/jumpscale/data/bcdb/models/user_model.html b/docs/api/jumpscale/data/bcdb/models/user_model.html
index dd600cb73..c03b2814d 100644
--- a/docs/api/jumpscale/data/bcdb/models/user_model.html
+++ b/docs/api/jumpscale/data/bcdb/models/user_model.html
@@ -28,6 +28,7 @@ 

Module jumpscale.data.bcdb.models.user_model

from .base import ModelBase
 
+
 class UserModel(ModelBase):
     _schema = """
     @url = user
diff --git a/docs/api/jumpscale/data/hash/hash.html b/docs/api/jumpscale/data/hash/hash.html
index 57f6eeae0..fe37c5545 100644
--- a/docs/api/jumpscale/data/hash/hash.html
+++ b/docs/api/jumpscale/data/hash/hash.html
@@ -341,7 +341,7 @@ 

Module jumpscale.data.hash.hash

with open(path, "rb") as f: h = hashlib.new(hash_type) while True: - data = f.read(2 ** 20) + data = f.read(2**20) if not data: break h.update(data) @@ -585,7 +585,7 @@

Returns

with open(path, "rb") as f: h = hashlib.new(hash_type) while True: - data = f.read(2 ** 20) + data = f.read(2**20) if not data: break h.update(data) diff --git a/docs/api/jumpscale/data/idgenerator/idgenerator.html b/docs/api/jumpscale/data/idgenerator/idgenerator.html index 4c65f79c8..8f22b387c 100644 --- a/docs/api/jumpscale/data/idgenerator/idgenerator.html +++ b/docs/api/jumpscale/data/idgenerator/idgenerator.html @@ -156,7 +156,7 @@

Module jumpscale.data.idgenerator.idgenerator

+ return hex(random.randint(0, 2**64) | 1 << 63)
@@ -185,7 +185,7 @@

Returns

str -- capnp id """ # the bitwise is for validating the id check capnp/parser.c++ - return hex(random.randint(0, 2 ** 64) | 1 << 63)
+ return hex(random.randint(0, 2**64) | 1 << 63)
diff --git a/docs/api/jumpscale/data/random_names/index.html b/docs/api/jumpscale/data/random_names/index.html index fc36cedaf..17ae96590 100644 --- a/docs/api/jumpscale/data/random_names/index.html +++ b/docs/api/jumpscale/data/random_names/index.html @@ -214,7 +214,7 @@

Module jumpscale.data.random_names

def random_name(): - """ Returns a random name "first name" & "last name """ + """Returns a random name "first name" & "last name""" name = "%s_%s" % (choice(right_names), choice(left_names)) @@ -238,7 +238,7 @@

Functions

Expand source code
def random_name():
-    """ Returns a random name "first name" & "last name """
+    """Returns a random name "first name" & "last name"""
 
     name = "%s_%s" % (choice(right_names), choice(left_names))
 
diff --git a/docs/api/jumpscale/data/serializers/json.html b/docs/api/jumpscale/data/serializers/json.html
index d468f6f0c..d3ad2cf46 100644
--- a/docs/api/jumpscale/data/serializers/json.html
+++ b/docs/api/jumpscale/data/serializers/json.html
@@ -44,10 +44,10 @@ 

Module jumpscale.data.serializers.json

def dump_to_file(file_path, obj): """Writes the dumped obj to a file - Args: - file_path (str): path to write to - obj (dict): the dict which will be dumped - """ + Args: + file_path (str): path to write to + obj (dict): the dict which will be dumped + """ with open(file_path, "w") as fp: json.dump(obj, fp) @@ -103,10 +103,10 @@

Args

def dump_to_file(file_path, obj):
     """Writes the dumped obj to a file
 
-   Args:
-       file_path (str): path to write to
-       obj (dict): the dict which will be dumped
-   """
+    Args:
+        file_path (str): path to write to
+        obj (dict): the dict which will be dumped
+    """
     with open(file_path, "w") as fp:
         json.dump(obj, fp)
diff --git a/docs/api/jumpscale/data/serializers/lzma.html b/docs/api/jumpscale/data/serializers/lzma.html index 7ce8769ee..b3e5e2814 100644 --- a/docs/api/jumpscale/data/serializers/lzma.html +++ b/docs/api/jumpscale/data/serializers/lzma.html @@ -28,23 +28,25 @@

Module jumpscale.data.serializers.lzma

import pylzma
 
+
 def compress(obj):
     """compress string with lzma algorithm
-    
+
     Arguments:
         obj (string) : the string will be encoded
-    
+
     Returns:
         bytes : the compressed bytes
     """
     return pylzma.compress(obj)
 
+
 def decompress(s):
     """decompress lzma bytes to original obj
-    
+
     Arguments:
         s (bytes) : the bytes will be compressed
-    
+
     Returns:
         (string) : the decompressed string
     """
@@ -76,10 +78,10 @@ 

Returns

def compress(obj):
     """compress string with lzma algorithm
-    
+
     Arguments:
         obj (string) : the string will be encoded
-    
+
     Returns:
         bytes : the compressed bytes
     """
@@ -101,10 +103,10 @@ 

Returns

def decompress(s):
     """decompress lzma bytes to original obj
-    
+
     Arguments:
         s (bytes) : the bytes will be compressed
-    
+
     Returns:
         (string) : the decompressed string
     """
diff --git a/docs/api/jumpscale/data/serializers/msgpack.html b/docs/api/jumpscale/data/serializers/msgpack.html
index c41e3ce41..f8761b302 100644
--- a/docs/api/jumpscale/data/serializers/msgpack.html
+++ b/docs/api/jumpscale/data/serializers/msgpack.html
@@ -30,11 +30,11 @@ 

Module jumpscale.data.serializers.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 """ @@ -43,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 """ @@ -66,10 +66,9 @@

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 -

+

obj (dict) : the dict which will be dumped

Returns

string
@@ -80,11 +79,11 @@

Returns

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
     """
@@ -109,10 +108,10 @@ 

Returns

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
     """
diff --git a/docs/api/jumpscale/data/serializers/pickle.html b/docs/api/jumpscale/data/serializers/pickle.html
index 099489912..23ab01620 100644
--- a/docs/api/jumpscale/data/serializers/pickle.html
+++ b/docs/api/jumpscale/data/serializers/pickle.html
@@ -30,11 +30,11 @@ 

Module jumpscale.data.serializers.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 """ @@ -43,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 """ @@ -78,10 +78,10 @@

Returns

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
     """
@@ -92,10 +92,9 @@ 

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 -

+

obj (pickle bytes) : the pickle bytes which will be dumped

Returns

string
@@ -106,11 +105,11 @@

Returns

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
     """
diff --git a/docs/api/jumpscale/data/serializers/toml.html b/docs/api/jumpscale/data/serializers/toml.html
index 023524007..7286bda63 100644
--- a/docs/api/jumpscale/data/serializers/toml.html
+++ b/docs/api/jumpscale/data/serializers/toml.html
@@ -30,11 +30,11 @@ 

Module jumpscale.data.serializers.toml

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 """ @@ -44,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 """ @@ -66,10 +66,9 @@

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 -

+

d (dict) : the dict which will be dumped

Returns

string
@@ -80,11 +79,11 @@

Returns

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
     """
@@ -110,10 +109,10 @@ 

Returns

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
     """
diff --git a/docs/api/jumpscale/data/serializers/yaml.html b/docs/api/jumpscale/data/serializers/yaml.html
index 0122123e1..bab028a7e 100644
--- a/docs/api/jumpscale/data/serializers/yaml.html
+++ b/docs/api/jumpscale/data/serializers/yaml.html
@@ -30,11 +30,11 @@ 

Module jumpscale.data.serializers.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 """ @@ -43,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 """ @@ -64,10 +64,9 @@

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 -

+

obj (dict) : the dict which will be dumped

Returns

string
@@ -78,11 +77,11 @@

Returns

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
     """
@@ -107,10 +106,10 @@ 

Returns

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
     """
diff --git a/docs/api/jumpscale/data/tarfile/tar_file.html b/docs/api/jumpscale/data/tarfile/tar_file.html
index a657e3db6..683d7f3fe 100644
--- a/docs/api/jumpscale/data/tarfile/tar_file.html
+++ b/docs/api/jumpscale/data/tarfile/tar_file.html
@@ -31,7 +31,7 @@ 

Module jumpscale.data.tarfile.tar_file

def istar(path): """check if the file is .tar format - + Arguments: path (str) : the path for the file """ @@ -40,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 @@ -51,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 """ @@ -100,7 +100,7 @@

Arguments

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
@@ -122,7 +122,7 @@ 

Arguments

def istar(path):
     """check if the file is .tar format
-    
+
     Arguments:
         path (str) : the path for the file
     """
@@ -148,7 +148,7 @@ 

Arguments

class Reader:
     """handle the reading operation on tar file
-    
+
     Arguments:
         path (str) : the path for tar file
     """
diff --git a/docs/api/jumpscale/data/text/index.html b/docs/api/jumpscale/data/text/index.html
index 137e465c2..ab50e5da5 100644
--- a/docs/api/jumpscale/data/text/index.html
+++ b/docs/api/jumpscale/data/text/index.html
@@ -65,10 +65,11 @@ 

Remove suffix

""" if s.startswith(prefix): - return s[len(prefix):] + return s[len(prefix) :] else: return s[:] + def removesuffix(s: str, suffix: str) -> str: """Remove a suffix string `suffix` from a string `s`. @@ -81,7 +82,7 @@

Remove suffix

""" if suffix and s.endswith(suffix): - return s[:-len(suffix)] + return s[: -len(suffix)] else: return s[:]
@@ -126,7 +127,7 @@

Returns

""" if s.startswith(prefix): - return s[len(prefix):] + return s[len(prefix) :] else: return s[:]
@@ -164,7 +165,7 @@

Returns

""" if suffix and s.endswith(suffix): - return s[:-len(suffix)] + return s[: -len(suffix)] else: return s[:]
diff --git a/docs/api/jumpscale/data/types/pritypes.html b/docs/api/jumpscale/data/types/pritypes.html index d72646cdb..d63c312fb 100644 --- a/docs/api/jumpscale/data/types/pritypes.html +++ b/docs/api/jumpscale/data/types/pritypes.html @@ -52,7 +52,7 @@

Module jumpscale.data.types.pritypes

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -64,7 +64,7 @@

Module jumpscale.data.types.pritypes

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -111,7 +111,7 @@

Module jumpscale.data.types.pritypes

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -123,7 +123,7 @@

Module jumpscale.data.types.pritypes

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -140,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) """ @@ -148,7 +148,7 @@

Module jumpscale.data.types.pritypes

def from_str(self, value): """Return value as is. - + Arguments: value (str) """ @@ -163,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. """ @@ -181,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. """ @@ -199,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. """ @@ -217,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. """ @@ -240,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. """ @@ -303,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. """ @@ -430,7 +430,7 @@

Arguments

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -442,7 +442,7 @@

Arguments

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -466,7 +466,7 @@

Arguments

def check(self, value):
     """Check whether provided string represent integer value
-    
+
     Arguments:
         value (str)
     """
@@ -490,7 +490,7 @@ 

Arguments

def from_str(self, value):
     """get integer value from tha string
-    
+
     Arguments:
         value (str)
     """
@@ -520,7 +520,7 @@ 

Arguments

def check(self, value): """Check whether provided string represent integer value - + Arguments: value (str) """ @@ -532,7 +532,7 @@

Arguments

def from_str(self, value): """get integer value from tha string - + Arguments: value (str) """ @@ -556,7 +556,7 @@

Arguments

def check(self, value):
     """Check whether provided string represent integer value
-    
+
     Arguments:
         value (str)
     """
@@ -580,7 +580,7 @@ 

Arguments

def from_str(self, value):
     """get integer value from tha string
-    
+
     Arguments:
         value (str)
     """
@@ -609,7 +609,7 @@ 

Arguments

def check(self, value): """Check whether provided string represent JSObject value. (Any string will do). - + Arguments: value (str) """ @@ -617,7 +617,7 @@

Arguments

def from_str(self, value): """Return value as is. - + Arguments: value (str) """ @@ -638,7 +638,7 @@

Arguments

def check(self, value):
     """Check whether provided string represent JSObject value. (Any string will do).
-    
+
     Arguments:
         value (str)
     """
@@ -658,7 +658,7 @@ 

Arguments

def from_str(self, value):
     """Return value as is.
-    
+
     Arguments:
         value (str)
     """
@@ -685,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. """ @@ -703,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. """ @@ -721,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. """ @@ -739,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. """ @@ -774,10 +774,10 @@

Returns

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.
     """
@@ -812,10 +812,10 @@ 

Returns

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.
     """
diff --git a/docs/api/jumpscale/loader.html b/docs/api/jumpscale/loader.html
index d6a2f322d..b5cc93c82 100644
--- a/docs/api/jumpscale/loader.html
+++ b/docs/api/jumpscale/loader.html
@@ -55,7 +55,7 @@ 

Module jumpscale.loader

""" cls_name = "".join([name.capitalize() for name in full_name.split(".")]) - return type(cls_name, (object,), {"__fullname": full_name,}) + return type(cls_name, (object,), {"__fullname": full_name}) def get_lazy_import_property(name, root_module, container_type): @@ -206,7 +206,7 @@

Returns

""" cls_name = "".join([name.capitalize() for name in full_name.split(".")]) - return type(cls_name, (object,), {"__fullname": full_name,})
+ return type(cls_name, (object,), {"__fullname": full_name})
diff --git a/docs/api/jumpscale/sals/hostsfile/index.html b/docs/api/jumpscale/sals/hostsfile/index.html index 074a54949..5dc45f898 100644 --- a/docs/api/jumpscale/sals/hostsfile/index.html +++ b/docs/api/jumpscale/sals/hostsfile/index.html @@ -81,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 @@ -177,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 @@ -310,7 +310,7 @@

Args

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
diff --git a/docs/api/jumpscale/servers/openresty/location.html b/docs/api/jumpscale/servers/openresty/location.html index c964c05bb..d46d0496d 100644 --- a/docs/api/jumpscale/servers/openresty/location.html +++ b/docs/api/jumpscale/servers/openresty/location.html @@ -65,8 +65,7 @@

Module jumpscale.servers.openresty.location

j.sals.fs.write_file(self.path_cfg, content) 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)""" j.sals.fs.mkdir(self.path_cfg_dir) if self.location_type in ["static", "spa"]: @@ -151,8 +150,7 @@

Args

j.sals.fs.write_file(self.path_cfg, content) 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)""" j.sals.fs.mkdir(self.path_cfg_dir) if self.location_type in ["static", "spa"]: @@ -598,8 +596,7 @@

Methods

Expand source code
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)"""
     j.sals.fs.mkdir(self.path_cfg_dir)
 
     if self.location_type in ["static", "spa"]:
diff --git a/docs/api/jumpscale/servers/openresty/server.html b/docs/api/jumpscale/servers/openresty/server.html
index 1b54e2fdb..9ca81da34 100644
--- a/docs/api/jumpscale/servers/openresty/server.html
+++ b/docs/api/jumpscale/servers/openresty/server.html
@@ -59,8 +59,7 @@ 

Module jumpscale.servers.openresty.server

return self.parent.path_web def configure(self): - """Writes configuration of the website and its locations - """ + """Writes configuration of the website and its locations""" j.sals.fs.mkdir(self.path_cfg_dir) config = render_config_template("website", base_dir=j.core.dirs.BASEDIR, website=self) @@ -110,13 +109,13 @@

Module jumpscale.servers.openresty.server

return self._logs_dir def configure(self): + """configures main nginx conf""" # clean old websites config self.cleanup() - """configures main nginx conf - """ + # self.install() This is commented for now until the repo and necessary deps are handled configtext = j.tools.jinja2.render_template( - template_path=j.sals.fs.join_paths(DIR_PATH, "templates", "nginx.conf"), logs_dir=self.logs_dir, + template_path=j.sals.fs.join_paths(DIR_PATH, "templates", "nginx.conf"), logs_dir=self.logs_dir ) j.sals.fs.write_file(self.path_cfg, configtext) @@ -161,9 +160,7 @@

Module jumpscale.servers.openresty.server

# copy the templates to the right location j.sals.fs.copy_tree(f"{DIR_PATH}/web_resources/", self.path_cfg_dir) - j.sals.fs.symlink( - f"{weblibs_path}/static", f"{self.path_web}/static/weblibs", overwrite=True, - ) + j.sals.fs.symlink(f"{weblibs_path}/static", f"{self.path_web}/static/weblibs", overwrite=True) self.status = Status.INSTALLED self.save() @@ -266,13 +263,13 @@

Args

return self._logs_dir def configure(self): + """configures main nginx conf""" # clean old websites config self.cleanup() - """configures main nginx conf - """ + # self.install() This is commented for now until the repo and necessary deps are handled configtext = j.tools.jinja2.render_template( - template_path=j.sals.fs.join_paths(DIR_PATH, "templates", "nginx.conf"), logs_dir=self.logs_dir, + template_path=j.sals.fs.join_paths(DIR_PATH, "templates", "nginx.conf"), logs_dir=self.logs_dir ) j.sals.fs.write_file(self.path_cfg, configtext) @@ -317,9 +314,7 @@

Args

# copy the templates to the right location j.sals.fs.copy_tree(f"{DIR_PATH}/web_resources/", self.path_cfg_dir) - j.sals.fs.symlink( - f"{weblibs_path}/static", f"{self.path_web}/static/weblibs", overwrite=True, - ) + j.sals.fs.symlink(f"{weblibs_path}/static", f"{self.path_web}/static/weblibs", overwrite=True) self.status = Status.INSTALLED self.save() @@ -494,19 +489,19 @@

Methods

def configure(self)
-
+

configures main nginx conf

Expand source code
def configure(self):
+    """configures main nginx conf"""
     # clean old websites config
     self.cleanup()
-    """configures main nginx conf
-    """
+
     # self.install() This is commented for now until the repo and necessary deps are handled
     configtext = j.tools.jinja2.render_template(
-        template_path=j.sals.fs.join_paths(DIR_PATH, "templates", "nginx.conf"), logs_dir=self.logs_dir,
+        template_path=j.sals.fs.join_paths(DIR_PATH, "templates", "nginx.conf"), logs_dir=self.logs_dir
     )
     j.sals.fs.write_file(self.path_cfg, configtext)
@@ -590,9 +585,7 @@

Args

# copy the templates to the right location j.sals.fs.copy_tree(f"{DIR_PATH}/web_resources/", self.path_cfg_dir) - j.sals.fs.symlink( - f"{weblibs_path}/static", f"{self.path_web}/static/weblibs", overwrite=True, - ) + j.sals.fs.symlink(f"{weblibs_path}/static", f"{self.path_web}/static/weblibs", overwrite=True) self.status = Status.INSTALLED self.save()
@@ -743,8 +736,7 @@

Args

return self.parent.path_web def configure(self): - """Writes configuration of the website and its locations - """ + """Writes configuration of the website and its locations""" j.sals.fs.mkdir(self.path_cfg_dir) config = render_config_template("website", base_dir=j.core.dirs.BASEDIR, website=self) @@ -945,8 +937,7 @@

Methods

Expand source code
def configure(self):
-    """Writes configuration of the website and its locations
-    """
+    """Writes configuration of the website and its locations"""
 
     j.sals.fs.mkdir(self.path_cfg_dir)
     config = render_config_template("website", base_dir=j.core.dirs.BASEDIR, website=self)
diff --git a/docs/api/jumpscale/servers/rack/index.html b/docs/api/jumpscale/servers/rack/index.html
index 532344c22..38ce684a3 100644
--- a/docs/api/jumpscale/servers/rack/index.html
+++ b/docs/api/jumpscale/servers/rack/index.html
@@ -28,6 +28,7 @@ 

Module jumpscale.servers.rack

def export_module_as():
     from .rack import ServerRack
+
     return ServerRack()
@@ -56,6 +57,7 @@

Functions

def export_module_as():
     from .rack import ServerRack
+
     return ServerRack()
diff --git a/docs/api/jumpscale/shell/config.html b/docs/api/jumpscale/shell/config.html index c2e1f25d1..9909025b9 100644 --- a/docs/api/jumpscale/shell/config.html +++ b/docs/api/jumpscale/shell/config.html @@ -219,7 +219,7 @@

Module jumpscale.shell.config

@repl.add_key_binding(Keys.ControlB) def _debug_event(event): - ' Pressing Control-B will insert "pdb.set_trace()" ' + 'Pressing Control-B will insert "pdb.set_trace()"' event.cli.current_buffer.insert_text("\nimport pdb; pdb.set_trace()\n") @repl.add_key_binding(Keys.ControlJ) @@ -246,7 +246,7 @@

Module jumpscale.shell.config

@repl.add_key_binding(" ") def _(event): - " When a space is pressed. Check & correct word before cursor. " + "When a space is pressed. Check & correct word before cursor." b = event.cli.current_buffer w = b.document.get_word_before_cursor() if w is not None: @@ -496,7 +496,7 @@

Functions

@repl.add_key_binding(Keys.ControlB) def _debug_event(event): - ' Pressing Control-B will insert "pdb.set_trace()" ' + 'Pressing Control-B will insert "pdb.set_trace()"' event.cli.current_buffer.insert_text("\nimport pdb; pdb.set_trace()\n") @repl.add_key_binding(Keys.ControlJ) @@ -523,7 +523,7 @@

Functions

@repl.add_key_binding(" ") def _(event): - " When a space is pressed. Check & correct word before cursor. " + "When a space is pressed. Check & correct word before cursor." b = event.cli.current_buffer w = b.document.get_word_before_cursor() if w is not None: diff --git a/docs/api/jumpscale/tools/alerthandler/index.html b/docs/api/jumpscale/tools/alerthandler/index.html index 5a252b9e9..c106c2bdd 100644 --- a/docs/api/jumpscale/tools/alerthandler/index.html +++ b/docs/api/jumpscale/tools/alerthandler/index.html @@ -28,6 +28,7 @@

Module jumpscale.tools.alerthandler

def export_module_as():
     from .alerthandler import AlertsHandler
+
     return AlertsHandler()
@@ -56,6 +57,7 @@

Functions

def export_module_as():
     from .alerthandler import AlertsHandler
+
     return AlertsHandler()
diff --git a/docs/api/jumpscale/tools/console/index.html b/docs/api/jumpscale/tools/console/index.html index fa77b8b20..9c8533d55 100644 --- a/docs/api/jumpscale/tools/console/index.html +++ b/docs/api/jumpscale/tools/console/index.html @@ -64,24 +64,24 @@

Module jumpscale.tools.console

def printcolors(s): """ - >>> j.tools.console.printcolors("{RED}Hello world") - Hello world - >>> j.tools.console.printcolors("{GREEN}Hello world") - Hello world - - Arguments: - s {[type]} -- [description] - """ + >>> j.tools.console.printcolors("{RED}Hello world") + Hello world + >>> j.tools.console.printcolors("{GREEN}Hello world") + Hello world + + Arguments: + s {[type]} -- [description] + """ print(format(s)) 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 """ @@ -94,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 """ @@ -122,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 """ @@ -152,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 """ @@ -184,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 """ @@ -202,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 """ @@ -231,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 """ @@ -249,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 """ @@ -290,11 +290,11 @@

Returns

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
     """
@@ -340,14 +340,14 @@ 

Returns

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
     """
@@ -395,14 +395,14 @@ 

Returns

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
     """
@@ -434,13 +434,13 @@ 

Returns

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
     """
@@ -477,11 +477,11 @@ 

Returns

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
     """
@@ -509,11 +509,11 @@ 

Returns

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
     """
@@ -539,10 +539,10 @@ 

Returns

def ask_string(prompt="Type :"):
     """Just input function
-    
+
     Keyword Arguments:
         prompt {str} -- the question message (default: {"Type :"})
-    
+
     Returns:
         str -- the string input
     """
@@ -568,12 +568,12 @@ 

Returns

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
     """
@@ -617,14 +617,14 @@ 

Returns

def printcolors(s):
     """
-        >>> j.tools.console.printcolors("{RED}Hello world")
-        Hello world
-        >>> j.tools.console.printcolors("{GREEN}Hello world")
-        Hello world
-
-        Arguments:
-        s {[type]} -- [description]
-        """
+    >>> j.tools.console.printcolors("{RED}Hello world")
+    Hello world
+    >>> j.tools.console.printcolors("{GREEN}Hello world")
+    Hello world
+
+    Arguments:
+    s {[type]} -- [description]
+    """
     print(format(s))
diff --git a/docs/api/jumpscale/tools/jinja2/index.html b/docs/api/jumpscale/tools/jinja2/index.html index eeba33367..39023505a 100644 --- a/docs/api/jumpscale/tools/jinja2/index.html +++ b/docs/api/jumpscale/tools/jinja2/index.html @@ -96,13 +96,7 @@

Rendering a template with data

""" from jumpscale.loader import j -from jinja2 import ( - Environment, - FileSystemLoader, - select_autoescape, - StrictUndefined, - Template, -) +from jinja2 import Environment, FileSystemLoader, select_autoescape, StrictUndefined, Template def get_env(templates_path): @@ -114,7 +108,7 @@

Rendering a template with data

Returns: jinja2.Environment: Jinja2 env """ - return Environment(loader=FileSystemLoader(templates_path), autoescape=select_autoescape(["html", "xml"]),) + return Environment(loader=FileSystemLoader(templates_path), autoescape=select_autoescape(["html", "xml"])) def get_template(template_path=None, template_text=None): @@ -171,7 +165,7 @@

Rendering a template with data

def render_code_python( - obj_key=None, template_path=None, template_text=None, dest=None, objForHash=None, name=None, **kwargs, + obj_key=None, template_path=None, template_text=None, dest=None, objForHash=None, name=None, **kwargs ): # TODO pass
@@ -212,7 +206,7 @@

Returns

Returns: jinja2.Environment: Jinja2 env """ - return Environment(loader=FileSystemLoader(templates_path), autoescape=select_autoescape(["html", "xml"]),)

+ return Environment(loader=FileSystemLoader(templates_path), autoescape=select_autoescape(["html", "xml"]))
@@ -279,7 +273,7 @@

Returns

Expand source code
def render_code_python(
-    obj_key=None, template_path=None, template_text=None, dest=None, objForHash=None, name=None, **kwargs,
+    obj_key=None, template_path=None, template_text=None, dest=None, objForHash=None, name=None, **kwargs
 ):
     # TODO
     pass
diff --git a/docs/api/jumpscale/tools/schemac/index.html b/docs/api/jumpscale/tools/schemac/index.html index 15efce43c..2453824a6 100644 --- a/docs/api/jumpscale/tools/schemac/index.html +++ b/docs/api/jumpscale/tools/schemac/index.html @@ -244,6 +244,7 @@

Generated file

``` ''' + def get_compiler(schema_text, lang="python"): from .compiler import Compiler diff --git a/docs/api/jumpscale/tools/startupcmd/startupcmd.html b/docs/api/jumpscale/tools/startupcmd/startupcmd.html index e716e44b2..796d06753 100644 --- a/docs/api/jumpscale/tools/startupcmd/startupcmd.html +++ b/docs/api/jumpscale/tools/startupcmd/startupcmd.html @@ -188,8 +188,7 @@

Module jumpscale.tools.startupcmd.startupcmd

return result def _kill_processes_by_port_or_filter(self): - """Kills processes that matches object properties - """ + """Kills processes that matches object properties""" processes = self._get_processes_by_port_or_filter() self._kill_processes(processes) @@ -225,8 +224,7 @@

Module jumpscale.tools.startupcmd.startupcmd

return False def _hard_kill(self): - """Force Kills the process - """ + """Force Kills the process""" if self.process: self._kill_processes([self.process]) self.reset() @@ -321,8 +319,7 @@

Module jumpscale.tools.startupcmd.startupcmd

self._wait(True, die, timeout) def start(self): - """Starts the process - """ + """Starts the process""" if self.is_running(): return @@ -529,8 +526,7 @@

Args

return result def _kill_processes_by_port_or_filter(self): - """Kills processes that matches object properties - """ + """Kills processes that matches object properties""" processes = self._get_processes_by_port_or_filter() self._kill_processes(processes) @@ -566,8 +562,7 @@

Args

return False def _hard_kill(self): - """Force Kills the process - """ + """Force Kills the process""" if self.process: self._kill_processes([self.process]) self.reset() @@ -662,8 +657,7 @@

Args

self._wait(True, die, timeout) def start(self): - """Starts the process - """ + """Starts the process""" if self.is_running(): return @@ -1089,8 +1083,7 @@

Returns

Expand source code
def start(self):
-    """Starts the process
-    """
+    """Starts the process"""
     if self.is_running():
         return
 
diff --git a/docs/api/jumpscale/tools/syncer/index.html b/docs/api/jumpscale/tools/syncer/index.html
index 445539f20..bf02ac5d0 100644
--- a/docs/api/jumpscale/tools/syncer/index.html
+++ b/docs/api/jumpscale/tools/syncer/index.html
@@ -140,15 +140,11 @@ 

Module jumpscale.tools.syncer

return clients def sync(self): - """Sync directory structure and files - - """ + """Sync directory structure and files""" j.logger.debug(f"paths: {self.paths}") def ensure_dirs(): - """For every directory in watched paths we make sure it's full path exists on remote. - - """ + """For every directory in watched paths we make sure it's full path exists on remote.""" for path in self.paths: for src_dir in j.sals.fs.walk_dirs(path): dest_dir = str(self._rewrite_path_for_dest(src_dir)) @@ -380,15 +376,11 @@

Returns

return clients def sync(self): - """Sync directory structure and files - - """ + """Sync directory structure and files""" j.logger.debug(f"paths: {self.paths}") def ensure_dirs(): - """For every directory in watched paths we make sure it's full path exists on remote. - - """ + """For every directory in watched paths we make sure it's full path exists on remote.""" for path in self.paths: for src_dir in j.sals.fs.walk_dirs(path): dest_dir = str(self._rewrite_path_for_dest(src_dir)) @@ -692,15 +684,11 @@

Methods

Expand source code
def sync(self):
-    """Sync directory structure and files
-
-    """
+    """Sync directory structure and files"""
     j.logger.debug(f"paths: {self.paths}")
 
     def ensure_dirs():
-        """For every directory in watched paths we make sure it's full path exists on remote.
-
-        """
+        """For every directory in watched paths we make sure it's full path exists on remote."""
         for path in self.paths:
             for src_dir in j.sals.fs.walk_dirs(path):
                 dest_dir = str(self._rewrite_path_for_dest(src_dir))
diff --git a/docs/wiki/release.md b/docs/wiki/release.md
index d1f003c51..708afc500 100644
--- a/docs/wiki/release.md
+++ b/docs/wiki/release.md
@@ -10,4 +10,4 @@
 - Merge the pull request into master
 - Tag the new version (can be done from the github UI) easier for release notes.
 - Build the package `poetry build`
-- Publish the package to `pypi.org` using `poetry publish`  
\ No newline at end of file
+- Publish the package to `pypi.org` using `poetry publish`
diff --git a/jumpscale/clients/stellar/stellar.py b/jumpscale/clients/stellar/stellar.py
index e90666876..9d0ba94eb 100644
--- a/jumpscale/clients/stellar/stellar.py
+++ b/jumpscale/clients/stellar/stellar.py
@@ -239,21 +239,21 @@ def _merge_account(self, address):
                 transaction_builder.append_payment_op(
                     destination=self.address,
                     amount=balance.balance,
-                    asset_code=balance.asset_code,
-                    asset_issuer=balance.asset_issuer,
-                    source=account.account.account_id,
+                    asset=stellar_sdk.Asset(balance.asset_code, balance.asset_issuer),
+                    source=account.account,
                 )
             # Step 2: Delete trustlines
             transaction_builder.append_change_trust_op(
-                asset_issuer=balance.asset_issuer, asset_code=balance.asset_code, limit="0"
+                asset=stellar_sdk.Asset(balance.asset_code, balance.asset_issuer),
+                limit="0",
+                source=account.account,
             )
         # Step 3: Merge account
         transaction_builder.append_account_merge_op(self.address)
 
         transaction_builder.set_timeout(30)
         transaction = transaction_builder.build()
-        signer_kp = stellar_sdk.Keypair.from_secret(self.secret)
-        transaction.sign(signer_kp)
+        transaction.sign(self.secret)
         server.submit_transaction(transaction)
 
     def activate_through_friendbot(self):
diff --git a/pyproject.toml b/pyproject.toml
index 0df6c1370..7818ae378 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,59 +1,61 @@
 [tool.poetry]
-name = "js-sdk"
-packages = [{ include = "jumpscale" }]
-version = "11.5b20"
-description = "SDK for threefold grid"
 authors = ["xmonader "]
+description = "SDK for threefold grid"
 license = "Apache-2.0"
+name = "js-sdk"
+packages = [{include = "jumpscale"}]
+version = "12.0.0"
 
 [tool.poetry.dependencies]
+PyGithub = "^1.43"
+base58 = "^2.0.0"
+beaker = "^1.11.0"
+certbot-nginx = "^1.31.0"
+certifi = "^2019.6"
+crontab = "^0.22.9"
+cryptocompare = "^0.6.4"
 cryptography = "3.3.2"
+dnspython = "^1.16"
+gevent = "^21.12.0"
+greenlet = "^1.1.3"
+importlib-metadata = "^4.0.1"
 js-ng = "11.0b17"
-python = ">=3.7,<4.0"
-cryptocompare = "^0.6.4"
-certifi = "^2019.6"
-base58 = "^2.0.0"
-netaddr = "^0.7.19"
-sendgrid = "^6.0"
 minio = "^4.0"
+namecom = "^0.5.0"
+netaddr = "^0.7.19"
+protobuf = "^3.12.2"
 pycountry = "^19.8"
-python-taiga = "^1.0.0"
-dnspython = "^1.16"
-PyGithub = "^1.43"
-python-digitalocean = "^1.15.0"
-stellar-sdk = "^8.1.0"
 pypng = "^0.0.20"
 pyqrcode = "^1.2.1"
-beaker = "^1.11.0"
-certbot-nginx = "^1.31.0"
+python = ">=3.7,<4.0"
+python-digitalocean = "^1.15.0"
+python-taiga = "^1.0.0"
 requests_unixsocket = "^0.2.0"
-protobuf = "^3.12.2"
-namecom = "^0.5.0"
-crontab = "^0.22.9"
-importlib-metadata = "^4.0.1"
-gevent = "^21.12.0"
-greenlet = "^1.1.3"
+sendgrid = "^6.0"
+stellar-sdk = "^8.1.0"
 
 [tool.poetry.dev-dependencies]
-ipython = "^7.6"
-ipdb = "^0.12.1"
 black = "^22.10.0"
+codecov = "^2.0"
 flake8 = "^3.7"
+hypothesis = "^4.28"
+ipdb = "^0.12.1"
+ipython = "^7.6"
+objgraph = "^3.4.1"
 parameterized = "^0.7.0"
 pytest = "^7.1.3"
-codecov = "^2.0"
-hypothesis = "^4.28"
 pytest-cov = "^2.7"
-objgraph = "^3.4.1"
-
 
 [tool.poetry.scripts]
 threebot = "jumpscale.entry_points.threebot:cli"
 
 [build-system]
-requires = ["poetry>=0.12"]
 build-backend = "poetry.masonry.api"
+requires = ["poetry>=0.12"]
 
 [tool.pytest.ini_options]
-markers = ["integration: marks tests as integration (deselect with '-m \"not integration\"')",
-           "unittests", "extend"]
+markers = [
+  "integration: marks tests as integration (deselect with '-m \"not integration\"')",
+  "unittests",
+  "extend",
+]