types.py
# Source Generated with Decompyle++
# File: types.pyc (Python 3.13)
import sys
def _f():
pass
FunctionType = type(_f)
LambdaType = type((lambda : pass))
CodeType = type(_f.__code__)
MappingProxyType = type(type.__dict__)
SimpleNamespace = type(sys.implementation)
def _cell_factory():
# MAKE_CELL(1)
a = 1
def f():
# COPY_FREE_VARS(1)
return f.__closure__[0]
CellType = type(_cell_factory())
def _g():
def _g():
# Return a generator
yield 1
GeneratorType = type(_g())
async def _c():
async def _c():
# Return a coroutine
_c = _c()
CoroutineType = type(_c)
_c.close()
def _ag():
def _ag():
# Return a generator
# WARNING: Decompyle incomplete
_ag = _ag()
AsyncGeneratorType = type(_ag)
class _C:
def _m(self):
pass
MethodType = type(_C()._m)
BuiltinFunctionType = type(len)
BuiltinMethodType = type([].append)
WrapperDescriptorType = type(object.__init__)
MethodWrapperType = type(object().__str__)
MethodDescriptorType = type(str.join)
ClassMethodDescriptorType = type(dict.__dict__['fromkeys'])
ModuleType = type(sys)
raise TypeError
GetSetDescriptorType = type(FunctionType.__code__)
MemberDescriptorType = type(FunctionType.__globals__)
del sys
del _f
del _g
del _C
del _c
del _ag
def new_class(name, bases, kwds, exec_body = ((), None, None)):
resolved_bases = resolve_bases(bases)
(meta, ns, kwds) = prepare_class(name, resolved_bases, kwds)
exec_body(ns)
if resolved_bases is not bases:
ns['__orig_bases__'] = bases
# WARNING: Decompyle incomplete
def resolve_bases(bases):
new_bases = list(bases)
updated = False
shift = 0
for i, base in enumerate(bases):
if isinstance(base, type):
continue
if not hasattr(base, '__mro_entries__'):
continue
new_base = base.__mro_entries__(bases)
updated = True
if not isinstance(new_base, tuple):
raise TypeError('__mro_entries__ must return a tuple')
new_bases[i + shift:i + shift + 1] = None
shift += len(new_base) - 1
if not updated:
return bases
return None(new_bases)
def prepare_class(name, bases, kwds = ((), None)):
if kwds is not None:
kwds = { }
else:
kwds = dict(kwds)
if 'metaclass' in kwds:
meta = kwds.pop('metaclass')
elif bases:
meta = type(bases[0])
else:
meta = type
if isinstance(meta, type):
meta = _calculate_meta(meta, bases)
# WARNING: Decompyle incomplete
def _calculate_meta(meta, bases):
winner = meta
for base in bases:
base_meta = type(base)
if issubclass(winner, base_meta):
continue
if issubclass(base_meta, winner):
winner = base_meta
continue
raise TypeError('metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases')
return winner
class DynamicClassAttribute:
def __init__(self, fget, fset, fdel, doc = (None, None, None, None)):
self.fget = fget
self.fset = fset
self.fdel = fdel
if not doc:
pass
self.__doc__ = fget.__doc__
self.overwrite_doc = doc is None
self.__isabstractmethod__ = bool(getattr(fget, '__isabstractmethod__', False))
def __get__(self, instance, ownerclass = (None,)):
if instance is not None:
if self.__isabstractmethod__:
return self
raise None()
if None.fget is not None:
raise AttributeError('unreadable attribute')
return None.fget(instance)
def __set__(self, instance, value):
if self.fset is not None:
raise AttributeError("can't set attribute")
None.fset(instance, value)
def __delete__(self, instance):
if self.fdel is not None:
raise AttributeError("can't delete attribute")
None.fdel(instance)
def getter(self, fget):
fdoc = fget.__doc__ if self.overwrite_doc else None
if not fdoc:
pass
result = type(self)(fget, self.fset, self.fdel, self.__doc__)
result.overwrite_doc = self.overwrite_doc
return result
def setter(self, fset):
result = type(self)(self.fget, fset, self.fdel, self.__doc__)
result.overwrite_doc = self.overwrite_doc
return result
def deleter(self, fdel):
result = type(self)(self.fget, self.fset, fdel, self.__doc__)
result.overwrite_doc = self.overwrite_doc
return result
class _GeneratorWrapper:
def __init__(self, gen):
self._GeneratorWrapper__wrapped = gen
self._GeneratorWrapper__isgen = gen.__class__ is GeneratorType
self.__name__ = getattr(gen, '__name__', None)
self.__qualname__ = getattr(gen, '__qualname__', None)
def send(self, val):
return self._GeneratorWrapper__wrapped.send(val)
def throw(self, tp, *rest):
pass
# WARNING: Decompyle incomplete
def close(self):
return self._GeneratorWrapper__wrapped.close()
gi_code = (lambda self: self._GeneratorWrapper__wrapped.gi_code)()
gi_frame = (lambda self: self._GeneratorWrapper__wrapped.gi_frame)()
gi_running = (lambda self: self._GeneratorWrapper__wrapped.gi_running)()
gi_yieldfrom = (lambda self: self._GeneratorWrapper__wrapped.gi_yieldfrom)()
cr_code = gi_code
cr_frame = gi_frame
cr_running = gi_running
cr_await = gi_yieldfrom
def __next__(self):
return next(self._GeneratorWrapper__wrapped)
def __iter__(self):
if self._GeneratorWrapper__isgen:
return self._GeneratorWrapper__wrapped
__await__ = __iter__
def coroutine(func):
# MAKE_CELL(0)
# MAKE_CELL(5)
if not callable(func):
raise TypeError('types.coroutine() expects a callable')
if None.__class__ is FunctionType and getattr(func, '__code__', None).__class__ is CodeType:
co_flags = func.__code__.co_flags
if co_flags & 384:
return func
if None & 32:
co = func.__code__
func.__code__ = co.replace(co_flags = co.co_flags | 256)
return func
import functools
import _collections_abc
wrapped = (lambda : # COPY_FREE_VARS(2)# WARNING: Decompyle incomplete
)()
return wrapped
GenericAlias = type(list[int])
UnionType = type(int | str)
EllipsisType = type(Ellipsis)
NoneType = type(None)
NotImplementedType = type(NotImplemented)
__all__ = globals()()