semvec/pypi-packages huggingface dataset:
socket-burst-dampener 1.3.4
A daemon that spawns a specified command to handle each connection, and dampens connection bursts
Requires Python: >=3.7

# socket-burst-dampener

A daemon that spawns a specified command to handle each connection, and
dampens connection bursts.

## Motivation
It is typical to configure a forking daemon such as rsync so that it
will respond with an error when a maximum number of concurrent
connections has been exceeded. Alternatively, it may be desirable to
queue excess connections, and service them in the order of arrival
while taking care to ensure that too many processes are not spawned at
once. The socket-burst-dampener daemon applies this behavior to any
daemon command that works with inetd.

On Linux, the net.core.somaxconn sysctl setting specifies the queue
length for completely established sockets waiting to be accepted.
It may also be useful to adjust the maximum queue length for incomplete
sockets that is controlled by the net.ipv4.tcp_max_syn_backlog sysctl
setting (mentioned in the
[listen(2)](http://man7.org/linux/man-pages/man2/listen.2.html) man page).

## Usage
```
usage: socket-burst-dampener [-h] [--address ADDRESS] [--ipv4] [--ipv6]
                             [--load-average LOAD] [--processes PROCESSES]
                             [-v]
                             PORT CMD [ARG [ARG ...]]

  socket-burst-dampener
  A daemon that spawns a specified command to handle each connection, and dampens connection bursts

positional arguments:
  PORT                  listen on the given port number
  CMD                   command to spawn to handle each connection
  ARG                   argument(s) for CMD

optional arguments:
  -h, --help            show this help message and exit
  --address ADDRESS     bind to the specified address
  --ipv4                prefer IPv4
  --ipv6                prefer IPv6
  --load-average LOAD   don't accept multiple connections unless load is below
                        LOAD
  --processes PROCESSES
                        maximum number of concurrent processes (0 means
                        infinite, default is 1)
  -v, --verbose         verbose logging (each occurence increases verbosity)
```
## Example with rsync
```
socket-burst-dampener 873 --processes $(nproc) --load-average $(nproc) -- rsync --daemon
```
easyttuimenus 1.0.3
Write simple UI for your code in seconds in a unified way using Easy TTUI Menus
Requires Python: >=3.6

# Easy TTUI Menus

## About

Write simple UI for your code in seconds using Easy TTUI Menus

## Roadmap (For when I get around to it)

- Function name overhaul to make more sense (because `list_menu` really is just a multiple-choice selection...)

## Changelog

### 1.0.3

- Changed the typing hints on multiple_choice_menu() and list_menu() to support `Any` instead of just `str`
- Added stub files
- Added Roadmap header to README

### 1.0.2

- Fixed issue where multiple_choice_menu() returns a list of strings instead of ints
- Added stubs
- More annotations

### 1.0.0

- Started a changelog
- Changes the function signature of `int_menu()`. It now takes a string and two integers instead of a string and a list containing two integers. Legacy systems should use version 0.1.5
- Added `multiple_choice_menu()`
- Removed "Usage" section of readme as I dread maintaining it

## Installation

Run `pip install easyttuimenus` from your preferred environment.
ising-toolkit 0.1.10
用于调用玉盘伊辛云平台的SDK
Requires Python: >=3.8


# Ising Toolkit (v0.1.1)

`ising-toolkit` 是一个为解决二次无约束二元优化 (QUBO) 和 Ising (伊辛) 模型问题而设计的 Python 工具包。

它提供了一个清晰的高级 API，可以自动处理模型（`IsingModel`, `QUBOModel`）的预处理、在 Ising 和 QUBO 格式之间转换，并支持使用本地**模拟退火**或远程**伊辛云平台**进行求解。

## 核心功能

  * **模型定义**: 提供了 `IsingModel` 和 `QUBOModel` [ 两个高级类来构建您的问题。
  * **自动预处理**:
      * **IsingModel**: 自动将非零的 `h` 向量（外部磁场）通过引入**辅助自旋**来转换模型，使其符合纯粹的 Ising 求解器要求。
      * **QUBOModel**: 自动将线性 `h` 向量合并到 `Q` 矩阵的对角线上，QUBO模型在计算时会先内部转化为IsingModel，因此其需要引入一个辅助自旋（求解器内部完成）。
      * 所有模型都会自动验证输入并进行矩阵对称化。
  * **模型转换**: 包含 `to_ising` 等工具函数，用于在 QUBO 和 Ising 模型之间轻松转换 。
  * **双求解器支持**:
      * `SimulatedAnnealingSolver`: 一个内置的、多副本并行的模拟退火求解器，用于快速本地测试。
      * `IsingSolver`: 对接 "伊辛云平台" 的远程求解器，用于提交任务到光电伊辛机。
  * **标准化的工作流**: 无论使用本地还是云端求解器，工作流都保持一致。

## 📦 安装

您可以直接使用 pip 安装：

```bash
pip install ising_toolkit
```

## 🚀 快速上手：求解最大割 (Max-Cut) 问题

本示例将引导您完成一个 100 节点图的最大割问题求解。

```python
from ising_toolkit import IsingModel, QUBOModel, IsingSolver
import numpy as np
import time


J = np.loadtxt("path/to/you/csv")
model = IsingModel(J) # QUBO 问题换成QUBOModel

solver = IsingSolver(api_key="api_key") 
response = solver.solve(model=model, name="Test Task")

#轮询等待计算完成
while solver.get_result(response['taskId']) is None:
    time.sleep(5)
    print("等待任务完成...")
    
result = solver.get_result(response['taskId'])
print(result.variables)
print(result.energy)
```
### 2. 求解器 (Solvers)

#### `SimulatedAnnealingSolver` (本地求解)
在本地 CPU 上运行模拟退火。

  * **如何初始化**: `SimulatedAnnealingSolver(agents=128, initial_temp=10.0, final_temp=0.1, cooling_rate=0.99, steps_per_temp=100)`
  * **如何求解**: `.solve(ising_model)`
  * **返回**: 一个字典，包含 `{'spins': np.ndarray, 'energy': float}`。

<!-- end list -->

```python
# (接上文 ising_model 示例)
local_solver = SimulatedAnnealingSolver(agents=64, steps_per_temp=50)
result = local_solver.solve(ising_model)
print(result['energy'])
```

#### `IsingSolver` (云平台求解)

将问题提交到远程光电伊辛机。

  * **如何初始化**: `IsingSolver(api_key: str)`
  * **如何提交任务**: `.solve(ising_model, name: str)`
      * 此方法会自动将 `ising_model.J` 和 `ising_model.h` 转换为 CSV 格式并上传。
      * **返回**: 一个字典，包含 `{'success': bool, 'taskId': str}`。
  * **如何获取结果**: `.get_result(task_id: str)`
      * 轮询此方法直到任务完成。
      * **返回**: 任务完成时，返回 `{'spins': np.ndarray, 'energy': float}`。如果任务仍在运行，返回 `None`。