Novelty mood ring object that returns a mood as a string
Project description
Mood-Ring
Mood-ring object to return a user's mood with available configurations - practice for packaging and distributing software.
Installation
Mood-ring can be installed with pip:
pip install mood-ring
Documentation
The ring class can be instantiated and used as a string to display a mood.
>>> from mood_ring import Ring
>>>
>>> r = Ring()
>>> print(r)
active
The Ring class comes with the following options:
- stressed
- nervous
- unsettled
- active
- relaxed
- lovable
- romantic
- happy
- tired
- calm
Methods
The change method will update the mood of the ring object.
NOTE: When using the change method, the mood will be reset to a different option than currently selected - there is no chance the same mood option will be set again.
>>> r = Ring()
>>> str(r)
'tired'
>>> r.change()
>>> str(r)
'unsettled'
If the possibility of the same outcome is desired, instantiate a new instance of the Ring object.
>>> r = Ring(); str(r)
'stressed'
>>> r = Ring(); str(r)
'stressed'
Custom User-Inputs
To over-write the default outputs, am optional list argument can be accepted to specify the pool of output options the class will output.
>>> r = Ring(['suave', 'sophisticated'])
>>> str(r)
'suave'
To retain the default output list while also adding user-defined outputs, the optional keyword argument 'extend' can accept a list of strings to extend the out-of-the-box behavior.
>>> r = Ring(extend=['million bucks'])
>>> str(r)
'tired'
Weighted User-Inputs
Either of the above arguments can also be passed a dictionary that weights the probability of a certain option being picked - keys are mood option names, and values are weights. In the example below, 'mad' has a 1/5 chance of being returned and 'happy' has a 4/5 chance of being returned.
>>> r = Ring({'mad': 1, 'happy': 4})
>>> str(r)
'happy'
NOTE: The 10 default options are weighted with 1. If using the 'extend' keyword, setting a key as weight 1 gives it equal probability as the original options.
>>> # New option weighted equally with default options
>>> r = Ring(extend={'dopey': 1})
>>> str(r)
'stressed'
>>>
>>> # New option weighted 99x as likely of returning as defaults
>>> r = Ring(extend={'dopey': 99})
>>> str(r)
'dopey'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mood-ring-0.1.0.tar.gz
.
File metadata
- Download URL: mood-ring-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60ddff768b0b3b70377a7e1258964de5f9118677f0a150f9cda627a20c3a0523 |
|
MD5 | f4a17edc4049fbb0bf70eb253d3547de |
|
BLAKE2b-256 | 4bd7d16b2bb4f06d5db343b4086844e60aa4cc66729f2afc11a72f15000cd482 |
Provenance
File details
Details for the file mood_ring-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: mood_ring-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3734f51cba87a8b2c3feea406d39e6a34ac97c7995c27d60e434c209b63b0876 |
|
MD5 | 133ce1b2f895c08c18c3ac870ca10d65 |
|
BLAKE2b-256 | e94d46382f32a9f297143a94a85c9874705701c65d35ebefb2721c7f42ef17cd |