semvec/pypi-packages huggingface dataset:
asfunc 0.1.0
装饰器对象，用来装饰同步函数，将同步函数变为可运行的异步函数。
Requires Python: >=3.9
Keywords: async,asyncio,func,function

# asfunc

> asfunc是一个同步函数装饰器，将同步函数变为可运行的异步函数。
> 同时支持在同步或异步函数上使用。

## 装饰器用法

```python
import asyncio
from asfunc import asfunc


@asfunc()
def sync_func():
    print("sync func run.")

asyncio.run(sync_func())
```

## 函数用法

```python
import asyncio
from asfunc import asfunc

def sync_func(msg: str):
    print("sync func run.", msg)

async def main():
    print("async func run.")
    await asfunc(sync_func, "some msg")

asyncio.run(main())
```
goerr 0.11.0
Go style explicit errors handling
Keywords: errors,error_handling

# Goerr

Go style explicit error handling in Python. Features:

  - **Pretty print** of error details  
  - **Trace** errors across the call stack  
  - **Log** errors  
  - **Test** errors

   ```bash
   pip install goerr
   ```
[Documentation](https://synw.github.io/goerr/)

## API

### Class **`Err`**

#### Methods:

**`err`**: creates a new error, print it and store it in the trace if the option is activated. Exit the program
if the trace is not activated. Parameters: 

- `ex`: an exception (optional)
- `msg`: the message string (optional)
Either a message string or an exception has to be provided as argument for the error to be
printed. If no argument is provided it will just record the function name to keep a trace of
the call stack

**`warning`**: prints a warning message

**`info`**: prints an info message

**`debug`**: prints a debug message

**`panic`**: force program exit after an error even if the errors trace is activated

**`to_dict`**: returns a dictionnary with the error details 

### Class **`Log`**

Same as  `Err` but log errors

#### Properties

**`log_path`**: path of the file where to log. Default is `"errors.log"`  
**`log_format`**: csv or text. Default is `"csv"`. 
Note: the tracebacks are not recorded if the format is csv.

### Class **`Trace`**

Same as `Err` but trace errors

#### Properties

**`trace`**: prints the errors trace and reset it
**`via`**: same as `err` with an empty error: to record the call stack. See example

## Example

Check the [examples](./examples) directory for code

Trace errors across the call stack:

```python
import time
from goerr import Trace

err = Trace()

def func1():
    print("Func 1 running")
    time.sleep(0.5)
    try:
        'x' > 1
    except Exception as e:
        err.new("Errmsg frun func1", e)
    print("Func 1 finished")

def func2():
    func1()
    time.sleep(0.5)
    err.via("Errmsg frun func2")
    print("Func 2 running")
       
def func3():
    func2()
    time.sleep(0.5)
    err.via()
    print("Func 3 running")
        
func3()
err.trace()
```

Output:

![Stack trace screenshot](doc/img/output.png)

## Testing errors in programs

A helper function is available to test errors:

**`testing.assert_err`**: parameters: 

- `error type`: a string with the error type
- `function to run`: the function to test
- `*args`: function arguments
- `**kwargs`: function keyword arguments

Example:

```python
# the program
from goerr import Err
   
   class Foo(Err):
      def func1(self, param1, param2):
          try:
              param1 > param2
          except Exception as e:
              self.err(e)

# the test
import unittest
from goerr.testing import assert_err
from myprogram import Foo

   class MyTest(unittest.TestCase):
	  def test_myprogram(self):
          foo = Foo()
          assert_err("TypeError", foo.func1, 1, "bar")
```

## Why?

I like the explicit errors management in Go (unlike many people) and I wanted to have the
same kind of experience in Python: a fined grained control over errors all across the call
stack.

The same lib in Go: [terr](https://github.com/synw/terr)
fast-torrent-trackers 0.0.1
快速开始搜索种子、下载种子(API Support for your favorite torrent trackers)
Requires Python: >=3.8
Keywords: torrent,tracker,bt,pt

种子搜索下载工具
==============
种子资源搜索、下载API，支持BT/PT站点(API Support for your favorite torrent trackers)
## Installation
Install using pip:
```
pip install fast-torrent-trackers
```