optional-faker
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.
Metadata
Release files for optional-faker 2.1.0
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 |
|---|---|---|---|---|
| optional_faker-2.1.0.tar.gz | 14.5 kB | Without provenance | Details for optional_faker-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| optional_faker-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for optional_faker-2.1.0-py3-none-any.whl |
Total release size: 29.2 kB
Release files / optional_faker-2.1.0.tar.gz
| Download URL | optional_faker-2.1.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a09f1db6a3f96d65e28c606e084e8c3259c1a6d4955a84e5f19c801137cc253
|
|
BLAKE2b-256 checksum How to use checksums |
c7a7a3057ca990bc5b6e1df8f341de6ba651262f398813330778123de9cc25ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
|
Release files / optional_faker-2.1.0-py3-none-any.whl
| Download URL | optional_faker-2.1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e6a9c1c576a8de6a7d266955364e162991a3aab03d77130ad0932fbec8012c9
|
|
BLAKE2b-256 checksum How to use checksums |
0b6075f0766fcb0ec9714c897e1f801653724280b99270fe41f7ee34f91f2a68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
|
Security for optional-faker 2.1.0
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.