[IMP] base_external_dbsource: black, isort, prettier

This commit is contained in:
bilbonet
2021-07-13 17:31:30 +02:00
committed by Ángel Rivas
parent 987709f91d
commit 05cc4870bc

View File

@@ -15,7 +15,7 @@ _logger = logging.getLogger(__name__)
class BaseExternalDbsource(models.Model):
""" It provides logic for connection to an external data source
"""It provides logic for connection to an external data source
Classes implementing this interface must provide the following methods
suffixed with the adapter type. See the method definitions and examples
@@ -95,7 +95,7 @@ class BaseExternalDbsource(models.Model):
self.current_table = name
def connection_close(self, connection):
""" It closes the connection to the data source.
"""It closes the connection to the data source.
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -106,7 +106,7 @@ class BaseExternalDbsource(models.Model):
@contextmanager
def connection_open(self):
""" It provides a context manager for the data source.
"""It provides a context manager for the data source.
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -123,7 +123,7 @@ class BaseExternalDbsource(models.Model):
_logger.exception("Connection close failure.")
def execute(self, query=None, execute_params=None, metadata=False, **kwargs):
""" Executes a query and returns a list of rows.
"""Executes a query and returns a list of rows.
"execute_params" can be a dict of values, that can be referenced
in the SQL statement using "%(key)s" or, in the case of Oracle,
@@ -163,7 +163,7 @@ class BaseExternalDbsource(models.Model):
return rows
def connection_test(self):
""" It tests the connection
"""It tests the connection
Raises:
ConnectionSuccessError: On connection success
@@ -182,7 +182,7 @@ class BaseExternalDbsource(models.Model):
)
def remote_browse(self, record_ids, *args, **kwargs):
""" It browses for and returns the records from remote by ID
"""It browses for and returns the records from remote by ID
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -200,7 +200,7 @@ class BaseExternalDbsource(models.Model):
return method(record_ids, *args, **kwargs)
def remote_create(self, vals, *args, **kwargs):
""" It creates a record on the remote data source.
"""It creates a record on the remote data source.
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -218,7 +218,7 @@ class BaseExternalDbsource(models.Model):
return method(vals, *args, **kwargs)
def remote_delete(self, record_ids, *args, **kwargs):
""" It deletes records by ID on remote
"""It deletes records by ID on remote
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -236,7 +236,7 @@ class BaseExternalDbsource(models.Model):
return method(record_ids, *args, **kwargs)
def remote_search(self, query, *args, **kwargs):
""" It searches the remote for the query.
"""It searches the remote for the query.
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -254,7 +254,7 @@ class BaseExternalDbsource(models.Model):
return method(query, *args, **kwargs)
def remote_update(self, record_ids, vals, *args, **kwargs):
""" It updates the remote records with the vals
"""It updates the remote records with the vals
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -295,7 +295,7 @@ class BaseExternalDbsource(models.Model):
# Compatibility & Private
def conn_open(self):
""" It opens and returns a connection to the remote data source.
"""It opens and returns a connection to the remote data source.
This method calls adapter method of this same name, suffixed with
the adapter type.
@@ -308,7 +308,7 @@ class BaseExternalDbsource(models.Model):
return connection
def _get_adapter_method(self, method_prefix):
""" It returns the connector adapter method for ``method_prefix``.
"""It returns the connector adapter method for ``method_prefix``.
Args:
method_prefix: (str) Prefix of adapter method (such as