# Path: m2core/utils/decorators.py
# class classproperty(property):
#     def __get__(self, obj, objtype=None):
#         return super(classproperty, self).__get__(objtype)
# 
#     def __set__(self, obj, value):
#         super(classproperty, self).__set__(type(obj), value)
# 
#     def __delete__(self, obj):
#         super(classproperty, self).__delete__(type(obj))
# 
# Path: m2core/utils/error.py
# class M2Error(Exception):
#     """
#     Raise this error wherever you want you exception to be raised, logged and showed up to user with custom message
#     """
#     def __init__(self, msg: str='', show_to_user: bool=False):
#         self.error_message = msg
#         self.show_to_user = show_to_user
#         self._log()
# 
#     def _log(self):
#         logger.error(self.error_message)
# 
#     def __repr__(self):
#         return self.error_message


from redis import StrictRedis
from sqlalchemy.orm import Session, scoped_session, Query
from m2core.utils.decorators import classproperty
from m2core.utils.error import M2Error
        """
        cls._db_session = session

    @classproperty
    def s(cls) -> scoped_session or Session:
        """
        Returns DB Session
        """
        if cls._db_session:
            return cls._db_session
        else:
            raise M2Error('No DB session defined')

    @classmethod
    def set_redis_session(cls, session) -> scoped_session or Session:
        """
        Sets Redis Session during M2Core initialization with this method
        """
        cls._redis_session = session

    @classproperty
    def r(cls) -> StrictRedis:
        """
        Returns Redis Session
        """
        if cls._redis_session:
            return cls._redis_session
        else:
            raise M2Error('No Redis session defined')


# Path: m2core/utils/decorators.py
# class classproperty(property):
#     def __get__(self, obj, objtype=None):
#         return super(classproperty, self).__get__(objtype)
# 
#     def __set__(self, obj, value):
#         super(classproperty, self).__set__(type(obj), value)
# 
#     def __delete__(self, obj):
#         super(classproperty, self).__delete__(type(obj))
# 
# Path: m2core/utils/error.py
# class M2Error(Exception):
#     """
#     Raise this error wherever you want you exception to be raised, logged and showed up to user with custom message
#     """
#     def __init__(self, msg: str='', show_to_user: bool=False):
#         self.error_message = msg
#         self.show_to_user = show_to_user
#         self._log()
# 
#     def _log(self):
#         logger.error(self.error_message)
# 
#     def __repr__(self):
#         return self.error_message


# Path: m2core/db/sqlalchemy_mixins/session_mixin.py
from redis import StrictRedis
from sqlalchemy.orm import Session, scoped_session, Query
from m2core.utils.decorators import classproperty
from m2core.utils.error import M2Error

        """
        cls._db_session = session

    @classproperty
    def s(cls) -> scoped_session or Session:
        """
        Returns DB Session
        """
        if cls._db_session:
            return cls._db_session
        else:
            raise M2Error('No DB session defined')

    @classmethod
    def set_redis_session(cls, session) -> scoped_session or Session:
        """
        Sets Redis Session during M2Core initialization with this method
        """
        cls._redis_session = session

    @classproperty
    def r(cls) -> StrictRedis:
        """
        Returns Redis Session
        """
        if cls._redis_session:
            return cls._redis_session
        else:
            raise M2Error('No Redis session defined')


    @classproperty