Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

optional-faker

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optional-faker

Small wrapper around faker, to make values optional!

  • 2.1.0
  • PyPI
  • Socket score

Maintainers
1

optional-faker

Support Ukraine

Build Status Code style: black Python support versions badge (from pypi)

Small wrapper around faker, to make values optional!

Note that faker added own optional proxy, which however can be used only with callables. This is why in version 2.0.0 we renamed our method to none_or.

Example

>>> from faker import Faker
>>> import optional_faker
>>>
>>> fake = Faker()
>>> Faker.seed(1555)
>>>
>>> # `fake.none_or` can take any value, and return it, or None.
>>> fake.none_or(fake.pystr())
'scHhghRDleajCHjEYWAu'
>>> fake.none_or(fake.pystr())
None
>>> # or it can take callable, and *args with **kwargs
>>> # that will be passed to this callable.
>>> fake.none_or(fake.pystr, 1, max_chars=10)
'zmZUcJVTYX'
>>> fake.none_or(fake.pystr, 1, max_chars=10)
None
>>> # there is no explicit check is callable a faker part,
>>> # so you can pass anything.
>>> fake.none_or(lambda: "my callable!")
'my callable!'
>>> fake.none_or(lambda: "my callable!")
None

Installing

pip install optional-faker

And then you need to import optional_faker anywhere but before creating Faker instance.

Installing for local developing

git clone https://github.com/PerchunPak/optional-faker.git
cd optional-faker

Installing poetry

Next we need install poetry with recommended way.

If you use Linux, use command:

curl -sSL https://install.python-poetry.org | python -

If you use Windows, open PowerShell with admin privileges and use:

(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -

Installing dependencies

poetry install

If something is not clear

You can always write me!

Updating

pip install -U optional-faker

For local development

For updating, just re-download repository, if you used git for downloading, just run git pull.

Thanks

This project was inspired by faker-optional.

This project was generated with python-template.

Keywords

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