semvec/pypi-packages huggingface dataset:
fast-protocol 1.0.1
A very simple Python module to declare protocols for checking if objects provide the desired interface.
License: MIT
Requires Python: >=3.7,<4.0
Keywords: type,protocol,match,checking,interface

# fast-protocol
A very simple Python module to declare protocols for checking if objects provide the desired interface.

## Installation
```shell
pip install fast-protocol
```

## Usage
To create a Fast Protocol just call the `fast_protocol.protocol` function passing it the names of the methods/attributes that the protocol should support.
```python
from fast_protocol import protocol

def example():
    ...

Callable = protocol("__call__")  # Create a protocol that matches objects with a dunder call method
match example:
    case Callable():
        print("example is callable")
```
This can be used outside a `match` statement using `isinstance`.
```python
if isinstance(example, Callable):
    print("example is callable")
```

Protocols are generated with the name `"FastProtocol"`. This name can be changed by creating a new instance of
`FastProtocolBuilder`. The name can be set traditionally by passing the name of the protocol to the `FastProtocolBuilder` class. Alternatively you can pass the protocol name as a subscript to an existing `FastProtocolBuilder` which will return a new instance that uses that name.

**Traditional approach:**
```python
from fast_protocol import FastProtocolBuilder

Callable = FastProtocolBuilder("Callable")("__call__")
```
**Alternative approach:**
```python
from fast_protocol import protocol

Callable = protocol["Callable"]("__call__")
```
orwell-translators 1.1.5
Create translators for the Orwell platform
License: MIT

# Orwell Package For Building Translators

## About

Orwell is an open-source platform that allows you to integrate different metrics collectors into one large super-system, storing the data from different sources in Prometheus' format.
  
With that goal in mind, this package tries to facilitate as much as possible the task of creating translator services compatible with Orwell's architecture.

## Development

If a given service's output follows the scheme "```host```,```metric```,```value```", its translator could be built with the following example:

```
from orwell import Metric, Runner


# The translator function should be able to receive multiple lines
# of the desired service output and return a list of Metric objects

def translate (lines: str) -> list[Metric]:
  metrics = [ line.split(',') for line in lines.split('\n') ]
  return [ Metric(metric, value, { 'host': host }) for host, metric, value in metrics ]


translator = Runner(translate)
translator.run()

```

## Usage

With the example given above we now have three options for running the service:

### Command-Line Mode
```python main.py cmd <output>```

The output will be processed and printed.


### Server Mode
```python main.py server```

A Flask server will start accepting POST requests for /metrics. 
The body of the request must be a dictionary with the only key ```metrics```.
The response will be the processed output whenever the status code is 200.

**Environment Variables**

```FLASK_HOST```
**Default** "localhost"

```FLASK_PORT```
**Default** "5000""

```FLASK_DEBUG```
If set the server will start in debug mode.

### Production Mode
```python main.py prod```

This is the most important mode as it allows to read messages from Kafka and write them to a Redis database, according to the Orwell's architecture.
  
  
**Environment Variables**

```REDIS_HOST```
**Default** "localhost"

```REDIS_PASSWORD```
**Default** "root"

```KAFKA_HOST```
**Default** "localhost""

```KAFKA_PORT```
**Default** 9093

```KAFKA_TOPIC```
**Default** "general"

### Pull Mode
```python main.py pull```

This mode allows gathering data from a custom endpoint.
  
  
**Environment Variables**

```PULL_ENDPOINT```

```PULL_INTERVAL```
**Default** "localhost"

```REDIS_PASSWORD```
**Default** "root"
Quart-Nextcord 2.1.6a1
Discord OAuth2 extension for Quart.
License: MIT
Requires Python: >=3.8

# Quart-Nextcord
[![PyPI](https://img.shields.io/pypi/v/Quart-Nextcord?style=for-the-badge)](https://pypi.org/project/Quart-Nextcord/) [![Read the Docs](https://img.shields.io/readthedocs/quart-nextcord?style=for-the-badge)](https://quart-nextcord.readthedocs.io/en/latest/) 

Discord OAuth2 extension for Quart.


### Installation
To install current latest release you can use following command:
```sh
python3 -m pip install Quart-Nextcord
```
To install the current dev version you can use followering command:
```sh
python3 - m pip install git+https://github.com/InvalidLenni/Quart-Nextcord/tree/dev
```

### Basic Example

```python
from quart import Quart, redirect, url_for
from quart_nextcord import DiscordOAuth2Session, requires_authorization, Unauthorized

app = Quart(__name__)

app.secret_key = b"random bytes representing quart secret key"

app.config["DISCORD_CLIENT_ID"] = 490732332240863233  # Discord client ID.
app.config["DISCORD_CLIENT_SECRET"] = ""  # Discord client secret.
app.config["DISCORD_REDIRECT_URI"] = ""  # URL to your callback endpoint.
app.config["DISCORD_BOT_TOKEN"] = ""  # Required to access BOT resources.

nextcord = DiscordOAuth2Session(app)


@app.route("/login/")
async def login():
    return await nextcord.create_session()


@app.route("/callback/")
async def callback():
    await nextcord.callback()
    return redirect(url_for(".me"))


@app.errorhandler(Unauthorized)
async def redirect_unauthorized(e):
    return redirect(url_for("login"))


@app.route("/me/")
@requires_authorization
async def me():
    user = await nextcord.fetch_user()
    return f"""
    <html>
        <head>
            <title>{user.name}</title>
        </head>
        <body>
            <img src='{user.avatar_url}' />
        </body>
    </html>"""


if __name__ == "__main__":
    app.run()
```

For an example to the working application, check [`test_app.py`](tests/test_app.py)


### Requirements
* Quart
* Async-OAuthlib
* cachetools
* nextcord


### Documentation
Head over to [documentation] for full API reference. 


[documentation]: https://quart-nextcord.readthedocs.io/en/latest/
simcubeltd-pulumi-onepassword 1.0.5
A Pulumi package for creating and managing onepassword resources.
License: MIT
Keywords: pulumi onepassword category/cloud

# 1Password Provider
[1Password Website](1password.com)

Based on the [1Password terraform provider](https://github.com/1Password/terraform-provider-onepassword)

&nbsp;

The 1Password resource provider for Pulumi lets you use 1Password resources in your Infrastructure as Code deployments.


## Installing

This package is available in C#, TypeScript, Python and Go

### .NET

To use from .NET, install using `dotnet add package`:

```bash
dotnet add package Pulumi.Onepassword
```

### Node.js (Java/TypeScript)

```bash
npm install @SimCubeLtd/pulumi-onepassword
```

or `yarn`:

```bash
yarn add @SimCubeLtd/pulumi-onepassword
```

### Python

To use from Python, install using `pip`:

```bash
pip install simcubeltd_pulumi_onepassword
```

### Go

To use from Go, use `go get` to grab the latest version of the library:

```bash
go get github.com/SimCubeLtd/pulumi-onepassword/sdk/go/onepassword
```

## Configuration

The following configuration entries are available:

| **Key**           | **Value**                                            |
|-------------------|:-----------------------------------------------------|
| onepassword:token | The access token for your 1Password Connect server   |
| onepassword:url   | URL where your 1Password Connect API is being served |