semvec/pypi-packages huggingface dataset:
LSparser 0.1.7
A command parser which breaks down a "command" into name, params, short & long options
License: MIT
Requires Python: >=3.6.0

# LSparser
[![pypi_badge](https://img.shields.io/pypi/v/LSparser?color=blue)](https://pypi.org/project/LSparser/)

一个基于Python的指令解析器（大概）

解析一定格式的指令，形如：
```
    .cmd param1 param2 -s1 -s2 s2val --l lval1 lval2 lval3
```
得到
```
    type: "."
    command: "cmd"
    params: ["param1", "param2"]
    s1: True
    s2: "s2val"
    l: ["lval1", "lval2", "lval3"]
```
### 安装
```
    pip install LSparser
```

### 指令格式
- type/指令前缀：一个字符，用于分辩文本是否为指令

  默认为`[".", "。", "-", "!", "！", "/"]`
- command/指令名：指令名称
- params/参数：提供给指令的参数
- short options/短选项：默认以`"-"`为前缀的选项，可以有至多一个选项值
- long options/长选项：默认以`"--"`为前缀的选项，可以有多个选项值

一些规则：
- 指令名、参数、选项、选项值之间通过`" "`分隔
- 可以事先设定哪些选项可被解析，以及这些选项后是否有选项值
- 没有附带选项值但出现在指令中的选项，其选项值当做`True`处理

### 使用方法
引入库
```Python
    from LSparser import *
```
创建指令模板，提供帮助文本，并设定要被解析的选项
```Python
    c=Command("cmd")
    c.help("这是名为cmd的指令")
    c.opt("-s1",OPT.Try,"短选项s1").opt("-s2",OPT.Must,"s2").opt("--l",OPT.Must,"还有长选项l")
```
可以为指令添加别名、指令前缀
```Python
    c.names("cmd1")
    c.types("$","￥")
```
添加回调函数
```Python
    @Events.onCmd("cmd")
    def cmdfunc(pr:ParseResult):
        # result 为 ParseResult 对象
        print("一个回调函数")
        print(pr) #解析结果储存在其中
        return "返回值"
```
解析指令
```Python
    cmd=".cmd param1 param2 -s1 -s2 s2val --l lval1 lval2 lval3"
    cp=CommandParser()
    pr:ParseResult=cp.tryParse(cmd)
    print("args:",pr.args) #选项
    print("output: ",pr.output) #回调函数执行结果
    # => ["返回值"]
```

进阶地，指令解析后各种情况
- 未解析到指令：
```Python
    #根本不是指令
    @Events.onNotCmd
    def notCmd(pr:ParseResult,cp:CommandParser):
        pass
```
- 解析到未定义指令：
```Python
    @Events.onUndefinedCmd
    def cmdUndefined(pr:ParseResult,cp:CommandParser):
        if pr.command=="test": #判断指令名
            pr.opt("-ts1",OPT.Must).opt("-opt",OPT.Not).opt(["-j","--j"],OPT.Try)
            pr.parse()
            #根据指令名设定选项，再次解析
            #可以在这里处理指令
```
- 解析到指令，但指令前缀和定义不匹配：
```Python
    @Events.onWrongCmdType
    def wrongType(pr:ParseResult,cp:CommandParser):
        if pr.type=="$":
            #可以在这里处理错误
            pass
```
一些额外内容
- 更多事件
```Python
    @Events.onCmd.error("cmd")
    @Events.onBeforeParse
    @Events.onAfterParse
    @Events.onExecuteError
    ...
```
- 解析时提供额外数据
```Python
    Command("extra")
    @Events.onCmd("extra")
    def extraFunc(pr:ParseResult):
        print(pr.dataArgs) #=> ('R', 'P', 'K')
        print(pr.dataKW)   #=> {'atk': 3000, 'def': 2500}

    cp.tryParse(".extra",*["R","P","K"],**{"atk":3000,"def":2500})
```
- 异步支持
```Python
    async def ainit():
        Command("async")
        @Events.onCmd("async")
        async def asyncFunc(pr:ParseResult):
            pass
        pr=await cp.asyncTryParse(".async")
```
- 不解析，手动构建解析结果并执行
```Python
    pr=ParseResult.fromCmd(cp,".cmd",params=["param1","param2"],
        args={"s1":True,"s2":"s2val","l":["lval1","lval2","lval3"]}
    )
    pr.execute()
```
- 比较文本和各指令间的相似度
```Python
    similist=cp.core.getCmdSimilarity("zmd",top=5)
```
tiffit 0.1.0
Lightweight tiff utilities
License: MIT

# tiffit
Lightweight command-line interface for handling tiff files in BigTIFF format.

Convert, extract information, and concatenate. That's it. Nothing fancy.


## installation and usage
Install with pip and then use from command line.

    pip install tiffit

    # convert file into a well-behaved bigtiff file
    tiffit convert old.tiff new.tiff

    # get info about file without loading into memory
    tiffit info filename.tiff

    # concatenate two tiff files into a single bigtiff file
    tiffit concat file1.tiff file2.tiff newfile.tiff


## Notes / caveats
- If there is other information you would like read out from the info command, please let me know, bearing in mind I am trying to keep this interface fairly universal and simple.
- For an excellent overview of tiff (`thousands of incompatible file formats`), see [https://www.fileformat.info/format/tiff/egff.htm](this excellent overview). It is a bit dated, but is still the best thing I've found.
- If you need a package with more complexity, see:
    - [opencv](https://docs.opencv.org/4.x/d6/d00/tutorial_py_root.html)
    - [pillow](https://github.com/python-pillow/Pillow)
    - [tiffile](https://github.com/cgohlke/tifffile/)
    - [tifftools](https://github.com/DigitalSlideArchive/tifftools)


## To do
- add keyword argument to info so user can check on specific image in stack.
Better yet, don't allow mixing of formats just make this a pure bigtiff library: add autoconversion of concatenated files.
- add verbosity controller for convert and concat.



## Acknowledgments
- Powered by the [tifffile](https://github.com/cgohlke/tifffile/) and [tifftools](https://github.com/DigitalSlideArchive/tifftools) packages.
- Developed with support from NIH Bioinformatics, NIEHS Neurobehavioral Core, NIEHS Neurobiology Laboratories. In particular thanks to Shaohua Wang for help during development.
batServe 1.0rc7
Simple file server and reverse proxy | part of batBelt
License: MIT
Requires Python: >=3.6.0


<p align="center">
    <h1 align="center">batServe</h1>
    <p align="center">simple, useful file server | part of <b><i>batBelt</i></b></p>
</p>


**Installation**:

- If you have python >= 3.6 installed and want to install batServe only

```pip install --upgrade batserve```

- If you don't have python pre-installed, batServe is available as a pre-built binary via batBelt

**Usage**:

```
usage: batserve (or) python -m batserve (optional arguments)

batBelt file server (1.0-rc4) - simple and useful file server

optional arguments:
  -h, --help            show this help message and exit
  --host [HOST]         Serve on host (eg: localhost, 0.0.0.0). Defaults to 0.0.0.0
  --port [PORT]         Serve on port. Defaults to 8080
  --public              Serve on a publicly accessible URL
  --no-index            Disable auto-generation of index.html
  --no-symlinks         Don't follow symlinks
  --dir [DIR]           The directory path to serve. Defaults to ./
  -u [USERNAME], --username [USERNAME]
                        Username for security, not set by default
  -p [PASSWORD], --password [PASSWORD]
                        Password for security, not set by default

```
spladtool 0.0.5
The Simple Pytorch-Like Auto Differentiation Toolkit is an automatic differentiation package for calculating gradients of a function in forward and reverse mode.
License: MIT
Requires Python: >=3.7

## Introduction

With the rapid development of deep learning, auto differentiation has become an indispensable part of multiple optimization algorithms like gradient descent. Numerical means such as Newton's Method and finite-difference method is useful in some situations, we desire to compute the analytical solutions by applying chain rules with our automatic differentiation SPLADTool (**S**imple **P**ytorch-**L**ike **A**uto **D**ifferentiation **Tool**kit), which will be faster and more accurate than numerical methods.

## Usage

1. Create a virtual environment: Conda
    ```bash
    conda create --name spladtool_env python
    ```
    
   Activate the environment:
   ```bash
   conda activate spladtool_env
   ```
   
   Deactivate the envrionment after use:
   ```bash
   conda deactivate
   ```

2. 
    Install spladtool
    ```bash
    pip install spladtool
    ``` 

3. Try out an example from `test.py` on arithmetic functions:

   ```python
   import spladtool.spladtool_forward as st

   x = st.tensor([[1., 2.], [3., 4.]])
           
   # Define output functions y(x) and z(x)
   y = 2 * x + 1
   z = - y / (x ** 3)
   w = st.cos((st.exp(z) + st.exp(-z)) / 2)
   
   # Print out the values calculated by our forward mode automatic differentiation SPLADTool
   print('x : ', x)
   print('y : ', y)
   print('y.grad : ', y.grad)
   print('z: ', z)
   print('z.grad: ', z.grad)
   print('w: ', w)
   print('w.grad: ', w.grad)
   ```

4.  Try out an example training a linear classifier on a dataset
    ```python
    import spladtool.spladtool_reverse as str
    from spladtool.utils import SGD
    import numpy as np


    # We chose a simple classification model with decision boundary being 4x1 - 3x2 > 0
    x = np.random.randn(200, 2)
    y = ((x[:, 0] - 3 * x[:, 1]) > 0).astype(float)

    # define a linear regression module

    np.random.seed(42)

    class MyModel(str.Module):
        def __init__(self):
            super().__init__()
            self.register_param(w1=str.tensor(np.random.randn()))
            self.register_param(w2=str.tensor(np.random.randn()))
            self.register_param(b=str.tensor(np.random.randn()))

        def forward(self, x):
            w1 = self.params['w1'].repeat(x.shape[0])
            w2 = self.params['w2'].repeat(x.shape[0])
            b = self.params['b'].repeat(x.shape[0])
            y = w1 * str.tensor(x[:, 0]) + w2 * str.tensor(x[:, 1]) + b
            return y

    # define loss function and optimizer
    model = MyModel()
    criterion = str.BCELoss()
    opt = SGD(model.parameters(), lr=0.1, momentum=0.9)

    # training
    for epoch in range(100):
        outputs = model(x)
        targets = str.tensor(y)
        loss = criterion(targets, outputs)
        opt.zero_grad()
        loss.backward()
        opt.step()
        print(loss.data)
    ```
pydantic-webargs 1.1.0
Pydatic webargs
License: MIT
Requires Python: >=3.7

# Pyndatic Webargs
[![CircleCI](https://circleci.com/gh/nf1s/pydantic-webargs.svg?style=shield)](https://circleci.com/gh/nf1s/pydantic-webargs) [![codecov](https://codecov.io/gh/nf1s/pydantic-webargs/branch/master/graph/badge.svg)](https://codecov.io/gh/nf1s/pydantic-webargs) ![GitHub Pipenv locked Python version](https://img.shields.io/github/pipenv/locked/python-version/nf1s/pydantic-webargs) [![Downloads](https://pepy.tech/badge/pydantic-webargs)](https://pepy.tech/project/pydantic-webargs) ![license](https://img.shields.io/badge/license-MIT-green)

A library for parsing and validating http requests for flask web-framework using pydantic library 

Full documentation [here](https://nf1s.github.io/pydantic-webargs/)

## Requirements

	python >= 3.7

## How to install

```bash
pip install pydantic-webargs
```

## Dependencies

	flask
	pydantic

## Example


```python
from flask import Flask
from pydantic import BaseModel
from pydantic_webargs import webargs

app = Flask(__name__)


class QueryModel(BaseModel):
    name: str


class BodyModel(BaseModel):
    age: int


@app.route("/get-request", methods=["GET"])
@webargs(query=QueryModel)
def example_get_endpoint(**kwargs):
    response = kwargs
    return response


@app.route("/post-request", methods=["POST"])
@webargs(query=QueryModel, body=BodyModel)
def example_post_endpoint(**kwargs):
    print(kwargs)
    response = kwargs
    return response


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)
```