semvec/pypi-packages huggingface dataset:
sqlfunc 0.1
Clever stuff with SQL in __doc__
License: MIT
Keywords: sqlite,function

sqlfunc
=======

Clever stuff with SQL in __doc__

Features
--------

- In-memory or file-backed database (Sqlite)
- Post-process returned data
- User definded functions

Example
-------

Given this:

.. code:: python

    ''' CREATE TABLE IF NOT EXISTS users (
            userid   INTEGER PRIMARY KEY,
            username TEXT    UNIQUE NOT NULL,
            bcrypt   BLOB    NOT NULL
        );
    '''
    from sqlfunc import sqlinit, sqludf, sqlfunc
    
    __database__ = ':memory:' # default
    
    @sqludf
    def bcrypt_hash(password):
        # call to library here
        return b'$2b$12$.OjbRwRejxw92C89sA6JkOVrhmQzGsjoyCf1ofIN9hUNdHFufb3ty'
    
    @sqludf
    def bcrypt_verify(password, bcrypthash):
        # call to library here
        return True
    
    @sqlfunc
    def add_user(username, password):
        ''' INSERT OR IGNORE INTO $$$ (username, bcrypthash)
            VALUES (:username, bcrypt_hash(:password));
        '''
     
    @sqlfunc(post=lambda x: bool(list(x)))
    def login(username, password):
        ''' SELECT 1 FROM users
            WHERE username=:username
              AND bcrypt_verify(:password, bcrypt);
        '''
        
    sqlinit()

You can now do this:

.. code:: python

    >>> import example_users
    >>> example_users.add_user('root', 'password123')
    >>> example_users.login('root', 'secret')
    False
    >>> example_users.login('root', 'password123')
    True
    >>> example_users.list_users()
    ['root']
    >>> 'bcrypt_verify' in dir(example_users) # helper functions are NOT exported
    False

This library is MIT licensed.
logmod 0.1
Log all calls to a module
License: MIT
Keywords: logging,module,debugging

logmod
======

Log all calls to a module

Dependencies
------------

- structlog

Features
--------

- Log all calls to a module

Example
-------

.. code:: python

    >>> from logmod import logmod
    >>> import secrets
    >>> logmod(secrets)
    >>>
    >>> secret.token_hex(5)
    logmod: call to secret.token_hex with (5,) {}
    'd34eb399f8'

Results in:

.. code:: text

    2018-01-09 01:04.15 coolname -> secrets.token_hex at example.py:8 args=(5,) caller=coolname callsite={'filename': 'example.py', 'lineno': 8} func=token_hex kwargs={} mod=secrets
    2018-01-09 01:04.15 token_hex -> secrets.token_bytes at /usr/lib/python3.6/secrets.py:58 args=(5,) caller=token_hex callsite={'filename': '/usr/lib/python3.6/secrets.py', 'lineno': 58} func=token_bytes kwargs={} mod=secrets
    Hello, f717fd2370
    2018-01-09 01:04.15 <module> -> random at example.py:12 args=() caller=<module> callsite={'filename': 'example.py', 'lineno': 12} func=random kwargs={} mod=None
    0.46899158604445124
shorten-cli 0.1
Simple (Python) tool to shorten any command in your terminal.
License: MIT


# Shorten

Simple (Python) tool to shorten any command in your terminal.

`shorten` takes the place of adding aliases in your bash profile. It also makes a few things a more convenient. For example, you can
  1. create an alias from any location,
  2. list your aliases and
  3. search aliases by leading characters.


Let me know if you experience any issues!

## Things you can do

**Create an alias.** Call `shorten` (from anywhere!) on any command and give it an alias.

```
$ shorten echo e
Alias successfully added.
```
```
$ # Let's try it out!
$ echo 'Hello, world!'
Hello, world!
```

**Remove an alias.** Call `shorten delete`.
```
$ shorten delete e
```

**List all your aliases.**
```
$ shorten list all

Alias         Command
-----         -------
ipynb         jupyter notebook
jlab          jupyter lab
e             echo
```

**List aliases that start with substring.**
```
$ shorten list ip

Alias         Command
-----         -------
ipynb         jupyter notebook
```

**Protip**: shorten `shorten` ;).
```
$ shorten shorten s
```

## How does it work?

*Shorten* creates a hidden folder in your home directory. This is where your aliases will be stored. Each alias is actually a python script that redirects the alias to the true command.

*Shorten* adds a line to your bash profile that points your $PATH variable to `~/.shorten`. If you can't get your aliases to work (or you're using another shell like Zsh), check that the following line is in the right `rc` file.

```
export PATH="~/.shorten:$PATH"
```


## Install

Clone this repo and pip install:
```
pip install -e .
```