semvec/pypi-packages huggingface dataset:
body-oc 2.2.0
Body contains shared concepts among all body parts
Requires Python: >=3.10

# body_oc
[![pypi version](https://img.shields.io/pypi/v/body-oc.svg)](https://pypi.org/project/body-oc) ![Custom License](https://img.shields.io/pypi/l/body-oc.svg)

Provides classes to create RESTlike micro-services with minimal configuration.

Please see [LICENSE](https://github.com/ouroboroscoding/body/blob/main/LICENSE)
for further information.

See [Releases](https://github.com/ouroboroscoding/body/blob/main/releases.md)
for changes from release to release.

See full [documentation](https://github.com/ouroboroscoding/body/blob/main/documentation.md) for complete description of `body_oc` and how to use it.

## JavaScript/TypeScript
Check out [@ouroboros/body](https://www.npmjs.com/package/@ouroboros/body)
on npm if you want to easily connect to body services in your choice of
javascript / typescript framework.
askin 0.0.2
Asynchronous keyboard input
Requires Python: >=3.11

# askin
### Asynchronous Keyboard Input

`askin` is a Python package that provides a simple way to get keyboard input asynchronously.

### Installation

```bash
pip install askin
```

### Usage

```python
from askin import KeyboardController


class KeyState:
    def __init__(self) -> None:
        self.value = 0

    async def update(self, key: str) -> None:
        if key == "a":
            self.value += 1
        elif key == "b":
            self.value -= 1


async def key_handler(key: str) -> None:
    key_state.update(key)


async def default() -> None:
    print("Default! Resetting value to 0")
    key_state.value = 0


async def main() -> None:
    key_state = KeyState()
    controller = KeyboardController(key_handler=key_state.update, default=default, timeout=0.001)
    await controller.start()

    try:
        while True:
            print(key_state.value)
            await asyncio.sleep(0.1)
    finally:
        await controller.stop()


if __name__ == "__main__":
    asyncio.run(main())
```
str2td 0.0.5
Easily convert from short, human readable, and easy to input strings to timedeltas and datetimes
Requires Python: >=3.12

# str2td

Easily express a timedelta in a succinct and human-readable way.

## Usage example
```python
from datetime import datetime
from lark import LarkError
from str2td import str2td

now = datetime.now().astimezone()
tz = now.tzinfo  # can be different if the string's timezone is different than your calculation timezone.

print(f"{now=:%Y-%m-%d %H:%M:%S (%Z)}\n")

try:
	string = input("Set a reminder in: ")
	td = str2td(string, now=now, tz=tz)
	print(f"Setting reminder at {now + td:%Y-%m-%d %H:%M:%S} ({td} from now).\n")

	string = input("When's your birthday? ")
	td = str2td(string, now=now, tz=tz)
	print(f"Great! Your nearest birthday is at: {now + td:%Y-%m-%d %H:%M:%S}, in {td.days} days.\n")

	string = input("[Seconds calculator]: ")
	td = str2td(string, now=now, tz=tz)
	print(f"{string} = {td.total_seconds()} seconds")
except LarkError as e:
	print("\nInvalid Syntax!")
	print("=" * 50)
	print(e)
	print("=" * 50)

```
<details>
<summary>Successful inputs</summary>

```
now=2025-05-13 21:01:41 (Central European Summer Time)

Set a reminder in: 3d!10:
Setting reminder at 2025-05-17 10:00:00 (3 days, 12:58:18.493712 from now).

When's your birthday? 10-10
Great! Your nearest birthday is at: 2025-10-10 21:01:41, in 150 days.

[Seconds calculator]: 3d-.25d5.5h1s
3d-.25d5.5h1s = 257401.0 seconds.
```
</details>

<details>
<summary>Erroring inputs</summary>

```
now=2025-05-13 21:12:22 (Central European Summer Time)

Set a reminder in: 1huj
Invalid Syntax!
Error trying to process rule "robostr_segment":

Unknown unit: 'huj'
```
</details>