semvec/pypi-packages huggingface dataset:
pyadverse 0.0.3
Risk Metrics library for financial analysis
License: MIT

# pyAdverse 

pyadverse is a Python library for calculating various financial risk metrics from return data.

## Installation

Install the package from PyPI:

```bash
pip install pyadverse
```


## Example Usage

```python
import numpy as np
from pyadverse import RiskMetrics

# Sample daily return data
returns = np.array([0.01, -0.02, 0.03, -0.01, 0.015, -0.005, 0.007, -0.03])

# Create the RiskMetrics object
risk = RiskMetrics(returns)

print("VaR (95%):", risk.value_at_risk(0.95))  # alpha = 0.95
print("CVaR (95%):", risk.conditional_var(0.95))  # alpha = 0.95
print("Max Drawdown:", risk.max_drawdown())  # no parameters
print("Expected Drawdown (0.01):", risk.expected_drawdown(0.01))  # threshold = 0.01
print("Conditional Drawdown (95%):", risk.conditional_drawdown(0.95))  # alpha = 0.95
print("Lower Partial Moment (threshold=0.0, order=2):", risk.lower_partial_moment(0.0, 2))  # threshold = 0.0, order = 2
print("Variance:", risk.variance())  # no parameters
print("Standard Deviation:", risk.std_deviation())  # no parameters
print("Skewness:", risk.skewness())  # no parameters
print("Kurtosis:", risk.kurtosis())  # no parameters
print("Volatility (annualized):", risk.volatility())  # assumes 252 trading days

```

## Risk Metrics Descriptions

- **Value at Risk (VaR):**
  Estimates the maximum potential loss at a given confidence level (e.g., 95%).

- **Conditional Value at Risk (CVaR):**
  Measures the expected loss given that the loss is beyond the VaR threshold.

- **Max Drawdown:**
  The maximum observed loss from a peak to a trough before a new peak is attained.

- **Expected Drawdown:**
  The average drawdown that exceeds a user-defined threshold.

- **Conditional Drawdown (CDaR):**
  The average of the worst-case drawdowns, defined by a confidence percentile.

- **Lower Partial Moment (LPM):**
  Measures downside risk. The higher the order, the more sensitive to extreme losses.

- **Variance:**
  The average squared deviation from the mean return; basic risk indicator.

- **Standard Deviation:**
  Square root of the variance; common measure of return volatility.

- **Skewness:**
  Measures asymmetry of the return distribution. Negative skew indicates more left tail risk.

- **Kurtosis:**
  Measures "tailedness" of the return distribution. Higher values mean more outlier-prone.

- **Volatility:**
  Annualized standard deviation of returns (assuming 252 trading days).
chora 0.3.0
Deploy a mock server for use in testing.
License: MIT
Requires Python: >=3.13
Keywords: server, mock

# chora

> **Warning:** chora is intended for development and testing only. Do not use
this server in production environments.  If you _do_ use this in production, and
get your ass handed to you, please don't come crying to me.

chora is a mock HTTP server for Python that serves responses based on your file
system structure. It's designed for testing and development, allowing you to
quickly simulate APIs or static content by simply organizing files and
directories.

## Features

- File-based routing: Map HTTP endpoints to files and folders.
- Supports multiple HTTP methods: Serve different responses for GET, POST, etc., using file naming conventions.
- Easy to configure: No code changes needed—just update the file system.
- Great for testing: Quickly mock APIs for frontend or integration tests.

## How It Works

- Each directory represents a route.
- Files inside directories represent responses, statuses, and headers for specific HTTP methods and endpoints.
- Dynamic request handling is done with a special HANDLE script.
- The server reads the file system to determine how to respond to incoming requests.

### Example Structure

```text
example/
├── users/
│   └── GET/
│   │    ├── HEADERS                  # Custom headers for GET /users
│   │    ├── DATA                     # Response body for GET /users
│   │    └── STATUS                   # HTTP status code for GET /users
│   └── POST/
│   │    ├── HEADERS                  # Custom headers for POST /users/
│   │    ├── DATA                     # Response body for POST /users/
│   │    └── STATUS                   # HTTP status code for POST /users/
│   └── PUT/
│        └── HANDLE                   # Custom handler for PUT /users/
└── status/
    └── POST/
        ├── HEADERS                   # Custom headers for POST /status
        ├── DATA                      # Response body for POST /status
        └── STATUS                    # HTTP status code for POST /status
```

A request to GET /users will return the contents of users/GET/DATA, with
headers from users/GET/HEADERS and status from users/GET/STATUS.

A request to PUT /users will execute the HANDLE script, with $1 containing the folder
with the details of the request.  The script is expected to introspect that and supply
a path to a folder containing the DATA, HEADERS and STATUS files.

## Installation

pip install chora

## Usage

chora --root ./example --port 8080

- --root: Path to the directory containing your mock API structure.
- --port: Port to run the server on (default: 8000).

## Customization

- Add new endpoints by creating directories and files.
- Use subdirectories for nested routes.

## License

MIT

## Author

pbhandari (<pbhandari@pbhandari.ca>)

For more information, see the project homepage: <https://github.com/pbhandari/chora>
po2lmo 1.0.0
Convert GNU gettext PO files to Lua Machine Objects (LMO) binary format
License: MIT
Requires Python: >=3.7
Keywords: gettext, po, lmo, lua, internationalization, localization, i18n, l10n

# po2lmo

A Python tool for converting GNU gettext PO files to Lua Machine Objects (LMO) binary format.

## Overview

po2lmo is a Python implementation of the original C version po2lmo tool, maintaining the same binary format compatibility. It converts GNU gettext PO files to LMO format, which is used by various Lua applications.

## Features

- Fully compatible with the original C version's binary format
- Supports Python 3.7+
- Provides both command-line tool and Python API
- Handles escape sequences and multi-line strings
- Duplicate key detection and error handling
- Debug output support

## Installation

Install using pip:

```bash
pip install po2lmo
```

## Usage

### Command Line Tool

After installation, you can use the `po2lmo` command:

```bash
po2lmo input.po output.lmo
```

Enable debug output:

```bash
po2lmo --debug input.po output.lmo
```

### Python API

You can also use it in Python code:

```python
from po2lmo import parse_po_file, write_lmo_file

# Parse PO file
entries = parse_po_file('input.po')

# Write LMO file
write_lmo_file(entries, 'output.lmo')
```

## Development

### Install from Source

```bash
git clone https://github.com/stevenjoezhang/po2lmo.py.git
cd po2lmo
pip install -e .
```

### Run Tests

```bash
python -m pytest tests/
```

## License

MIT License

## Contributing

Issues and Pull Requests are welcome!

## Original Version

Original C version:
Copyright (C) 2009-2012 Jo-Philipp Wich <xm@subsignal.org>