semvec/pypi-packages huggingface dataset:
pystopwatch2 0.1.1
Multi-functional Stopwatch for Python
License: MIT License

# pystopwatch
Multi-functional Simple Stopwatch for Python.

- Multiple Stopwatch by Tags
- Manage elapsed times by tags
- Example of use : profiling python codes(latency by functions, ...)

## Install

```
$ pip install pystopwatch2
```

## Usage

```python
from pystopwatch2 import PyStopwatch

w = PyStopwatch()
w.start(tag='a')
time.sleep(1)
w.pause('a')
e = w.get_elapsed('a')
print(e)
# 1.0xxx

w.start(tag='b')
time.sleep(0.5)
w.pause('b')
print(w)

"""
a: state=ClockState.PAUSE elapsed=1.0027 prev_time=1548382910.66398311
b: state=ClockState.PAUSE elapsed=0.5051 prev_time=1548382911.66670585
"""

e.clear('a')
e.clear('b')
```
mathext 0.2.1
An extension to the math library provided by Python.
License: MIT License

[![Travis CI Build Status](https://img.shields.io/travis/com/Richienb/mathext/master.svg?style=for-the-badge)](https://travis-ci.com/Richienb/mathext)
[![CodeFactor Score](https://www.codefactor.io/repository/github/richienb/mathext/badge?style=for-the-badge)](https://www.codefactor.io/repository/github/richienb/mathext)
[![Codecov Score](https://img.shields.io/codecov/c/github/Richienb/mathext/master.svg?style=for-the-badge)](https://codecov.io/gh/Richienb/mathext)
[![PyPI Status](https://img.shields.io/pypi/status/mathext.svg?style=for-the-badge)](https://pypi.org/project/mathext)

[![Mathext](https://a.icons8.com/dZbSxfid/P8gu1y/mathext.svg)](#)

An extension to the math library provided by Python.

Documentation available [here](https://mathext.richie-bendall.ml/).

## Getting started

### Install via pip
```sh
pip install mathext
```

### Importing
```py
import mathext
```

### Example usage
```py
if mathext.triangular(5): print("5 is a triangular number.")
```

For more commands, visit [this website](https://mathext.richie-bendall.ml/commands/mathext.html).
casl-django 0.4.3
Django module for converting regular django permissions to CASL-Style rules
License: MIT License

===========
CASL-Django
===========

CASL Django is an app that converts the usual Django permissions to CASL-Style rules.


CASL is an isomorphic authorization JavaScript library:
https://github.com/stalniy/casl/

Example
-------

Having a rule called **my_app.change_item**, will generate a CASL rule:

::

    {
        subject: 'my_app/item',
        action: 'change'
    }


If you have more than one rule for the same subject, for example:

::

    my_app.change_item
    my_app.add_item
    my_app.remove_item

This will generate:

::

    {
        subject: 'my_app/item',
        actions: ['add', 'change', 'remove']
    }

Configuration
-------------

By default, the length for subject and action fields is 128 characters, you can
increase the length of them by adding to your settings file:

::

    CASL_DJANGO = {
        'subject-length': 256,
        'action-length': 256
    }

Custom Permissions
------------------

Sometimes you'd like to have custom permissions for your users, given this, you
can add to your user using the Permission's `add_permission` class method::

    from casl_django.casl.permissions import Permissions

    ...

    my_custom_permission = Permissions.create(subject="navigation", action="index")

    ...

    Permissions.set_user_permission(user=user, permission=my_custom_permission)


Or you can import `casl_django.models.UserPermission` and create objects as desired.

Quick start
-----------

1. Add "casl_django" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [
        ...
        'casl_django',
    ]

2. Run `python manage.py migrate` to create the models.


API
---

By default, your user object should contain a related relationship called `casl_permissions`.
You can filter by `permission__subject` and `permission__action` and finally get the rules with
the queryset method `bundle()`.

--------
bundle()
--------

This method it's included in the QuerySet's for `UserPermissions` (user.casl_permissions) and for
`CASLPermission` (CASLPermission.objects).

This method returns a list like the following::

    [
        // These are regular django permissions transformed to CASL-Style rules
        {'subject': 'products/item', actions: ['add', 'change']},
        // These are CASLPermissions objects
        {'subject': 'navigation', actions: ['index', 'products']}
    ]

The bundle consists in grouping same-subject rules and the actions, having less data
to send over the wire.