semvec/pypi-packages huggingface dataset:
Swagger2Tests 1.2.2
swagger


# 生成pytest用例

## install

```shell
python3 -m venv .myenv
source .myenv/bin/activate
#deactivate 退出
```

## 1. 初始化

```shell
Swagger2Tests --init --target='./'
```

初始化项目时会在指定的`target`目录,初始化项目，并且生成一些基础文件。

- constants 可配置一些公共参数 比如 domain等
- helpers 一些通用方法
- templates 生成模板，可进行自定义修改

## 生成测试文件

```shell
Swagger2Tests --swagger='https://swagger.json' --target='./'
```

- swagger 参数支持文件和url

当前会按请求参数类型，一次性生成固定值，如果需要每次请求都动态更改,则可以在文件里进行修改，使用Helper类的方法

```python
    def test_chargingUsingPOST(self):
        # 计算费用
        requestBody = {
            "appid": REQUEST_APPID,
            "bizContent": {
                'amount': Helper.get_random_float(),
                'gasId': 'string',
                'gunNo': Helper.get_random_int(),
                'oilNo': Helper.get_random_int()
            },
            "sign": "string",
            "timestamp": Helper.get_random_datetime()
        }
```

## 用pytest 进行接口测试

1. 在当前目录创建test_suits目录
2. 在该目录内创建符合pytest扫描规则的测试文件,下面是个示例`test_detail.py`.

```python
from apps.testCases.goods.items.DetailCase import *

class TestDetail:

    def test_detail(self):
        DetailCase.detailUsingGET()
```

以上只是一个示例，描述了对单个接口的测试。实际上，你可以处理接口返回，进行串联，模拟某个功能场景的测试集合。

3. 编写pytest执行文件

```python
import pytest

if __name__ == '__main__':
    pytest.main(['-s'])

```

执行单接口或场景接口集合测试

```shell
python3 pytest_main.py  
```

- 使用pytest_main.py 执行的意义在于，避免有使用自定义包,因目录层级而存在的包导入问题

## 结合locust进行压力测试

1. 编写locust用例文件

```python
from locust import HttpUser,task
from locust.clients import LocustResponse
from apps.testCases.goods.items.DetailCase import *
from Swagger2Tests.helpers.helper import RequestInfo


class TestUser(HttpUser):

    min_wait = 5 * 1000
    max_wait = 10 * 1000


    @task
    def getGoodsDetail(self):
        r:RequestInfo = DetailCase.detailUsingGET(self.host)
        response:LocustResponse
        with self.client.request(r.request_method,r.request_path,
                            data=r.request_body,params=r.request_params,
                            catch_response =True
                            ) as response:
            if response.status_code == 200:
                response.success()
            else:
                response.failure("Request failed with status code: %s" % response.status_code)

```

## development

1. test

```shell
python3 -m tests.test_run --swagger='./tests/oil_detail.json'
```

2. compile and deploy

```
python3 setup.py sdist bdist_wheel
twine upload dist/*   
```
symsearch 0.0.2
symsearch is a search engine for research and development that uses a searching and ranking pipeline in Dense Passage Retrieval.
Requires Python: >=3.8

# SYMSEARCH
symsearch is a search engine for research and development that uses a searching and ranking pipeline in Dense Passage Retrieval. 

## Installation
symsearch recommends Python 3.8 or higher version. 

Install with ``pip``
```
pip install symsearch
```

## Training
    Updating . . .
## Inference 
### Retrieval
1. Query embedding
  
``` python
from symsearch import RetrieveInference

sentence = "Why does water heated to room temperature feel colder than the air around it?"

retrieve = RetrieveInference(
        model_name_or_path="caskcsg/cotmae_base_msmarco_retriever",
        q_max_length=128,
        device_type='cpu'
      )
query_embd = retrieval.encode_question(sentence)
print(query_embd)
```
2. Passage embedding
``` python
from symsearch import RetrieveInference

sentence = "Water transfers heat more efficiently than air. When something feels cold it's " \
          "because heat is being transferred from your skin to whatever you're touching. " \
          "Since water absorbs the heat more readily than air, it feels colder."

retrieve = RetrieveInference(
        model_name_or_path="caskcsg/cotmae_base_msmarco_retriever",
        p_max_length=384,
        device_type='cpu'
      )
passage_embd = retrieval.encode_context(sentence)
print(passage_embd)
```
    
### Reranker
```python
from symsearch import RerankInference

sentence1 = "If I hypothetically built a fully functioning rocket and were able to "\
            "fund the trip myself, would it be legal for me to leave earth?"
sentence2 = "crew, who have become the first humans to travel into space. The rocket is at first thought to be lost, " \
            "having dramatically overshot its planned orbit, but eventually it is detected by radar and returns to Earth, " \
            "crash-landing in Wimbledon, London.\nWhen Quatermass and his team reach the crash area and succeed in opening " \
            "the rocket, they discover that only one of the three crewmen, Victor Carroon, remains inside."

rerank = RerankInference(
        model_name_or_path="caskcsg/cotmae_base_msmarco_reranker",
        q_max_length=128,
        p_max_length=384,
        device_type='cpu'
      )
score = rerank.encode_pair(query=sentence1, passage=sentence2)[0]
print(score)
```

# Contacts
If you have any questions/suggestions feel free to open an issue or send general ideas through email.
- Contact person: tien.ngnvan@gmail.com
  
> This repository contains experimental research and developments purpose of giving additional background details on Dense Passage Retrieval.
amy-py 0.0.7
Transform Python development with this innovative package, introducing a unique syntax extension that empowers developers to write code more expressively and efficiently. Explore a new level of flexibility and productivity in your projects with this custom Python language enhancements.
Requires Python: >=3.6

# amy_py - Custom Python Syntax Extension

amy_py is a powerful Python package that introduces a unique and expressive custom syntax extension for Python developers. With amy_py, you can leverage an innovative set of keywords and constructs that enhance your coding experience and productivity.

## Features

- **Custom Syntax**: amy_py extends Python's capabilities with custom keywords like `VAR`, `IF`, and more, allowing you to write code in a more intuitive and concise manner.

- **Improved Readability**: Our custom syntax enhances code readability, making it easier to understand and maintain complex logic.

- **Boosted Productivity**: amy_py streamlines common programming tasks, reducing boilerplate code and saving you time.

- **Seamless Integration**: You can seamlessly integrate amy_py into your existing Python projects without disrupting your workflow.

## Installation

To get started with amy_py, simply install it using `pip`:

```bash
pip install amy_py
Usage
amy_py is straightforward to use. Import the package and begin writing code with the custom syntax:

python
Copy code
import amy_py

# Use custom syntax
amy_py.VAR('a', 42)
amy_py.IF(a == 42, "Hello, amy_py!")

# Your code continues here
Documentation
For detailed information on how to use amy_py and a complete list of available keywords and features, please refer to our official documentation.

Examples
Explore practical examples and use cases in the examples directory of this repository.

Support
If you encounter any issues or have questions, feel free to reach out to us on our GitHub Issues page.

Contributing
We welcome contributions! If you'd like to enhance amy_py or report issues, please check our Contributing Guidelines.

License
This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments
We would like to thank the Python community for its continuous support and inspiration.

Enjoy coding with amy_py and unlock a new world of possibilities in Python development!