"""
This type stub file was generated by pyright.
"""

import sys
import _testcapi as t
from mmap import PAGESIZE as _PAGESIZE

"""
This is a stripped-down of asizeof.py from the pympler module. It's vendored
because pympler is unmaintained, while having a critical vulnerability.

Differences from the original asizeof module:
- Removed code for running as __main__
- Removed `adict`
- `__all__` only includes `asizeof`

The *original* original copyright, license and disclaimer are at the end of this
file, exactly as they appeared in the pympler code. pympler itself is under the
Apache license, which appears in the project root.

The original module docstring that appears in pympler follows; note that some of
it no longer pertains here, but it's preserved to document implementation
details.
"""
__all__ = ["asizeof"]
__version__ = ...
_NN = ...
_Not_vari = ...
_ignored_modules = ...
_sizeof_Cbyte = ...
_sizeof_Clong = ...
_sizeof_Cvoidp = ...
_z_P_L = ...
_sizeof_CPyCodeObject = ...
_sizeof_CPyFrameObject = ...
_sizeof_CPyModuleObject = ...
_sizeof_CPyDictEntry = ...
_sizeof_Csetentry = ...
u = ...
_sizeof_Cunicode = ...
_sizeof_CPyGC_Head = ...
t = ...
_sizeof_Crefcounts = ...
_Py_TPFLAGS_HEAPTYPE = ...
_Py_TPFLAGS_HAVE_GC = ...
_Type_type = ...
if sys.platform == "ios":
    ...
_getsizeof = ...
c = ...
_cell_type = ...
_all_refs: Set[Union[None, Callable], ...] = ...
_all_lens: Set[Union[None, Callable], ...] = ...
class _Claskey:
    """Wrapper for class objects."""
    __slots__ = ...
    def __init__(self, obj) -> None:
        ...
    
    def __str__(self) -> str:
        ...
    
    __repr__ = ...


_claskeys: Dict[int, _Claskey] = ...
_NoneNone = ...
class _NamedRef:
    """Store referred object along
    with the name of the referent.
    """
    __slots__ = ...
    def __init__(self, name, ref) -> None:
        ...
    


i = ...
_all_kinds = ...
class _Typedef:
    """Type definition class."""
    base = ...
    both = ...
    item = ...
    kind = ...
    leng = ...
    refs = ...
    type = ...
    vari = ...
    xtyp = ...
    def __init__(self, **kwds) -> None:
        ...
    
    def __lt__(self, unused) -> bool:
        ...
    
    def __repr__(self): # -> str:
        ...
    
    def __str__(self) -> str:
        ...
    
    def args(self): # -> tuple[int, int, Any | Callable[..., int] | None, Any | None, bool | None, Any | None, Any | None, bool | None]:
        """Return all attributes as arguments tuple."""
        ...
    
    def dup(self, other=..., **kwds): # -> None:
        """Duplicate attributes of dict or other typedef."""
        ...
    
    def flat(self, obj, mask=...): # -> int:
        """Return the aligned flat size."""
        ...
    
    def format(self): # -> dict[str, Any | None]:
        """Return format dict."""
        ...
    
    def kwds(self): # -> dict[str, str | bool | None]:
        """Return all attributes as keywords dict."""
        ...
    
    def reset(self, base=..., item=..., leng=..., refs=..., both=..., kind=..., type=..., vari=..., xtyp=..., **extra): # -> None:
        """Reset all specified typedef attributes."""
        ...
    
    def save(self, t, base=..., heap=...): # -> None:
        """Save this typedef plus its class typedef."""
        ...
    
    def set(self, safe_len=..., **kwds): # -> None:
        """Set one or more attributes."""
        ...
    


_typedefs: Dict[type, _Typedef] = ...
_dict_typedef = ...
_dict_types = ...
if type(bytes) is not type(str):
    ...
_numpy_memmap = ...
if _PAGESIZE < 1024:
    ...
s = ...
class _Prof:
    """Internal type profile class."""
    high = ...
    number = ...
    objref = ...
    total = ...
    weak = ...
    def __cmp__(self, other): # -> Literal[-1, 1, 0]:
        ...
    
    def __lt__(self, other) -> bool:
        ...
    
    def format(self, clip=..., grand=...): # -> dict[str, str]:
        """Return format dict."""
        ...
    
    def update(self, obj, size): # -> None:
        """Update this profile."""
        ...
    


class _Rank:
    """Internal largest object class."""
    deep = ...
    id = ...
    key = ...
    objref = ...
    pid = ...
    size = ...
    weak = ...
    def __init__(self, key, obj, size, deep, pid) -> None:
        ...
    
    def format(self, clip=..., id2x=...): # -> str:
        """Return this *rank* as string."""
        ...
    


class _Seen(dict):
    """Internal obj visits counter."""
    def again(self, key): # -> None:
        ...
    


class Asized:
    """Stores the results of an **asized** object in the following
    4 attributes:

     *size* -- total size of the object (including referents)

     *flat* -- flat size of the object (in bytes)

     *name* -- name or ``repr`` of the object

     *refs* -- tuple containing an **Asized** instance for each referent
    """
    __slots__ = ...
    def __init__(self, size, flat, refs=..., name=...) -> None:
        ...
    
    def __str__(self) -> str:
        ...
    
    def format(self, format=..., depth=..., order_by=..., indent=...): # -> str:
        """Format the size information of the object and of all
        sized referents as a string.

         *format* -- Specifies the format per instance (with 'name',
                     'size' and 'flat' as interpolation parameters)

         *depth* -- Recursion level up to which the referents are
                    printed (use -1 for unlimited)

         *order_by* -- Control sort order of referents, valid choices
                       are 'name', 'size' and 'flat'

         *indent* -- Optional indentation (default '')
        """
        ...
    
    def get(self, name, dflt=...): # -> None:
        """Return the named referent (or *dflt* if not found)."""
        ...
    


class Asizer:
    """Sizer state and options to accumulate sizes."""
    _above_ = ...
    _align_ = ...
    _clip_ = ...
    _code_ = ...
    _cutoff_ = ...
    _derive_ = ...
    _detail_ = ...
    _frames_ = ...
    _infer_ = ...
    _limit_ = ...
    _stats_ = ...
    _depth = ...
    _excl_d = ...
    _ign_d = ...
    _incl = ...
    _mask = ...
    _missed = ...
    _profile = ...
    _profs = ...
    _ranked = ...
    _ranks: List[_Rank] = ...
    _seen = ...
    _stream = ...
    _total = ...
    def __init__(self, **opts) -> None:
        """New **Asizer** accumulator.

        See this module documentation for more details.
        See method **reset** for all available options and defaults.
        """
        ...
    
    @property
    def above(self): # -> int:
        """Get the large object size threshold (int)."""
        ...
    
    @property
    def align(self): # -> int:
        """Get the size alignment (int)."""
        ...
    
    def asized(self, *objs, **opts): # -> tuple[Any, ...]:
        """Size each object and return an **Asized** instance with
        size information and referents up to the given detail
        level (and with modified options, see method **set**).

        If only one object is given, the return value is the
        **Asized** instance for that object.  The **Asized** size
        of duplicate and ignored objects will be zero.
        """
        ...
    
    def asizeof(self, *objs, **opts): # -> int:
        """Return the combined size of the given objects
        (with modified options, see method **set**).
        """
        ...
    
    def asizesof(self, *objs, **opts): # -> tuple[Any, ...]:
        """Return the individual sizes of the given objects
        (with modified options, see method  **set**).

        The size of duplicate and ignored objects will be zero.
        """
        ...
    
    @property
    def clip(self): # -> int:
        """Get the clipped string length (int)."""
        ...
    
    @property
    def code(self): # -> bool:
        """Size (byte) code (bool)."""
        ...
    
    @property
    def cutoff(self): # -> int:
        """Stats cutoff (int)."""
        ...
    
    @property
    def derive(self): # -> bool:
        """Derive types (bool)."""
        ...
    
    @property
    def detail(self): # -> int:
        """Get the detail level for **Asized** refs (int)."""
        ...
    
    @property
    def duplicate(self): # -> int:
        """Get the number of duplicate objects seen so far (int)."""
        ...
    
    def exclude_objs(self, *objs): # -> None:
        """Exclude the specified objects from sizing, profiling and ranking."""
        ...
    
    def exclude_refs(self, *objs): # -> None:
        """Exclude any references to the specified objects from sizing.

        While any references to the given objects are excluded, the
        objects will be sized if specified as positional arguments
        in subsequent calls to methods **asizeof** and **asizesof**.
        """
        ...
    
    def exclude_types(self, *objs): # -> None:
        """Exclude the specified object instances and types from sizing.

        All instances and types of the given objects are excluded,
        even objects specified as positional arguments in subsequent
        calls to methods **asizeof** and **asizesof**.
        """
        ...
    
    @property
    def excluded(self): # -> tuple[Any, ...]:
        """Get the types being excluded (tuple)."""
        ...
    
    @property
    def frames(self): # -> bool:
        """Ignore stack frames (bool)."""
        ...
    
    @property
    def ignored(self): # -> bool:
        """Ignore certain types (bool)."""
        ...
    
    @property
    def infer(self): # -> bool:
        """Infer types (bool)."""
        ...
    
    @property
    def limit(self): # -> int:
        """Get the recursion limit (int)."""
        ...
    
    @property
    def missed(self): # -> int:
        """Get the number of objects missed due to errors (int)."""
        ...
    
    def print_largest(self, w=..., cutoff=..., **print3options): # -> None:
        """Print the largest objects.

        The available options and defaults are:

         *w=0*           -- indentation for each line

         *cutoff=100*    -- number of largest objects to print

         *print3options* -- some keyword arguments, like Python 3+ print
        """
        ...
    
    def print_profiles(self, w=..., cutoff=..., **print3options): # -> None:
        """Print the profiles above *cutoff* percentage.

        The available options and defaults are:

             *w=0*           -- indentation for each line

             *cutoff=0*      -- minimum percentage printed

             *print3options* -- some keyword arguments, like Python 3+ print
        """
        ...
    
    def print_stats(self, objs=..., opts=..., sized=..., sizes=..., stats=..., **print3options): # -> None:
        """Prints the statistics.

        The available options and defaults are:

             *w=0*           -- indentation for each line

             *objs=()*       -- optional, list of objects

             *opts={}*       -- optional, dict of options used

             *sized=()*      -- optional, tuple of **Asized** instances returned

             *sizes=()*      -- optional, tuple of sizes returned

             *stats=3*       -- print stats, see function **asizeof**

             *print3options* -- some keyword arguments, like Python 3+ print
        """
        ...
    
    def print_summary(self, w=..., objs=..., **print3options): # -> None:
        """Print the summary statistics.

        The available options and defaults are:

             *w=0*           -- indentation for each line

             *objs=()*       -- optional, list of objects

             *print3options* -- some keyword arguments, like Python 3+ print
        """
        ...
    
    def print_typedefs(self, w=..., **print3options): # -> None:
        """Print the types and dict tables.

        The available options and defaults are:

             *w=0*           -- indentation for each line

             *print3options* -- some keyword arguments, like Python 3+ print
        """
        ...
    
    @property
    def ranked(self): # -> int:
        """Get the number objects ranked by size so far (int)."""
        ...
    
    def reset(self, above=..., align=..., clip=..., code=..., cutoff=..., derive=..., detail=..., frames=..., ignored=..., infer=..., limit=..., stats=..., stream=..., **extra): # -> None:
        """Reset sizing options, state, etc. to defaults.

        The available options and default values are:

             *above=0*      -- threshold for largest objects stats

             *align=8*      -- size alignment

             *code=False*   -- incl. (byte)code size

             *cutoff=10*    -- limit large objects or profiles stats

             *derive=False* -- derive from super type

             *detail=0*     -- **Asized** refs level

             *frames=False* -- ignore frame objects

             *ignored=True* -- ignore certain types

             *infer=False*  -- try to infer types

             *limit=100*    -- recursion limit

             *stats=0*      -- print statistics, see function **asizeof**

             *stream=None*  -- output stream for printing

        See function **asizeof** for a description of the options.
        """
        ...
    
    @property
    def seen(self): # -> int:
        """Get the number objects seen so far (int)."""
        ...
    
    def set(self, above=..., align=..., code=..., cutoff=..., frames=..., detail=..., limit=..., stats=...): # -> None:
        """Set some sizing options.  See also **reset**.

        The available options are:

             *above*  -- threshold for largest objects stats

             *align*  -- size alignment

             *code*   -- incl. (byte)code size

             *cutoff* -- limit large objects or profiles stats

             *detail* -- **Asized** refs level

             *frames* -- size or ignore frame objects

             *limit*  -- recursion limit

             *stats*  -- print statistics, see function **asizeof**

        Any options not set remain unchanged from the previous setting.
        """
        ...
    
    @property
    def sized(self): # -> int:
        """Get the number objects sized so far (int)."""
        ...
    
    @property
    def stats(self): # -> int:
        """Get the stats and cutoff setting (float)."""
        ...
    
    @property
    def total(self): # -> int:
        """Get the total size (in bytes) accumulated so far."""
        ...
    


def amapped(percentage=...): # -> float:
    """Set/get approximate mapped memory usage as a percentage
    of the mapped file size.

    Sets the new percentage if not None and returns the
    previously set percentage.

    Applies only to *numpy.memmap* objects.
    """
    ...

_amapped = ...
_asizer = ...
def asized(*objs, **opts): # -> tuple[Any, ...] | tuple[()]:
    """Return a tuple containing an **Asized** instance for each
    object passed as positional argument.

    The available options and defaults are:

         *above=0*      -- threshold for largest objects stats

         *align=8*      -- size alignment

         *code=False*   -- incl. (byte)code size

         *cutoff=10*    -- limit large objects or profiles stats

         *derive=False* -- derive from super type

         *detail=0*     -- Asized refs level

         *frames=False* -- ignore stack frame objects

         *ignored=True* -- ignore certain types

         *infer=False*  -- try to infer types

         *limit=100*    -- recursion limit

         *stats=0*      -- print statistics

    If only one object is given, the return value is the **Asized**
    instance for that object.  Otherwise, the length of the returned
    tuple matches the number of given objects.

    The **Asized** size of duplicate and ignored objects will be zero.

    Set *detail* to the desired referents level and *limit* to the
    maximum recursion depth.

    See function **asizeof** for descriptions of the other options.
    """
    ...

def asizeof(*objs, **opts): # -> int:
    """Return the combined size (in bytes) of all objects passed
    as positional arguments.

    The available options and defaults are:

         *above=0*      -- threshold for largest objects stats

         *align=8*      -- size alignment

         *clip=80*      -- clip ``repr()`` strings

         *code=False*   -- incl. (byte)code size

         *cutoff=10*    -- limit large objects or profiles stats

         *derive=False* -- derive from super type

         *frames=False* -- ignore stack frame objects

         *ignored=True* -- ignore certain types

         *infer=False*  -- try to infer types

         *limit=100*    -- recursion limit

         *stats=0*      -- print statistics

    Set *align* to a power of 2 to align sizes.  Any value less
    than 2 avoids size alignment.

    If *all* is True and if no positional arguments are supplied.
    size all current gc objects, including module, global and stack
    frame objects.

    A positive *clip* value truncates all repr() strings to at
    most *clip* characters.

    The (byte)code size of callable objects like functions,
    methods, classes, etc. is included only if *code* is True.

    If *derive* is True, new types are handled like an existing
    (super) type provided there is one and only of those.

    By default certain base types like object, super, etc. are
    ignored.  Set *ignored* to False to include those.

    If *infer* is True, new types are inferred from attributes
    (only implemented for dict types on callable attributes
    as get, has_key, items, keys and values).

    Set *limit* to a positive value to accumulate the sizes of
    the referents of each object, recursively up to the limit.
    Using *limit=0* returns the sum of the flat sizes of the
    given objects.  High *limit* values may cause runtime errors
    and miss objects for sizing.

    A positive value for *stats* prints up to 9 statistics, (1)
    a summary of the number of objects sized and seen and a list
    of the largests objects with size over *above* bytes, (2) a
    simple profile of the sized objects by type and (3+) up to 6
    tables showing the static, dynamic, derived, ignored, inferred
    and dict types used, found respectively installed.
    The fractional part of the *stats* value (x 100) is the number
    of largest objects shown for (*stats*1.+) or the cutoff
    percentage for simple profiles for (*stats*=2.+).  For example,
    *stats=1.10* shows the summary and the 10 largest objects,
    also the default.

    See this module documentation for the definition of flat size.
    """
    ...

def asizesof(*objs, **opts): # -> tuple[Any, ...] | tuple[()]:
    """Return a tuple containing the size (in bytes) of all objects
    passed as positional arguments.

    The available options and defaults are:

         *above=1024*   -- threshold for largest objects stats

         *align=8*      -- size alignment

         *clip=80*      -- clip ``repr()`` strings

         *code=False*   -- incl. (byte)code size

         *cutoff=10*    -- limit large objects or profiles stats

         *derive=False* -- derive from super type

         *frames=False* -- ignore stack frame objects

         *ignored=True* -- ignore certain types

         *infer=False*  -- try to infer types

         *limit=100*    -- recursion limit

         *stats=0*      -- print statistics

    See function **asizeof** for a description of the options.

    The length of the returned tuple equals the number of given
    objects.

    The size of duplicate and ignored objects will be zero.
    """
    ...

def basicsize(obj, **opts): # -> int | _Typedef:
    """Return the basic size of an object (in bytes).

    The available options and defaults are:

        *derive=False* -- derive type from super type

        *infer=False*  -- try to infer types

        *save=False*   -- save the object's type definition if new

    See this module documentation for the definition of *basic size*.
    """
    ...

def flatsize(obj, align=..., **opts): # -> int | _Typedef:
    """Return the flat size of an object (in bytes), optionally aligned
    to the given power-of-2.

    See function **basicsize** for a description of other available options.

    See this module documentation for the definition of *flat size*.
    """
    ...

def itemsize(obj, **opts): # -> Any | int | _Typedef:
    """Return the item size of an object (in bytes).

    See function **basicsize** for a description of the available options.

    See this module documentation for the definition of *item size*.
    """
    ...

def leng(obj, **opts): # -> Any | int | object | _Typedef | None:
    """Return the length of an object, in number of *items*.

    See function **basicsize** for a description of the available options.
    """
    ...

def named_refs(obj, **opts): # -> list[Any]:
    """Return all named **referents** of an object (re-using
    functionality from **asizeof**).

    Does not return un-named *referents*, e.g. objects in a list.

    See function **basicsize** for a description of the available options.
    """
    ...

def refs(obj, **opts): # -> object | None:
    """Return (a generator for) specific *referents* of an object.

    See function **basicsize** for a description of the available options.
    """
    ...

