Slot Machine
Have you ever found yourself unclear over which configuration to choose?
Don't choose.
Randomize.
With slot_machine you can now sample any configuration.
Can't settle on a background color? Randomize...
Looking for a reasonable model parameter? Randomize...
Don't know what to eat on Sunday? Randomize...
With slot_machine your next choice will be one you look forward to.
Examples
Simply add your favorite samplers to the configuration:
chicken_nuggets: !SampleRange 5..20
price: !SampleUniform 9.99..20
Specify your dataclass and get rolling:
from dataclasses import dataclass
from slot_machine import SlotsSerializer
@dataclass(slots=True)
class Basket(SlotsSerializer):
chicken_nuggets: int
price: float
yaml_file = """
basket:
chicken_nuggets: !SampleRange 5..10
price: !SampleUniform 9.99..20
"""
surprise_basket = Basket.from_yaml(yaml_file)
Build your own
from dataclasses import dataclass
from slot_machine import SlotsSerializer, MappingSampler
@dataclass(slots=True)
class Basket(SlotsSerializer):
chicken_nuggets: int
splits: list[int]
class SampleSplits(MappingSampler):
@classmethod
def get_sample(cls, n_splits: str, values: str):
n_splits = int(n_splits)
values = list(map(int, values.split("..")))
return sorted([random.randint(*values) for _ in range(n_splits)])
yaml_file = """
basket:
chicken_nuggets: 100
splits: !SampleSplits
n_splits: 3
values: 0..100
"""
surprise_basket = Basket.from_yaml(yaml_file)
Metadata
Release files for slot-machine-serializers 0.4.1
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 |
|---|---|---|---|---|
| slot-machine-serializers-0.4.1.tar.gz | 5.2 kB | Without provenance | Details for slot-machine-serializers-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slot_machine_serializers-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for slot_machine_serializers-0.4.1-py3-none-any.whl |
Total release size: 10.0 kB
Release files / slot-machine-serializers-0.4.1.tar.gz
| Download URL | slot-machine-serializers-0.4.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffb284a3f56fa9d07d986a843413264005e03a3a9c3274caee3ccf4cd2c9b984
|
|
BLAKE2b-256 checksum How to use checksums |
018839da4806bd7e66a02a089c1e53bfbe6edee5140b3df293883b85ac26ce9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / slot_machine_serializers-0.4.1-py3-none-any.whl
| Download URL | slot_machine_serializers-0.4.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d17143c101c284719bac29c7b6aa8e395bd6548d46e8da9fe0ae608adca70ce
|
|
BLAKE2b-256 checksum How to use checksums |
173fa0e3dbc4a4440cebe2a0007084f5bced7659eedd7150ddf0e357fa22f18e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for slot-machine-serializers 0.4.1
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.