• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: OnExportSurface

    def OnExportSurface(self, pubsub_evt):
        filename, filetype = pubsub_evt.data
        if (filetype == const.FILETYPE_STL) or\
           (filetype == const.FILETYPE_VTP) or\
           (filetype == const.FILETYPE_PLY) or\
           (filetype == const.FILETYPE_STL_ASCII):

            # First we identify all surfaces that are selected
            # (if any)
            proj = prj.Project()
            polydata_list = []

            for index in proj.surface_dict:
                surface = proj.surface_dict[index]
                if surface.is_shown:
                    polydata_list.append(surface.polydata)

            if len(polydata_list) == 0:
                utl.debug("oops - no polydata")
                return
            elif len(polydata_list) == 1:
                polydata = polydata_list[0]
            else:
                polydata = pu.Merge(polydata_list)

            # Having a polydata that represents all surfaces
            # selected, we write it, according to filetype
            if filetype == const.FILETYPE_STL:
                writer = vtk.vtkSTLWriter()
                writer.SetFileTypeToBinary()
            elif filetype == const.FILETYPE_STL_ASCII:
                writer = vtk.vtkSTLWriter()
                writer.SetFileTypeToASCII()
            elif filetype == const.FILETYPE_VTP:
                writer = vtk.vtkXMLPolyDataWriter()
            #elif filetype == const.FILETYPE_IV:
            #    writer = vtk.vtkIVWriter()
            elif filetype == const.FILETYPE_PLY:
                writer = vtk.vtkPLYWriter()
                writer.SetFileTypeToASCII()
                writer.SetColorModeToOff()
                #writer.SetDataByteOrderToLittleEndian()
                #writer.SetColorModeToUniformCellColor()
                #writer.SetColor(255, 0, 0)

            if filetype in (const.FILETYPE_STL, const.FILETYPE_PLY):
                # Invert normals
                normals = vtk.vtkPolyDataNormals()
                normals.SetInputData(polydata)
                normals.SetFeatureAngle(80)
                normals.AutoOrientNormalsOn()
                #  normals.GetOutput().ReleaseDataFlagOn()
                normals.UpdateInformation()
                normals.Update()
                polydata = normals.GetOutput()

            filename = filename.encode(wx.GetDefaultPyEncoding())
            writer.SetFileName(filename)
            writer.SetInputData(polydata)
            writer.Write()
开发者ID:151706061,项目名称:invesalius3,代码行数:60,代码来源:surface.py


示例2: compress_textures

def compress_textures(filenames, dest):
    utils.pg_init((10, 10))
    data = []

    for name in filenames:
        try:
            textures = PackedTextureGroup(name)
        except FileNotFoundError:
            continue
        image = textures.pack.image
        rawImageStr = pg.image.tostring(image, 'RGB')
        compressedImageStr = gzip.compress(rawImageStr)
        utils.debug('compressed size: {}MB. ratio: {}'.format(
            len(compressedImageStr) / 1024 ** 2,
            len(compressedImageStr) / len(rawImageStr)
        ))
        textureMetas = []
        for p, (id, t) in zip(textures.pack.poses, textures.iter_all()):
            textureMetas.append((
                id, t.xoff, t.yoff, p[0], p[1], t.image.get_width(), t.image.get_height(),
            ))
        metaItem = {
            'name': textures.name,
            'size': image.get_size(),
            'format': 'RGB',
            'image': compressedImageStr,
            'textureMetas': textureMetas,
        }
        data.append(metaItem)
    with open(dest, 'wb') as outfile:
        pickle.dump(data, outfile, -1)
开发者ID:ZhanruiLiang,项目名称:jinyong-legend-py,代码行数:31,代码来源:compress.py


示例3: setup_tablets

def setup_tablets():
  # Start up a master mysql and vttablet
  utils.debug("Setting up tablets")
  utils.run_vtctl('CreateKeyspace test_keyspace')
  master_tablet.init_tablet('master', 'test_keyspace', '0')
  utils.run_vtctl('RebuildShardGraph test_keyspace/0')
  utils.run_vtctl('RebuildKeyspaceGraph test_keyspace')
  utils.validate_topology()

  setup_schema()
  replica_tablet.create_db('vt_test_keyspace')
  master_tablet.start_vttablet(memcache=True)

  replica_tablet.init_tablet('idle', 'test_keyspace', start=True, memcache=True)
  snapshot_dir = os.path.join(utils.vtdataroot, 'snapshot')
  utils.run("mkdir -p " + snapshot_dir)
  utils.run("chmod +w " + snapshot_dir)
  utils.run_vtctl('Clone -force %s %s' %
                  (master_tablet.tablet_alias, replica_tablet.tablet_alias))

  utils.run_vtctl('Ping test_nj-0000062344')
  utils.run_vtctl('SetReadWrite ' + master_tablet.tablet_alias)
  utils.check_db_read_write(62344)

  utils.validate_topology()
  utils.run_vtctl('Ping test_nj-0000062345')
  utils.run_vtctl('ChangeSlaveType test_nj-0000062345 replica')
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:27,代码来源:rowcache_invalidator.py


示例4: run_test_sigterm

def run_test_sigterm():
  utils.zk_wipe()
  utils.run_vtctl('CreateKeyspace -force test_keyspace')

  # create the database so vttablets start, as it is serving
  tablet_62344.create_db('vt_test_keyspace')

  tablet_62344.init_tablet('master', 'test_keyspace', '0', start=True)

  # start a 'vtctl Sleep' command in the background
  sp = utils.run_bg(utils.vtroot+'/bin/vtctl -logfile=/dev/null Sleep %s 60s' %
                    tablet_62344.tablet_alias,
                    stdout=PIPE, stderr=PIPE)

  # wait for it to start, and let's kill it
  time.sleep(2.0)
  utils.run(['pkill', 'vtaction'])
  out, err = sp.communicate()

  # check the vtctl command got the right remote error back
  if "vtaction interrupted by signal" not in err:
    raise utils.TestError("cannot find expected output in error:", err)
  utils.debug("vtaction was interrupted correctly:\n" + err)

  tablet_62344.kill_vttablet()
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:25,代码来源:tabletmanager.py


示例5: on_task_finished

    def on_task_finished(self, task):
        task.sound_file.progress = 1.0

        if task.error:
            debug("error in task, skipping rename:", task.output_filename)
            if vfs_exists(task.output_filename):
                vfs_unlink(task.output_filename)
            self.errors.append(task.error)
            self.error_count += 1
            return

        duration = task.get_duration()
        if duration:
            self.duration_processed += duration

        # rename temporary file
        newname = self.window.prefs.generate_filename(task.sound_file)
        log(beautify_uri(task.output_filename), "->", beautify_uri(newname))

        # safe mode. generate a filename until we find a free one
        p, e = os.path.splitext(newname)
        p = p.replace("%", "%%")
        p = p + " (%d)" + e
        i = 1
        while vfs_exists(newname):
            newname = p % i
            i += 1

        task.error = vfs_rename(task.output_filename, newname)
        if task.error:
            self.errors.append(task.error)
            self.error_count += 1
开发者ID:nueces,项目名称:soundconverter,代码行数:32,代码来源:gstreamer.py


示例6: play

    def play(self):
        if not self.parsed:
            command = " ! ".join(self.command)
            debug("launching: '%s'" % command)
            try:
                self.pipeline = gst.parse_launch(command)
                bus = self.pipeline.get_bus()
                assert not self.connected_signals
                self.connected_signals = []
                for name, signal, callback in self.signals:
                    if name:
                        element = self.pipeline.get_by_name(name)
                    else:
                        element = bus
                    sid = element.connect(signal, callback)
                    self.connected_signals.append((element, sid))

                self.parsed = True

            except gobject.GError, e:
                show_error("GStreamer error when creating pipeline", str(e))
                self.error = str(e)
                self.eos = True
                self.done()
                return

            bus.add_signal_watch()
            watch_id = bus.connect("message", self.on_message)
            self.watch_id = watch_id
开发者ID:nueces,项目名称:soundconverter,代码行数:29,代码来源:gstreamer.py


示例7: filter_plugin

    def filter_plugin(self, plug_results, setobj, changed=False):
        '''
        Apply specified filter to plugin results.
        '''
        # If there is no filter defined, return as is.
        if self.filterp == None:
            return plug_results

        filtered_plug_results = []

        # get type definitions for this memobj type
        typedefs = setobj.get_field_typedefs()
        # if filterp (e.g., 'pid') name is in our typedefs
        if self.filterp_name in typedefs.keys():
            debug("passed keys: %s" % typedefs.keys())
            # for each memoobj
            for elem in plug_results:
                filter_passed = None
                # if changed, these are tuples of the before and after elements
                if changed:
                    filter_passed = (self.__filter_passed(elem[0], typedefs) or self.__filter_passed(elem[1], typedefs))    
                else:    
                    filter_passed = self.__filter_passed(elem, typedefs) 

                debug("filter passed %s" % filter_passed)
                if filter_passed:
                    filtered_plug_results.append(elem)
            
        return filtered_plug_results
开发者ID:forensix-cn,项目名称:DAMM,代码行数:29,代码来源:api.py


示例8: found_tag

    def found_tag(self, decoder, something, taglist):
        """
        Called when the decoder reads a tag.
        """
        debug('found_tags:', self.sound_file.filename_for_display)
        for k in taglist.keys():
            if 'image' not in k:
                debug('\t%s=%s' % (k, taglist[k]))
            if isinstance(taglist[k], gst.Date):
                taglist['year'] = taglist[k].year
                taglist['date'] = '%04d-%02d-%02d' % (taglist[k].year,
                                    taglist[k].month, taglist[k].day)
        tag_whitelist = (
            'artist',
            'album',
            'title',
            'track-number',
            'track-count',
            'genre',
            'date',
            'year',
            'timestamp',
            'disc-number',
            'disc-count',
        )
        tags = {}
        for k in taglist.keys():
            if k in tag_whitelist:
                tags[k] = taglist[k]

        self.sound_file.tags.update(tags)
        self.query_duration()
开发者ID:hongquan,项目名称:soundconverter,代码行数:32,代码来源:gstreamer.py


示例9: remInstalled

def remInstalled(category, package, version, buildtype=""):
    """ deprecated, use InstallDB.installdb.remInstalled() instead """
    utils.debug("remInstalled called", 2)
    if buildtype != "":
        fileName = "installed-" + buildtype
    else:
        fileName = "installed"
    utils.debug("removing package %s - %s from %s" % (package, version, fileName), 2)
    dbFileName = os.path.join(utils.etcDir(), fileName)
    tmpdbfile = os.path.join(utils.etcDir(), "TMPinstalled")
    found = False
    if os.path.exists(dbFileName):
        with open(dbFileName, "rb") as dbFile:
            with open(tmpdbfile, "wb") as tfile:
                for line in dbFile:
                    ## \todo the category should not be part of the search string
                    ## because otherwise it is not possible to unmerge package using
                    ## the same name but living in different categories
                    if not line.startswith("%s/%s" % (category, package)):
                        tfile.write(line)
                    else:
                        found = True
        os.remove(dbFileName)
        os.rename(tmpdbfile, dbFileName)
    return found
开发者ID:KDE,项目名称:emerge-history,代码行数:25,代码来源:portage.py


示例10: getDependencies

def getDependencies(category, package, version, runtimeOnly=False):
    """returns the dependencies of this package as list of strings:
    category/package"""
    if not os.path.isfile(getFilename(category, package, version)):
        utils.die("package name %s/%s-%s unknown" % (category, package, version))

    package, subpackage = getSubPackage(category, package)
    print "getDependencies:", package, subpackage
    if subpackage:
        utils.debug(
            "solving package %s/%s/%s-%s %s"
            % (category, subpackage, package, version, getFilename(category, package, version)),
            2,
        )
    else:
        utils.debug(
            "solving package %s/%s-%s %s" % (category, package, version, getFilename(category, package, version)), 2
        )
    mod = __import__(getFilename(category, package, version))

    deps = []
    if hasattr(mod, "subinfo"):
        info = mod.subinfo()
        depDict = info.hardDependencies
        depDict.update(info.dependencies)
        depDict.update(info.runtimeDependencies)
        if not runtimeOnly:
            depDict.update(info.buildDependencies)

        for line in depDict.keys():
            (category, package) = line.split("/")
            version = PortageInstance.getNewestVersion(category, package)
            deps.append([category, package, version, depDict[line]])

    return deps
开发者ID:KDE,项目名称:emerge-history,代码行数:35,代码来源:portage.py


示例11: __import__

def __import__(module):  # pylint: disable=W0622
    utils.debug("module to import: %s" % module, 2)
    if not os.path.isfile(module):
        try:
            return __builtin__.__import__(module)
        except ImportError as e:
            utils.warning("import failed for module %s: %s" % (module, e.message))
            return None
    else:
        sys.path.append(os.path.dirname(module))
        modulename = os.path.basename(module).replace(".py", "")

        suff_index = None
        for suff in imp.get_suffixes():
            if suff[0] == ".py":
                suff_index = suff
                break

        if suff_index is None:
            utils.die("no .py suffix found")

        with open(module) as fileHdl:
            try:
                return imp.load_module(modulename.replace(".", "_"), fileHdl, module, suff_index)
            except ImportError as e:
                utils.warning("import failed for file %s: %s" % (module, e.message))
                return None
开发者ID:KDE,项目名称:emerge-history,代码行数:27,代码来源:portage.py


示例12: create_db

 def create_db(self, name):
   self.mquery('', 'drop database if exists %s' % name)
   while self.has_db(name):
     utils.debug("%s sleeping while waiting for database drop: %s" % (self.tablet_alias, name))
     time.sleep(0.3)
     self.mquery('', 'drop database if exists %s' % name)
   self.mquery('', 'create database %s' % name)
开发者ID:andredurao,项目名称:golang-stuff,代码行数:7,代码来源:tablet.py


示例13: autostart

def autostart():
    """
    Starts the cleaning service.
    """
    cleaner = Cleaner()

    service_sleep = 10
    ticker = 0
    delayed_completed = False

    while not xbmc.abortRequested:
        if get_setting(service_enabled):
            scan_interval_ticker = get_setting(scan_interval) * 60 / service_sleep
            delayed_start_ticker = get_setting(delayed_start) * 60 / service_sleep

            if delayed_completed and ticker >= scan_interval_ticker:
                results, exit_status = cleaner.cleanup()
                if results and exit_status == 0:
                    notify(results)
                ticker = 0
            elif not delayed_completed and ticker >= delayed_start_ticker:
                delayed_completed = True
                results, exit_status = cleaner.cleanup()
                if results and exit_status == 0:
                    notify(results)
                ticker = 0

            xbmc.sleep(service_sleep * 1000)
            ticker += 1
        else:
            xbmc.sleep(service_sleep * 1000)

    debug("Abort requested. Terminating.")
    return
开发者ID:struart,项目名称:script.filecleaner,代码行数:34,代码来源:service.py


示例14: _update

	def _update(self):
		if not g.screen_map:
			utils.error(".init() not run -- what are you playing at?")

		pygame.event.pump()
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				utils.debug("quit signal caught")
				self.running = False
				return

			self.inputmanager.handle(event)

		if self.inputmanager.check_key(pygame.K_q):
			self.running = False
			return

		if self.inputmanager.check_key_single(pygame.K_m):
			g.screen = g.screen_map["title"]
			self.force_update = True
			return

		if self.inputmanager.check_key_single(pygame.K_r):
			g.deaths += 1
			self.force_update = True
			return

		#if self.inputmanager.check_key_single(pygame.K_n):
			#if isinstance(self.screen, core.World):
				#g.screen = g.screen_map.get(self.screen.index+1, g.screen_map["win"])
				#self.force_update = True
				#return

		self.screen.update(self.inputmanager)
开发者ID:JT-Dev,项目名称:leon-hero-273,代码行数:34,代码来源:game.py


示例15: _display_previews

    def _display_previews(self):
        initial = self.displayed_position * NCOLS
        final = initial + NUM_PREVIEWS

        if len(self.files) < final:
            for i in xrange(final-len(self.files)):
                try:
                    self.previews[-i-1].Hide()
                except IndexError:
                    utils.debug("doesn't exist!")
            self.nhidden_last_display = final-len(self.files)
        else:
            if self.nhidden_last_display:
                for i in xrange(self.nhidden_last_display):
                    try:
                        self.previews[-i-1].Show()
                    except IndexError:
                        utils.debug("doesn't exist!")
                self.nhidden_last_display = 0

        for f, p in zip(self.files[initial:final], self.previews):
            p.SetDicomToPreview(f)
            if f.selected:
                self.selected_panel = p
            #p.interactor.Render()

        for f, p in zip(self.files[initial:final], self.previews):
            p.Show()
开发者ID:151706061,项目名称:invesalius,代码行数:28,代码来源:dicom_preview_panel.py


示例16: Output

    def Output(self, Ground1, Ground2, Ground3):
        #self.Groundings = self.output
        ground_1 = None
        ground_2 = None
        ground_3 = None
        
        if self.Grounds.isGround(Ground1) and self.isVariable(Ground1):
            ground_1 = self.Grounds.getGrounding(Ground1)
        elif not self.isVariable(Ground1):
            ground_1 = Ground1
            
        if self.Grounds.isGround(Ground2) and self.isVariable(Ground2):
            ground_2 = self.Grounds.getGrounding(Ground2)
        elif not self.isVariable(Ground2):
            ground_2 = Ground2
            
        if self.Grounds.isGround(Ground3) and self.isVariable(Ground3):
            ground_3 = self.Grounds.getGrounding(Ground3)
        elif not self.isVariable(Ground3):
            ground_3 = Ground3

        
        if ground_1 and ground_2 and ground_3:
            debug([ground_1, ground_2, ground_3], prefix="triple")
            
            self.hypergraph.add_edge(ground_2, ground_3,\
            edge_data=[ground_1], edge_type='triple', with_merge=False)
开发者ID:bluemoon,项目名称:Godel,代码行数:27,代码来源:rule_engine.py


示例17: createProfile

 def createProfile(self, profile_path, browser_config):
     # Create the new profile
     temp_dir, profile_dir = self._ffsetup.CreateTempProfileDir(profile_path,
                                                  browser_config['preferences'],
                                                  browser_config['extensions'])
     utils.debug("created profile") 
     return profile_dir, temp_dir
开发者ID:wlach,项目名称:talos,代码行数:7,代码来源:ttest.py


示例18: cleanupProcesses

    def cleanupProcesses(self, process_name, child_process, browser_wait):
        #kill any remaining browser processes
        #returns string of which process_names were terminated and with what signal

        # if we are running this against the metro browser, we currently use
        # metrotestharness.exe as a way to launch the metro browser process.
        # Talos thinks this harness is the browser, see:
        # http://hg.mozilla.org/build/talos/file/8c5f2725fbdd/talos/run_tests.py#l249
        # We must inform talos about the sub process, the metro browser itself,
        # that is spawned from metrotestharness. The metro browser proc is
        # given the same name as the non metro equivalent: 'firefox.exe'
        if process_name == "metrotestharness" and \
                "firefox" not in self.extra_prog:
            self.extra_prog.append("firefox")

        processes_to_kill = filter(lambda n: n, ([process_name, child_process] +
                                                 self.extra_prog))
        utils.debug("Terminating: %s", ", ".join(str(p) for p in processes_to_kill))
        terminate_result = self.TerminateAllProcesses(browser_wait, *processes_to_kill)
        #check if anything is left behind
        if self.checkAllProcesses(process_name, child_process):
            #this is for windows machines.  when attempting to send kill messages to win processes the OS
            # always gives the process a chance to close cleanly before terminating it, this takes longer
            # and we need to give it a little extra time to complete
            time.sleep(browser_wait)
            processes = self.checkAllProcesses(process_name, child_process)
            if processes:
                raise talosError("failed to cleanup processes: %s" % processes)

        return terminate_result
开发者ID:lundjordan,项目名称:build-talos,代码行数:30,代码来源:ffprocess.py


示例19: run

 def run(self):
     if self.arduino == None:
         return
     debug("DroidControlThread: Thread started")
     self.execute_commands()
     self.arduino.close()
     debug("DroidControlThread: Thread stopped")
开发者ID:LachlanNXT,项目名称:DroidRacing,代码行数:7,代码来源:DroidControl.py


示例20: __no_cvs_check_user_override

    def __no_cvs_check_user_override(self):
        """Return True iff pre-commit-checks are turned off by user override...

        ... via the ~/.no_cvs_check file.

        This function also performs all necessary debug traces, warnings,
        etc.
        """
        no_cvs_check_fullpath = expanduser('~/.no_cvs_check')
        # Make sure the tilde expansion worked.  Since we are only using
        # "~" rather than "~username", the expansion should really never
        # fail...
        assert (not no_cvs_check_fullpath.startswith('~'))

        if not isfile(no_cvs_check_fullpath):
            return False

        # The no_cvs_check file exists.  Verify its age.
        age = time.time() - getmtime(no_cvs_check_fullpath)
        one_day_in_seconds = 24 * 60 * 60

        if (age > one_day_in_seconds):
            warn('%s is too old and will be ignored.' % no_cvs_check_fullpath)
            return False

        debug('%s found - pre-commit checks disabled' % no_cvs_check_fullpath)
        syslog('Pre-commit checks disabled for %(rev)s on %(repo)s by user'
               ' %(user)s using %(no_cvs_check_fullpath)s'
               % {'rev': self.new_rev,
                  'repo': self.email_info.project_name,
                  'user': get_user_name(),
                  'no_cvs_check_fullpath': no_cvs_check_fullpath,
                  })
        return True
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:34,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.decimal_utc函数代码示例发布时间:2022-05-26
下一篇:
Python utils.db_connect函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap