Skip to main content

FilesFF - Files For Fun

  • python package to work with file handles
  • use handles of files as parameters without keeping open files
  • replace file handles easily with mocks
  • handle many file types with generic protocol

to install

pip install filesff

Usage

read a json from gzip compressed file:

accessor = json_file_accessor("./file.gz", GzippedFileHandle)
accessor.dump({"json": "data"})

write a protobuf into a temp file

pip install fileff[protobuf]
from google.protobuf.timestamp_pb2 import Timestamp

accessor = temp_protobuf_file_accessor()
now = Timestamp()
now.FromDatetime(datetime.now())
accessor.dump(now)

loaded_now = accessor.load(message_cls=Timestamp)

implement new file format:

class NewFileFormatter(FullTextFileFormatter):
    def load(self, reader: TextIO, **_) -> AnyStr:
        return reader.read().replace("a", "e")

    def dump(self, writer: TextIO, value: Any, **_):
        writer.write(value.replace("e", "a"))

use it

file_accessor = FullFileAccessor.of("./path.ae", NewFileFormatter())
file_accessor.dump("ababab")

Metadata

Release files for filesff 0.0.4

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

Source distribution (sdist)

Source distribution for filesff 0.0.4
File Size Uploaded Provenance Actions
filesff-0.0.4.tar.gz 6.0 kB Without provenance Details for filesff-0.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 14.4 kB

Release files / filesff-0.0.4.tar.gz

Download URL filesff-0.0.4.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
911fcdd65bf4ec36b24d596179115e129d39be5a7624217171c467c28a4c67ff
BLAKE2b-256 checksum
How to use checksums
4d86d91d8acd5ce6fda547935074548739fd368fc146cdd4faf21576a0e4eed2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.11.1 Windows/10

Release files / filesff-0.0.4-py3-none-any.whl

Download URL filesff-0.0.4-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c29df0002020d9608b6f9937495de5609713b8b2dd779e5bb00a10853d3a0b90
BLAKE2b-256 checksum
How to use checksums
3e52e995f5ad556a4cc2e2bbb27ca8f5280e6a7d8d6f3b6b1d26fafcf43e1ccf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.11.1 Windows/10

Security for filesff 0.0.4

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