semvec/pypi-packages huggingface dataset:
gst-calculation 0.1.2
This package contains Greedy String Tiling calculation
Requires Python: >=3.7

# GST Calculation
GST is a module that calculates Greedy String Tiling algorithm as described in "String Similarity via Greedy String Tiling and Running Karp−Rabin Matching" (Wise, 1993) - https://www.researchgate.net/publication/262763983_String_Similarity_via_Greedy_String_Tiling_and_Running_Karp-Rabin_Matching

# Installation
### Using PIP via PyPI
```
pip install gst-calculation
```
### Using PIP via Github
```
pip install git+https://github.com/tomytw/gst-calculation.git@0.1.2
```

# Usage

## Importing the package
```
>>> from gst_calculation import gst
```
You can calculate a gst of a collection of numbers or strings (or any collection of object that can be compared using equal function, must have \_\_eq\_\_ method inside it's class)

The result will be array that contains two elements (two index):
1. Tile information (position and length of matched tiles)
2. Total score
## GST on Numbers List
```
>>> tokens_sequence_1 = [1,2,3,4,5]
>>> tokens_sequence_2 = [3,4,5,6,7]
>>> gst.calculate(tokens_sequence_1, tokens_sequence_2, minimal_match=3)
    [[{'token_1_position': 2, 'token_2_position': 0, 'length': 3, 'score': 3}], 3]
```
## GST on Strings List
```
>>> tokens_sequence_1 = ['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog']
>>> tokens_sequence_2 = ['the', 'lazy', 'dog', 'jumps', 'over', 'the', 'quick', 'brown', 'fox']
>>> gst.calculate(tokens_sequence_1, tokens_sequence_2, minimal_match=3)
    [[{'token_1_position': 0, 'token_2_position': 5, 'length': 4, 'score': 4},
    {'token_1_position': 6, 'token_2_position': 0, 'length': 3, 'score': 3}],
    7]
```
fastapi-cls 0.1.3
FastAPI framework class view router

## Example

### fastapi_cls demo
- Create a file `view.py` with: 

    ```python
    from pydantic import BaseModel

    from fastapi import Depends

    class User(BaseModel):
        username: str
        email: Optional[str] = None
        full_name: Optional[str] = None
        disabled: Optional[bool] = None

    async def get_user():
        return User(username="john")

    class ItemView:
        user: User = Depends(get_user)

        def get(self) -> User:
            return self.user

        def post(self) -> str:
            self.user.username = 'change name'
            return "ok"
    
    ``` 
- Create a file `route.py` with: 
    ```python
    from fastapi_cls import ClassRouter 
    router = ClassRouter()
    router.add_resource("/item",ItemView,methods=["GET","POST"])    
    ``` 
    Or, if you want to define your owner method reflect to http method. you can do like this. 

    ```python
    from fastapi_cls import ClassRouter 
    router = ClassRouter()
    router.add_method_route("/item",ItemView,ItemView.get, methods=["GET"])    
    router.add_method_route("/item",ItemView,ItemView.post, methods=["POST"])    
    ```

###  Its equivalent to 
- fastapi
    ```python
    from fastapi import ApiRouter, Depends


    class User(BaseModel):
        username: str
        email: Optional[str] = None
        full_name: Optional[str] = None
        disabled: Optional[bool] = None

    async def get_user():
        return User(username="john")

    router = ApiRouter()

    @router.get('/item')
    def get(user: User = Depends(get_user)) -> User:
        return user

    @router.post('/item')
    def post(user: User = Depends(get_user)) -> str:
        user.username = 'change name'
        return "ok"
    ```

    In this case. The `ItemView` methods `get` and `post` will bind on router as a function.
s3-upload-download 0.0.4
Utility modules for the s3 upload and download tasks.
Requires Python: >=3.6

# s3_upload_download with dirictory position 

Utilities for s3 download and upload file.

## Function for s3 download to the local path including s3 sub folder path

from  s3_upload_download import s3_transfers_utlits

s3_transfers_utlits.download_s3_file(bucket_name, s3_folder,file_extension, destination_path)

### Parameters:

        bucket_name: The name of the s3 bucket 
        s3_folder: The folder path in the s3 bucket including subfolders 
        file_extension: extension of file such as .parquet or .csv 
        destination_path: a relative or absolute directory path in the local file system 

Example Usage
.. code-block:: python

        from  s3_upload_download import s3_transfers_file

        bucket_name='test_bucket'
        s3_folder='test_folder'
        file_extension='.parquet'
        destination_path=f'home/momataj/test_folder/'
        s3_transfers_file.download_s3_file(bucket_name, s3_folder, file_extension, destination_path)





## Function for s3 upload from the local path including s3 sub folder path and file extension

from  s3_upload_download import s3_transfers_utlits

s3_transfers_utlits.upload_s3_file(bucket_name,source_path,base_dir,file_extension)

### Parameters:
        bucket_name: the name of the s3 bucket 
        source_path: local dirctory where file is located such as /home/{username}/{foldername} 
        base_dir: a relative or absolute directory path in the local file system such as /home/{username}/ 
        file_extension: extension of file such as .parquet or .csv 

Example Usage
.. code-block:: python
        from  s3_upload_download import s3_transfers_file

        bucket_name='test_bucket'
        s3_folder='test_folder'
        file_extension='.parquet'
        base_dir='home/momataj/'
        sourceDir=f'home/momataj/test_folder/'
        s3_transfers_file.upload_s3_file(bucket_name,sourceDir,base_dir,file_extension)