;
"Ic               @   s  d  Z  d Z d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l m Z d d l m Z db \ Z Z Z Z dc \ Z Z Z dd Z d   Z d   Z d   Z d   Z d   Z e e d  o d   Z n
 d   Z e e d  o d   Z n
 d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d   Z% d    Z& d!   Z' d"   Z" d#   Z( d d$  Z* e d% d&  Z+ d'   Z, d(   Z- d)   Z. d*   Z/ d+   Z0 d,   Z1 d-   Z2 e d. d/  Z3 d0   Z4 d1   Z5 d2   Z6 d d3  Z7 i  Z8 i  Z9 d d4  Z: d5   Z; d6   Z< Gd7   d8 e=  Z> Gd9   d:  Z? d;   Z@ d<   ZA d=   ZB d>   ZC d d?  ZD e d@ dA  ZE dB   ZF dC   ZG e dD dE  ZH dF   ZI e dG dH  ZJ dI   ZK e dJ dK  ZL dL   ZM dM   ZN eN dN  ZO d dO  ZP dP   ZQ d d d de i  i  eR dQ   dR   dS   dT   eP eN dU  ZS eR dV   dW   dX   eN dY  ZT e dZ d[  ZU d d\  ZV d]   ZW d d^  ZX d d_  ZY e jZ Z[ d d`  Z\ d da  Z] d S(f   u  Get useful information from live Python objects.

This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.

Here are some of the useful functions provided by this module:

    ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
        isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
        isroutine() - check object types
    getmembers() - get members of an object that satisfy a given condition

    getfile(), getsourcefile(), getsource() - find an object's source code
    getdoc(), getcomments() - get documentation on an object
    getmodule() - determine the module that an object came from
    getclasstree() - arrange classes so as to represent their hierarchy

    getargspec(), getargvalues() - get info about function arguments
    getfullargspec() - same, with support for Python-3000 features
    formatargspec(), formatargvalues() - format an argument spec
    getouterframes(), getinnerframes() - get info about frames
    currentframe() - get the current stack frame
    stack(), trace() - get info about frames on the stack or in a traceback
u   Ka-Ping Yee <ping@lfw.org>u
   1 Jan 2001i    N(   u
   attrgetter(   u
   namedtuplei   i   i   i   i   i    i@   i   c             C   s   t  |  t j  S(   u   Return true if the object is a module.

    Module objects provide these attributes:
        __doc__         documentation string
        __file__        filename (missing for built-in modules)(   u
   isinstanceu   typesu
   ModuleType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   ismodule4   s    c             C   s   t  |  t  p t |  d  S(   u   Return true if the object is a class.

    Class objects provide these attributes:
        __doc__         documentation string
        __module__      name of module in which this class was definedu	   __bases__(   u
   isinstanceu   typeu   hasattr(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isclass<   s    c             C   s   t  |  t j  S(   u_  Return true if the object is an instance method.

    Instance method objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this method was defined
        __func__        function object containing implementation of method
        __self__        instance to which this method is bound(   u
   isinstanceu   typesu
   MethodType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   ismethodD   s    c             C   sH   t  |  d  o8 t  |  d  o' t |   o t |   o t |   S(   u  Return true if the object is a method descriptor.

    But not if ismethod() or isclass() or isfunction() are true.

    This is new in Python 2.2, and, for example, is true of int.__add__.
    An object passing this test has a __get__ attribute but not a __set__
    attribute, but beyond that the set of attributes varies.  __name__ is
    usually sensible, and __doc__ often is.

    Methods implemented via descriptors that also pass one of the other
    tests return false from the ismethoddescriptor() test, simply because
    the other tests promise more -- you can, e.g., count on having the
    __func__ attribute (etc) when an object passes ismethod().u   __get__u   __set__(   u   hasattru   ismethodu
   isfunctionu   isclass(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   ismethoddescriptorN   s
    c             C   s   t  |  d  o t  |  d  S(   u  Return true if the object is a data descriptor.

    Data descriptors have both a __get__ and a __set__ attribute.  Examples are
    properties (defined in Python) and getsets and members (defined in C).
    Typically, data descriptors will also have __name__ and __doc__ attributes
    (properties, getsets, and members have both of these attributes), but this
    is not guaranteed.u   __set__u   __get__(   u   hasattr(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isdatadescriptorb   s    u   MemberDescriptorTypec             C   s   t  |  t j  S(   u   Return true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.(   u
   isinstanceu   typesu   MemberDescriptorType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   ismemberdescriptorn   s    c             C   s   d S(   u   Return true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.F(   u   False(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   ismemberdescriptorv   s    u   GetSetDescriptorTypec             C   s   t  |  t j  S(   u   Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.(   u
   isinstanceu   typesu   GetSetDescriptorType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isgetsetdescriptor   s    c             C   s   d S(   u   Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.F(   u   False(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isgetsetdescriptor   s    c             C   s   t  |  t j  S(   u(  Return true if the object is a user-defined function.

    Function objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this function was defined
        __code__        code object containing compiled function bytecode
        __defaults__    tuple of any default values for arguments
        __globals__     global namespace in which this function was defined
        __annotations__ dict of parameter annotations
        __kwdefaults__  dict of keyword only parameters with defaults(   u
   isinstanceu   typesu   FunctionType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   isfunction   s    c             C   s4   t  |   p t |   o |  j j t @o d Sd S(   u   Return true if the object is a user-defined generator function.

    Generator function objects provides same attributes as functions.

    See isfunction.__doc__ for attributes listing.NT(   u
   isfunctionu   ismethodu   __code__u   co_flagsu   CO_GENERATORu   True(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isgeneratorfunction   s    c             C   s   t  |  t j  S(   u   Return true if the object is a generator.

    Generator objects provide these attributes:
        __iter__        defined to support interation over container
        close           raises a new GeneratorExit exception inside the
                        generator to terminate the iteration
        gi_code         code object
        gi_frame        frame object or possibly None once the generator has
                        been exhausted
        gi_running      set to 1 when generator is executing, 0 otherwise
        next            return the next item from the container
        send            resumes the generator and "sends" a value that becomes
                        the result of the current yield-expression
        throw           used to raise an exception inside the generator(   u
   isinstanceu   typesu   GeneratorType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isgenerator   s    c             C   s   t  |  t j  S(   ub  Return true if the object is a traceback.

    Traceback objects provide these attributes:
        tb_frame        frame object at this level
        tb_lasti        index of last attempted instruction in bytecode
        tb_lineno       current line number in Python source code
        tb_next         next inner traceback object (called by this level)(   u
   isinstanceu   typesu   TracebackType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   istraceback   s    c             C   s   t  |  t j  S(   u`  Return true if the object is a frame object.

    Frame objects provide these attributes:
        f_back          next outer frame object (this frame's caller)
        f_builtins      built-in namespace seen by this frame
        f_code          code object being executed in this frame
        f_globals       global namespace seen by this frame
        f_lasti         index of last attempted instruction in bytecode
        f_lineno        current line number in Python source code
        f_locals        local namespace seen by this frame
        f_trace         tracing function for this frame, or None(   u
   isinstanceu   typesu	   FrameType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isframe   s    c             C   s   t  |  t j  S(   uu  Return true if the object is a code object.

    Code objects provide these attributes:
        co_argcount     number of arguments (not including * or ** args)
        co_code         string of raw compiled bytecode
        co_consts       tuple of constants used in the bytecode
        co_filename     name of file in which this code object was created
        co_firstlineno  number of first line in Python source code
        co_flags        bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
        co_lnotab       encoded mapping of line numbers to bytecode indices
        co_name         name with which this code object was defined
        co_names        tuple of names of local variables
        co_nlocals      number of local variables
        co_stacksize    virtual machine stack space required
        co_varnames     tuple of names of arguments and local variables(   u
   isinstanceu   typesu   CodeType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   iscode   s    c             C   s   t  |  t j  S(   u,  Return true if the object is a built-in function or method.

    Built-in functions and methods provide these attributes:
        __doc__         documentation string
        __name__        original name of this function or method
        __self__        instance to which a method is bound, or None(   u
   isinstanceu   typesu   BuiltinFunctionType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu	   isbuiltin   s    c             C   s1   t  |   p$ t |   p t |   p
 t |   S(   u<   Return true if the object is any kind of function or method.(   u	   isbuiltinu
   isfunctionu   ismethodu   ismethoddescriptor(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu	   isroutine   s    c             C   s   t  |  t j  S(   u0   Return true if the object is a generator object.(   u
   isinstanceu   typesu   GeneratorType(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   isgenerator   s    c             C   s   t  |  t  o |  j t @S(   u:   Return true if the object is an abstract base class (ABC).(   u
   isinstanceu   typeu	   __flags__u   TPFLAGS_IS_ABSTRACT(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   isabstract   s    c             C   sf   g  } xO t  |   D]A } t |  |  } | p | |  o | j | | f  q q W| j   | S(   u   Return all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate.(   u   diru   getattru   appendu   sort(   u   objectu	   predicateu   resultsu   keyu   value(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   getmembers   s     
u	   Attributeu   name kind defining_class objectc       
   	   C   s  t  |   } t |   } g  } x^| D]V} | |  j k o |  j | } n t |  |  } t | d d  } | d k o0 x- | D]! } | | j k o | } Pq q Wn | d k	 o! | | j k o | j | } n t |  |  } t | t  o
 d }	 n_ t | t  o
 d }	 nE t | t  o
 d }	 n+ t	 |  p t
 |  o
 d }	 n d }	 | j t | |	 | |   q% W| S(   u  Return list of attribute-descriptor tuples.

    For each name in dir(cls), the return list contains a 4-tuple
    with these elements:

        0. The name (a string).

        1. The kind of attribute this is, one of these strings:
               'class method'    created via classmethod()
               'static method'   created via staticmethod()
               'property'        created via property()
               'method'          any other flavor of method
               'data'            not a method

        2. The class which defined this attribute (a class).

        3. The object as obtained directly from the defining class's
           __dict__, not via getattr.  This is especially important for
           data attributes:  C.data is just a data object, but
           C.__dict__['data'] may be a data descriptor with additional
           info, like a __doc__ string.
    u   __objclass__u   static methodu   class methodu   propertyu   methodu   dataN(   u   getmrou   diru   __dict__u   getattru   Noneu
   isinstanceu   staticmethodu   classmethodu   propertyu
   isfunctionu   ismethoddescriptoru   appendu	   Attribute(
   u   clsu   mrou   namesu   resultu   nameu   obju   homeclsu   baseu   obj_via_getattru   kind(    (    u$   /mit/python/lib/python3.0/inspect.pyu   classify_class_attrs  s<      



 c             C   sD   |  | k o d  S| j  |   x |  j D] } t | |  q) Wd  S(   N(   u   appendu	   __bases__u   _searchbases(   u   clsu   accumu   base(    (    u$   /mit/python/lib/python3.0/inspect.pyu   _searchbasesL  s    
 c             C   s9   t  |  d  o |  j Sg  } t |  |  t |  Sd S(   uH   Return tuple of base classes (including cls) in method resolution order.u   __mro__N(   u   hasattru   __mro__u   _searchbasesu   tuple(   u   clsu   result(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getmroT  s
    c             C   s&   |  j    } t |  t | j    S(   uB   Return the indent size, in spaces, at the start of a line of text.(   u
   expandtabsu   lenu   lstrip(   u   lineu   expline(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   indentsize^  s    c          	   C   sG   y |  j  } Wn t k
 o d SYn Xt | t  p d St |  S(   u   Get the documentation string for an object.

    All tabs are expanded to spaces.  To clean up docstrings that are
    indented to line up with blocks of code, any whitespace than can be
    uniformly removed from the second line onwards is removed.N(   u   __doc__u   AttributeErroru   Noneu
   isinstanceu   stru   cleandoc(   u   objectu   doc(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getdocc  s    
c             C   s]  y |  j    j d  } Wn t k
 o d SYn'Xt j } xT | d d  D]B } t | j    } | o# t |  | } t | |  } qN qN W| o | d j   | d <n | t j k  o< x9 t	 d t |   D] } | | | d  | | <q Wn x" | o | d o | j
   qWx% | o | d o | j
 d  q'Wd j |  Sd S(   u   Clean up indentation from docstrings.

    Any whitespace that can be uniformly removed from the second line
    onwards is removed.u   
i   Ni    i(   u
   expandtabsu   splitu   UnicodeErroru   Noneu   sysu   maxsizeu   lenu   lstripu   minu   rangeu   popu   join(   u   docu   linesu   marginu   lineu   contentu   indentu   i(    (    u$   /mit/python/lib/python3.0/inspect.pyu   cleandocq  s0    
	      c             C   s  t  |   o( t |  d  o |  j St d   n t |   o= t j j |  j  }  t |  d  o |  j St d   n t	 |   o |  j
 }  n t |   o |  j }  n t |   o |  j }  n t |   o |  j }  n t |   o |  j St d   d S(   u@   Work out which source or compiled file an object was defined in.u   __file__u   arg is a built-in moduleu   arg is a built-in classuN   arg is not a module, class, method, function, traceback, frame, or code objectN(   u   ismoduleu   hasattru   __file__u	   TypeErroru   isclassu   sysu   modulesu   getu
   __module__u   ismethodu   __func__u
   isfunctionu   __code__u   istracebacku   tb_frameu   isframeu   f_codeu   iscodeu   co_filename(   u   object(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getfile  s(    u
   ModuleInfou   name suffix mode module_typec             C   s   t  j j |   } d   t j   D } | j   xO | D]G \ } } } } | | d  | k o t | d |  | | |  Sq9 Wd S(   uD   Get the module name, suffix, mode, and module type for a given file.c             S   s7   g  } |  ]) \ } } } | t  |  | | | f q
 S(    (   u   len(   u   .0u   _[1]u   suffixu   modeu   mtype(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   <listcomp>  s   N(   u   osu   pathu   basenameu   impu   get_suffixesu   sortu
   ModuleInfo(   u   pathu   filenameu   suffixesu   neglenu   suffixu   modeu   mtype(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getmoduleinfo  s    
 c             C   s    t  |   } | o	 | d Sd S(   u1   Return the module name for a given file, or None.i    N(   u   getmoduleinfo(   u   pathu   info(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getmodulename  s     c             C   s   t  |   } | d d  j   d k o | d d  d } n xS t j   D]E \ } } } d | k o) | t |  d  j   | k o d SqN Wt j j |  o | St	 t
 |  |  d  o | Sd S(	   uE   Return the Python source file an object was defined in, if it exists.iNu   .pycu   .pyou   .pyu   bu
   __loader__(   u   .pycu   .pyo(   u   getfileu   loweru   impu   get_suffixesu   lenu   Noneu   osu   pathu   existsu   hasattru	   getmodule(   u   objectu   filenameu   suffixu   modeu   kind(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getsourcefile  s     1	c             C   sF   | d k o t |   p
 t |   } n t j j t j j |   S(   u   Return an absolute path to the source or compiled file for an object.

    The idea is for each object to have a unique origin, so this routine
    normalizes the result as much as possible.N(   u   Noneu   getsourcefileu   getfileu   osu   pathu   normcaseu   abspath(   u   objectu	   _filename(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   getabsfile  s    c       
      C   s!  t  |   o |  St |  d  o t j j |  j  S| d k	 o" | t k o t j j t |  Sy t |  |  } Wn t	 k
 o d SYn X| t k o t j j t |  Sx t j j
   D] \ } } t  |  ot t | d  od | j } | t j | d  k o q n | t | <t |  } | j t | <t t j j |  <q q W| t k o t j j t |  St j d } t |  d  p d St | |  j  o( t | |  j  } | |  k o | Sn t j d } t | |  j  o( t | |  j  }	 |	 |  k o | Sn d S(   uA   Return the module an object was defined in, or None if not found.u
   __module__u   __file__u   __main__u   __name__u   builtinsN(   u   ismoduleu   hasattru   sysu   modulesu   getu
   __module__u   Noneu   modulesbyfileu
   getabsfileu	   TypeErroru   itemsu   __file__u   _filesbymodnameu   __name__u   osu   pathu   realpathu   getattr(
   u   objectu	   _filenameu   fileu   modnameu   moduleu   fu   mainu
   mainobjectu   builtinu   builtinobject(    (    u$   /mit/python/lib/python3.0/inspect.pyu	   getmodule  sF    
 	
)	c       
      C   sh  t  |   p
 t |   } t |  |  } | o t j | | j  } n t j |  } | p t d   n t |   o | d f St |   o |  j	 } t
 j d | d  } g  } xt t t |   D]` } | j | |  } | o@ | | d d k o | | f S| j | j d  | f  q q W| o | j   | | d d f St d   n t |   o |  j }  n t |   o |  j }  n t |   o |  j }  n t |   o |  j }  n t |   o t |  d  p t d	   n |  j d }	 t
 j d
  } x5 |	 d k o' | j | |	  o Pn |	 d }	 qW| |	 f St d   d S(   ub  Return the entire source file and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of all the lines
    in the file and the line number indexes a line in that list.  An IOError
    is raised if the source code cannot be retrieved.u   could not get source codei    u   ^(\s*)class\s*u   \bu   ci   u   could not find class definitionu   co_firstlinenou"   could not find function definitionu+   ^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)u   could not find code objectN(   u   getsourcefileu   getfileu	   getmoduleu	   linecacheu   getlinesu   __dict__u   IOErroru   ismoduleu   isclassu   __name__u   reu   compileu   rangeu   lenu   matchu   appendu   groupu   sortu   ismethodu   __func__u
   isfunctionu   __code__u   istracebacku   tb_frameu   isframeu   f_codeu   iscodeu   hasattru   co_firstlineno(
   u   objectu   fileu   moduleu   linesu   nameu   patu
   candidatesu   iu   matchu   lnum(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   findsource   sX    	 $
  c          
   C   s  y t  |   \ } } Wn t t f k
 o d SYn Xt |   od } | o% | d d d  d k o
 d } n x9 | t |  k  o% | | j   d	 k o | d } qy W| t |  k  o | | d d  d k oq g  } | } xT | t |  k  o@ | | d d  d k o% | j | | j    | d } q Wd j	 |  Sn| d k ot
 | |  } | d } | d k ow| | j   d d  d k oVt
 | |  | k o?| | j   j   g } | d k o | d } | | j   j   } x| | d d  d k o` t
 | |  | k oI | g | d d  <| d } | d k  o Pn | | j   j   } q
Wn x3 | o+ | d j   d k o g  | d d  <qWx3 | o+ | d j   d k o g  | d d  <qWd j	 |  Sn d S(
   uw   Get lines of comments immediately preceding an object's source code.

    Returns None when source can't be found.
    i    Ni   u   #!i   u    u   #i(   u    u   #(   u
   findsourceu   IOErroru	   TypeErroru   Noneu   ismoduleu   lenu   stripu   appendu
   expandtabsu   joinu
   indentsizeu   lstrip(   u   objectu   linesu   lnumu   startu   commentsu   endu   indentu   comment(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getcomments=  sT    
" 
 *. .
.
 .
   c             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   EndOfBlockj  s   
 u
   EndOfBlockc             B   s&   |  Ee  Z d  Z d   Z d   Z d S(   u@   Provide a tokeneater() method to detect the end of a code block.c             C   s1   d |  _  d |  _ d |  _ d |  _ d |  _ d  S(   Ni    i   F(   u   indentu   Falseu   islambdau   startedu   passlineu   last(   u   self(    (    u$   /mit/python/lib/python3.0/inspect.pyu   __init__n  s
    				c             C   s9  |  j  pA | d k o' | d k o d |  _ n d |  _  n d |  _ n | t j k o. d |  _ | d |  _ |  j o
 t  q5n |  j o n | t j	 k o |  j
 d |  _
 d |  _ nr | t j k o. |  j
 d |  _
 |  j
 d k o
 t  q5n4 |  j
 d k o# | t j t j f k o
 t  n d  S(	   Nu   defu   classu   lambdai    i   (   u   defu   classu   lambdaTF(   u   startedu   Trueu   islambdau   passlineu   tokenizeu   NEWLINEu   Falseu   lastu
   EndOfBlocku   INDENTu   indentu   DEDENTu   COMMENTu   NL(   u   selfu   typeu   tokenu   srowcolu   erowcolu   line(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   tokeneateru  s,    
	

)N(   u   __name__u
   __module__u   __doc__u   __init__u
   tokeneater(   u
   __locals__(    (    u$   /mit/python/lib/python3.0/inspect.pyu   BlockFinderl  s   
	u   BlockFinderc             C   sq   t    } y: t j t |   j  } x | D] } | j |   q+ WWn t t f k
 o Yn X|  d | j  S(   u@   Extract the block of code at the top of the given list of lines.N(	   u   BlockFinderu   tokenizeu   generate_tokensu   iteru   __next__u
   tokeneateru
   EndOfBlocku   IndentationErroru   last(   u   linesu   blockfinderu   tokensu   _token(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getblock  s    	 c             C   sL   t  |   \ } } t |   o | d f St | | d   | d f Sd S(   u  Return a list of source lines and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of the lines
    corresponding to the object and the line number indicates where in the
    original source file the first line of code was found.  An IOError is
    raised if the source code cannot be retrieved.i    Ni   (   u
   findsourceu   ismoduleu   getblock(   u   objectu   linesu   lnum(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getsourcelines  s     c             C   s   t  |   \ } } d j |  S(   u  Return the text of the source code for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a single string.  An
    IOError is raised if the source code cannot be retrieved.u    (   u   getsourcelinesu   join(   u   objectu   linesu   lnum(    (    u$   /mit/python/lib/python3.0/inspect.pyu	   getsource  s    c             C   sx   g  } |  j  d t d d   xR |  D]J } | j | | j f  | | k o! | j t | | | |   q& q& W| S(   u-   Recursive helper function for getclasstree().u   keyu
   __module__u   __name__(   u   sortu
   attrgetteru   appendu	   __bases__u   walktree(   u   classesu   childrenu   parentu   resultsu   c(    (    u$   /mit/python/lib/python3.0/inspect.pyu   walktree  s     %c             C   s   i  } g  } x |  D] } | j  o] xx | j  D]K } | | k o g  | | <n | | j |  | o | |  k o Pq- q- Wq | | k o | j |  q q Wx, | D]$ } | |  k o | j |  q q Wt | | d  S(   u  Arrange the given list of classes into a hierarchy of nested lists.

    Where a nested list appears, it contains classes derived from the class
    whose entry immediately precedes the list.  Each entry is a 2-tuple
    containing a class and a tuple of its base classes.  If the 'unique'
    argument is true, exactly one entry appears in the returned structure
    for each class in the given list.  Otherwise, classes using multiple
    inheritance and their descendants will appear multiple times.N(   u	   __bases__u   appendu   walktreeu   None(   u   classesu   uniqueu   childrenu   rootsu   cu   parent(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getclasstree  s&    	 

   u	   Argumentsu   args, varargs, varkwc             C   s,   t  |   \ } } } } t | | | |  S(   u<  Get information about the arguments accepted by a code object.

    Three things are returned: (args, varargs, varkw), where
    'args' is the list of argument names, possibly containing nested
    lists. Keyword-only arguments are appended. 'varargs' and 'varkw'
    are the names of the * and ** arguments or None.(   u   _getfullargsu	   Arguments(   u   cou   argsu   varargsu
   kwonlyargsu   varkw(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getargs  s    c       	      C   s   t  |   p t d   n |  j } |  j } |  j } t | d |   } t | | | |   } d } | | 7} d } |  j t @o |  j | } | d } n d } |  j t	 @o |  j | } n | | | | f S(   uB  Get information about the arguments accepted by a code object.

    Four things are returned: (args, varargs, kwonlyargs, varkw), where
    'args' and 'kwonlyargs' are lists of argument names (with 'args'
    possibly containing nested lists), and 'varargs' and 'varkw' are the
    names of the * and ** arguments or None.u   arg is not a code objectNi    i   (
   u   iscodeu	   TypeErroru   co_argcountu   co_varnamesu   co_kwonlyargcountu   listu   Noneu   co_flagsu
   CO_VARARGSu   CO_VARKEYWORDS(	   u   cou   nargsu   namesu   nkwargsu   argsu
   kwonlyargsu   stepu   varargsu   varkw(    (    u$   /mit/python/lib/python3.0/inspect.pyu   _getfullargs  s"    			
u   ArgSpecu   args varargs keywords defaultsc             C   sR   t  |   \ } } } } } } } | p | o t d   n t | | | |  S(   uq  Get the names and default values of a function's arguments.

    A tuple of four things is returned: (args, varargs, varkw, defaults).
    'args' is a list of the argument names (it may contain nested lists).
    'args' will include keyword-only argument names.
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'defaults' is an n-tuple of the default values of the last n arguments.

    Use the getfullargspec() API for Python-3000 code, as annotations
    and keyword arguments are supported. getargspec() will raise ValueError
    if the func has either annotations or keyword arguments.
    uc   Function has keyword-only arguments or annotations, use getfullargspec() API which can support them(   u   getfullargspecu
   ValueErroru   ArgSpec(   u   funcu   argsu   varargsu   varkwu   defaultsu
   kwonlyargsu   kwonlydefaultsu   ann(    (    u$   /mit/python/lib/python3.0/inspect.pyu
   getargspec  s    !u   FullArgSpecuC   args, varargs, varkw, defaults, kwonlyargs, kwdefaults, annotationsc             C   sw   t  |   o |  j }  n t |   p t d   n t |  j  \ } } } } t | | | |  j | |  j |  j	  S(   u  Get the names and default values of a function's arguments.

    A tuple of seven things is returned:
    (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults annotations).
    'args' is a list of the argument names (it may contain nested lists).
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'defaults' is an n-tuple of the default values of the last n arguments.
    'kwonlyargs' is a list of keyword-only argument names.
    'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults.
    'annotations' is a dictionary mapping argument names to annotations.

    The first four items in the tuple correspond to getargspec().
    u   arg is not a Python function(
   u   ismethodu   __func__u
   isfunctionu	   TypeErroru   _getfullargsu   __code__u   FullArgSpecu   __defaults__u   __kwdefaults__u   __annotations__(   u   funcu   argsu   varargsu
   kwonlyargsu   varkw(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getfullargspec  s    u   ArgInfou   args varargs keywords localsc             C   s.   t  |  j  \ } } } t | | | |  j  S(   uW  Get information about arguments passed into a particular frame.

    A tuple of four things is returned: (args, varargs, varkw, locals).
    'args' is a list of the argument names (it may contain nested lists).
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'locals' is the locals dictionary of the given frame.(   u   getargsu   f_codeu   ArgInfou   f_locals(   u   frameu   argsu   varargsu   varkw(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getargvalues5  s    c             C   s=   t  |   d k o d |  d d Sd d j |   d Sd  S(   Ni   u   (i    u   ,)u   , u   )(   u   lenu   join(   u   seq(    (    u$   /mit/python/lib/python3.0/inspect.pyu   joinseq?  s    c             C   sD   t  |   t t f k o | t | | d  |    S| |   Sd S(   u7   Recursively walk a sequence, stringifying each element.c             S   s   t  |  | |  S(    (   u   strseq(   u   ou   cu   j(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>H  s    N(   u   typeu   listu   tupleu   map(   u   objectu   convertu   join(    (    u$   /mit/python/lib/python3.0/inspect.pyu   strseqE  s    c             C   sK   t  |  t  o1 |  j d | f k o |  j S|  j d |  j St |   S(   Nu   builtinsu   .(   u
   isinstanceu   typeu
   __module__u   __name__u   repr(   u
   annotationu   base_module(    (    u$   /mit/python/lib/python3.0/inspect.pyu   formatannotationL  s
    c                s%   t  |  d d       f d   } | S(   Nu
   __module__c                s   t  |     S(   N(   u   formatannotation(   u
   annotation(   u   module(    u$   /mit/python/lib/python3.0/inspect.pyu   _formatannotationU  s    (   u   getattru   None(   u   objectu   _formatannotation(    (   u   moduleu$   /mit/python/lib/python3.0/inspect.pyu   formatannotationrelativetoS  s    c             C   s   d  |  S(   u   *(    (   u   name(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>\  s    c             C   s   d  |  S(   u   **(    (   u   name(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>]  s    c             C   s   d  t  |   S(   u   =(   u   repr(   u   value(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>^  s    c             C   s   d  |  S(   u    -> (    (   u   text(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>_  s    c          	      s      f d   } g  } | o t  |   t  |  } n xm t t  |    D]Y } t |  | | |  } | o) | | k o | |
 | | |  } n | j |  qO W| d k	 o | j | | |    n | o | j d  n | oS xP | D]D } | |  } | | k o | |
 | |  7} n | j |  q Wn | d k	 o | j |	 | |    n d d j |  d } d  k o | |   d   7} n | S(   u  Format an argument spec from the values returned by getargspec
    or getfullargspec.

    The first seven arguments are (args, varargs, varkw, defaults,
    kwonlyargs, kwonlydefaults, annotations).  The other five arguments
    are the corresponding optional formatting functions that are called to
    turn names and values into strings.  The last argument is an optional
    function to format the sequence of arguments.c                s9    |   } |   k o | d    |   7} n | S(   Nu   : (    (   u   argu   result(   u   formatannotationu	   formatargu   annotations(    u$   /mit/python/lib/python3.0/inspect.pyu   formatargandannotationj  s    u   *u   (u   , u   )u   returnN(   u   lenu   rangeu   strsequ   appendu   Noneu   join(   u   argsu   varargsu   varkwu   defaultsu
   kwonlyargsu   kwonlydefaultsu   annotationsu	   formatargu   formatvarargsu   formatvarkwu   formatvalueu   formatreturnsu   formatannotationu   joinu   formatargandannotationu   specsu   firstdefaultu   iu   specu	   kwonlyargu   result(    (   u	   formatargu   formatannotationu   annotationsu$   /mit/python/lib/python3.0/inspect.pyu   formatargspecY  s6      c             C   s   d  |  S(   u   *(    (   u   name(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>  s    c             C   s   d  |  S(   u   **(    (   u   name(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>  s    c             C   s   d  t  |   S(   u   =(   u   repr(   u   value(    (    u$   /mit/python/lib/python3.0/inspect.pyu   <lambda>  s    c	             C   s   | | | d  }	 g  }
 x7 t  t |    D]# } |
 j t |  | |	 |   q+ W| o% |
 j | |  | | |   n | o% |
 j | |  | | |   n d d j |
  d S(   uf  Format an argument spec from the 4 values returned by getargvalues.

    The first four arguments are (args, varargs, varkw, locals).  The
    next four arguments are the corresponding optional formatting functions
    that are called to turn names and values into strings.  The ninth
    argument is an optional function to format the sequence of arguments.c             S   s   | |   | | |   S(   N(    (   u   nameu   localsu	   formatargu   formatvalue(    (    u$   /mit/python/lib/python3.0/inspect.pyu   convert  s    u   (u   , u   )(   u   rangeu   lenu   appendu   strsequ   join(   u   argsu   varargsu   varkwu   localsu	   formatargu   formatvarargsu   formatvarkwu   formatvalueu   joinu   convertu   specsu   i(    (    u$   /mit/python/lib/python3.0/inspect.pyu   formatargvalues  s     !%%u	   Tracebacku+   filename lineno function code_context indexc             C   s5  t  |   o |  j } |  j }  n
 |  j } t |   p t d   n t |   p
 t |   } | d k o | d | d } y t |   \ } } Wn t	 k
 o d } } YqXt | d  } t d t | t |  |   } | | | |  } | d | } n d } } t | | |  j j | |  S(   u  Get information about a frame or traceback object.

    A tuple of five things is returned: the filename, the line number of
    the current line, the function name, a list of lines of context from
    the source code, and the index of the current line within that list.
    The optional second argument specifies the number of lines of context
    to return, which are centered around the current line.u&   arg is not a frame or traceback objecti    i   i   N(   u   istracebacku	   tb_linenou   tb_frameu   f_linenou   isframeu	   TypeErroru   getsourcefileu   getfileu
   findsourceu   IOErroru   Noneu   maxu   minu   lenu	   Tracebacku   f_codeu   co_name(   u   frameu   contextu   linenou   filenameu   startu   linesu   lnumu   index(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getframeinfo  s&    		"
c             C   s   |  j  S(   uC   Get the line number from a frame object, allowing for optimization.(   u   f_lineno(   u   frame(    (    u$   /mit/python/lib/python3.0/inspect.pyu	   getlineno  s    c             C   s?   g  } x2 |  o* | j  |  f t |  |   |  j }  q	 W| S(   u   Get a list of records for a frame and all higher (calling) frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.(   u   appendu   getframeinfou   f_back(   u   frameu   contextu	   framelist(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getouterframes  s     c             C   sB   g  } x5 |  o- | j  |  j f t |  |   |  j }  q	 W| S(   u   Get a list of records for a traceback's frame and all lower frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.(   u   appendu   tb_frameu   getframeinfou   tb_next(   u   tbu   contextu	   framelist(    (    u$   /mit/python/lib/python3.0/inspect.pyu   getinnerframes  s      c             C   s   t  t j d  |   S(   u@   Return a list of records for the stack above the caller's frame.i   (   u   getouterframesu   sysu	   _getframe(   u   context(    (    u$   /mit/python/lib/python3.0/inspect.pyu   stack  s    c             C   s   t  t j   d |   S(   uC   Return a list of records for the stack below the current exception.i   (   u   getinnerframesu   sysu   exc_info(   u   context(    (    u$   /mit/python/lib/python3.0/inspect.pyu   trace  s    (   i   i   i   i   (   i   i    i@   i   (    (^   u   __doc__u
   __author__u   __date__u   sysu   osu   typesu   stringu   reu   disu   impu   tokenizeu	   linecacheu   operatoru
   attrgetteru   collectionsu
   namedtupleu   CO_OPTIMIZEDu   CO_NEWLOCALSu
   CO_VARARGSu   CO_VARKEYWORDSu	   CO_NESTEDu   CO_GENERATORu	   CO_NOFREEu   TPFLAGS_IS_ABSTRACTu   ismoduleu   isclassu   ismethodu   ismethoddescriptoru   isdatadescriptoru   hasattru   ismemberdescriptoru   isgetsetdescriptoru
   isfunctionu   isgeneratorfunctionu   isgeneratoru   istracebacku   isframeu   iscodeu	   isbuiltinu	   isroutineu
   isabstractu   Noneu
   getmembersu	   Attributeu   classify_class_attrsu   _searchbasesu   getmrou
   indentsizeu   getdocu   cleandocu   getfileu
   ModuleInfou   getmoduleinfou   getmodulenameu   getsourcefileu
   getabsfileu   modulesbyfileu   _filesbymodnameu	   getmoduleu
   findsourceu   getcommentsu	   Exceptionu
   EndOfBlocku   BlockFinderu   getblocku   getsourcelinesu	   getsourceu   walktreeu   getclasstreeu	   Argumentsu   getargsu   _getfullargsu   ArgSpecu
   getargspecu   FullArgSpecu   getfullargspecu   ArgInfou   getargvaluesu   joinsequ   strsequ   formatannotationu   formatannotationrelativetou   stru   formatargspecu   formatargvaluesu	   Tracebacku   getframeinfou	   getlinenou   getouterframesu   getinnerframesu	   _getframeu   currentframeu   stacku   trace(    (    (    u$   /mit/python/lib/python3.0/inspect.pyu   <module>   s   			
		
				
		
								G		
					
			.	=	-'			
	
	
					
				)!		