semvec/pypi-packages huggingface dataset:
django-ninja-fsbr 0.2.1
Wrapper around NinjaAPI that adds file based routing and endpoint auto-discovery.

# django-ninja-fsbr

File-System Based Routing for django-ninja

## Why

- To enforce an opinionated project structure, that does not make me think.
- To enable easily mapping routes/endpoints to files.
- For fun. :)

## Usage

The usage is most easily explained using an example.
Let's say you want to have the following API:

```
/products/ GET, POST
/products/<product_id>/ GET
/products/<product_id>/stock/ GET, PUT
```

You can achieve this using the following directory layout:

```
├── root.py
└── views
    └── products
        ├── index.py
        ├── __init__.py
        └── product_id
            ├── index.py
            ├── __init__.py
            └── stock.py
```

The `root` module contains the definition of a router which specifies the base directory, that your automatic routes
will be relative to:

```python
from ninja_fsbr import FilesystemBasedRouter

api = NinjaApi(
    ...
)

router = FilesystemBasedRouter(views_module="root.views")
router.auto_discover()

api.add_router("api/", router)
```

To define an "auto" route, just use the `@router.auto_route` decorator instead django-ninja's `@router.<method>` decorators:

```python
from root import router

@router.auto_route(
  methods=["GET"],  # optional, if method name starts with get_ (or any other HTTP method name)
  ... # other django-ninja arguments here
)
def get_stock(request, product_id):
  ...
```

## Conventions

- Any directory with the ending `_id` will be treated as a path parameter in the generated route.
- The `index.py` will resolve to the path itself.
- The supported HTTP method can be set by either passing a `methods` argument to `auto_route` or by prefixing the view function with the verbs i.e. get_put_stock (to support both GET and PUT requests)
- Routes are sorted by name
keep-presence 1.0.7.1
Keeps your computer awake by moving the mouse or pressing a key when you step away.
Requires Python: >=3.7

# Keep Presence

This program **moves the mouse** or presses a key when it detects that you are **away** from your computer.

It does nothing if you are using your computer, making it useful for **tricking your machine into thinking you are still using it**.

## Demo

[![Demo](https://raw.githubusercontent.com/carrot69/keep-presence/master/demo/demo.gif)](https://github.com/carrot69/keep-presence)

# Install from Pypi

```
python3 -m pip install keep_presence
```
https://pypi.org/project/keep-presence/


### Run

```
keep-presence

# or

python3 -m keep_presence
```

# Install with Snap

```
sudo snap install keep-presence
```

<a href="https://snapcraft.io/keep-presence" target="_blank">
  <img alt="Get it from the Snap Store"
       src="https://snapcraft.io/static/images/badges/en/snap-store-black.svg"
       align="center"
       height="50">
</a>

### Run

```
keep-presence
```

# Manual installation

```
git clone https://github.com/carrot69/keep-presence.git

cd keep-presence

python3 -m pip install pynput

python3 src/keep-presence.py
```

## Optional arguments

```
-h, --help                        show this help message and exit
            
-s SECONDS, --seconds SECONDS     Define in seconds how long to wait after a user is
                                  considered idle. Default 300.

-p PIXELS, --pixels PIXELS        Set how many pixels the mouse should move. Default 1.

-c, --circular                    Move mouse in a circle. Default move diagonally.

-m MODE, --mode MODE              Available options: keyboard, mouse, both (mouse & keyboard) and scroll. 
                                  Default is mouse. 
                                  This is the action that will be executed when the user is idle. 
                                  If keyboard is selected, the program will press the shift key. 
                                  If mouse is selected, the program will move the mouse. 
                                  If both is selected, the program will do both actions.

-r RANDOM RANDOM, --random RANDOM RANDOM
                                  Usage: two numbers (ex. -r 3 10). Execute actions based on a 
                                  random interval between start and stop seconds. 
                                  Note: Overwrites the seconds argument.

```

# Donations:

If you've found Keep Presence to be helpful, you can buy me a coffee, thanks!

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/keep_presence)