SILENT KILLERPanel

Current Path: > > opt > alt > python313 > > lib64 > > python3.13


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/alt/python313//lib64//python3.13

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
_pyrepl Directory - -
asyncio Directory - -
collections Directory - -
concurrent Directory - -
config-3.13-x86_64-linux-gnu Directory - -
ctypes Directory - -
curses Directory - -
dbm Directory - -
email Directory - -
encodings Directory - -
ensurepip Directory - -
html Directory - -
http Directory - -
importlib Directory - -
json Directory - -
lib-dynload Directory - -
logging Directory - -
multiprocessing Directory - -
pathlib Directory - -
pydoc_data Directory - -
re Directory - -
site-packages Directory - -
sqlite3 Directory - -
sysconfig Directory - -
tomllib Directory - -
unittest Directory - -
urllib Directory - -
venv Directory - -
wsgiref Directory - -
xml Directory - -
xmlrpc Directory - -
zipfile Directory - -
zoneinfo Directory - -
LICENSE.txt File 13809 bytes June 11 2025 15:36:57.
__future__.py File 5218 bytes June 23 2025 14:28:17.
__hello__.py File 227 bytes June 23 2025 14:28:17.
_aix_support.py File 4021 bytes June 23 2025 14:28:16.
_android_support.py File 6895 bytes June 23 2025 14:28:03.
_apple_support.py File 2256 bytes June 23 2025 14:28:16.
_collections_abc.py File 32264 bytes June 23 2025 14:28:03.
_colorize.py File 2848 bytes June 23 2025 14:28:03.
_compat_pickle.py File 8735 bytes June 23 2025 14:28:15.
_compression.py File 5681 bytes June 23 2025 14:28:03.
_ios_support.py File 2672 bytes June 23 2025 14:28:16.
_markupbase.py File 14653 bytes June 23 2025 14:28:03.
_opcode_metadata.py File 9265 bytes June 23 2025 14:28:16.
_osx_support.py File 22023 bytes June 23 2025 14:28:16.
_py_abc.py File 6189 bytes June 23 2025 14:28:16.
_pydatetime.py File 91990 bytes June 23 2025 14:28:17.
_pydecimal.py File 227283 bytes June 23 2025 14:28:02.
_pyio.py File 93693 bytes June 23 2025 14:28:04.
_pylong.py File 11830 bytes June 23 2025 14:28:03.
_sitebuiltins.py File 3128 bytes June 23 2025 14:28:03.
_strptime.py File 29383 bytes June 23 2025 14:28:16.
_sysconfigdata__linux_x86_64-linux-gnu.py File 67303 bytes June 23 2025 14:37:34.
_sysconfigdata_d_linux_x86_64-linux-gnu.py File 67285 bytes June 23 2025 14:31:05.
_threading_local.py File 4363 bytes June 23 2025 14:28:03.
_weakrefset.py File 5893 bytes June 23 2025 14:28:03.
abc.py File 6538 bytes June 23 2025 14:28:03.
antigravity.py File 500 bytes June 23 2025 14:28:03.
argparse.py File 101661 bytes June 23 2025 14:28:16.
ast.py File 65339 bytes June 23 2025 14:28:16.
base64.py File 21643 bytes June 23 2025 14:28:03.
bdb.py File 35343 bytes June 23 2025 14:28:15.
bisect.py File 3423 bytes June 23 2025 14:28:02.
bz2.py File 11969 bytes June 23 2025 14:28:16.
cProfile.py File 6637 bytes June 23 2025 14:28:02.
calendar.py File 26077 bytes June 23 2025 14:28:16.
cmd.py File 15316 bytes June 23 2025 14:28:02.
code.py File 13170 bytes June 23 2025 14:28:03.
codecs.py File 36928 bytes June 23 2025 14:28:03.
codeop.py File 5828 bytes June 23 2025 14:28:03.
colorsys.py File 4062 bytes June 23 2025 14:28:03.
compileall.py File 20665 bytes June 23 2025 14:28:03.
configparser.py File 53831 bytes June 23 2025 14:28:03.
contextlib.py File 27801 bytes June 23 2025 14:28:03.
contextvars.py File 129 bytes June 23 2025 14:28:15.
copy.py File 8975 bytes June 23 2025 14:28:03.
copyreg.py File 7614 bytes June 23 2025 14:28:16.
csv.py File 19178 bytes June 23 2025 14:28:03.
dataclasses.py File 64545 bytes June 23 2025 14:28:16.
datetime.py File 268 bytes June 23 2025 14:28:17.
decimal.py File 2798 bytes June 23 2025 14:28:16.
difflib.py File 83368 bytes June 23 2025 14:28:03.
dis.py File 40962 bytes June 23 2025 14:28:03.
doctest.py File 109333 bytes June 23 2025 14:28:03.
enum.py File 85578 bytes June 23 2025 14:28:03.
filecmp.py File 10652 bytes June 23 2025 14:28:03.
fileinput.py File 15717 bytes June 23 2025 14:28:03.
fnmatch.py File 6180 bytes June 23 2025 14:28:03.
fractions.py File 40021 bytes June 23 2025 14:28:02.
ftplib.py File 34735 bytes June 23 2025 14:28:03.
functools.py File 39123 bytes June 23 2025 14:28:17.
genericpath.py File 6247 bytes June 23 2025 14:28:17.
getopt.py File 7488 bytes June 23 2025 14:28:16.
getpass.py File 6233 bytes June 23 2025 14:28:02.
gettext.py File 21534 bytes June 23 2025 14:28:16.
glob.py File 19720 bytes June 23 2025 14:28:03.
graphlib.py File 9648 bytes June 23 2025 14:28:02.
gzip.py File 24633 bytes June 23 2025 14:28:16.
hashlib.py File 9446 bytes June 23 2025 14:28:17.
heapq.py File 23024 bytes June 23 2025 14:28:02.
hmac.py File 7716 bytes June 23 2025 14:28:04.
imaplib.py File 54040 bytes June 23 2025 14:28:16.
inspect.py File 128276 bytes June 23 2025 14:28:15.
io.py File 3582 bytes June 23 2025 14:28:03.
ipaddress.py File 81635 bytes June 23 2025 14:28:16.
keyword.py File 1073 bytes June 23 2025 14:28:16.
linecache.py File 7284 bytes June 23 2025 14:28:03.
locale.py File 79033 bytes June 23 2025 14:28:15.
lzma.py File 13399 bytes June 23 2025 14:28:16.
mailbox.py File 81644 bytes June 23 2025 14:28:15.
mimetypes.py File 23851 bytes June 23 2025 14:28:15.
modulefinder.py File 23792 bytes June 23 2025 14:28:03.
netrc.py File 6922 bytes June 23 2025 14:28:04.
ntpath.py File 32806 bytes June 23 2025 14:28:03.
nturl2path.py File 2374 bytes June 23 2025 14:28:16.
numbers.py File 11467 bytes June 23 2025 14:28:17.
opcode.py File 2825 bytes June 23 2025 14:28:17.
operator.py File 10980 bytes June 23 2025 14:28:15.
optparse.py File 60369 bytes June 23 2025 14:28:16.
os.py File 41635 bytes June 23 2025 14:28:03.
pdb.py File 90938 bytes June 23 2025 14:28:03.
pickle.py File 66957 bytes June 23 2025 14:28:03.
pickletools.py File 94052 bytes June 23 2025 14:28:03.
pkgutil.py File 18281 bytes June 23 2025 14:28:03.
platform.py File 47359 bytes June 23 2025 14:28:03.
plistlib.py File 29794 bytes June 23 2025 14:28:02.
poplib.py File 14604 bytes June 23 2025 14:28:02.
posixpath.py File 18360 bytes June 23 2025 14:28:03.
pprint.py File 24158 bytes June 23 2025 14:28:03.
profile.py File 23153 bytes June 23 2025 14:28:03.
pstats.py File 29296 bytes June 23 2025 14:28:03.
pty.py File 6137 bytes June 23 2025 14:28:02.
py_compile.py File 7837 bytes June 23 2025 14:28:16.
pyclbr.py File 11396 bytes June 23 2025 14:28:02.
pydoc.py File 110078 bytes June 23 2025 14:28:03.
queue.py File 13481 bytes June 23 2025 14:28:16.
quopri.py File 7197 bytes June 23 2025 14:28:16.
random.py File 37006 bytes June 23 2025 14:28:02.
reprlib.py File 7192 bytes June 23 2025 14:28:03.
rlcompleter.py File 7918 bytes June 23 2025 14:28:17.
runpy.py File 12885 bytes June 23 2025 14:28:02.
sched.py File 6351 bytes June 23 2025 14:28:16.
secrets.py File 1984 bytes June 23 2025 14:28:04.
selectors.py File 19457 bytes June 23 2025 14:28:03.
shelve.py File 8810 bytes June 23 2025 14:28:16.
shlex.py File 13353 bytes June 23 2025 14:28:17.
shutil.py File 57463 bytes June 23 2025 14:28:16.
signal.py File 2495 bytes June 23 2025 14:28:15.
site.py File 25568 bytes June 23 2025 14:28:15.
smtplib.py File 43545 bytes June 23 2025 14:28:03.
socket.py File 37759 bytes June 23 2025 14:28:17.
socketserver.py File 28065 bytes June 23 2025 14:28:17.
sre_compile.py File 231 bytes June 23 2025 14:28:03.
sre_constants.py File 232 bytes June 23 2025 14:28:03.
sre_parse.py File 229 bytes June 23 2025 14:28:03.
ssl.py File 52706 bytes June 23 2025 14:28:15.
stat.py File 6147 bytes June 23 2025 14:28:16.
statistics.py File 61831 bytes June 23 2025 14:28:03.
string.py File 11786 bytes June 23 2025 14:28:16.
stringprep.py File 12917 bytes June 23 2025 14:28:03.
struct.py File 257 bytes June 23 2025 14:28:03.
subprocess.py File 89486 bytes June 23 2025 14:28:02.
symtable.py File 14207 bytes June 23 2025 14:28:16.
tabnanny.py File 11545 bytes June 23 2025 14:28:16.
tarfile.py File 114095 bytes June 23 2025 14:28:03.
tempfile.py File 32366 bytes June 23 2025 14:28:02.
textwrap.py File 19939 bytes June 23 2025 14:28:03.
this.py File 1003 bytes June 23 2025 14:28:03.
threading.py File 55244 bytes June 23 2025 14:28:15.
timeit.py File 13477 bytes June 23 2025 14:28:03.
token.py File 2489 bytes June 23 2025 14:28:03.
tokenize.py File 21568 bytes June 23 2025 14:28:16.
trace.py File 29728 bytes June 23 2025 14:28:02.
traceback.py File 66524 bytes June 23 2025 14:28:16.
tracemalloc.py File 18047 bytes June 23 2025 14:28:16.
tty.py File 2035 bytes June 23 2025 14:28:02.
types.py File 11207 bytes June 23 2025 14:28:02.
typing.py File 132718 bytes June 23 2025 14:28:16.
uuid.py File 29141 bytes June 23 2025 14:28:03.
warnings.py File 26948 bytes June 23 2025 14:28:03.
wave.py File 23236 bytes June 23 2025 14:28:03.
weakref.py File 21513 bytes June 23 2025 14:28:16.
webbrowser.py File 24298 bytes June 23 2025 14:28:16.
zipapp.py File 8618 bytes June 23 2025 14:28:03.
zipimport.py File 32890 bytes June 23 2025 14:28:16.

Reading File: //opt/alt/python313//lib64//python3.13/symtable.py

"""Interface to the compiler's internal symbol tables"""

import _symtable
from _symtable import (USE, DEF_GLOBAL, DEF_NONLOCAL, DEF_LOCAL, DEF_PARAM,
     DEF_IMPORT, DEF_BOUND, DEF_ANNOT, SCOPE_OFF, SCOPE_MASK, FREE,
     LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL)

import weakref
from enum import StrEnum

__all__ = ["symtable", "SymbolTableType", "SymbolTable", "Class", "Function", "Symbol"]

def symtable(code, filename, compile_type):
    """ Return the toplevel *SymbolTable* for the source code.

    *filename* is the name of the file with the code
    and *compile_type* is the *compile()* mode argument.
    """
    top = _symtable.symtable(code, filename, compile_type)
    return _newSymbolTable(top, filename)

class SymbolTableFactory:
    def __init__(self):
        self.__memo = weakref.WeakValueDictionary()

    def new(self, table, filename):
        if table.type == _symtable.TYPE_FUNCTION:
            return Function(table, filename)
        if table.type == _symtable.TYPE_CLASS:
            return Class(table, filename)
        return SymbolTable(table, filename)

    def __call__(self, table, filename):
        key = table, filename
        obj = self.__memo.get(key, None)
        if obj is None:
            obj = self.__memo[key] = self.new(table, filename)
        return obj

_newSymbolTable = SymbolTableFactory()


class SymbolTableType(StrEnum):
    MODULE = "module"
    FUNCTION = "function"
    CLASS = "class"
    ANNOTATION = "annotation"
    TYPE_ALIAS = "type alias"
    TYPE_PARAMETERS = "type parameters"
    TYPE_VARIABLE = "type variable"


class SymbolTable:

    def __init__(self, raw_table, filename):
        self._table = raw_table
        self._filename = filename
        self._symbols = {}

    def __repr__(self):
        if self.__class__ == SymbolTable:
            kind = ""
        else:
            kind = "%s " % self.__class__.__name__

        if self._table.name == "top":
            return "<{0}SymbolTable for module {1}>".format(kind, self._filename)
        else:
            return "<{0}SymbolTable for {1} in {2}>".format(kind,
                                                            self._table.name,
                                                            self._filename)

    def get_type(self):
        """Return the type of the symbol table.

        The value returned is one of the values in
        the ``SymbolTableType`` enumeration.
        """
        if self._table.type == _symtable.TYPE_MODULE:
            return SymbolTableType.MODULE
        if self._table.type == _symtable.TYPE_FUNCTION:
            return SymbolTableType.FUNCTION
        if self._table.type == _symtable.TYPE_CLASS:
            return SymbolTableType.CLASS
        if self._table.type == _symtable.TYPE_ANNOTATION:
            return SymbolTableType.ANNOTATION
        if self._table.type == _symtable.TYPE_TYPE_ALIAS:
            return SymbolTableType.TYPE_ALIAS
        if self._table.type == _symtable.TYPE_TYPE_PARAMETERS:
            return SymbolTableType.TYPE_PARAMETERS
        if self._table.type == _symtable.TYPE_TYPE_VARIABLE:
            return SymbolTableType.TYPE_VARIABLE
        assert False, f"unexpected type: {self._table.type}"

    def get_id(self):
        """Return an identifier for the table.
        """
        return self._table.id

    def get_name(self):
        """Return the table's name.

        This corresponds to the name of the class, function
        or 'top' if the table is for a class, function or
        global respectively.
        """
        return self._table.name

    def get_lineno(self):
        """Return the number of the first line in the
        block for the table.
        """
        return self._table.lineno

    def is_optimized(self):
        """Return *True* if the locals in the table
        are optimizable.
        """
        return bool(self._table.type == _symtable.TYPE_FUNCTION)

    def is_nested(self):
        """Return *True* if the block is a nested class
        or function."""
        return bool(self._table.nested)

    def has_children(self):
        """Return *True* if the block has nested namespaces.
        """
        return bool(self._table.children)

    def get_identifiers(self):
        """Return a view object containing the names of symbols in the table.
        """
        return self._table.symbols.keys()

    def lookup(self, name):
        """Lookup a *name* in the table.

        Returns a *Symbol* instance.
        """
        sym = self._symbols.get(name)
        if sym is None:
            flags = self._table.symbols[name]
            namespaces = self.__check_children(name)
            module_scope = (self._table.name == "top")
            sym = self._symbols[name] = Symbol(name, flags, namespaces,
                                               module_scope=module_scope)
        return sym

    def get_symbols(self):
        """Return a list of *Symbol* instances for
        names in the table.
        """
        return [self.lookup(ident) for ident in self.get_identifiers()]

    def __check_children(self, name):
        return [_newSymbolTable(st, self._filename)
                for st in self._table.children
                if st.name == name]

    def get_children(self):
        """Return a list of the nested symbol tables.
        """
        return [_newSymbolTable(st, self._filename)
                for st in self._table.children]


class Function(SymbolTable):

    # Default values for instance variables
    __params = None
    __locals = None
    __frees = None
    __globals = None
    __nonlocals = None

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

    def get_parameters(self):
        """Return a tuple of parameters to the function.
        """
        if self.__params is None:
            self.__params = self.__idents_matching(lambda x:x & DEF_PARAM)
        return self.__params

    def get_locals(self):
        """Return a tuple of locals in the function.
        """
        if self.__locals is None:
            locs = (LOCAL, CELL)
            test = lambda x: ((x >> SCOPE_OFF) & SCOPE_MASK) in locs
            self.__locals = self.__idents_matching(test)
        return self.__locals

    def get_globals(self):
        """Return a tuple of globals in the function.
        """
        if self.__globals is None:
            glob = (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
            test = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) in glob
            self.__globals = self.__idents_matching(test)
        return self.__globals

    def get_nonlocals(self):
        """Return a tuple of nonlocals in the function.
        """
        if self.__nonlocals is None:
            self.__nonlocals = self.__idents_matching(lambda x:x & DEF_NONLOCAL)
        return self.__nonlocals

    def get_frees(self):
        """Return a tuple of free variables in the function.
        """
        if self.__frees is None:
            is_free = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) == FREE
            self.__frees = self.__idents_matching(is_free)
        return self.__frees


class Class(SymbolTable):

    __methods = None

    def get_methods(self):
        """Return a tuple of methods declared in the class.
        """
        if self.__methods is None:
            d = {}

            def is_local_symbol(ident):
                flags = self._table.symbols.get(ident, 0)
                return ((flags >> SCOPE_OFF) & SCOPE_MASK) == LOCAL

            for st in self._table.children:
                # pick the function-like symbols that are local identifiers
                if is_local_symbol(st.name):
                    match st.type:
                        case _symtable.TYPE_FUNCTION:
                            # generators are of type TYPE_FUNCTION with a ".0"
                            # parameter as a first parameter (which makes them
                            # distinguishable from a function named 'genexpr')
                            if st.name == 'genexpr' and '.0' in st.varnames:
                                continue
                            d[st.name] = 1
                        case _symtable.TYPE_TYPE_PARAMETERS:
                            # Get the function-def block in the annotation
                            # scope 'st' with the same identifier, if any.
                            scope_name = st.name
                            for c in st.children:
                                if c.name == scope_name and c.type == _symtable.TYPE_FUNCTION:
                                    # A generic generator of type TYPE_FUNCTION
                                    # cannot be a direct child of 'st' (but it
                                    # can be a descendant), e.g.:
                                    #
                                    # class A:
                                    #   type genexpr[genexpr] = (x for x in [])
                                    assert scope_name != 'genexpr' or '.0' not in c.varnames
                                    d[scope_name] = 1
                                    break
            self.__methods = tuple(d)
        return self.__methods


class Symbol:

    def __init__(self, name, flags, namespaces=None, *, module_scope=False):
        self.__name = name
        self.__flags = flags
        self.__scope = (flags >> SCOPE_OFF) & SCOPE_MASK # like PyST_GetScope()
        self.__namespaces = namespaces or ()
        self.__module_scope = module_scope

    def __repr__(self):
        flags_str = '|'.join(self._flags_str())
        return f'<symbol {self.__name!r}: {self._scope_str()}, {flags_str}>'

    def _scope_str(self):
        return _scopes_value_to_name.get(self.__scope) or str(self.__scope)

    def _flags_str(self):
        for flagname, flagvalue in _flags:
            if self.__flags & flagvalue == flagvalue:
                yield flagname

    def get_name(self):
        """Return a name of a symbol.
        """
        return self.__name

    def is_referenced(self):
        """Return *True* if the symbol is used in
        its block.
        """
        return bool(self.__flags & _symtable.USE)

    def is_parameter(self):
        """Return *True* if the symbol is a parameter.
        """
        return bool(self.__flags & DEF_PARAM)

    def is_global(self):
        """Return *True* if the symbol is global.
        """
        return bool(self.__scope in (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
                    or (self.__module_scope and self.__flags & DEF_BOUND))

    def is_nonlocal(self):
        """Return *True* if the symbol is nonlocal."""
        return bool(self.__flags & DEF_NONLOCAL)

    def is_declared_global(self):
        """Return *True* if the symbol is declared global
        with a global statement."""
        return bool(self.__scope == GLOBAL_EXPLICIT)

    def is_local(self):
        """Return *True* if the symbol is local.
        """
        return bool(self.__scope in (LOCAL, CELL)
                    or (self.__module_scope and self.__flags & DEF_BOUND))

    def is_annotated(self):
        """Return *True* if the symbol is annotated.
        """
        return bool(self.__flags & DEF_ANNOT)

    def is_free(self):
        """Return *True* if a referenced symbol is
        not assigned to.
        """
        return bool(self.__scope == FREE)

    def is_imported(self):
        """Return *True* if the symbol is created from
        an import statement.
        """
        return bool(self.__flags & DEF_IMPORT)

    def is_assigned(self):
        """Return *True* if a symbol is assigned to."""
        return bool(self.__flags & DEF_LOCAL)

    def is_namespace(self):
        """Returns *True* if name binding introduces new namespace.

        If the name is used as the target of a function or class
        statement, this will be true.

        Note that a single name can be bound to multiple objects.  If
        is_namespace() is true, the name may also be bound to other
        objects, like an int or list, that does not introduce a new
        namespace.
        """
        return bool(self.__namespaces)

    def get_namespaces(self):
        """Return a list of namespaces bound to this name"""
        return self.__namespaces

    def get_namespace(self):
        """Return the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces
        or no namespace.
        """
        if len(self.__namespaces) == 0:
            raise ValueError("name is not bound to any namespaces")
        elif len(self.__namespaces) > 1:
            raise ValueError("name is bound to multiple namespaces")
        else:
            return self.__namespaces[0]


_flags = [('USE', USE)]
_flags.extend(kv for kv in globals().items() if kv[0].startswith('DEF_'))
_scopes_names = ('FREE', 'LOCAL', 'GLOBAL_IMPLICIT', 'GLOBAL_EXPLICIT', 'CELL')
_scopes_value_to_name = {globals()[n]: n for n in _scopes_names}


def main(args):
    import sys
    def print_symbols(table, level=0):
        indent = '    ' * level
        nested = "nested " if table.is_nested() else ""
        if table.get_type() == 'module':
            what = f'from file {table._filename!r}'
        else:
            what = f'{table.get_name()!r}'
        print(f'{indent}symbol table for {nested}{table.get_type()} {what}:')
        for ident in table.get_identifiers():
            symbol = table.lookup(ident)
            flags = ', '.join(symbol._flags_str()).lower()
            print(f'    {indent}{symbol._scope_str().lower()} symbol {symbol.get_name()!r}: {flags}')
        print()

        for table2 in table.get_children():
            print_symbols(table2, level + 1)

    for filename in args or ['-']:
        if filename == '-':
            src = sys.stdin.read()
            filename = '<stdin>'
        else:
            with open(filename, 'rb') as f:
                src = f.read()
        mod = symtable(src, filename, 'exec')
        print_symbols(mod)


if __name__ == "__main__":
    import sys
    main(sys.argv[1:])

SILENT KILLER Tool