# mypy: ignore-errors
"""
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.
"""
"""
**Public Functions** [#unsafe]_
Function **asizesof** returns a tuple containing the (approximate)
size in bytes for each given Python object separately.
Function **asized** returns for each object an instance of class
**Asized** containing all the size information of the object and
a tuple with the referents [#refs]_.
Functions **basicsize** and **itemsize** return the *basic-*
respectively *itemsize* of the given object, both in bytes. For
objects as ``array.array``, ``numpy.array``, ``numpy.ndarray``,
etc. where the item size varies depending on the instance-specific
data type, function **itemsize** returns that item size.
Function **flatsize** returns the *flat size* of a Python object
in bytes defined as the *basic size* plus the *item size* times
the *length* of the given object.
Function **leng** returns the *length* of an object, like standard
function ``len`` but extended for several types. E.g. the **leng**
of a multi-precision int (formerly long) is the number of ``digits``
[#digit]_. The length of most *mutable* sequence objects includes
an estimate of the over-allocation and therefore, the **leng** value
may differ from the standard ``len`` result. For objects like
``array.array``, ``numpy.array``, ``numpy.ndarray``, etc. function
**leng** returns the proper number of items.
Function **refs** returns (a generator for) the referents [#refs]_
of the given object.
**Public Classes** [#unsafe]_
Class **Asizer** may be used to accumulate the results of several
**asizeof** or **asizesof** calls. After creating an **Asizer**
instance, use methods **asizeof** and **asizesof** as needed to
size any number of additional objects.
Call methods **exclude_refs** and/or **exclude_types** to exclude
references to respectively instances or types of certain objects.
Use one of the **print\\_...** methods to report the statistics.
An instance of class **Asized** is returned for each object sized
by the **asized** function or method.
**Duplicate Objects**
Any duplicate, given objects are sized only once and the size
is included in the accumulated total only once. But functions
**asizesof** and **asized** will return a size value respectively
an **Asized** instance for each given object, including duplicates.
**Definitions** [#arb]_
The *length* of an objects like ``dict``, ``list``, ``set``,
``str``, ``tuple``, etc. is defined as the number of items held
in or allocated by the object. Held items are *references* to
other objects, called the *referents*.
The *size* of an object is defined as the sum of the *flat size*
of the object plus the sizes of any referents [#refs]_. Referents
are visited recursively up to the specified detail level. However,
the size of objects referenced multiple times is included only once
in the total *size*.
The *flat size* of an object is defined as the *basic size* of the
object plus the *item size* times the number of allocated *items*,
*references* to referents. The *flat size* does include the size
for the *references* to the referents, but not the size of the
referents themselves.
The *flat size* returned by function *flatsize* equals the result
of function *asizeof* with options *code=True*, *ignored=False*,
*limit=0* and option *align* set to the same value.
The accurate *flat size* for an object is obtained from function
``sys.getsizeof()`` where available. Otherwise, the *length* and
*size* of sequence objects as ``dicts``, ``lists``, ``sets``, etc.
is based on an estimate for the number of allocated items. As a
result, the reported *length* and *size* may differ substantially
from the actual *length* and *size*.
The *basic* and *item size* are obtained from the ``__basicsize__``
respectively ``__itemsize__`` attributes of the (type of the)
object. Where necessary (e.g. sequence objects), a zero
``__itemsize__`` is replaced by the size of a corresponding C type.
The overhead for Python's garbage collector (GC) is included in
the *basic size* of (GC managed) objects as well as the space
needed for ``refcounts`` (used only in certain Python builds).
Optionally, size values can be aligned to any power-of-2 multiple.
**Size of (byte)code**
The *(byte)code size* of objects like classes, functions, methods,
modules, etc. can be included by setting option *code=True*.
Iterators are handled like sequences: iterated object(s) are sized
like *referents* [#refs]_, but only up to the specified level or
recursion *limit* (and only if function ``gc.get_referents()``
returns the referent object of iterators).
Generators are sized as *(byte)code* only, but the objects are
never generated and never sized.
**New-style Classes**
All ``class``, instance and ``type`` objects are handled uniformly
such that instance objects are distinguished from class objects.
Class and type objects are represented as ``<class .... def>``
respectively ``<type ... def>`` where the ``... def`` suffix marks
the *definition object*. Instances of classes are shown as
``<class module.name>`` without the ``... def`` suffix.
**Ignored Objects**
To avoid excessive sizes, several object types are ignored [#arb]_
by default, e.g. built-in functions, built-in types and classes
[#bi]_, function globals and module referents. However, any
instances thereof and module objects will be sized when passed as
given objects. Ignored object types are included unless option
*ignored* is set accordingly.
In addition, many ``__...__`` attributes of callable objects are
ignored [#arb]_, except crucial ones, e.g. class attributes ``__dict__``,
``__doc__``, ``__name__`` and ``__slots__``. For more details, see
the type-specific ``_..._refs()`` and ``_len_...()`` functions below.
.. rubric:: Footnotes
.. [#unsafe] The functions and classes in this module are not thread-safe.
.. [#refs] The *referents* of an object are the objects referenced *by*
that object. For example, the *referents* of a ``list`` are the
objects held in the ``list``, the *referents* of a ``dict`` are
the key and value objects in the ``dict``, etc.
.. [#arb] These definitions and other assumptions are rather arbitrary
and may need corrections or adjustments.
.. [#digit] The C ``sizeof(digit)`` in bytes can be obtained from the
``int.__itemsize__`` attribute or since Python 3.1+ also from
attribute ``sys.int_info.sizeof_digit``. Function **leng**
determines the number of ``digits`` of a multi-precision int.
.. [#bi] All ``type``s and ``class``es in modules named in private set
``_ignored_modules`` are ignored like other, standard built-ins.
"""
import sys
import types as Types
import warnings
import weakref as Weakref
from inspect import isbuiltin, isclass, iscode, isframe, isfunction, ismethod, ismodule
from math import log
from os import curdir, linesep
from struct import calcsize
__all__ = ["asizeof"]
__version__ = "22.06.30"
_NN = ""
_Not_vari = _NN # non-variable item size
# Any classes and types in modules named in set _ignored_modules
# are ignored by
没有合适的资源?快使用搜索试试~ 我知道了~
streamlit-Python建立仪表盘、生成报告或创建聊天应用程序
共2000个文件
py:788个
tsx:372个
png:288个
0 下载量 39 浏览量
2024-10-01
00:03:14
上传
评论
收藏 87.47MB ZIP 举报
温馨提示
streamlit-Python建立仪表盘、生成报告或创建聊天应用程序
资源推荐
资源详情
资源评论
收起资源包目录
streamlit-Python建立仪表盘、生成报告或创建聊天应用程序 (2000个子文件)
streamlit.cmd 676B
CODEOWNERS 999B
.coveragerc 250B
vega-embed.css 3KB
vega-tooltip.css 1KB
.dockerignore 109B
.dockerignore 33B
.editorconfig 492B
fireworks.gif 100KB
icon_running.gif 3KB
hostframe.html 6KB
hostframe.html 6KB
index.html 2KB
favicon.ico 1KB
favicon.ico 1KB
MANIFEST.in 100B
mypy.ini 1KB
pytest.ini 421B
pytest.ini 296B
cat.jpg 88KB
bokeh-mathjax-2.4.3.esm.min.js 1.68MB
bokeh.esm.js 782KB
bokeh-tables-2.4.3.esm.min.js 285KB
bokeh-widgets-2.4.3.esm.min.js 246KB
bokeh-gl-2.4.3.esm.min.js 187KB
bokeh-api-2.4.3.esm.min.js 86KB
iframerResizer.min.js 14KB
.eslintrc.js 7KB
craco.config.js 5KB
create.js 5KB
jest.config.js 3KB
fileTransform.js 2KB
use-strict-null-equality-checks.js 2KB
use-strict-null-equality-checks.test.js 2KB
jsdom-polyfill-env.js 1KB
setupTestEnv.js 1KB
cssTransform.js 1KB
babelTransform.js 1KB
babel-preset-dev-env.js 895B
babel-preset-test-env.js 888B
index.js 825B
babel.config.js 820B
test_html.js 22B
package.json 6KB
package.json 5KB
package.json 2KB
package.json 1KB
launch.json 719B
tsconfig.json 611B
tsconfig.json 516B
tsconfig.json 326B
babel.config.json 258B
extensions.json 233B
package.json 212B
tsconfig.dev.json 172B
tsconfig.prod.json 124B
tsconfig.json 96B
LICENSE 11KB
Material-Icons.LICENSE 11KB
LICENSE 11KB
Source-Sans-Pro.LICENSE 4KB
Source-Serif-Pro.LICENSE 4KB
Source-Code-Pro.LICENSE 4KB
Open-Iconic.LICENSE 1KB
yarn.lock 768KB
yarn.lock 201KB
Makefile 15KB
README.md 6KB
CODE_OF_CONDUCT.md 3KB
RELEASE_NOTES.md 3KB
readme.md 1KB
CONTRIBUTING.md 753B
pull_request_template.md 368B
README.md 361B
SECURITY.md 296B
README.md 229B
sintel-short.mp4 21.27MB
NOTICES 1.01MB
.nvmrc 6B
Pipfile 1KB
flake-2.png 90KB
flake-1.png 84KB
st_markdown-many_elements_in_one_block[dark_theme-firefox].png 80KB
st_markdown-many_elements_in_one_block[light_theme-firefox].png 80KB
flake-0.png 72KB
st_markdown-many_elements_in_one_block[dark_theme-chromium].png 57KB
st_markdown-many_elements_in_one_block[light_theme-chromium].png 55KB
st_markdown-many_elements_in_one_block[dark_theme-webkit].png 54KB
deploy_dialog[dark_theme-firefox].png 54KB
st_markdown-many_elements_in_one_block[light_theme-webkit].png 53KB
deploy_dialog[light_theme-firefox].png 52KB
st_markdown-headers_in_labeled_columns[firefox].png 43KB
st_markdown-headers_in_columns[firefox].png 38KB
st_markdown-headers_via_multiple_commands[firefox].png 36KB
st_markdown-headers_joined_in_single_command[firefox].png 36KB
st_markdown-with_large_image[firefox].png 33KB
deploy_dialog[light_theme-webkit].png 33KB
deploy_dialog[dark_theme-webkit].png 32KB
deploy_dialog[light_theme-chromium].png 31KB
deploy_dialog[dark_theme-chromium].png 31KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Unity打怪升级
- 粉丝: 1w+
- 资源: 208
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- HTML与CSS制作的静态圣诞树图案教程
- 基于STM32单片机的智能晾衣架高分项目源码(小白也可实战).zip
- STM32+ESP8266 WIFI遥控小车源码
- C# winform新版盒盖机[完整源码解压后1.8G].zip
- Python实现控制台圣诞树图形打印
- node-v20.10.0-x64.msi 下载
- 约瑟夫问题及递推公式的计算机科学应用
- 基于stm32f103c8t6的智能台灯源码
- 本地磁盘学习使用仅供参考
- C# winform-SerialPort串口Demo.zip
- putty远程连接服务器利器,ssh连接工具
- 二维码生成工具,适用于window平台汉字转二维码的工具,文本传输
- openEuler 22.03-SP4 在线部署 Kubernetes
- C# WPF-CCS线体,写的测试MES用的Demo .zip
- 自动蒸馏清洁机sw18可编辑全套技术开发资料100%好用.zip
- C++实现Qt和Mysql的智能停车场管理系统源码+数据库(高分项目)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功