Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@classproperty
def _s_auto_commit(self):
"""
:return: whether the instance should be automatically commited.
:rtype: boolen
fka db_commit: auto_commit is a beter name, but keep db_commit for backwards compatibility
"""
return self.db_commit @classproperty
def _s_type(cls):
return cls._target._s_type @classproperty
def _s_class_name(cls):
"""
"""
return cls._target.__name__ @classproperty
def _s_query(cls):
"""
query placeholder
"""
return TestQuery() @classproperty
def column_names(self):
"""
:return: a list of columns names of this id type
"""
return [c.name for c in self.columns] @classproperty
def _s_type(cls):
"""
json:api type
"""
return cls.ja_type @classproperty
def _s_relationship_names(cls):
return cls._target._s_relationship_names @classproperty
def _s_class_name(cls):
"""
:return: the name of the instances
"""
return cls.__name__ @classproperty
def object_id(cls):
"""
:return: the Flask url parameter name of the object, e.g. UserId
:rtype: string
"""
# pylint: disable=no-member
return cls.__name__ + get_config("OBJECT_ID_SUFFIX") @classproperty
def _s_query(cls):
"""
:return: sqla query object
"""
_table = getattr(cls, "_table", None)
if _table:
return safrs.DB.session.query(_table)
return safrs.DB.session.query(cls)