semvec/pypi-packages huggingface dataset:
asgi-context 0.2.0
Simple request context for ASGI compatible applications
License: MIT
Requires Python: >=3.10

# ASGI Context

Zero dependency middleware for storing HTTP request data in scoped context.
By default the library exposes the middleware for creating the context and
header extrator builder which can be used e.g. for storing tracing headers.

## Installation

The project is available on PyPI:

```shell
pip install asgi_context
```

or you can use pre-built sdist and wheels from `Releases` page.

## Example usage

### FastAPI

```python
from http import HTTPStatus

from fastapi import FastAPI

from asgi_context import (
    http_requst_context,
    ContextMiddleware,
    HeadersExtractorMiddlewareFactory,
    ValidationConfig,
)

app = FastAPI()

def example_headers_validator(header_value: str) -> bool:
    return "example" in value

# will return 400 when missing specified headers or headers don't pass validation
example_headers_extractor_with_validation = HeadersExtractorMiddlewareFactory.build(
    base_name="example_with_validation",
    header_names=("X-Example",),
    validation_config=ValidationConfig(
        err_on_missing=HTTPStatus.BAD_REQUEST,
        err_on_invalid=HTTPStatus.BAD_REQUEST,
        validators={
            "X-Example": example_headers_validator,
        },
    ),
)

example_headers_extractor_without_validation = HeadersExtractorMiddlewareFactory.build(
    base_name="example_without_validation",
    header_names=("X-Not-Validated-Example",)
)

app.add_middleware(example_headers_extractor_with_validation)
app.add_middleware(example_headers_extractor_without_validation)
app.add_middleware(ContextMiddleware)

@app.get("/")
def index():
    return http_request_context["X-Example"]
```

### Starlite

```python
from http import HTTPStatus

from starlite import Starlite, get

from asgi_context import (
    http_requst_context,
    ContextMiddleware,
    HeadersExtractorMiddlewareFactory,
    ValidationConfig,
)

def example_headers_validator(header_value: str) -> bool:
    return "example" in value


# will return 400 when missing specified headers or headers don't pass validation
example_headers_extractor_with_validation = HeadersExtractorMiddlewareFactory.build(
    base_name="example",
    header_names=("X-Example",)
    validation_config=ValidationConfig(
        err_on_missing=HTTPStatus.BAD_REQUEST,
        err_on_invalid=HTTPStatus.BAD_REQUEST,
        validators={
            "X-Example": example_headers_validator,
        },
    ),
)


example_headers_extractor_without_validation = HeadersExtractorMiddlewareFactory.build(
    base_name="example_without_validation",
    header_names=("X-Not-Validated-Example",)
)


@get("/")
def index() -> str:
    return http_request_context["X-Example"]


app = Starlite(
    route_handlers=[index],
    middleware=[
        ContextMiddleware,
        example_headers_extractor_with_validation,
        example_headers_extractor_without_validation,
    ]
)
```
clipboard-tui 1.0.0
TUI application for clipboard history
License: MIT

# clipboard-tui

Clipboard [TUI](https://en.wikipedia.org/wiki/Text-based_user_interface) for clipboard history written in Python

![Screenshot 2023-04-29 at 15 32 03](https://user-images.githubusercontent.com/8545435/235305662-87b2549a-119f-4210-a2ef-b4da965de1f4.png)


## Installation

    pip3 install -r requirements.txt

## Run

    python3 main.py

## Exit applicaiton

    q or ctrl + c

## Limitations

The clipboard TUI does not persist history between runs.
fabisschomagut 0.11
Converts back and forth between different color formats [(255,0,0),#ff0000, 16711680,(255,0,255) ... ]
License: MIT
Keywords: rgb,bgr,bgra,convert

# Converts back and forth between different color formats [(255,0,0),#ff0000, 16711680,(255,0,255) ... ]

### pip install fabisschomagut

#### Tested against Windows 10 / Python 3.10 / Anaconda




### How to use it

```python

# Converting from one color format to another

from fabisschomagut import subtract_color,add_color,to_rgb_hex,to_rgba_hex,to_rgba_tuple,to_rgb_tuple

print(to_rgb_tuple(color="red"))
print(to_rgba_tuple(color=(255, 0, 0)))
print(to_rgb_hex(color="#ff0000"))
print(to_rgba_hex(color="0xFF0000"))


print(to_rgb_tuple(color=0xFF0000, invert=True))
print(to_rgba_tuple(color="red", invert=True))
print(to_rgb_hex(color="red", invert=True))
print(to_rgba_hex(color=(255, 0, 0), invert=True))


print(to_rgb_tuple(color="blue", invert=True))
print(to_rgba_tuple(color=(0, 255, 0), invert=True))
print(to_rgb_hex(color="ff0000", invert=False))
print(to_rgba_hex(color="#FFF000", invert=False))
print(to_rgb_tuple(color="BLUE", invert=False))
print(add_color(color1="BLUE", color2=(0, 255, 0), invert=False))

print(subtract_color(color1="pink", color2="#200000", invert=False))
print(to_rgb_hex(color=16746513, invert=False))

print(subtract_color(color1="pink", color2="0x200000", invert=False))
print(subtract_color(color1="ffc0cb", color2=0x200000, invert=False))
print(subtract_color(color1=0xFFC0CB, color2="#200000", invert=True))
print(to_rgb_hex(subtract_color(color1="pink", color2="200000", invert=True)))


# (255, 0, 0)
# (255, 0, 0, 255)
# 0xff0000
# (255, 0, 0, 255)
# 0xff0000ff
# #FF0000
# (0, 0, 255)
# (0, 0, 255, 255)
# 0x0000ff
# (0, 0, 255, 255)
# 0x0000ffff
# (255, 0, 0)
# (0, 255, 0, 255)
# 0xff0000
# (255, 240, 0, 255)
# 0xfff000ff
# (0, 0, 255)
# (0, 255, 255)
# (223, 192, 203)
# #FF8811
# 0xff8811
# (223, 192, 203)
# #200000
# (223, 192, 203)
# #FFC0CB
# (203, 192, 223)
# 0xcbc0df

```
custom-plotly-templates 2.0.1
Custom templates and configurations for Plotly
License: MIT
Requires Python: >=3.8,<3.11
Keywords: plotly,template,config

# Custom plotly templates

[![PyPI](https://img.shields.io/pypi/v/custom-plotly-templates?color=brightgreen)](https://pypi.org/project/custom-plotly-templates/)

[![wemake-python-styleguide](https://img.shields.io/badge/style-wemake-000000.svg)](https://wemake-python-styleguide.readthedocs.io/en/latest/)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)

Custom templates and configurations for Plotly. Developed primary for my personal use.

Can be installed with `pip install custom-plotly-templates`.

# Usage

```Python
from custom_plotly_templates import set_template, set_render_config

set_template("custom_white")
set_render_config()
```