EmptyFiles.Python
TL;DR Null Object pattern for files.
Contents
This project will create an empty file of a type requested. If possible, that file will be the smallest valid file for that type. For example, an empty jpg will be a 1x1 pixel jpg.
Setup
From pypi:
pip install empty-files
Usage
This code:
from empty_files.empty_files import create_empty_file
create_empty_file("temp/empty.jpg")
will create the following image
Null Object Pattern
Issue: null/None causes extra checks in order to avoid errors.
Solution: return an empty version of the object, so methods can be used normally.
Example:
if last_name returns "" instead of None,
we can write:
name_length = len(person.last_name())
instead of :
name_length = 0
if (person.last_name())
name_length = len(person.last_name())
Attributions
The empty files are taken from Simon Cropp's Empty Files.
Metadata
Release files for empty-files 0.0.9
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 |
|---|---|---|---|---|
| empty-files-0.0.9.tar.gz | 6.8 kB | Without provenance | Details for empty-files-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| empty_files-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for empty_files-0.0.9-py3-none-any.whl |
Total release size: 14.0 kB
Release files / empty-files-0.0.9.tar.gz
| Download URL | empty-files-0.0.9.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22e74de327271ef9592a661aaa53bb1d5fa6cfd539dac7315625c8b30b7292ae
|
|
BLAKE2b-256 checksum How to use checksums |
0e19ac55ab18403da2885b3fd5baa7974b12d8a3c59ee56ea185a9a80632839b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / empty_files-0.0.9-py3-none-any.whl
| Download URL | empty_files-0.0.9-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9af04feacd5858d1255a00e76926a2d760f6d05c3c5a8df58abd6be21da742c2
|
|
BLAKE2b-256 checksum How to use checksums |
3c4cd5b6973c9f10992a2aee9c4cb542b25ebdabe907243d6c9650c89dbf578b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for empty-files 0.0.9
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.