Metadata-Version: 2.1 Name: empty-files Version: 0.0.9 Summary: Serves empty files of many types Home-page: https://github.com/approvals/EmptyFiles.Python Author: empty_files Contributors Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: MacOS :: MacOS X Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities Requires-Python: >=3.7.1 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: requests # EmptyFiles.Python [![PyPI version](https://img.shields.io/pypi/v/empty-files.svg)](https://pypi.org/project/empty-files) [![Test](https://github.com/approvals/EmptyFiles.Python/actions/workflows/test.yml/badge.svg)](https://github.com/approvals/EmptyFiles.Python/actions/workflows/test.yml) **TL;DR** Null Object pattern for files. ## Contents * [Setup](#setup) * [Usage](#usage) * [Null Object Pattern](#null-object-pattern) * [Attributions](#attributions) 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](https://pypi.org/project/empty-files/): pip install empty-files ## Usage This code: ```py from empty_files.empty_files import create_empty_file create_empty_file("temp/empty.jpg") ``` snippet source | anchor will create the following [image](tests/test_empty_files.test_sample.approved.jpg) ## 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: ```python name_length = len(person.last_name()) ``` instead of : ```python 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](https://github.com/VerifyTests/EmptyFiles/tree/main/index).