跳转到主要内容

废弃Python版本的回滚版本

项目描述

pylegacy

这个库旨在将Python新版本中的回滚内容移植到废弃的Python版本中。

pylegacy包的树状结构类似于Python标准库,即pylegacy包含pylegacy.abcpylegacy.builtinspylegacy.os等。如果某个功能有回滚版本可用,则可以通过从pylegacy命名空间导入该功能来使用它。

例如,Python 2.7中的os.makedirs缺少在Python 3.2中首次引入的exist_ok参数。为了启用此功能,需要将以下失败的代码片段替换为以下有效的代码片段

import os
os.makedirs("example_folder", exist_ok=True)
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
# TypeError: makedirs() got an unexpected keyword argument 'exist_ok'

...

from pylegacy import os
os.makedirs("example_folder", exist_ok=True)

许可证

pylegacy包在MIT许可证下发布(参见LICENSE文件)

Copyright (c) 2021-2024 Víctor Molina García

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

《pylegacy》包的很大一部分是 Python 标准库的派生作品。Python 源代码根据 PSF-2.0 许可协议发布,版权所有 (c) 2001-2022 Python 软件基金会,保留所有权利。可以在 LICENSE.PSF-2.0 文件中找到 PSF-2.0 许可协议的副本。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源代码分发

pylegacy-0.2.1.zip (36.4 kB 查看哈希值)

上传时间 源代码

构建分发

pylegacy-0.2.1-py2.py3-none-any.whl (14.5 kB 查看哈希值)

上传时间 Python 2 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面