Serves empty files of many types
Project Links
Meta
Author: empty_files Contributors
Requires Python: >=3.7.1
Classifiers
Development Status
- 4 - Beta
Intended Audience
- Developers
License
- OSI Approved :: Apache Software License
Operating System
- POSIX
- Microsoft :: Windows
- MacOS :: MacOS X
Programming Language
- Python :: 3
- Python :: 3 :: Only
- Python :: 3.7
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
Topic
- Software Development :: Libraries
- Utilities
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.
0.0.9
Jul 30, 2023
0.0.4
Jun 25, 2023
0.0.3
Oct 31, 2021
0.0.2
Oct 31, 2021
0.0.1.post2
Oct 24, 2021
0.0.1
Oct 24, 2021
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
requests