semvec/pypi-packages huggingface dataset:
magic-timer 1.0.0
Conveniently get a rough idea of how long things take.
Requires Python: >=3.6

# magic-timer

[![](https://github.com/sradc/magic-timer/workflows/Python%20package/badge.svg)](https://github.com/sradc/magic-timer/commits/)

`pip install magic-timer`

Conveniently get a rough idea of how long things take. 

This is a light wrapper around the standard library's [time.monotonic](https://docs.python.org/3/library/time.html#time.monotonic). It aims to provide a clean API, and nice output strings.


## How to use:

```python
from magic_timer import MagicTimer

timer = MagicTimer(history=True)
for i in range(3):
    expensive_computation()
    # Print nicely formatted string:
    print(f"{i} - elapsed time {timer}")

# Get the elapsed times that were printed:
print("timer.str_history =", timer.str_history)
```

```
0 - elapsed time 510 milliseconds
1 - elapsed time 1.1 seconds
2 - elapsed time 1.6 seconds
timer.str_history = [0.5046274580000158, 1.005028416000016, 1.510260250000016]
```

## Use via context manager:

```python
from magic_timer import MagicTimer

with MagicTimer() as timer:
    # do stuff
    x = sum(i*i for i in range(100_000))

# Print a nicely formatted string:
print('Stuff took', timer)

# Or get the elapsed time in seconds:
time_elapsed = timer.time_elapsed()
print(time_elapsed)
```

```
Stuff took 8.0 milliseconds
0.007906290999997623
```

## Use via `MagicTimer` object:

```python
from magic_timer import MagicTimer

def do_stuff():
    [i*i for i in range(5_000_000)]

timer = MagicTimer()
do_stuff()
print('Stuff took', timer)
do_stuff()
print("Note the timer's still ticking, unless `.stop()` is called...", timer)
```

```
Stuff took 210 milliseconds
Note the timer's still ticking, unless `.stop()` is called... 400 milliseconds
```



To pause the timer, use the `stop` method (restart with the `.start()` method). (Note that the context manager automatically calls `.stop()`).

```python
from magic_timer import MagicTimer

def do_stuff():
    [i*i for i in range(5_000_000)]

timer = MagicTimer()
do_stuff()
timer.stop()
print('Stuff took', timer)
time_elapsed = timer.time_elapsed()
other_stuff()
timer.start()  # continue timing
```

## Use via `ftimer` decorator:

```python
from magic_timer import ftimer

@ftimer
def do_stuff():
    [i*i for i in range(20_000_000)]

do_stuff()
```

```
`do_stuff` ran in 1.9 seconds.
```

### The use case for this package:

You have something you want to time, but you don't want to time it multiple times with [timeit](https://docs.python.org/3/library/timeit.html).

You also don't want to use [Jupyter's `%%timeit`](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-timeit) because it puts the cell into a different scope.

You can import `magic-timer`, throw it in, and get a rough idea of the time taken. (It's slightly neater than using time.monotonic directly.)
fastapi-exceptions 0.1.0
Common exceptions for FastAPI
Requires Python: >=3.6

# [FastAPI](https://fastapi.tiangolo.com/) exceptions

## Introduction

`fastapi-exceptions` is a set of standard http exceptions based on starlette exceptions.
## Installation

```shell
> pip install fastapi-exceptions
```

## Usage

Instead of duplication of exceptions codes and their details for standard cases:

```python
from fastapi import HTTPException
from starlette import status

# some app logic ...
    raise HTTPException(
        status_code=status.HTTP_401_UNAUTHORIZED,
        detail='Authentication credentials were not provided',
    )
```

you can simply import exceptions and use wherever you need:
```python
from fastapi_exceptions.exceptions import NotAuthenticated

# some app logic ...
    raise NotAuthenticated()
```

and, of course, modify details if needed:
```python
# some app logic ...
    raise NotAuthenticated(detail='No authentication header')
```
secure-config-manager 0.0.2
Secure config manager. Access app secrets easily without sharing them to public.
Requires Python: >=3.0

# secure-config-manager

## Description
Secure ConfigManager offers splitting your JSON config files into two parts.

We suggest one main `config.json` file that can be safely checked out to version control system. This can contain default values or a sample config structure for reference. The second one would be `config_override.json`, containing secret tokens or environment-dependent values.

Data in `config_override.json` is assumed to be more relevant, hence if the value is present in both configs, we choose config_override.

## Usage example
```
>>> from secure_config_manager import ConfigManager
>>> config_manager = ConfigManager(config_path="tests/test_config.json", config_override_path="tests/test_config_override.json", redacted_keys=("secret", "key"))
>>> config_manager.load_config_with_override()
{'key_a': {'attr1': 'value1', 'attr2': 'new_value', 'attr_secret': 'secret_value'}, 'key_b': {'attr1': 1}, 'key_c': {'app_key': 'sensitive_value'}}
>>> config_manager.redact(config_manager.get_key_a_config())
{'attr1': 'value1', 'attr2': 'new_value', 'attr_secret': '*****'}
```

## Notes:
* ConfigManager is a singleton class
* ConfigManager is application-agnostic and can be used in any Python 3.x project of your choice
raypipe 1.0.0
Easy implementation and abstraction for train and deploy model on ray cluster

## 简介
Easy implementation and abstraction for train and deploy model on ray cluster

## 资源清单
1. docker image  
   docker.4pd.io/ray_tensorflow2:pipe-105-commit-aa96d082
2. 安装文档  
./doc
3. 安装
pip install raypip