semvec/pypi-packages huggingface dataset:
fastlevenshtein 0.2.1
A really fast levenshtein distance implementation, with early exit.

.. contents ::

Introduction
------------
Rust implementation of levenshtein distance (https://en.wikipedia.org/wiki/Levenshtein_distance), based on Wagner–Fischer_algorithm (https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm).

Installation
------------

::

   pip install fastlevenshtein


Usage
------------

First param is either a list or a str.

It will be compared to the second param that is a str.

The third param is the maximum value of levensthein. 
For example, if the third param is 3, if the levensthein value reach at least 3, the function with exit and return 3 as value.
This third param is used to increase computation time when you are only interested in string that are close to each other.
If you do not want to use early exit, you can just use a really high value for this param

::

   from fastlevenshtein import levenshtein
   levenshtein("string1", "string2", 999) # 999 so no early exit
   >>> 1

   from fastlevenshtein import levenshtein_list
   levenshtein_list(["string1", "string2"], "string3", 999)
   >>> [1, 1]

   from fastlevenshtein import levenshtein_list
   levenshtein_list(["aaaaaaaa", "bbbbbbbb"], "ccccccc", 3) # early exit at 3 maximum value for levensthein distance
   >>> [3, 3]


License
-------

fastlevenshtein is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.

See the file COPYING for the full text of GNU General Public License version 2.
waycheck 0.0.1
A lightweight Python type checker. Designed with the developer in mind.
Keywords: waycheck,typechecker,type,check,assertion,assertion check,python types,ableinc,python type check,python type checker,python decorator,decorator,decorator class,type check decorator

# Waycheck (Python Type Checker)

A lightweight Python type checker. Designed with the developer in mind. The Waycheck class is a decorator, which means you can use it by prepending '@' above the function you'd like to type check. No library dependencies under the hood - Pure Python ;)!

## Install

```bash
python -m pip --install waycheck
```

## Getting Started

You can refer to the ```demo.py``` file in this repository or the code block below
to see how ```Waycheck``` works.

```python
import waycheck

# Defining the type for each argument
@Waycheck(a=int, b=int)
def main(a, b):
    print('Total: ', a + b)


# Defining the default type for ALL arguments
@Waycheck(default_type=int)
def main2(a, b):
    print('Total: ', a + b)


if __name__ == '__main__':
    main(5, 10)  # this will pass
    main('5', 10)  # this will fail

    main2(5, 10)  # this will pass
    main2('5', 10)  # this will fail
```

## Accepted Types

Waycheck can type check any valid Python Type provided to it, as well as a wildcard type. A wildcard type
is used when an argument can be any value. This is handy when you're doing your own type checking within
your function and would like Waycheck to skip type checking that argument.

You can specify a wildcard by using '*'. See an example below:

```python
@Waycheck(a='*', b=bool)
def main(a, b):
    if b:
        return a
```

You can also pass a tuple of Types, instead of '*' (wildcat). See an example below:

```python
@Waycheck(a=(str, int))
def main(a):
    print('Argument a is: ', a, ' - type: ', type(a))
```

## Exmaples

Refer to ```demo.py``` file.

## FAQ

Q: My type checking is failling/passing, but I know it shouldn't be. Why is this happening?
A: This happens when you don't specify the correct order of appearance for the Waycheck class.
The order in which the arguments are passed to the function, should be the exact same order you
provide to the Waycheck class. By not doing this, unexpected type checking behavior will occur,
such as passing when it should fail or failing when it should pass.

Note: This will occur if the argument all have different expected type values. i.e if all arguments are supposed to be integers, then the order doesn't matter.
Example:

```python
# this works as expected
@Waycheck(a=int, b=int)
def main(a, b):
    ...


# this will fail if all the arguments
# are not the same expected type
@Waycheck(b=int, a=int)
def main(a, b):
    ...
```

Q: Can I pass my own custom error class?
A: No. The default error given is ```WaycheckTypeError```. You could use a blanket Exeception check (try/except) then throw whatever error you want.

Q: I keep getting an IndexError, why?
A: If you're going to type check the function you must provide Waycheck with the expected type for ALL the arguments, not just some of them.

## Changelog

April 2022:

* Initial Release - v0.0.1