def init(filename): """ Initializes asterix with XML category definition Args: filename: Path to XML definition file Returns: 0: if OK Raises: SyntaxError: if there is a syntax error in XMl file RuntimeError: if there is some internal problem IOError: if XML file is not found or can't be read ValueError: if parameter is not string TypeError: if there is more or less than 1 parameter Example: >>> asterix.init(path_to_your_config_file) """ return _asterix.init(filename)
def get_configuration_file(match): """ Returns first Asterix configuration file matching the parameter string Args: match: Search string for configuration file Returns: Configuration file path """ filepath = os.path.join(os.path.dirname(__file__), 'config') for fn in sorted(os.listdir(filepath)): f = os.path.join(filepath, fn) if os.path.isfile(f) and match in fn: return f # default callback function #def callback(arg): # for a in arg: # print(a) # initialize asterix with default configuration files filepath = os.path.join(os.path.dirname(__file__), 'config') for fn in sorted(os.listdir(filepath)): f = os.path.join(filepath, fn) if os.path.isfile(f) and f.endswith(".xml"): _asterix.init(f) # set default callback #_asterix.set_callback(callback)