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


Python debug函数代码示例

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


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

示例1: timer_callback

	def timer_callback( self ):
		debug('timer_callback timeout_id: '+str(self.timeout_id))
		self.remove_timeout()
		self.update_profile()
		self.mainloop()
		#commented by merlin 1991 advice self.mainloop()
		debug('end of timer_callback')
开发者ID:nivw,项目名称:switch-profile-by-meeting,代码行数:7,代码来源:switch_backend.py

示例2: load

def load( manipulator, filename ):

    try:
        dom = minidom.parse( filename )
    except IOError:
        print "Error. Can't read", filename
        return False

    manipulator.items = []
    for item in dom.getElementsByTagName('item'):
        
        i = None
        if item.hasAttribute('figure'):
            i = Figure( item.getAttribute('figure').encode() )
        elif item.hasAttribute('text'):
            i = TextItem( item.getAttribute('text').encode() )

        pos = item.getAttribute('pos').encode().split(',')
        pos = map( float, pos )
        i.position.setTranspose( pos[0],pos[1], 1 )
        i.refreshTransform()
        manipulator.items.append( i )
    
    dom.unlink()

    refnames.reset()

    debug('save', 'loaded from', filename )
    
    return True

        
开发者ID:dsummerfield,项目名称:visual-lambda,代码行数:30,代码来源:saving.py

示例3: paint

    def paint( self ):
        "Draws and flips bg and rings"
        
        surface = self.getSurface()
        
        # Erase
        self.erase()
        
        # Draw Field Items
        self.drawItems()
        
        # Export Frame as bitmap
        if Enduring.exportMode:
            filename = 'frame_%s_%05d.bmp' % ( strDate(), Enduring.exportModeFrame )
            Enduring.exportModeFrame += 1
            
            pygame.image.save( surface, filename )
            debug(1, 'Frame saved:', filename )

        # Draw Toolbars
        for t in self.toolbars:
            t.draw( surface, self.size )
            
        
        # Flip screen
        self.flip()
开发者ID:dsummerfield,项目名称:visual-lambda,代码行数:26,代码来源:manipulator.py

示例4: def2c

 def def2c(self, ssad, prio = 19, implicit_global=False):
   if ssad.type == 's' and ssad.parent_def != None:
     debug(CODE, 6, 'found',ssad,'to be member of', ssad.parent_def)
     s = self.expr2c(ssad.parent_def, deref_auto = False) + '.' + 'mem_' + zhex(ssad.addr - ssad.parent_def.ops[0])
     self.add_struct_member(ssad, ssad.parent_def.ops[0], ssad.parent_def.ops[1])
   elif isinstance(ssad.addr, int):
     if ssad.dessa_name == None:
       raise InternalError('no dessa_name in ' + str(ssad) + '(' + repr(ssad) + '), defined in ' + str(ssad.define_statement))
     s = Symbol(ssad.addr, ssad.dessa_name).name
   else:
     assert(ssad.addr == None)
     assert(ssad.dessa_name != None)
     s = ssad.dessa_name
   if not implicit_global and ssad.type[0] == 'M' and not ssad.is_dessa_tmp and s not in self.declare_globals:
     self.declare_globals[s] = ssatype2c(ssad.data_type)
   elif (ssad.type[0] != 'M' or ssad.is_dessa_tmp) and s not in self.declare_locals and ssad.parent_def == None:
     ctype = ssatype2c(ssad.data_type)
     if ssad.type == 's':
       self.declare_locals[s] = (ctype, '__sp[' + str(ssad.addr) + ']')
     else:
       self.declare_locals[s] = (ctype, None)
   if ssad.type == 's' and ssad.addr in [1,2] and arch.stacked_return_address:
     current_statement.add_comment('XXX: stacked return address accessed')
   if ssad.data_type.type == SSAType.COMPOUND:
     s = '&' + s
   return s
开发者ID:pfalcon-mirrors,项目名称:decomp-6502-arm,代码行数:26,代码来源:code.py

示例5: parse

 def parse(self, start, comefrom = None, blockified = None):
   self.start_st = start
   basic_blocks[start] = self
   if comefrom != None:
     self.comefrom += [comefrom]
   curst = start
   debug(BLOCK, 3, 'startblockat', curst)
   while len(curst.next) == 1 and len(list(curst.next)[0].comefrom) == 1 and curst.op != ssa.ENDLESS_LOOP and not curst.next[0] in basic_blocks:
     curst = list(curst.next)[0]
   debug(BLOCK, 3, 'endblockat', curst)
   self.end_st = curst
   if curst.op != ssa.ENDLESS_LOOP:
     for i in curst.next:
       if i in basic_blocks:
         basic_blocks[i].comefrom += [self]
         self.next += [basic_blocks[i]]
       else:
         nb = BasicBlock()
         nb.parse(i, self, blockified)
         basic_blocks[i] = nb
         self.next += [nb]
     # Workaround for "Bxx 0": A basic block should not have the same
     # successor multiple times.
     final_next = []
     for i in self.next:
       if i not in final_next:
         final_next += [i]
     self.next = final_next
开发者ID:pfalcon-mirrors,项目名称:decomp-6502-arm,代码行数:28,代码来源:block.py

示例6: get_group_from_xy

 def get_group_from_xy(self, x, y):
     debug('TaskBar._get_group_from_xy: x={0} y={1}'.format(x, y))
     for g in self.groups.values():
         debug3('g: {}'.format(g))
         if x >= g['x'] and x <= g['right'] and y >= g['y'] and y <= g['bottom']:
             debug3('get_group_from_xy: {}'.format(g))
             return g
开发者ID:ethanpost,项目名称:task_manager_app,代码行数:7,代码来源:taskbar.py

示例7: _draw_taskbar

    def _draw_taskbar(self):
        debug('TaskBar._draw_taskbar')
        
        if not self.x:
            self.x=self.canvas.winfo_x()
        if not self.y:
            self.y=self.canvas.winfo_y()
        if not self.width:
            self.width=self.canvas.winfo_reqwidth()
        if not self.height:
            self.height=self.canvas.winfo_reqheight()
        if not self.bordersize:
            self.bordersize=1

        group_count=len(self.groups)

        if self.width/group_count < 200:
            self.group_width=200
        else:
            self.group_width=int(self.width/group_count)
            self.group_width=200

        self.canvas.delete("taskbar")
        object_id=self.canvas.create_rectangle(self.x, self.y, self.x+self.width, self.y+self.height, fill='white', outline='black', tags="taskbar")
        self.canvas.tag_lower(object_id)
        self._draw_groups()
        self._update_bottom()
开发者ID:ethanpost,项目名称:task_manager_app,代码行数:27,代码来源:taskbar.py

示例8: _string

 def _string(self, func, size=0):
     '''Used to pretty print the stack.  func should be a function that
     will format a number.  If size is nonzero, only display that many
     items.  Note:  we make a copy of the stack so we can't possibly
     mess it up.
     '''
     s = self.stack[:]
     if not size or size > len(s): size = max(1, len(s))
     s.reverse()
     s = s[:size]
     s.reverse()
     if debug():
         fmt = "%%(vtype)s | %%(index) %dd: %%(value)s" % (2+int(log10(max(len(s),1))))
     else:
         fmt = "%%(index) %dd: %%(value)s" % (2+int(log10(max(len(s),1))))
     m = []
     lens = len(s)
     for i in xrange(lens):
         if debug():
             vtype = repr(s[i])[:16]
             vtype += ' '*(16-len(vtype))
             m.append(fmt % { 'vtype': vtype, 'index': size - i, 'value': func(s[i], i==(lens-1))})
         else:
             m.append(fmt % {'index': size - i, 'value': func(s[i], i==(lens-1))})
     s = '\n'.join(m)
     # Special treatment for the first four registers:  name them x, y,
     # z, t (as is done for HP calculators).
     if 0:
         s = s.replace(" 0: ", " x: ")
         s = s.replace(" 1: ", " y: ")
         s = s.replace(" 2: ", " z: ")
         s = s.replace(" 3: ", " t: ")
     return s
开发者ID:dvhart,项目名称:hcpy,代码行数:33,代码来源:stack.py

示例9: _getAttrs

    def _getAttrs(self, soup):
        try:
            soup.find('span', 'label-heading').extract()
        except:
            debug('Unable to remove .label-heading')

        values = soup.renderContents() \
            .replace('<span class="label-heading">Some things about me:</span>', '') \
            .strip().split('<br />')

        attrs = {
            'category': '',
            'style': '',
            'type': '',
            'country': '',
            'brewer': '',
            'alcohol content (abv)': ''
        }
        for pair in values:
            if pair == '':
                continue

            try:
                key, value = pair.replace('<span class="label">', '').split('</span>')
                key = key.replace(':', '').strip().lower()
                value = value.strip().title()
                attrs[key] = value
            except:
                debug('Problem extracting key from: %s in %s' % (pair, values))
        return attrs
开发者ID:ryan953,项目名称:BierFrau,代码行数:30,代码来源:BeerStore.py

示例10: __init__

 def __init__(self, id, context_type = 'playlist', auto_fetch = True):
     self.id = id
     super(Cache_track, self).__init__(qobuz.path.cache,
                                      'track',
                                      self.id, True)
     self.set_cache_refresh(qobuz.addon.getSetting('cache_duration_track'))
     debug(self, "Cache duration: " + str(self.cache_refresh))
开发者ID:Qobuz,项目名称:plugin.audio.qobuz,代码行数:7,代码来源:track.py

示例11: setSpeakLanguage

def setSpeakLanguage( nNumLang = getDefaultSpeakLanguage(), proxyTts = False ):
    "change the tts speak language"
    print( "SetSpeakLanguage to: %d" % nNumLang );
    if( not proxyTts ):
        proxyTts = naoqitools.myGetProxy( "ALTextToSpeech" );
    if( not proxyTts ):
        debug( "ERR: setSpeakLanguage: can't connect to tts" );
        return;

    try:
        if( nNumLang == constants.LANG_FR ):
            proxyTts.loadVoicePreference( "NaoOfficialVoiceFrench" );
        elif ( nNumLang == constants.LANG_EN ):
            proxyTts.loadVoicePreference( "NaoOfficialVoiceEnglish" );
        elif ( nNumLang == constants.LANG_SP ):
            proxyTts.loadVoicePreference( "NaoOfficialVoiceSpanish" );
        elif ( nNumLang == constants.LANG_IT ):
            proxyTts.loadVoicePreference( "NaoOfficialVoiceItalian" );
        elif ( nNumLang == constants.LANG_GE ):
            proxyTts.loadVoicePreference( "NaoOfficialVoiceGerman" );
        elif ( nNumLang == constants.LANG_CH ):
            proxyTts.loadVoicePreference( "NaoOfficialVoiceChinese" );
        elif ( nNumLang == constants.LANG_PO ):
            proxyTts.loadVoicePreference( "NaoOfficialVoicePolish" );
        elif ( nNumLang == constants.LANG_KO ):
            proxyTts.loadVoicePreference( "NaoOfficialVoiceKorean" );            
        else:
            proxyTts.loadVoicePreference( "NaoOfficialVoiceEnglish" );
    except:
        print( "ERR: setSpeakLanguage: loadVoicePreference error" );
开发者ID:Mister-Jingles,项目名称:NAO-EPITECH,代码行数:30,代码来源:speech.py

示例12: runMachine

def runMachine(name):
    global debugging
    print("Starting machine: " + str(name) + "...")
    run = ["docker", "run", "-d"]
    # get the machine info
    this_machine = mach.all_machines[name]

    # append port info
    for port in this_machine["ports"]:
        nex = str(nextPort(port))
        run.append("-p=" + nex + ":" + str(portNum(port)))
        debug("next port for " + port + " is: " + nex, FINEST)

    # append environment info
    for env in this_machine["env"]:
        run.append("-e=" + env[0] + ":" + env[-1])

    # append volume info
    for vol in this_machine["vol"]:
        run.append("-v=" + vol[0] + ":" + vol[-1])

    # append name
    run.append('--name="' + name + "-" + nextRunNumber(name) + '"')
    run.append("build/" + name)

    if not debugging:
        child = subprocess.Popen(run, stdout=subprocess.PIPE)
        print("Machine " + str(name) + " started")
    else:
        debug_msg = "\tdocker run"
        for item in run[2:]:
            debug_msg += "\n\t\t" + item
        debug(debug_msg)
开发者ID:kevinjohnston,项目名称:dockerfiles,代码行数:33,代码来源:docker-run.py

示例13: definePort

def definePort(name, base):
    if str(base) not in port_infinities:
        port_infinities[str(base)] = infiniteNumbers(10000 + base, 100)
    new_port = {"inf": port_infinities[str(base)], "basePort": base}
    all_ports[name] = new_port
    debug('Created port "' + name + '" with base "' + str(base) + "'", FINE)
    return new_port
开发者ID:kevinjohnston,项目名称:dockerfiles,代码行数:7,代码来源:docker-run.py

示例14: guess_entry_points

def guess_entry_points(text, org, manual_entries):
  # find all "MOV R12, SP" and "PUSH {..., lr}"
  mov_r12_sp = []
  push_lr = []
  for i in range(0, len(text) >> 2):
    insn = struct.unpack('<I', text[i:i+4])[0]
    if insn == 0xe1a0c00d:
      mov_r12_sp += [i]
    elif insn & 0xffffc000 == 0xe92d4000:
      push_lr += [i]
  debug(TRACE, 3, 'found', len(mov_r12_sp), 'times MOV R12, SP;', len(push_lr), 'times PUSH {...lr}')

  # if there are a lot of "MOV R12, SP"'s, we assume the code has been
  # compiled with frame pointer and functions start at the MOV; otherwise,
  # functions start at the PUSH
  if len(mov_r12_sp) > len(push_lr) / 2:
    entry_points = mov_r12_sp
  else:
    entry_points = push_lr

  new_entry_points = []
  for i in entry_points:
    i += org
    if not i in manual_entries:
      new_entry_points.append(i)

  return new_entry_points
开发者ID:pfalcon-mirrors,项目名称:decomp-6502-arm,代码行数:27,代码来源:insn_arm.py

示例15: _edit_select_all

def _edit_select_all(action, window):
	debug(DEBUG_COMMANDS)
	active_view = window.get_active_view()
	if warn_if_equal(active_view, None):
		return
	active_view.select_all()
	active_view.grab_focus()
开发者ID:jhasse,项目名称:taluka,代码行数:7,代码来源:commands.py


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