The magical switch switcher !
```python
import magwitch
@magwitch.on
def save_figure(in_png:bool=False, legend:bool=True):
... # an implementation we do not care about for the example
return in_png
# Now, you can set the value of the boolean arguments by giving their name:
assert save_figure.in_png() is True
# Or not:
assert save_figure.not_in_png() is False
# Also, you can do it multiple times:
save_figure.not_in_png.no_legend()
# The last set is autoritative
assert f.not_in_png.in_png() is True
# And there is many other options if you want to !
@magwitch.on_with(use_defaults=True, enable='do_', disable=('nope_', 'never_'):
def f(a:bool=False): return a
# effect of use_defaults
assert f.do_a() is False
```
See the [tests](test/) for complete API, and the docstring of `Magwitch.build`
for a description of all available parameters.
Install with
pip install magwitch
Metadata
Release files for magwitch 0.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 |
|---|---|---|---|---|
| magwitch-0.1.0.tar.gz | 3.8 kB | Without provenance | Details for magwitch-0.1.0.tar.gz |
Release files / magwitch-0.1.0.tar.gz
| Download URL | magwitch-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c8760f07857ab1e674b770905f38f9c572ac40a2180535e68345b6728bea134
|
|
BLAKE2b-256 checksum How to use checksums |
1812d5c09ece8438e9a7525d83d86d222ba6142cb9e93a878e3980413345f145
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for magwitch 0.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.