focal
Data Access Objects for local files.
focal re-exports the file-system stores of dol (Files, TextFiles, PickleFiles, ...) and adds multi_extension_wrap, which serializes by file extension.
Examples
The examples below run as doctests (pytest tests/test_readme.py).
a dict-like view of a folder
>>> import os, tempfile
>>> from focal import Files, TextFiles
>>>
>>> rootdir = tempfile.mkdtemp()
>>> store = Files(rootdir) # keys are relative paths, values are bytes
>>> store['foo'] = b'baz'
>>> 'foo' in store
True
>>> store['foo']
b'baz'
>>> os.listdir(rootdir) # it is a real file
['foo']
>>> texts = TextFiles(rootdir) # same folder, values are str
>>> texts['foo']
'baz'
>>> del store['foo']
bytes contents of a file, and key validation
>>> import os, tempfile
>>> from focal import Files
>>>
>>> rootdir = tempfile.mkdtemp()
>>> s = Files(rootdir)
>>> s['hello.txt'] = b'import os'
>>> s['hello.txt'][:6]
b'import'
>>> s['../escape'] # keys outside the root folder are refused
Traceback (most recent call last):
...
dol.filesys.KeyValidationError: ...
>>> try:
... s['no_such_file']
... except KeyError:
... print("KeyError (not FileNotFoundError) was raised.")
KeyError (not FileNotFoundError) was raised.
serialize by extension
See focal.extension_store.multi_extension_wrap.
Metadata
Release files for focal 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| focal-0.1.15.tar.gz | 23.6 kB | Without provenance | Details for focal-0.1.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| focal-0.1.15-py3-none-any.whl | Python 3 | none | any | Details for focal-0.1.15-py3-none-any.whl |
Total release size: 44.0 kB
Release files / focal-0.1.15.tar.gz
| Download URL | focal-0.1.15.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9e76a4164fece44ba905ac46d35356ae51dd3798bb148d0b8d807a9ae033da0
|
|
BLAKE2b-256 checksum How to use checksums |
5c0ab90b1d5f60c424a4b32836f25857f5977a5721cca4095f300f311dd73814
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / focal-0.1.15-py3-none-any.whl
| Download URL | focal-0.1.15-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4723f7e161b63aadbf897b3d015205354eb881ec19dd334f5141ba92e6ee3bf9
|
|
BLAKE2b-256 checksum How to use checksums |
b9c86735cd99a6965c9e1c71de29495b07f9a976f5927f2f89864623e904b86d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for focal 0.1.15
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.