コード例 #1
0
ファイル: module.py プロジェクト: thpatel/synapse
    def setModProp(self, prop, valu):
        '''
        Set a module property within the cortex storage layer.

        Args:
            prop (str): The property name.
            valu (obj): A str/int valu.
        '''
        if self._mod_iden is None:
            raise s_common.NoModIden(name=self._mod_name,
                                     ctor=self.__class__.__name__)

        prop = '.:mod:' + self._mod_iden + '/' + prop
        self.core.setRowsByIdProp(self._mod_iden, prop, valu)
コード例 #2
0
ファイル: module.py プロジェクト: thpatel/synapse
    def getModProp(self, prop, defval=None):
        '''
        Retrieve a module property from the cortex storage layer.

        Args:
            prop (str): The property name

        Returns:
            (obj): The int/str or None
        '''
        if self._mod_iden is None:
            raise s_common.NoModIden(name=self._mod_name,
                                     ctor=self.__class__.__name__)

        prop = '.:mod:' + self._mod_iden + '/' + prop
        rows = self.core.getRowsByProp(prop, limit=1)
        if not rows:
            return defval
        return rows[0][2]