Skip to main content

A module for reading and writing an RSV document file.

Project description

rsv.py

Description

A module for reading and writing an RSV document file.

Using

import rsv

sample_data = [
    ["Name", "Description", None],
    [],
    [None, ":)"]
]

with open("document.rsv", "wb") as file:
    rsv.dump(sample_data, file)

# The first load method.
# It is the most efficient and suitable for working even with large arrays.
# Since it loads data from the file sequentially when loading.
with open("document.rsv", "rb") as file:
    data = rsv.load(file)

# The second load method.
# It is suitable for working with small arrays.
# Since it loads the entire file into memory at once and only then parses it.
with open("document.rsv", "rb") as file:
    data = rsv.load_split(file)

# The third load method.
# This is the most efficient possible method suitable for working with any arrays of any size.
# Loads the file line by line, the use of `for` is required.
with open("document.rsv", "rb") as file:
    lines = []
    for line in file.load_generator():
        # And here you can do whatever you want...
        lines.append(line)

Notes

It is also worth noting that no one forbids you to use the Encoder/Decoder directly:

import rsv

rsv_encoder = rsv.Encoder(open("document.rsv", "wb"))
rsv_decoder = rsv.Decoder(open("document.rsv", "rb"))

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

rsv-1.5.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

rsv-1.5.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file rsv-1.5.0.tar.gz.

File metadata

  • Download URL: rsv-1.5.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.5 Windows/10

File hashes

Hashes for rsv-1.5.0.tar.gz
Algorithm Hash digest
SHA256 e536ac0eb349419917a85f75db46e20362b76d41f9e1308f01c5ceb73d7e44ca
MD5 45512df14bd210030341ca31b14fb732
BLAKE2b-256 f17a1424d0df916625be0d08503b87c57d0454400994dd680d8e4d949298ab80

See more details on using hashes here.

File details

Details for the file rsv-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: rsv-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.5 Windows/10

File hashes

Hashes for rsv-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e62483dfe2d63d86aaa4920e50f37ff8c7614a76cf309b964a734bfb1924a90d
MD5 f9d405c9cba8d4ddd0b6a1b385a08f36
BLAKE2b-256 d2f470cf7d892d41beba6f00f51eb14317aa6cd72cabb9614d1ba107cf3b8f37

See more details on using hashes here.

Supported by

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