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


Python log.debug函数代码示例

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


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

示例1: _responseExpandAll

 def _responseExpandAll(self, response):
     '''
     Expands an accessible tree item from the response recursively.
     '''
     path = response.accessible.path
     log.debug("Expanding accessible tree item recursively: %s" % path)
     if not response.status:
         return False
     accessible = response.accessible
     item = None
     if path.tuple:
         item = self._pathItem(path)
         if not item:
             log.warning("Invalid accessible tree path: %s" % path)
             return False
         # Update the item
         self._setAccessibleItem(accessible, item)
         item.setDisabled(False)
     else:
         self._treeWidget.clear()
     self._manualExpand = True
     if item:
         item.setExpanded(True)
     for child in accessible.children():
         self._accessibleItem(child, item or self._treeWidget,
                              recursive=True)
     for i in xrange(self._COLUMN_COUNT):
         self._treeWidget.resizeColumnToContents(i)
     self._manualExpand = False
     return True
开发者ID:mlyko,项目名称:tadek-ui,代码行数:30,代码来源:device.py

示例2: getDevices

def getDevices(deviceArgs):
    '''
    Converts command-line arguments representing devices.

    :param deviceArgs: Devices identifiers
    :type deviceArgs: list [string]
    :return: List of devices
    :rtype: list [tadek.connection.device.Device]
    '''
    log.debug("Get devices from command-line arguments: %s" % deviceArgs)
    deviceList = []
    if deviceArgs is None or deviceArgs == [None]:
        log.info("Using default device %s:%d"
                 % (devices.DEFAULT_IP, devices.DEFAULT_PORT) )
        deviceList.append(Device('localhost', devices.DEFAULT_IP,
                                 devices.DEFAULT_PORT))
    else:
        for arg in deviceArgs:
            device = devices.get(arg)
            if device is None:
                address = arg.split(':')
                if len(address) == 2:
                    address, port = address
                    port = int(port)
                elif len(address) == 1:
                    address, port = address[0], devices.DEFAULT_PORT
                else:
                    exitWithError("Invalid format of a device: %s" % arg)
                device = Device(address + ':' + str(port), address, port)
            log.info("Adding a device: %s=%s:%d"
                      % (device.name, device.address[0], device.address[1]))
            deviceList.append(device)
    return deviceList
开发者ID:mlyko,项目名称:tadek-tools,代码行数:33,代码来源:utils.py

示例3: _editDevice

 def _editDevice(self):
     '''
     Runs the 'Edit device' dialog for currently selected device.
     '''
     items = self._deviceList.selectedItems()
     if not items:
         return
     dev = devices.get(items[0].text(0))
     log.debug("Editing device: %s" % dev)
     dialog = DeviceConfigDialog(dev)
     if not dialog.run():
         return
     connect = dialog.params.pop("connect", False)
     if dev.name != dialog.params["name"]:
         self._updateConnectionState(False, dev)
         devices.remove(dev.name)
         index = self._deviceList.indexOfTopLevelItem(items[0])
         self._deviceList.takeTopLevelItem(index)
         dev = devices.add(type=Device, **dialog.params)
         self._addDeviceItem(dev)
     else:
         address = dialog.params["address"]
         port = dialog.params["port"]
         if dev.address != (address, port):
             self._updateConnectionState(False, dev)
         devices.update(**dialog.params)
         self._deviceItems[dev].updateDevice()
     log.info("Device edited: %s" % dev)
     if connect:
         self._updateConnectionState(True, dev)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:30,代码来源:devices.py

示例4: _openRecent

 def _openRecent(self):
     '''
     Opens a recent dump file in a new tab.
     '''
     path = self.sender().data()
     log.debug("Opening recent dump: '%s'" % path)
     self._open(path)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:7,代码来源:exploreview.py

示例5: run

 def run(self, deviceTab):
     '''
     Runs the mouse event dialog.
     '''
     log.debug("Running mouse event dialog")
     self._deviceTab = deviceTab
     self.dialog.show()
开发者ID:mlyko,项目名称:tadek-ui,代码行数:7,代码来源:exploredialogs.py

示例6: systemExec

def systemExec(processor, command, wait=True):
    '''
    Executes the given system command.

    :param processor: A processor object calling the function
    :type processor: Processor
    :param command: A cammand to execute
    :type command: string
    :param wait: If True wait for termination of a command process
    :type wait: boolean
    :return: The command execution status, output and error
    :rtype: tuple
    '''
    log.debug(str(locals()))
    # Reset the processor cache
    processor.cache = None
    stdout, stderr = '', ''
    try:
        cmd = subprocess.Popen(command, stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE, shell=True)
        status = True
        if wait:
            code = cmd.wait()
            log.info("System command '%s' returned with code: %d"
                     % (command, code))
            status = (code == 0)
            stdout, stderr = cmd.communicate()
            stdout = stdout or ''
            stderr = stderr or ''
    except:
        log.exception("Execute system command failure: %s" % command)
        return False, stdout, stderr
    return status, stdout, stderr
开发者ID:mlyko,项目名称:tadek-daemon,代码行数:33,代码来源:processor.py

示例7: systemPut

def systemPut(processor, path, data):
    '''
    Puts the given data in a system file of the specified path.

    :param processor: A processor object calling the function
    :type processor: Processor
    :param path: A path to the system file
    :type path: string
    :return: True if success, False otherwise
    :rtype: boolean
    '''
    log.debug(str(locals()))
    # Reset the processor cache
    processor.cache = None
    fd = None
    try:
        dir = os.path.dirname(path)
        if not os.path.exists(dir):
            log.info("Create intermediate directories of file path: %s" % path)
            os.makedirs(dir)
        fd = open(path, 'w')
        fd.write(data)
    except:
        log.exception("Get system file failure: %s" % path)
        return False
    finally:
        if fd:
            fd.close()
    return True
开发者ID:mlyko,项目名称:tadek-daemon,代码行数:29,代码来源:processor.py

示例8: systemGet

def systemGet(processor, path):
    '''
    Gets content data of a system file of the given path.

    :param processor: A processor object calling the function
    :type processor: Processor
    :param path: A path to the system file
    :type path: string
    :return: The file content data or None
    :rtype: string
    '''
    log.debug(str(locals()))
    # Reset the processor cache
    processor.cache = None
    if not os.path.exists(path):
        log.warning("Attempt of getting not existing system file: %s" % path)
        return False, ''
    fd = None
    try:
        fd = open(path, 'r')
        data = fd.read()
    except:
        log.exception("Get system file failure: %s" % path)
        return False, ''
    finally:
        if fd:
            fd.close()
    return True, data
开发者ID:mlyko,项目名称:tadek-daemon,代码行数:28,代码来源:processor.py

示例9: _loadState

    def _loadState(self):
        """
        Loads window's settings from configuration.
        """
        log.debug("Loading main window's settings")
        if self._views:
            index = config.getInt(self._NAME, "views", "last", 0)
            view = self._views[0]
            try:
                view = self._views[index]
            except IndexError:
                log.error("Failed to load view #%d" % index)
            view.activate()

        section = "geometry"
        self.window.setGeometry(
            config.getInt(self._NAME, section, "window_x", 50),
            config.getInt(self._NAME, section, "window_y", 50),
            config.getInt(self._NAME, section, "window_w", 800),
            config.getInt(self._NAME, section, "window_h", 600),
        )
        state = config.get(self._NAME, section, "window_state")
        if state:
            byteData = QtCore.QByteArray.fromBase64(state)
            self.window.restoreState(byteData)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:25,代码来源:main.py

示例10: _disconnectAll

 def _disconnectAll(self):
     '''
     Disconnects all devices.
     '''
     log.debug("Disconnecting all devices")
     for dev in devices.all():
         self._updateConnectionState(False, dev)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:7,代码来源:devices.py

示例11: _openDialog

 def _openDialog(self):
     '''
     Opens selected files containing test results in tabs.
     '''
     log.debug("Opening result file")
     readableChannels = {}
     for c in [c for c in channels.get()
                 if isinstance(c, channels.TestResultFileChannel)]:
         desc = "%s (*.%s)" % (c.name, c.fileExt().strip("."))
         readableChannels[desc] = c
     if not readableChannels:
         dialogs.runWarning("There are no readable channels available")
         return
     dialog = QtGui.QFileDialog(self.view)
     dialog.setFileMode(QtGui.QFileDialog.ExistingFiles)
     dialog.setFilter(";;".join(readableChannels))
     if not dialog.exec_():
         log.debug("Opening result file was cancelled")
         return
     channel = readableChannels[dialog.selectedFilter()]
     for path in dialog.selectedFiles():
         try:
             self.addTab(channel.read(path), os.path.split(path)[1],
                         tooltip=path)
             self._updateRecentFiles(path)
         except Exception, ex:
             dialogs.runError("Error occurred while loading result file "
                              "'%s':\n%s" % (path, ex))
开发者ID:mlyko,项目名称:tadek-ui,代码行数:28,代码来源:resultview.py

示例12: unload

 def unload(self):
     '''
     Disconnect and unload all current devices from the dialog.
     '''
     log.debug("Unloading device list")
     for dev in devices.all():
         self._updateConnectionState(False, dev)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:7,代码来源:devices.py

示例13: _addDeviceTab

 def _addDeviceTab(self, device):
     '''
     Adds the device tab for given device.
     '''
     log.debug("Adding device tab: %s" % device)
     tab = DeviceTab(device, self)
     self._tabs[device] = tab
     index = self._tabWidget.addTab(tab.tab, device.name)
     address, port = device.address
     if port:
         tooltip = "%s:%d" % (address, port)
     else:
         tooltip = address
     self._tabWidget.setTabToolTip(index, tooltip)
     self._tabWidget.setCurrentIndex(index)
     self._actionRefresh.triggered.connect(tab.refresh)
     self._actionRefreshAll.triggered.connect(tab.refreshAll)
     self._actionExpand.triggered.connect(tab.expand)
     self._actionExpandAll.triggered.connect(tab.expandAll)
     self._actionCollapse.triggered.connect(tab.collapse)
     self._actionCollapseAll.triggered.connect(tab.collapseAll)
     if not tab.isOffline():
         self._actionSave.triggered.connect(tab.save)
         self._actionSaveAll.triggered.connect(tab.saveAll)
         self._actionButtons.buttonClicked.connect(tab.doAction)
         self._mouse.clicked.connect(self._callMouseDialog)
         self._keyboard.clicked.connect(self._callKeyboardDialog)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:27,代码来源:exploreview.py

示例14: printResult

def printResult(result):
    '''
    Prints the given test result.
    '''
    log.debug("Print test result: %s" % result)
    summary = result.get(name=SUMMARY_CHANNEL)[0].getSummary()
    log.info("Print summary of test execution results: %s" % summary)
    report = "Ran %d of %d test cases in %s" % (summary[COUNTER_TESTS_RUN],
                                                summary[COUNTER_N_TESTS],
                                                summary[COUNTER_RUN_TIME])
    print '\n', report
    printSeparator(len(report))
    if summary[STATUS_PASSED]:
        print "Tests passed:\t\t%d" % summary[STATUS_PASSED]
    if summary[STATUS_FAILED]:
        print "Tests failed:\t\t%d" % summary[STATUS_FAILED]
    if summary[STATUS_NOT_COMPLETED]:
        print "Tests not completed:\t%d" % summary[STATUS_NOT_COMPLETED]
    if summary[COUNTER_CORE_DUMPS]:
        print "Core dumps:\t\t%d" % summary[COUNTER_CORE_DUMPS]
    if summary[STATUS_ERROR]:
        print "Tests error:\t\t%d" % summary[STATUS_ERROR]
    filechls = [chl for chl in result.get(cls=channels.TestResultFileChannel)
                    if chl.isActive()]
    if filechls:
        print "Result file:" if len(filechls) == 1 else "Result files:"
        for channel in filechls:
            print "\t%s" % channel.filePath()
    printSeparator()

    status = (1 if (summary[STATUS_FAILED] + summary[STATUS_ERROR] +
                    summary[STATUS_NOT_COMPLETED]) else 0)
    exitWithStatus("FAILURE" if status else "SUCCESS", status)
开发者ID:mlyko,项目名称:tadek-tools,代码行数:33,代码来源:test.py

示例15: _startTests

    def _startTests(self):
        '''
        Starts execution of tests.
        '''
        log.debug("Starting tests")
        self._actionStart.setVisible(False)
        devices = self._devices.getChecked()
        if not devices:
            runWarning("Select some devices first")
            self._actionStart.setVisible(True)
            return
        tests = self._tests.getCheckedTests()
        if not tests:
            self._actionStart.setVisible(True)
            return
        if sum([test.count() for test in tests]) == 0:
            runWarning("Selected test suites do not contain any test cases")
            self._actionStart.setVisible(True)
            return

        self._suiteRuns = 0
        self._todoSuites = len(tests)
        self._testResult = testresult.TestResult()
        self._testRunner = TestRunner(devices, tests, self._testResult)
        self._devices.deviceChecked.connect(self._testRunner.addDevice)
        self._devices.deviceUnchecked.connect(self._testRunner.removeDevice)
        self._devices.setWarning(True)

        self._testRunner.start()

        self._actionStop.setVisible(True)
        self._actionPause.setVisible(True)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:32,代码来源:testview.py


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