https://github.com/eackermann/snarky
Snarky is a useless Python package that makes it easy to add a jk (just kidding!) keyword argument to any function.
https://github.com/eackermann/snarky
lol python useless
Last synced: 5 months ago
JSON representation
Snarky is a useless Python package that makes it easy to add a jk (just kidding!) keyword argument to any function.
- Host: GitHub
- URL: https://github.com/eackermann/snarky
- Owner: eackermann
- License: other
- Created: 2018-04-05T19:13:56.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-06T17:26:01.000Z (about 8 years ago)
- Last Synced: 2025-11-27T21:18:33.033Z (7 months ago)
- Topics: lol, python, useless
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
======
Snarky
======
Snarky is a useless Python package that makes it easy to add a ``jk`` (just kidding!) keyword argument to any function. Moreover, snarky defines several default behaviors for reacting whenever jk==True.
Quick examples
==============
Using snarky is really easy. Suppose we have a function:
.. code-block:: python
def my_func(a, b):
"""Sample function with arguments."""
return a*b
Then calling our function might look like this:
.. code-block::
>>> my_func(4, 5)
20
>>> my_func(a=3, b=7)
21
>>> my_func(a=3, b=7, jk=True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 my_func(a=3, b=7, jk=True)
TypeError: my_func() got an unexpected keyword argument 'jk'
But that's lame! What function doesn't give you the option to say 'just kidding!', right?
That's where ``snarky`` shines!
Simply add one of several default behaviors, or even define your own! Here, we will apply the default snarky behavior to our function:
.. code-block:: python
from snarky import *
@snarky
def my_func(a, b):
"""Sample function with arguments."""
return a*b
Now calling our function might look like this:
.. code-block::
>>> my_func(4, 5)
20
>>> my_func(a=3, b=7)
21
>>> my_func(a=3, b=7, jk=True)
LOL! Then why are you asking me to run 'my_func'? Unbelievable!
21
And the day is saved.
Installation
============
The easiest way to install snarky is to use ``pip``. From the terminal, run:
.. code-block:: bash
$ pip install snarky
Alternatively, you can install the latest version of snarky by running the following commands:
.. code-block:: bash
$ git clone https://github.com/eackermann/snarky.git
$ cd snarky
$ python setup.py install
License
=======
Snarky is distributed under the MIT license. See the `LICENSE `_ file for details.