Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-30-SQL-based-storage-implementation aaf35c1d2 -> 91f9de43b (forced update)
more lynting Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/91f9de43 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/91f9de43 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/91f9de43 Branch: refs/heads/ARIA-30-SQL-based-storage-implementation Commit: 91f9de43b0042d5619f9d9539350fc5847287be6 Parents: 2d6b937 Author: mxmrlv <mxm...@gmail.com> Authored: Thu Dec 1 12:56:11 2016 +0200 Committer: mxmrlv <mxm...@gmail.com> Committed: Thu Dec 1 12:58:13 2016 +0200 ---------------------------------------------------------------------- aria/__init__.py | 1 - aria/storage/filesystem_api.py | 4 ++++ aria/storage/mapi/sql.py | 7 ++++--- aria/storage/models.py | 2 +- aria/storage/rapi/filesystem.py | 6 +++--- aria/storage/structures.py | 7 +++---- tests/requirements.txt | 3 +-- 7 files changed, 16 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/91f9de43/aria/__init__.py ---------------------------------------------------------------------- diff --git a/aria/__init__.py b/aria/__init__.py index 2c00729..6e810f0 100644 --- a/aria/__init__.py +++ b/aria/__init__.py @@ -23,7 +23,6 @@ import pkgutil from .VERSION import version as __version__ from .orchestrator.decorators import workflow, operation -from . import storage from . import ( utils, parser, http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/91f9de43/aria/storage/filesystem_api.py ---------------------------------------------------------------------- diff --git a/aria/storage/filesystem_api.py b/aria/storage/filesystem_api.py index d42cd61..f28d1f6 100644 --- a/aria/storage/filesystem_api.py +++ b/aria/storage/filesystem_api.py @@ -24,6 +24,10 @@ class BaseFileSystemAPI(api.StorageAPI): """ Base class which handles storage on the file system. """ + + def create(self, **kwargs): + super(BaseFileSystemAPI, self).create(**kwargs) + def __init__(self, *args, **kwargs): super(BaseFileSystemAPI, self).__init__(*args, **kwargs) self._lock = RLock() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/91f9de43/aria/storage/mapi/sql.py ---------------------------------------------------------------------- diff --git a/aria/storage/mapi/sql.py b/aria/storage/mapi/sql.py index f2ec0e5..4408aa3 100644 --- a/aria/storage/mapi/sql.py +++ b/aria/storage/mapi/sql.py @@ -49,7 +49,7 @@ class SQLAlchemyModelAPI(storage.api.ModelAPI): self._engine = engine self._session = session - def get(self, entry_id, include=None, filters=None, locking=False): + def get(self, entry_id, include=None, filters=None, locking=False, **kwargs): """Return a single result based on the model class and element ID """ filters = filters or {'id': entry_id} @@ -69,7 +69,8 @@ class SQLAlchemyModelAPI(storage.api.ModelAPI): include=None, filters=None, pagination=None, - sort=None): + sort=None, + **kwargs): """Return a (possibly empty) list of `model_class` results """ query = self._get_query(include, filters, sort) @@ -91,7 +92,7 @@ class SQLAlchemyModelAPI(storage.api.ModelAPI): self._safe_commit() return entry - def delete(self, entry_id, filters=None): + def delete(self, entry_id, filters=None, **kwargs): """Delete a single result based on the model class and element ID """ try: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/91f9de43/aria/storage/models.py ---------------------------------------------------------------------- diff --git a/aria/storage/models.py b/aria/storage/models.py index 9d0515e..c04f7d8 100644 --- a/aria/storage/models.py +++ b/aria/storage/models.py @@ -318,7 +318,7 @@ class DeploymentUpdate(SQLModelBase): """ return self.deployment.id - def to_dict(self, suppress_error=False): + def to_dict(self, suppress_error=False, **kwargs): dep_update_dict = super(DeploymentUpdate, self).to_dict(suppress_error) # Taking care of the fact the DeploymentSteps are objects dep_update_dict['steps'] = [step.to_dict() for step in self.steps] http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/91f9de43/aria/storage/rapi/filesystem.py ---------------------------------------------------------------------- diff --git a/aria/storage/rapi/filesystem.py b/aria/storage/rapi/filesystem.py index ceafde5..a6c4ddf 100644 --- a/aria/storage/rapi/filesystem.py +++ b/aria/storage/rapi/filesystem.py @@ -21,10 +21,10 @@ from distutils import dir_util from functools import partial from aria.storage import ( - api, - filesystem_api, + api, + filesystem_api, exceptions -) +) class FileSystemResourceAPI(api.ResourceAPI, filesystem_api.BaseFileSystemAPI): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/91f9de43/aria/storage/structures.py ---------------------------------------------------------------------- diff --git a/aria/storage/structures.py b/aria/storage/structures.py index 4f01524..b8b74fa 100644 --- a/aria/storage/structures.py +++ b/aria/storage/structures.py @@ -218,8 +218,7 @@ class SQLModelBase(Model): # Indicates whether the `id` column in this class should be unique is_id_unique = True - @property - def to_dict(self): + def to_dict(self, **kwargs): """ Convert the model into dict :return: @@ -231,7 +230,7 @@ class SQLModelBase(Model): Convert the model into json. :return: """ - return jsonpickle.encode(self.to_dict, unpicklable=False) + return jsonpickle.encode(self.to_dict(), unpicklable=False) @classproperty def fields(cls): @@ -261,4 +260,4 @@ class SQLModelBase(Model): return str(self) def __eq__(self, other): - return isinstance(other, self.__class__) and self.to_dict == other.to_dict + return isinstance(other, self.__class__) and self.to_dict() == other.to_dict() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/91f9de43/tests/requirements.txt ---------------------------------------------------------------------- diff --git a/tests/requirements.txt b/tests/requirements.txt index 0379362..0e4740f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -15,5 +15,4 @@ mock==1.0.1 pylint==1.6.4 pytest==3.0.2 pytest-cov==2.3.1 -pytest-mock==1.2 -SQLAlchemy==1.1.4 +pytest-mock==1.2 \ No newline at end of file