semvec/pypi-packages huggingface dataset:
ping-game-theory 0.1.4
Driver Code for @ping/game-theory-25
Requires Python: >=3.9

This package contains simple driver code + testing functionality for @ping/game-theory-25

# Types


## `Move` (Enum)
```python
class Move(StrEnum):
    ROCK = "ROCK"
    PAPER = "PAPER"
    SCISSOR = "SCISSOR"
```
Represents a single move in the game.


## `HistoryEntry` (Dataclass)
```py
@dataclass
class HistoryEntry:
    self: Move
    other: Move
```
Represents the result of one round of play between two strategies.

| Field   | Type   | Meaning                            |
| ------- | ------ | ---------------------------------- |
| `self`  | `Move` | The move played by *this* strategy |
| `other` | `Move` | The move played by the opponent    |


## `History` (Type Alias)
```py
History = Tuple[HistoryEntry, ...]
```
A read-only sequence of all previous rounds. Each element is a `HistoryEntry`. The most recent round is at the **end** of the tuple.


## `Strategy` (Abstract Base Class)
```py
class Strategy(ABC):
    @abstractmethod
    def begin(self) -> Move:
        ...

    @abstractmethod
    def turn(self, history: History) -> Move:
        ...
```
Base class for all strategies (bots).
Every strategy must implement two methods:
| Method          | Called When                 | Purpose                                         |
| --------------- | --------------------------- | ----------------------------------------------- |
| `begin()`       | Before the first round      | Returns the first move                          |
| `turn(history)` | Every round after the first | Returns the next move based on previous history |

Any class that does **not** implement both methods cannot be instantiated.


# Example Strategy
```py
class ILoveRocks(Strategy):
    def __init__(self) -> None:
        self.author_netid = "lm742"
        self.strategy_name = "ILoveRocks"
        self.strategy_desc = "I really love rocks"

    def begin(self) -> Move:
        return Move.ROCK

    def turn(self, history: History) -> Move:
        return Move.ROCK
```

# Strategy Tester
To ensure every strategy follows the required interface and runs efficiently, the project includes a built-in tester: `StrategyTester`

The tester automatically checks:
| Check              | What it verifies                                         |
| ------------------ | -------------------------------------------------------- |
| **Initialization** | Your strategy's `__init__` runs without errors           |
| **Return types**   | `begin()` and `turn()` must always return a valid `Move` |
| **No exceptions**  | Your strategy must never crash during play               |
| **Performance**    | Must complete `10,000` rounds within `60 seconds`        |

If your strategy passess all checks, you will see:
```py
✅ PASS: 10000 rounds in X.XX seconds
```

## How to Test your Strategy
You must pass in your strategy class **without** instantiating it
```py
if __name__ == "__main__":
    tester = StrategyTester(ILoveRocks)
    tester.run()
```
rtorrent-rpc 0.9.5a0
Typed rtorrent rpc client
Requires Python: >=3.9
Keywords: rtorrent, rpc

# Typed rtorrent rpc client

[![PyPI](https://img.shields.io/pypi/v/rtorrent-rpc)](https://pypi.org/project/rtorrent-rpc/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rtorrent-rpc)](https://pypi.org/project/rtorrent-rpc/)
[![Documentation Status](https://readthedocs.org/projects/rtorrent-rpc/badge/)](https://rtorrent-rpc.readthedocs.io/)

`rtorrent-rpc` is a python wrapper on top of rtorrent XML RPC protocol,
hosted on GitHub
at [github.com/trim21/rtorrent-rpc](https://github.com/trim21/rtorrent-rpc)

Document is hosted at https://rtorrent-rpc.readthedocs.io/ by readthedocs.

## Introduction

```console
pip install rtorrent-rpc
```

supported extras:

- `orjson`: use [orjson](https://github.com/ijl/orjson) as jsonlib

```console
pip install 'rtorrent-rpc[orjson]'
```

## Contributing

All kinds of PRs (docs, feature, bug fixes and eta...) are most welcome.

## Quick Start

```python
from rtorrent_rpc import RTorrent

client = RTorrent(address='scgi://127.0.0.1:5000')
unix_client = RTorrent(address='scgi:///home/ubuntu/.local/share/rtorrent.sock')
```

tls cert validation is enabled when you are using `https` protocol, set environment
variable `PY_RTORRENT_RPC_DISABLE_TLS_CERT=1` to disable.

## Known Problem

rTorrent's [xmlrpc-c does not support all utf8 characters](https://github.com/rakshasa/rtorrent/issues/1250),
for example, emoji.

If torrent name of file name contains any emoji,
you can't retrieve correct torrent name or file name through xmlrpc-c.

Please consider either:
* Compiling rtorrent with tinyxml2 instead of xmlrpc-c, which will allow all unicode characters
* Using a rtorrent distro with json-rpc support,
for example: [jesec/rtorrent](https://github.com/jesec/rtorrent), which support utf8
correctly. If your rtorrent distro support jsonrpc,
you can use send json-rpc request with `RTorrent(...).jsonrpc.call(...)`.

## License

`rtorrent-rpc` is licensed under the MIT license.
nkutils 0.1.2
Simple Utilities for reading from excel named ranges, forward rates and other minor tasks

Experimental package with some functions I found useful for automating frequently used tasks

The package is for illustration only - it is unlikely it will be updated. Or it may be replaced by a more comprehensive list of other packages.

It has the following functions: 
- read_named_range_to_dataframe(file_path, sheet_name, range_name, header=True)
    - reads data to a python dataframe from a named range in excel. 
    - arguments are: 
        - filepath: the name of the file, together with the path, if not in the working directory
        - sheet_name: self-explanatory
        - range_name: self-explanatory
        - header: defaults to True, which assumes the table/range has a label.
    - even if you put "A1:B5", the code should work. ,m,
    - it reads single cells as well as rectangular ranges.
    - It probably fails with ranges that are neither of the two above. 
    - it works with .xlsx and .xlsm files. Does not work with .xlsb files for now. 

-   forward_rate(rfr, t1,t2, comp="ann")
    - calculates the forward rate between two times
    - takes as inputs a list of spot rates and the two times between which the forward rate is to be calculated
    - the list is assumed to have rates at each year (so it assumes annual rates)
    - by default it assumes annual compounding. You can set comp = "cont" for continuous formula.

-   send2clipboard(A,colnames = ["datafrompython"])
    - used mainly while debugging jupyter notebook files; 
    - A is usually a numpy array. 
    - you can add a colnames argument that matches the number of columns of the array
    - no index is printed.

-   print_stats(myseries,percentiles = [0.01, 0.05, 0.25, 0.5, 0.75, 0.95, 0.99], colnames = None)
    - prints various statistics from the myseries data; the built-in describe function didnt do it for me!
    - myseries needs to be a numpy array with numerical data only; nan values will result in error
    - as well as the percentiles, it prints mean, st.dev, skewness, kurtosis, min and max
    - colnames need to have the right size, or it will result in an error. or you can leave empty
    - this is a crude stats function. a more sophisticated one will be published in due course.

-  align_to_schema(subdf: pd.DataFrame, maindf: pd.DataFrame)
    - produces a single dataframe with all columns of the main dataframe, maintaining their order.
    - it also adds any columns in the subdf that are not in the maindf 
    - it makes sure there is no NaN data, by putting zeros or empty strings in the relevant columns
    - useful for combining a "base position" list of assets with a "buy list" which may have some fields that are not relevant in the base scenario (e.g. asset base MA or asset base FS)

If you have used the previous version, please note the forward rate calc was wrong - it is fixed now.
seqcalc 0.0.2
Arithmetic sequence calculator
Requires Python: >=3.9

A Python package for calculating arithmetic sequences.

*Features:*

- Calculate the nth term of an arithmetic sequence
- Calculate the sum of the first n terms of an arithmetic sequence

*Installation:*

    pip install seqcalc

*Usage:*

Find the nth term

    seqcalc.find(nth, first_term, common_difference)

Find the sum

    seqcalc.find_sum(nth, first_term, common_difference)

Example:

    import seqcalc

    nth = 16
    first_term = 3
    d = 2

    seq = seqcalc.find(nth, first_term, d)
    print(seq)

    # output: 33