Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes
symtable.Function Class Reference
Inheritance diagram for symtable.Function:
Inheritance graph
[legend]
Collaboration diagram for symtable.Function:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def get_parameters
def get_locals
def get_globals
def get_frees
def __repr__
def get_type
def get_id
def get_name
def get_lineno
def is_optimized
def is_nested
def has_children
def has_exec
def has_import_star
def get_identifiers
def lookup
def get_symbols
def get_children

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def __idents_matching

Static Private Attributes

 __params = None
 __locals = None
 __frees = None
 __globals = None

Detailed Description

Definition at line 121 of file symtable.py.


Member Function Documentation

def symtable.Function.__idents_matching (   self,
  test_func 
) [private]

Definition at line 129 of file symtable.py.

00129 
00130     def __idents_matching(self, test_func):
00131         return tuple([ident for ident in self.get_identifiers()
00132                       if test_func(self._table.symbols[ident])])

Here is the call graph for this function:

Here is the caller graph for this function:

def symtable.SymbolTable.__repr__ (   self) [inherited]

Definition at line 47 of file symtable.py.

00047 
00048     def __repr__(self):
00049         if self.__class__ == SymbolTable:
00050             kind = ""
00051         else:
00052             kind = "%s " % self.__class__.__name__
00053 
00054         if self._table.name == "global":
00055             return "<{0}SymbolTable for module {1}>".format(kind, self._filename)
00056         else:
00057             return "<{0}SymbolTable for {1} in {2}>".format(kind,
00058                                                             self._table.name,
00059                                                             self._filename)

def symtable.SymbolTable.get_children (   self) [inherited]

Definition at line 116 of file symtable.py.

00116 
00117     def get_children(self):
00118         return [_newSymbolTable(st, self._filename)
00119                 for st in self._table.children]
00120 

Definition at line 152 of file symtable.py.

00152 
00153     def get_frees(self):
00154         if self.__frees is None:
00155             is_free = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) == FREE
00156             self.__frees = self.__idents_matching(is_free)
00157         return self.__frees
00158 

Here is the call graph for this function:

Definition at line 145 of file symtable.py.

00145 
00146     def get_globals(self):
00147         if self.__globals is None:
00148             glob = (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
00149             test = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) in glob
00150             self.__globals = self.__idents_matching(test)
00151         return self.__globals

Here is the call graph for this function:

def symtable.SymbolTable.get_id (   self) [inherited]

Definition at line 70 of file symtable.py.

00070 
00071     def get_id(self):
00072         return self._table.id

def symtable.SymbolTable.get_identifiers (   self) [inherited]

Definition at line 97 of file symtable.py.

00097 
00098     def get_identifiers(self):
00099         return self._table.symbols.keys()

Here is the caller graph for this function:

def symtable.SymbolTable.get_lineno (   self) [inherited]

Definition at line 76 of file symtable.py.

00076 
00077     def get_lineno(self):
00078         return self._table.lineno

Definition at line 138 of file symtable.py.

00138 
00139     def get_locals(self):
00140         if self.__locals is None:
00141             locs = (LOCAL, CELL)
00142             test = lambda x: ((x >> SCOPE_OFF) & SCOPE_MASK) in locs
00143             self.__locals = self.__idents_matching(test)
00144         return self.__locals

Here is the call graph for this function:

def symtable.SymbolTable.get_name (   self) [inherited]

Definition at line 73 of file symtable.py.

00073 
00074     def get_name(self):
00075         return self._table.name

Definition at line 133 of file symtable.py.

00133 
00134     def get_parameters(self):
00135         if self.__params is None:
00136             self.__params = self.__idents_matching(lambda x:x & DEF_PARAM)
00137         return self.__params

Here is the call graph for this function:

def symtable.SymbolTable.get_symbols (   self) [inherited]

Definition at line 108 of file symtable.py.

00108 
00109     def get_symbols(self):
00110         return [self.lookup(ident) for ident in self.get_identifiers()]

Here is the call graph for this function:

def symtable.SymbolTable.get_type (   self) [inherited]

Definition at line 60 of file symtable.py.

00060 
00061     def get_type(self):
00062         if self._table.type == _symtable.TYPE_MODULE:
00063             return "module"
00064         if self._table.type == _symtable.TYPE_FUNCTION:
00065             return "function"
00066         if self._table.type == _symtable.TYPE_CLASS:
00067             return "class"
00068         assert self._table.type in (1, 2, 3), \
00069                "unexpected type: {0}".format(self._table.type)

def symtable.SymbolTable.has_children (   self) [inherited]

Definition at line 86 of file symtable.py.

00086 
00087     def has_children(self):
00088         return bool(self._table.children)

def symtable.SymbolTable.has_exec (   self) [inherited]
Return true if the scope uses exec.  Deprecated method.

Definition at line 89 of file symtable.py.

00089 
00090     def has_exec(self):
00091         """Return true if the scope uses exec.  Deprecated method."""
00092         return False

def symtable.SymbolTable.has_import_star (   self) [inherited]
Return true if the scope uses import *

Definition at line 93 of file symtable.py.

00093 
00094     def has_import_star(self):
00095         """Return true if the scope uses import *"""
00096         return bool(self._table.optimized & OPT_IMPORT_STAR)

def symtable.SymbolTable.is_nested (   self) [inherited]

Definition at line 83 of file symtable.py.

00083 
00084     def is_nested(self):
00085         return bool(self._table.nested)

def symtable.SymbolTable.is_optimized (   self) [inherited]

Definition at line 79 of file symtable.py.

00079 
00080     def is_optimized(self):
00081         return bool(self._table.type == _symtable.TYPE_FUNCTION
00082                     and not self._table.optimized)

def symtable.SymbolTable.lookup (   self,
  name 
) [inherited]

Definition at line 100 of file symtable.py.

00100 
00101     def lookup(self, name):
00102         sym = self._symbols.get(name)
00103         if sym is None:
00104             flags = self._table.symbols[name]
00105             namespaces = self.__check_children(name)
00106             sym = self._symbols[name] = Symbol(name, flags, namespaces)
00107         return sym

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

symtable.Function.__frees = None [static, private]

Definition at line 126 of file symtable.py.

symtable.Function.__globals = None [static, private]

Definition at line 127 of file symtable.py.

symtable.Function.__locals = None [static, private]

Definition at line 125 of file symtable.py.

symtable.Function.__params = None [static, private]

Definition at line 124 of file symtable.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: