New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

empty-files

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

empty-files

Serves empty files of many types

  • 0.0.9
  • PyPI
  • Socket score

Maintainers
1

EmptyFiles.Python

PyPI version Test

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")

snippet source | anchor

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc