当前位置: 首页>>代码示例>>Python>>正文


Python Output.Output类代码示例

本文整理汇总了Python中Output.Output的典型用法代码示例。如果您正苦于以下问题:Python Output类的具体用法?Python Output怎么用?Python Output使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Output类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: send_message

    def send_message(self, event):

        if self._event_os_cached(event):
            return

        if self._exclude_event(event):
            return

        # use default values for some empty attributes
        event = self._plugin_defaults(event)

        Output.event(event)
        Stats.new_event(event)
        return
        # check for consolidation
        if self.conn is not None:
            try:
                self.conn.send(str(event))
            except:
                id = self._plugin.get("config", "plugin_id")
                c = ServerConnPro(self._conf, id)
                self.conn = c.connect(0, 10)
                try:
                    self.conn.send(str(event))
                except:
                    return

            logger.info(str(event).rstrip())

        elif not self.consolidation.insert(event):
            Output.event(event)

        Stats.new_event(event)
开发者ID:cterron,项目名称:OSSIM,代码行数:33,代码来源:Detector.py

示例2: stop_process

    def stop_process(plugin, notify=True):

        id = plugin.get("config", "plugin_id")
        process = plugin.get("config", "process")
        process_aux = plugin.get("config", "process_aux")
        name = plugin.get("config", "name")
        command = plugin.get("config", "shutdown")

        # stop service
        if command:
            logger.info("Stopping service %s (%s): %s.." % (id, name, command))
            logger.debug(commands.getstatusoutput(command))

        # notify result to server
        if notify:
            time.sleep(1)

            if not process:
                logger.debug("plugin (%s) has an unknown state" % (name))
                Output.plugin_state(Watchdog.PLUGIN_UNKNOWN_STATE_MSG % (id))
                
            elif Watchdog.pidof(process, process_aux) is None:
                logger.info(WATCHDOG_PROCESS_STOPPED % (process, id))
                Output.plugin_state(Watchdog.PLUGIN_STOP_STATE_MSG % (id))
                Watchdog.__pluginID_stoppedByServer.append(id)
                logger.info("Plugin %s process :%s stopped by server..." % (id,name))

            else:
                logger.warning(WATCHDOG_ERROR_STOPPING_PROCESS % (process, id))
开发者ID:cterron,项目名称:OSSIM,代码行数:29,代码来源:Watchdog.py

示例3: setupOutput

 def setupOutput(self):
     path = u'standard_test_cases/Unit Testing/Unit Test Output/Analysis/Grade 0/Experiment 1/test'
     InputData.Set_Start_Freq(1)
     InputData.Set_Stop_Freq(2)
     InputData.Set_Step_Freq(1)
     TransformedSignalData.Set_Original_Transformed_Data(numpy.asarray([[2,4,6,8,10],[3,6,9,12,15]]))
     TransformedSignalData.Set_Filtered_Transformed_Data(numpy.asarray([[1,2,3,4,5],[10,20,30,40,50]]))
     TransformedSignalData.Set_Original_Frequency_Data(numpy.asarray([[5,10,15,20,25],[4,8,12,16,20]]))
     TransformedSignalData.Set_Filtered_Frequency_Data(numpy.asarray([[6,12,18,24,30],[7,14,21,28,35]]))
     output = Output()
     output.output(path)
开发者ID:NolanDriessen,项目名称:PolyHarmonics,代码行数:11,代码来源:unitTest.py

示例4: disable_process

    def disable_process(plugin, notify=True):

        id = plugin.get("config", "plugin_id")
        name = plugin.get("config", "name")

        # disable plugin
        plugin.set("config", "enable", "no")

        # notify to server
        if notify:
            logger.info("plugin (%s) is now disabled" % (name))
            Output.plugin_state(PluginDisableState(id))
开发者ID:jackpf,项目名称:ossim-arc,代码行数:12,代码来源:Watchdog.py

示例5: disable_process

    def disable_process(plugin, notify=True):

        id = plugin.get("config", "plugin_id")
        name = plugin.get("config", "name")

        # disable plugin
        plugin.set("config", "enable", "no")

        # notify to server
        if notify:
            logger.info("plugin (%s) is now disabled" % (name))
            Output.plugin_state(Watchdog.PLUGIN_DISABLE_STATE_MSG % (id))
开发者ID:cterron,项目名称:OSSIM,代码行数:12,代码来源:Watchdog.py

示例6: clear

    def clear(self):

        events_to_remove = []

        for event in self.__event_list:
            Output.event(event)
            events_to_remove.append(event)
            Stats.consolidation['consolidated'] += 1

        for e in events_to_remove:
            self.__event_list.removeRule(e)

        del events_to_remove
开发者ID:CyberTaoFlow,项目名称:alienvault-ossim,代码行数:13,代码来源:Threshold.py

示例7: send_message

    def send_message(self, event):

        if self._event_os_cached(event):
            return

        if self._exclude_event(event):
            return

        # use default values for some empty attributes
        event = self._plugin_defaults(event)
        Output.event(event)
        Stats.new_event(event)
        return
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:13,代码来源:Detector.py

示例8: extractTables

    def extractTables(self, path, target):
        """
            Starts the table extraction. Using only this method, nothing will be returned,
            but the HTML output Files will be created in the specified output folder.
        """
        try:
            os.mkdir(target)
        except OSError:
            pass
        os.chdir(target)
        self.__dtdFile = open(target + "/pdf2xml.dtd", "w")
        self.buildDtd()
        self.__cmdLine = "pdftohtml -xml " + path
        print(self.__cmdLine)
        os.system(self.__cmdLine)
        xmlFile = os.path.basename(path).rstrip(".pdf") + ".xml"
        fileMover.moveXmlFile(path = path, target = target)

        #starting the extraction
        firstClassification = FirstClassification(target)
        self.__resultTuple = firstClassification.run(target + "/" + xmlFile)

        tableList = self.__resultTuple[0]
        fontsList = self.__resultTuple[1]
        path = self.__resultTuple[2]

        self.__outputObj = Output(tableList, fontsList, path)
        self.__outputObj.createOutput()
开发者ID:B-Rich,项目名称:pypdf2table,代码行数:28,代码来源:ExecuteConverter.py

示例9: __init__

class Programa:

    def __init__(self, name):
        self.name = name
        self.instrucciones = []
        self.output = Output()

    def agregarInstruccion(self, instruccion):
        self.instrucciones.append(instruccion)

    def ejecutar(self):
        for instr in self.instrucciones:
            instr.run(self.output)

    def size(self):
        return len(self.instrucciones)

    def getInstrucciones(self):
        return self.instrucciones

    def getElemento(self, posicion):
        return self.instrucciones[posicion]

    def getInstruccionEjecutada(self, indice):
        return self.output.get(indice)
开发者ID:javierperini,项目名称:sistemas-operativos-perini-melendi,代码行数:25,代码来源:Programa.py

示例10: send_message

    def send_message(self, event):

        if self._event_os_cached(event):
            return

        if self._exclude_event(event):
            return

        # use default values for some empty attributes
#        check_data =True
#        if event["event_type"] != EventIdm.EVENT_TYPE:
#            check_data =False
        
        event = self._plugin_defaults(event)
        Output.event(event)
        Stats.new_event(event)
        return
开发者ID:DuVale,项目名称:phpzdl,代码行数:17,代码来源:Detector.py

示例11: start_process

    def start_process(plugin, notify=True):

        id = plugin.get("config", "plugin_id")
        process = plugin.get("config", "process")
        process_aux = plugin.get("config", "process_aux")
        name = plugin.get("config", "name")
        command = plugin.get("config", "startup")

        # start service
        if command:
            logger.info("Starting service %s (%s): %s.." % (id, name, command))
            task = Task(command)
            task.Run(1, 0)
            timeout = 300
            start = datetime.now()
            plugin.start_time = float(time.time())

            while not task.Done():
                time.sleep(0.1)
                now = datetime.now()

                if (now - start).seconds > timeout:
                    task.Kill()
                    logger.warning("Could not start %s, returning after %s second(s) wait time." % (command, timeout))

        # notify result to server
        if notify:

            if not process:
                logger.debug("plugin (%s) has an unknown state" % (name))
                Output.plugin_state(Watchdog.PLUGIN_UNKNOWN_STATE_MSG % (id))

            elif Watchdog.pidof(process, process_aux) is not None:
                logger.info(WATCHDOG_PROCESS_STARTED % (process, id))
                Output.plugin_state(Watchdog.PLUGIN_START_STATE_MSG % (id))
                for pid in Watchdog.__pluginID_stoppedByServer:
                    if pid == id:
                         Watchdog.__pluginID_stoppedByServer.remove(id)
                         break

            else:
                logger.warning(WATCHDOG_ERROR_STARTING_PROCESS % (process, id))
开发者ID:cterron,项目名称:OSSIM,代码行数:42,代码来源:Watchdog.py

示例12: test_property_handling

    def test_property_handling(self):
        output = Output()
        propertyDict = {'fw1': {'prop1': 'val1', 'prop2': 'not val2'}, 'fw2': {'propfw2': 'something'}}
        output.add_property(propertyDict)
        self.assertEqual(output.get_properties(),propertyDict)
        updateDict = {'fw1': {'prop2': 'val2', 'prop3': None}, 'fw3': {'propfw3': 'foo'}}
        output.add_property(updateDict)
        propertyDict['fw1'].update(updateDict['fw1'])
        propertyDict['fw3'] = updateDict['fw3']

        # print(propertyDict)
        self.assertEqual(output.get_properties(),propertyDict)
开发者ID:icclab,项目名称:disco,代码行数:12,代码来源:OutputTest.py

示例13: evaluate

    def evaluate(self, rule_name):
        
        if self.first_value is None:
            logger.debug("Can not extract value (arg1) from monitor response or no initial value to compare with")
            return True

        value = None
        monitor_response = self.get_data(rule_name)
        if not monitor_response:
            logger.warning("No data received from monitor")
            return True
        else:
            value = self.get_value(monitor_response, rule_name)
            if value is None:
	    	return True
	    #if not value:
            #    continue
            if self.eval_condition(cond=self.watch_rule["condition"],
                                   arg1=self.first_value,
                                   arg2=value,
                                   value=int(self.watch_rule["value"])):
                self.watch_rule["type"] = "monitor"
		try:
			cond = self.watch_rule["condition"]
                        arg1 = self.first_value
                        arg2 = value
                        value = int(self.watch_rule["value"])
                        comm = self.queries
			log = "Monitor Command: %s , Monitor expresion evaluation: %s(arg2) <%s> %s(arg1) + %s(value)? , Command Response: %s" % (str(comm), str(arg2), str(cond), str(arg1), str(value), monitor_response.replace("\n", "\r"))
		except:
			log = "Monitor Exception"
                self.watch_rule = self._plugin_defaults(self.watch_rule, log)
                Output.event(self.watch_rule)
                Stats.new_event(self.watch_rule)
                return True

        logger.debug("No data matching the watch-rule received from monitor")
        return False
开发者ID:cterron,项目名称:OSSIM,代码行数:38,代码来源:Monitor.py

示例14: main

def main():
  ticker = raw_input("\n\n\n----------------------------------------------\nWelcome. Ready to trade? Pick a stock ticker: ")
  reuterObj = ReutersQuery()
  reuterVector = reuterObj.getQuery(ticker)

  sentimentObj = Sentiment()
  sentiments = sentimentObj.sentimentVectorize(reuterVector)

  yahooObj = YahooQuery()
  yahooVector = yahooObj.doYahooQuery(ticker, reuterVector)

  reuterDates = DateFormat()
  dates = reuterDates.fixDates(reuterVector)

  mergeObj = Merge()
  merged = mergeObj.mergeEverything(sentiments, yahooVector, dates)

  strategyObj = Strategy()
  metrics = strategyObj.runStrategy(ticker, merged)

  outputObj = Output()
  outputObj.putOutput(ticker, metrics, yahooVector, merged)
  print '\nThanks for trading with Vivek! Get money, get paid!'
开发者ID:ffmaer2,项目名称:newstrader,代码行数:23,代码来源:NewsTrader.py

示例15: __init__

 def __init__(self, disco_config, params):
     """
     creating a Disco class instance which will provide the regular interface to access the cluster lifecycle
     :param disco_config: data needed for Disco class
     :param params: possible further parameters (not used currently)
     """
     self.deployer = disco_config['deployer']
     self.framework_directory = disco_config['framework_directory']
     self.root_component = disco_config['root_component']
     self.root_component_state = disco_config['root_component_state']
     self.params = params
     self.components = {}
     self.output = FinalOutput()
     self.load_components()
开发者ID:icclab,项目名称:disco,代码行数:14,代码来源:Disco.py


注:本文中的Output.Output类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。