original_docstring: print out the name, role, and number of children for the
      IAccessible ia and each of its children
docstring: print out the name, role, and number of children for the
  IAccessible ia and each of its children
docstring_tokens: print out the name role and number of children for the IAccessible ia and each of its children
code: def inspect(ia, indent=0, indent_step=4):
      """print out the name, role, and number of children for the
      IAccessible ia and each of its children"""
      # retrieve the name, role, and number of children for ia
      selfID = VARIANT(CHILDID_SELF)
      accName = ia.accName[selfID]
      if accName == None or accName == '':
          accName = 'NAMELESS'
      else:
          accName = unicode(accName).encode('utf_8')
      accRole = ia.accRole[selfID]
      if accRole in roles:
          accRoleText = roles[accRole]
      else:
          accRoleText = str(accRole)
      accChildCount = ia.accChildCount
      print '%s%s (%s, %d children)' % (' ' * indent, accName, accRoleText, accChildCount)
  
      # recurse through the accessible children
      if accChildCount > 0:
          # allocate memory for information about the children
          # (VARIANT structures)
          VariantArrayType = VARIANT * accChildCount
          rgvarChildren = VariantArrayType()
          pcObtained = c_long()
          oledll.oleacc.AccessibleChildren(ia, 0, accChildCount, rgvarChildren,
                                           byref(pcObtained))
          # child.vt may be VT_I4 or VT_DISPATCH
          # see the MSDN documentation on the AccessibleChildren function
          # http://msdn2.microsoft.com/en-us/library/ms697243.aspx
          for child in rgvarChildren:
              if child.vt == VT_I4:
                  try:
                      ppdispChild = ia.accChild(child)
                      if ppdispChild:
                          inspect(ppdispChild.QueryInterface(IAccessible),
                                  indent + indent_step, indent_step)
                  except:
                      pass
              elif child.vt == VT_DISPATCH:
                  inspect(child.value.QueryInterface(IAccessible),
                          indent + indent_step, indent_step)
code_tokens: def inspect ( ia , indent = 0 , indent_step = 4 ) : selfID = VARIANT ( CHILDID_SELF ) accName = ia . accName [ selfID ] if accName == None or accName == '' : accName = 'NAMELESS' else : accName = unicode ( accName ) . encode ( 'utf_8' ) accRole = ia . accRole [ selfID ] if accRole in roles : accRoleText = roles [ accRole ] else : accRoleText = str ( accRole ) accChildCount = ia . accChildCount print '%s%s (%s, %d children)' % ( ' ' * indent , accName , accRoleText , accChildCount ) if accChildCount > 0 : VariantArrayType = VARIANT * accChildCount rgvarChildren = VariantArrayType ( ) pcObtained = c_long ( ) oledll . oleacc . AccessibleChildren ( ia , 0 , accChildCount , rgvarChildren , byref ( pcObtained ) ) for child in rgvarChildren : if child . vt == VT_I4 : try : ppdispChild = ia . accChild ( child ) if ppdispChild : inspect ( ppdispChild . QueryInterface ( IAccessible ) , indent + indent_step , indent_step ) except : pass elif child . vt == VT_DISPATCH : inspect ( child . value . QueryInterface ( IAccessible ) , indent + indent_step , indent_step )
short_docstring: print out the name, role, and number of children for the
  IAccessible ia and each of its children
short_docstring_tokens: print out the name role and number of children for the IAccessible ia and each of its children
comment: """print out the name, role, and number of children for the
      IAccessible ia and each of its children"""$SEP$# retrieve the name, role, and number of children for ia$SEP$# recurse through the accessible children$SEP$# allocate memory for information about the children$SEP$# (VARIANT structures)$SEP$# child.vt may be VT_I4 or VT_DISPATCH$SEP$# see the MSDN documentation on the AccessibleChildren function$SEP$# http://msdn2.microsoft.com/en-us/library/ms697243.aspx