semvec/pypi-packages huggingface dataset:
alegrapy 0.0.2
alegra-api-client: Python package for consuming the Alegra API
License: MIT
Keywords: python,alegra,alegra.com

# AlegraPy

Este paquete nos permite consumir el API del la plataforma de facturacion Alegra mediante python 🐍

## Características

- Permite leer facturas, pagos, productos, contactos
- Permite crear facturas, pagos, productos, contactos
- Permite borrar facturas, pagos, productos, contactos

## Instalación y uso

### 1. Obtener token de acceso
Debes seguir los siguientes pasos para obtener el token de acceso:

- Ingresar a la aplicación de [Alegra](https://www.alegra.com/).
- Haz clic sobre el vínculo "Configuración" en la parte superior derecha de la pantalla de Alegra y haz clic en la sección "API - Integraciones con otros sistemas"
- En la nueva pantalla puedes encontrar el correo con el cual debes acceder al API y el token. Si aún no cuentas con un token puedes generarlo también.

### 2. Instalación

```
pip install alegrapy==0.0.1
```

### 3. Uso

Un ejemplo para usar este paquete

```py
from alegra import invoices, contacts, session

session.user = "your_email@domnain.com"
session.token = "your_token"

invoice = invoices()
invoice.read(1,fields='pdf')
invoice.list(0,3)

contact = contacts()
contact.read(12)
contact.list(0,2)
```

## Créditos

- Camilo Andrés Rodriguez

## referencias

- https://developer.alegra.com/


## Licencia

Este proyecto está bajo la Licencia [MIT].

---

¡Puedes personalizarlo según las necesidades específicas de tu proyecto!
aad-token-verify 0.2.0
A python utility library to verify an Azure Active Directory OAuth token
License: MIT
Requires Python: >=3.7
Keywords: azure ad token oauth verify jwt

[![Tests](https://github.com/GeneralMills/azure-ad-token-verify/workflows/Test%20and%20Analysis/badge.svg)](https://github.com/GeneralMills/azure-ad-token-verify/actions)
[![PyPi](https://img.shields.io/pypi/pyversions/aad-token-verify.svg)](https://pypi.python.org/pypi/aad-token-verify)
# aad-token-verify
A python utility library to verify an Azure Active Directory OAuth token. Meant for resource servers serving secured API endpoints (eg FastAPI)

## Install

```bash
python3 -m pip install aad-token-verify
```

## Usage

To use stand alone, simply import the verify payload function and call.

```python
from aad_token_verify import get_verified_payload

token_verifier = get_verified_payload(token, tenant_id="YOUR_TENANT_ID", audience_uris=["AUDIENCE_URI"])
```

To use with FastAPI, there's some setup to get the Swagger docs to work

```python
from fastapi import Depends, FastAPI
from fastapi.openapi.models import OAuthFlowImplicit, OAuthFlows
from fastapi.middleware.cors import CORSMiddleware
from fastapi.security import OAuth2

from aad_token_verify import get_verified_payload

# TODO Update these with your Tenant ID, Audience URI, and Client ID
_TENANT_ID = "ISSUER_TENANT_ID"
_AUDIENCE_URI = "https://YOUR_AUDIENCE_URI"
_AAD_CLIENT_ID = "CLIENT_ID"

oauth2_scheme = OAuth2(
    flows=OAuthFlows(
        implicit=OAuthFlowImplicit(
            authorizationUrl=f"https://login.microsoftonline.com/{_TENANT_ID}/oauth2/v2.0/authorize",
            scopes={
                f"{_AUDIENCE_URI}/.default": "Custom Audience URI scope",
                "openid": "OpenID scope",
                "profile": "Profile scope",
                "email": "email scope",
            },
        )
    )
)

async def get_current_user(
    auth_header: str = Depends(oauth2_scheme),  # noqa: B008
):
    scheme, _, token = auth_header.partition(" ")
    return get_verified_payload(
        token,
        tenantId=_TENANT_ID,
        audience_uris=[_AUDIENCE_URI],
    )

app = FastAPI()

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

app.swagger_ui_init_oauth = {
    "usePkceWithAuthorizationCodeGrant": True,
    "clientId": _AAD_CLIENT_ID,
    "scopes": [f"{_AUDIENCE_URI}.default"],
}

@app.get("/")
async def secured_endpoint(user=Depends(get_current_user)):
    return user
```

## Contributing

Feel free to submit issues and pull requests!
dynamic-overload 0.2.0
A basic package that allows to overload functions and class functions dynamically depending on the input types.
License: MIT
Requires Python: >=3.10

# Dynamic Overload

Dynamic Overload is a python package that allows you to overload functions and classes using dynamic dispatch depending on the type of the arguments. This allows you to write more readable code and avoid using isinstance and type checks.

The package also detects collisions between the overloads and warns the user about them without breaking the code. In case of collision, the first overload is used. So, its recomended that you put the most specific overloads first before the more general ones.

## Installation

Requires python 3.10 or higher

```bash
pip install dynamic-overload
```

## Usage

For functions:
```python
from dynamic_overload import overload
from typing import Iterable

@overload
def flatten(x: Iterable[int]) -> Iterable[int]:
    return [y for l in x for y in flatten(l)]

@overload
def flatten(x: int) -> Iterable[int]:
    yield x

assert list(flatten([1, [2, 3], 4])) == [1, 2, 3, 4]
assert list(flatten(1)) == [1]
```

For classes:
```python
from dynamic_overload import OverloadMeta

class Integer(metaclass=OverloadMeta):
    x: int

    def __init__(self, x: int):
        self.x = x

    def __init__(self, x: str):
        self.x = int(x)

    def __init__(self, x: float):
        self.x = int(x)

assert Integer(1).x == 1
assert Integer('1').x == 1
assert Integer(1.0).x == 1
```

The package also supports inheritance similar to python [abc](https://docs.python.org/3/library/abc.html) module. So the previous example can be rewritten as:
```python
from dynamic_overload import Overload

class Integer(Overload):
    x: int

    def __init__(self, x: int):
        self.x = x

    def __init__(self, x: str):
        self.x = int(x)

    def __init__(self, x: float):
        self.x = int(x)

assert Integer(1).x == 1
assert Integer('1').x == 1
assert Integer(1.0).x == 1
```

## License

[MIT](https://choosealicense.com/licenses/mit/)
pwproxy 1.1.2
Implement the core functions of mitmproxy based on playwright: request interception, response tampering
License: MIT
Requires Python: >=3.10

# pwproxy

<hr>

> 基于playwright实现mitmproxy的核心功能:请求拦截,响应篡改<br>

优点

1. 基于playwright，直接调用本地浏览器，不用以设置代理的方式启动浏览器, mitmproxy必须以冷启动设置代理的方法启动本地浏览器才能实现拦截
2. 不需要考虑安全证书的问题

# 安装

`pip install pwproxy`

# 使用

<hr>
目录结构:<br>

```python
├─run.py
├─demo.py
```

```python
# run.py
from pwproxy.run import Run

Run.run("demo.py", url="http://example.com/")
```

```python
# demo.py
from playwright.sync_api import Route


def replace_resp(route: Route):
    if "http://example.com/" in route.request.url:
        response = route.fetch()
        body = response.text()
        body = body.replace("Example Domain", "Goodo")
        route.fulfill(
            body=body
        )

addons = [
    replace_resp
]
```
tree-ring-watermark 0.0.2
tree_ring_watermark
License: MIT
Requires Python: >=3.7.0
Keywords: deep learning

# Tree-Ring Watermarks: Fingerprints for Diffusion Images that are Invisible and Robust

<img src=scripts/teaser.png  width="80%" height="60%">

This code is the official implementation of [Tree-Ring Watermarks](http://arxiv.org/abs/2305.20030).

If you have any questions, feel free to email Yuxin (<ywen@umd.edu>).

## About
We propose Tree-Ring Watermarking to watermark diffusion model outputs. Tree-Ring Watermarking chooses the initial noise array so that its Fourier transform contains a carefully constructed pattern near its center. This pattern is called the key. This initial noise vector is then converted into an image using the standard diffusion pipeline with no modifications. To detect the watermark in an image, the diffusion model is inverted to retrieve the original noise array used for generation. This array is then checked to see whether the key is present.

## Dependencies
- PyTorch == 1.13.0
- transformers == 4.23.1
- diffusers == 0.11.1

Note: higher diffusers version may not be compatible with the DDIM inversion code.

## Usage

### Perform main experiments and calculate CLIP Score
For non-adversarial case, you can simply run:
```
python run_tree_ring_watermark.py --run_name no_attack --w_channel 3 --w_pattern ring --start 0 --end 1000 --with_tracking --reference_model ViT-g-14 --reference_model_pretrain laion2b_s12b_b42k
```

You can modify arguments to perform attack. For example, for rotation with 75 degrees:
```
python run_tree_ring_watermark.py --run_name rotation --w_channel 3 --w_pattern ring --r_degree 75 --start 0 --end 1000 --with_tracking
```

For more adversarial cases, see [here](scripts/tree_ring.sh).

For other watermark types mentioned in the paper, you can check [scripts/](scripts/).

### Calculate FID
You can download 5000 COCO examples used in the paper [here](https://drive.google.com/drive/folders/1saWx-B3vJxzspJ-LaXSEn5Qjm8NIs3r0?usp=sharing). Feel free to add more data or other datasets according to the format of `fid_outputs/coco/meta_data.json`.

Then, to calculate FID, you may run:
```
python latent_watermark_fourier_fid.py --run_name fid_run --w_channel 3 --w_pattern ring --start 0 --end 5000 --with_tracking --run_no_w
```

## Parameters
Crucial hyperparameters for Tree-Ring:

- `w_channel`: the index of the watermarked channel. If set as -1, watermark all channels.
- `w_pattern`: watermark type: zeros, rand, ring.
- `w_radius`: watermark radius.

## Suggestions and Pull Requests are welcome!