Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mood-ring-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

mood_ring-0.1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file mood-ring-0.1.1.tar.gz.

File metadata

  • Download URL: mood-ring-0.1.1.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

Hashes for mood-ring-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ca85289c7ebeaf897a6f93aa2e7e8cfbbaeee7ccd13a9aec061e908dd7566c50
MD5 5edb55df89bee33f65f70136a0193490
BLAKE2b-256 c38ee5518e3cdf60897df024a2ea80f3fafafc08f08b653cf9acf74375fc65bf

See more details on using hashes here.

Provenance

File details

Details for the file mood_ring-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mood_ring-0.1.1-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

Hashes for mood_ring-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 044f6e4bb6015870cd67d7f6cb6cfbfd401c53ec5515392d0b0f27f2f5a49ff6
MD5 a405d9f7bbf91d6cbbaba07d45859899
BLAKE2b-256 993ad67d818dbaace324ac5075cdb735b3f117fa018016bc512b692b71567202

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page