Skip to main content

sometimes

Stop being so black and white. Mix things up a bit and execute code sometimes. This is a Python port of the Ruby sometimes gem.

Installation

You can install via pip:

$ pip install sometimes

Or by cloning from Github:

$ git clone git@github.com:aaronbassett/sometimes.git
$ cd sometimes
$ python setup.py install

Usage

Say something every other time:

from sometimes import sometimes

@sometimes
def hello():
    print "Hey, you are awesome. You really are."  # executes warm fuzzies 50% of the time

Have a 50% chance of saying something:

from sometimes import sometimesish

@sometimesish
def hello():
    print "Hey, you are awesome. You really are."

Maybe you want to do something several times, but not always the exact same number of times:

from sometimes import times

@times(4,10)
def pick_nose():
    pass

Maybe you want to remind someone of something, but not toooo often (It gets annoying!):

from sometimes import percent_of_the_time

@percent_of_the_time(15)
def naughty():
    print "Howdy, Don't forget to register!"  # be annoying, but only 15% of the time

@percent_of_the_time(33)
def be_very_polite():
    pass

Share a rare moment with your user:

from sometimes import rarely

@rarely()
def spam():
    print "How would you like some spammy spam spam!"  # be really annoying about 5% of the time

Do something most of the time:

from sometimes import mostly

@mostly()
def be_awesome():
    print "Want to see something really cool?"  # Be awesome about 95% of the time

Hold on a minute

Why does it have @sometimes and @sometimesish? I wanted sometimes to behave as described by the gem docs, not how it operates in the gem. I included sometimesish if anyone wanted the gem style functionality.

License

MIT: http://aaron.mit-license.org

Metadata

Release files for sometimes 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sometimes 0.1.3
File Size Uploaded Provenance Actions
sometimes-0.1.3.tar.gz 2.8 kB Without provenance Details for sometimes-0.1.3.tar.gz

Release files / sometimes-0.1.3.tar.gz

Download URL sometimes-0.1.3.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2cc48190048766e5054499de620fea274f028635ff96d3cb3949a28cedc32729
BLAKE2b-256 checksum
How to use checksums
150cca99dd638c1706006b1c7dda65bf606bf09e9517937fcdae9176a356ec3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for sometimes 0.1.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page