def data(self, data): """ Sets the data to be passed to the plugin when it is being executed Args: data (object): The data to be passed to the plugin when it is being executed Returns: None """ assert PanoptesValidators.valid_hashable_object( data), u'plugin_data must be a valid hashable object' self._data = data
def __init__(self, plugin_name, plugin_type, plugin_class, plugin_info_class, plugin_data, panoptes_context, plugin_agent_kv_store_class, plugin_kv_store_class, plugin_secrets_store_class, plugin_logger_name, plugin_result_class, results_callback): assert PanoptesValidators.valid_nonempty_string( plugin_name), u'plugin_name must be a non-empty string' assert PanoptesValidators.valid_nonempty_string( plugin_type), u'plugin_type must be a non-empty string' assert PanoptesBasePluginValidators.valid_plugin_class( plugin_class ), u'plugin_class must be instance of PanoptesBasePlugin' assert PanoptesPluginInfoValidators.valid_plugin_info_class( plugin_info_class ), u'plugin_info_class must be instance of PanoptesPluginInfo' assert PanoptesValidators.valid_hashable_object( plugin_data), u'plugin_data must be a valid hashable object' assert PanoptesKeyValueStoreValidators.valid_kv_store_class( plugin_kv_store_class ), u'plugin_kv_store_class must be a subclass of PanoptesKeyValueStore' assert PanoptesKeyValueStoreValidators.valid_kv_store_class( plugin_secrets_store_class ), u'plugin_secrets_store_class must be a subclass of PanoptesKeyValueStore' assert PanoptesValidators.valid_nonempty_string(plugin_logger_name), u'plugin_logger_name must be a non-empty '\ u'string' assert PanoptesValidators.valid_callback( results_callback), u'plugin_callback must be a callable' self._plugin_name = plugin_name self._plugin_type = plugin_type self._plugin_class = plugin_class self._plugin_info_class = plugin_info_class self._plugin_data = plugin_data self._panoptes_context = panoptes_context self._plugin_agent_kv_store_class = plugin_agent_kv_store_class self._plugin_secrets_store_class = plugin_secrets_store_class self._plugin_kv_store_class = plugin_kv_store_class self._plugin_logger_name = plugin_logger_name self._logger = self._panoptes_context.logger self._plugin_result_class = plugin_result_class self._results_callback = weakref.proxy(results_callback)
def test_valid_hashable_object(self): self.assertTrue(PanoptesValidators.valid_hashable_object(object())) self.assertFalse(PanoptesValidators.valid_hashable_object(list()))