Package fuzz :: Package visplugins :: Module abc_plugin
[hide private]
[frames] | no frames]

Source Code for Module fuzz.visplugins.abc_plugin

 1  """\ 
 2  FuzzPy visualization plugins abstract base class. 
 3   
 4  Enforce an interface that visualization plugins must follow, namely: 
 5      - types: most provide a list of supported object types 
 6      - is_supported: must return True if the plugin can run in the current \ 
 7      environment. 
 8      - visualize: must return a tuple (format, payload) that contains the \ 
 9      visualization format and a string containing the visualization payload. 
10   
11  @author: Xavier Spriet 
12  @contact: linkadmin@gmail.com 
13  @license: LGPL-3 
14  """ 
15   
16  from abc import ABCMeta, abstractmethod 
17 18 19 -class AbstractPlugin:
20 """\ 21 Abstract plugins class. 22 """ 23 __metaclass__ = ABCMeta 24 25 types = [] 26 """Supported datatypes for visualization.""" 27 28 @abstractmethod
29 - def is_supported(self):
30 """\ 31 Return whether the plugin is supported. 32 33 @rtype: C{bool} 34 @return: True if the plugin can run in the current environment, False\ 35 otherwise. 36 """ 37 return False
38 39 @abstractmethod
40 - def visualize(self, *args, **kwargs):
41 """\ 42 Main visualization callback. 43 44 Draws the visualization in-memory and saves the visualization data 45 in a payload string to be returned. 46 47 Arbitrary keyword arguments can be passed that will be send to the 48 backend object constructor. Future versions will attempt to provide 49 a consistent framework for marshalling those keywords. 50 51 @rtype: C{tuple} 52 @return: (format, payload) tuple. 53 """ 54 return ('', '')
55