Skip to main content

fies

下の方に日本語の説明があります

Overview

  • A tool to easily read and write json files, YAML files, pickle files, binary files, csv files and plain text files.

Usage

import fies

# Save json file
fies["./test.json"] = {"hoge": 23, "dummy_data": "fuga"}

# Read json file
print(fies["./test.json"])	# -> {'hoge': 23, 'dummy_data': 'fuga'}

# Save plain text file
fies["./test.txt"] = "hogehoge"

# Read plain text file
print(fies["./test.txt"])	# -> hogehoge

# Save pickle file
fies["./test.pickle"] = [("hoge", 23), 5.7]

# Read pickle file
print(fies["./test.pickle"])	# -> [('hoge', 23), 5.7]

# Save csv file
fies["./test.csv"] = [
	["hoge", "fuga"],
	[23, True],	# Numbers and bool types will be automatically converted to strings.
	['Hey, "Escape" man!\n']	# Any line breaks, commas, or double quotation marks will be automatically escaped.
]

# Save YAML file
fies["./test.yml", "yaml"] = {"hoge": {"fuga": 13, 77: [1,2]}}

# Checking if a file exists
print("test.pickle" in fies)	# -> True
print("hoge.txt" in fies["input_dir"])	# -> True

# delete file
del fies["input_dir"]["hoge.txt"]

Advanced usage

# Save binary file
fies["./test.bin", "binary"] = b"hoge"

# format-specified save
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}

# Recursive Enumeration of Files (Returns a list of absolute paths)
print(fies["./input_dir/"].all())
print(fies["./input_dir/"].rec())	# This notation works the same as above

概要

  • jsonファイル, YAMLファイル, pickleファイル, バイナリファイル, csvファイル, プレーンテキストのファイルを簡単に読み書きできるツールです。

使い方

import fies

# jsonファイル保存
fies["./test.json"] = {"hoge": 23, "dummy_data": "fuga"}

# jsonファイル読み込み
print(fies["./test.json"])	# -> {'hoge': 23, 'dummy_data': 'fuga'}

# プレーンテキストファイル書き出し
fies["./test.txt"] = "hogehoge"

# プレーンテキストファイル読み込み
print(fies["./test.txt"])	# -> hogehoge

# pickleファイル書き出し
fies["./test.pickle"] = [("hoge", 23), 5.7]

# pickleファイル読み込み
print(fies["./test.pickle"])	# -> [('hoge', 23), 5.7]

# csvファイル書き出し
fies["./test.csv"] = [
	["hoge", "fuga"],
	[23, True],	# 数値や真理値型のものは文字列に変換される
	['Hey, "Escape" man!\n']	# 改行やカンマ、ダブルクオーテーションがある場合は自動的にエスケープされる
]

# yamlファイル書き出し
fies["./test.yml", "yaml"] = {"hoge": {"fuga": 13, 77: [1,2]}}

# ファイルの存在確認
print("test.pickle" in fies)	# -> True
print("hoge.txt" in fies["input_dir"])	# -> True

# ファイルの削除
del fies["input_dir"]["hoge.txt"]

発展的な使い方

# バイナリファイル書き出し
fies["./test.bin", "binary"] = b"hoge"

# フォーマット指定書き出し
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}

# ファイルの再帰的列挙 (絶対パスのリストが返る)
print(fies["./input_dir/"].all())
print(fies["./input_dir/"].rec())	# この書き方でも上記と同様

Metadata

Release files for fies 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fies 1.6.0
File Size Uploaded Provenance Actions
fies-1.6.0.tar.gz 5.4 kB Without provenance Details for fies-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fies 1.6.0
File Interpreter ABI Platform Actions
fies-1.6.0-py3-none-any.whl Python 3 none any Details for fies-1.6.0-py3-none-any.whl

Total release size: 11.4 kB

Release files / fies-1.6.0.tar.gz

Download URL fies-1.6.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
466b6597ba37d2e42e53835300acb5c526047cec5dd6280e8c26fda55e2088d4
BLAKE2b-256 checksum
How to use checksums
e084fc9b5db6823d7780a9b32cc00773a7619311884ef957734bfff2e894e857
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release files / fies-1.6.0-py3-none-any.whl

Download URL fies-1.6.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
575f08234b08adf5cf7e87fbb8afed0f318eea2c3b2c47ccda091e598b0ce2cc
BLAKE2b-256 checksum
How to use checksums
5693a451db96af1d4a67756dadb909eabe0eb2f2b88849172e4d3daef2817090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Security for fies 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page