def clobber_in_except(node):
 if isinstance(node, astroid.AssAttr):
  return (True, (node.attrname, ('object %r' % (node.expr.as_string(),))))
 elif isinstance(node, astroid.AssName):
  name = node.name
  if is_builtin(name):
   return (True, (name, 'builtins'))
  else:
   stmts = node.lookup(name)[1]
   if (stmts and (not isinstance(stmts[0].ass_type(), (astroid.Assign, astroid.AugAssign, astroid.ExceptHandler)))):
    return (True, (name, ('outer scope (line %s)' % stmts[0].fromlineno)))
 return (False, None)

def clobber_in_except ( node ) : if isinstance ( node , astroid . AssAttr ) : return ( True , ( node . attrname , ( 'object %r' % ( node . expr . as_string ( ) , ) ) ) ) elif isinstance ( node , astroid . AssName ) : name = node . name if is_builtin ( name ) : return ( True , ( name , 'builtins' ) ) else : stmts = node . lookup ( name ) [ 1 ] if ( stmts and ( not isinstance ( stmts [ 0 ] . ass_type ( ) , ( astroid . Assign , astroid . AugAssign , astroid . ExceptHandler ) ) ) ) : return ( True , ( name , ( 'outer scope (line %s)' % stmts [ 0 ] . fromlineno ) ) ) return ( False , None )
checks if an assignment node in an except handler clobbers an existing variable .