Skip to main content

常用 Python 组件

Project description

user_tools

一些个人常用的模块。 The English README

注意:

user_tools v2.0.0 以上版本与之前版本代码完全不一致,若正在使用旧版本代码,请指定 user_tools<=2.0.0

当前代码为进行完整测试,可能存在一些 bug,会在后续使用中进行处理

以下文件中的代码可能存在风险,使用时请提前检查安全风险。 user_tools.common.ucmd.py: 未对待执行的命令进行安全检查。 user_tools.db.umysql.py: 未对待执行的 SQL 进行安全检查 user_tools.file.ucompress.py: 未对压缩包文件进行检查。尤其在 Unix 系统使用 tarfile 插件时需要注意 user_tools.file: 所有对文件的修改,都允许删除或强行覆盖,使用时需要注意。

目录

背景

  • 在项目开发过程中, 涉及很多相同的功能, 每次编写相同的代码很浪费时间, 且并不是每次都能想到具体的实现代码, 因此开发了这个 Python 模块, 包含了常用的一些方法。

安装方式

  • 由于此模块已发布到 PyPi, 所以可以直接使用 pip 进行安装, 命令为: pip install user_tools

使用方法

  • 这是一个 user_tools.common.utime 的使用示例:
from user_tools.common import utime

# 输出给定的时间是否符合给定的时间格式, 默认时间格式为 %Y-%m-%d %H:%M:%S
is_time = utime.validate_datetime('2024-01-01 10:10:10')

相关项目

  • 暂无。若有已知被使用的开源项目, 会在这里标注

注意:

可能存在已被使用的开源代码或基于开源代码进行的二次开发。因本工具主要方便个人使用, 且开源代码来源未知, 所以未注明具体来源 如果您认为侵权, 请通过邮件或 GitHub 联系我删除。 如果我知道代码的来源, 我会加以说明。

开源协议

  • 此项目使用的开源协议为: GNU LGPLv3

待办

  • user_tools.network.ussh: 未实现

  • user_tools.db: 增加 sqlite、ck 查询方法

  • user_tools.file.uexcel: 增加写文件/读文件方法,并且独立单个 Sheet 写入方法

  • user_tools.file.ufile: 增加文件清理逻辑

  • user_tools.file.ufile: 中需要考虑读写的换行符问题。同时增加入参,用于指定是否需要对每行数据进行 strip

  • user_tools.file.upath: 增加文件查找功能, 参考 path_get 方法, 增加 ignore_dict 参数

  • user_tools.network: 新建 uapi.py 文件, 构建默认 API 方法

  • user_tools.network.unet: 增加网络校验功能, 如端口检测, ping 检测, 后续增加 IP 信息的方法, 如CIDR地址格式, 地址排序等等。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

user_tools-2.0.0a0.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

user_tools-2.0.0a0-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file user_tools-2.0.0a0.tar.gz.

File metadata

  • Download URL: user_tools-2.0.0a0.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for user_tools-2.0.0a0.tar.gz
Algorithm Hash digest
SHA256 70900433703771a17ace1b3e2c361cf8c7e934510b34e99bcbe2591f8674f836
MD5 acb1c80d39c8f28ef8a113b8f3a32166
BLAKE2b-256 2c9d2e23d3ca6b1147d68a661e3fc65d255ccf05d0ae62d466fe9b131db22a56

See more details on using hashes here.

File details

Details for the file user_tools-2.0.0a0-py3-none-any.whl.

File metadata

  • Download URL: user_tools-2.0.0a0-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for user_tools-2.0.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 8362acc6c317b30db9e57ad5d1f4926dbfef44ed07834b2d26a9dc12f90f6f0b
MD5 667a1fba5800feded984c635ca579b0c
BLAKE2b-256 85ee8bf10514a3519f6491d5446a401d1bdfe5dc9ecd8634b63963bf73dd20c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page