Skip to main content

The toolbox for json load save and print, you may find more function in the future.

Project description

toolbox-iop - JSON 处理工具箱

PyPI Version Python Versions License

The essential toolbox for JSON operations: loading, saving, printing, and more.
JSON 操作必备工具箱:加载、保存、打印等实用功能


Features / 功能特点

  • 🚀 Advanced Printing - Flexible file reading with multiple options
    高级打印 - 支持多种选项的灵活文件读取
  • 🎲 Random Access - Read lines in random order
    随机访问 - 支持随机顺序读取内容
  • 🔍 Keyword Filtering - Find specific content by keywords
    关键词过滤 - 通过关键词筛选特定内容
  • 🔁 Loop Mode - Continuously display all content
    循环模式 - 持续显示所有内容
  • 📊 Quantity Control - Read specific amount of content
    数量控制 - 读取特定数量的内容
  • ⚙️ Output Control - Toggle printing as needed
    输出控制 - 根据需要开关打印输出
  • ✔️ Python 3.6+ - Compatible with modern Python versions
    Python 3.6+ - 兼容现代 Python 版本

Installation / 安装

pip install toolbox-iop

Command Line Tools / 命令行工具

1. Print File Content / 打印文件内容

toolbox-iop-print path/to/file.json [options]

功能特点:

  • Multiple reading modes / 多种读取模式
  • Keyword filtering / 关键词过滤
  • Content output control / 内容输出控制
  • Quantity control / 数量控制

参数 / Arguments

选项 描述 默认值
file_path File path to read (必需)
文件路径 要读取的文件路径 (必需)
-r, --random Read lines in random order False
-r, --random 随机顺序读取内容 关闭
-k KEY, --key KEY Filter lines by keyword "" (all)
-k KEY, --key KEY 按关键词过滤行 "" (全部)
-a, --all Continuously display all content False
-a, --all 持续显示所有内容 关闭
-n NUMBER, --number NUMBER Number of lines to read "1.0" (all)
-n NUMBER, --number NUMBER 读取的行数 "1.0" (全部)
--print_off Disable output printing True (print on)
--print_off 关闭打印输出 开启

2. Check for Duplicates / 检查ID字段重复项

toolbox-iop-duplicate path/to/file.json --key KEY

功能特点:

  • Duplicate key detection / 重复键检测。默认为id字段
  • JSON structure validation / JSON 结构验证
  • Progress visualization / 进度可视化

3. Count JSON/JSONL List Length / 统计JSON/JSONL列表长度

toolbox-iop-count path/to/file [options]

功能特点:

  • Auto-detect JSON/JSONL format / 自动检测JSON/JSONL格式
  • List length counting / 列表长度统计
  • Force format parsing / 强制指定格式解析

参数 / Arguments

选项 描述 默认值
file_path File path to count (必需)
文件路径 要统计的文件路径 (必需)
-j, --json Force parse as JSON file False
-j, --json 强制解析为JSON文件 关闭
-l, --jsonl Force parse as JSONL file False
-l, --jsonl 强制解析为JSONL文件 关闭

Usage Examples / 使用示例

Basic File Reading / 基础文件读取

# Read single file / 读取单个文件
toolbox-iop-print data.json

# Read random lines / 随机读取行
toolbox-iop-print log.txt -r

# Filter by keyword / 按关键词过滤
toolbox-iop-print records.json -k "error"

# Continuous display / 持续显示内容
toolbox-iop-print stream.json -a

# Read specific quantity / 读取特定数量
toolbox-iop-print log.txt -n 10  # Read 10 lines
toolbox-iop-print data.json -n 0.5  # Read 50% of content

Duplicate Checking / 重复项检查

# Check file / 检查文件
toolbox-iop-duplicate data.json

toolbox-iop-duplicate data.json --key name

Count List Length / 统计列表长度

# Auto-detect format / 自动检测格式
toolbox-iop-count data.json

toolbox-iop-count data.jsonl

# Force parse as JSON / 强制解析为JSON
toolbox-iop-count data.json --json

# Force parse as JSONL / 强制解析为JSONL
toolbox-iop-count data.jsonl --jsonl

Dependencies / 依赖项

  • Rich - Terminal formatting / 终端格式化
  • tqdm - Progress bars / 进度条显示

Contributing / 贡献指南

Contributions are welcome! Please open an issue or submit a PR:
欢迎贡献代码!请提交 issue 或 PR:
https://github.com/yourusername/toolbox-iop


License / 许可证

MIT License - Free for personal and commercial use
MIT 许可证 - 可免费用于个人和商业用途

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

toolbox_iop-0.1.7.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

toolbox_iop-0.1.7-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file toolbox_iop-0.1.7.tar.gz.

File metadata

  • Download URL: toolbox_iop-0.1.7.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toolbox_iop-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b32a00ffedfa687b716abf26bc6fe2484a160421b7cec3d684d651df1d635647
MD5 1d1d631bef76d9f4f06ce793efd97953
BLAKE2b-256 96a0ef1d42c90c4494ab1a8b8206fc83204471ecc2c0c495c63faefe1d7bc90e

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolbox_iop-0.1.7.tar.gz:

Publisher: python-publish.yml on scorpionfree98/toolbox-iop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file toolbox_iop-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: toolbox_iop-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toolbox_iop-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 639654685bea5ad36634429b7ef30cabee675ea502989040c19043c89e719f50
MD5 5b36f29c51c8792a7111c32eeddcd086
BLAKE2b-256 b8b45352a11345965ee8e9303946d5a8d55ebe994e2696d637880d374a9eb474

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolbox_iop-0.1.7-py3-none-any.whl:

Publisher: python-publish.yml on scorpionfree98/toolbox-iop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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