MCPcopy Index your code
hub / github.com/python/cpython / get_type

Method get_type

Lib/symtable.py:80–100  ·  view source on GitHub ↗

Return the type of the symbol table. The value returned is one of the values in the ``SymbolTableType`` enumeration.

(self)

Source from the content-addressed store, hash-verified

78 self._filename)
79
80 def get_type(self):
81 """Return the type of the symbol table.
82
83 The value returned is one of the values in
84 the ``SymbolTableType`` enumeration.
85 """
86 if self._table.type == _symtable.TYPE_MODULE:
87 return SymbolTableType.MODULE
88 if self._table.type == _symtable.TYPE_FUNCTION:
89 return SymbolTableType.FUNCTION
90 if self._table.type == _symtable.TYPE_CLASS:
91 return SymbolTableType.CLASS
92 if self._table.type == _symtable.TYPE_ANNOTATION:
93 return SymbolTableType.ANNOTATION
94 if self._table.type == _symtable.TYPE_TYPE_ALIAS:
95 return SymbolTableType.TYPE_ALIAS
96 if self._table.type == _symtable.TYPE_TYPE_PARAMETERS:
97 return SymbolTableType.TYPE_PARAMETERS
98 if self._table.type == _symtable.TYPE_TYPE_VARIABLE:
99 return SymbolTableType.TYPE_VARIABLE
100 assert False, f"unexpected type: {self._table.type}"
101
102 def get_id(self):
103 """Return an identifier for the table.

Callers 7

print_symbolsFunction · 0.80
test_typeMethod · 0.80
test_annotatedMethod · 0.80
test_lambdaMethod · 0.80
test_nested_lambdaMethod · 0.80
test_genexprMethod · 0.80
test_nested_genexprMethod · 0.80

Calls

no outgoing calls

Tested by 6

test_typeMethod · 0.64
test_annotatedMethod · 0.64
test_lambdaMethod · 0.64
test_nested_lambdaMethod · 0.64
test_genexprMethod · 0.64
test_nested_genexprMethod · 0.64