Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romanin-rf/rsv
A module for reading and writing an RSV document file.
https://github.com/romanin-rf/rsv
document file io read rsv write
Last synced: 26 days ago
JSON representation
A module for reading and writing an RSV document file.
- Host: GitHub
- URL: https://github.com/romanin-rf/rsv
- Owner: romanin-rf
- License: mit
- Created: 2024-01-06T19:12:06.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-11-12T00:29:13.000Z (about 2 months ago)
- Last Synced: 2024-11-12T01:23:22.196Z (about 2 months ago)
- Topics: document, file, io, read, rsv, write
- Language: Python
- Homepage: https://pypi.org/project/rsv
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rsv.py
# Description
A module for reading and writing an [RSV](https://github.com/Stenway/RSV-Challenge) document file.# Using
```python
import rsvsample_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:
```python
import rsvrsv_encoder = rsv.Encoder(open("document.rsv", "wb"))
rsv_decoder = rsv.Decoder(open("document.rsv", "rb"))
```