semvec/pypi-packages huggingface dataset:
nabto-client 1.0.1
Nabto Client Wrapper for Python
License: MIT
Requires Python: >=3.6

# python-nabto-client

Python Wrapper for Nabto Client

## Requirements

* Python 3.6+
* `python3-dev` package for Debian distributions

## Installation

Install using `pip`...

    pip install -i https://test.pypi.org/simple/ nabto-client

## Example

Let's take a look at a quick example of using `nabto_client` to open a session and a tunnel.

    import nabto_client
    
    NABTO_HOME_DIRECTORY = "/home/nabto/example"

    USER = "user"
    PASSWORD = "password"
    
    LOCAL_PORT = 7000
    NABTO_HOST = "example.appmyproduct.com"
    REMOTE_HOST = "localhost"
    REMOTE_PORT = 8000

    # Initializes the Nabto client API
    nabto_client.startup(NABTO_HOME_DIRECTORY)
    
    # Creates a Nabto self signed profile
    nabto_client.createSelfSignedProfile(USER, PASSWORD)
    
    with nabto_client.NabtoSession(USER, PASSWORD) as session:
        with nabto_client.NabtoTunnel(session, LOCAL_PORT, NABTO_HOST, REMOTE_HOST, REMOTE_PORT) as port:
            print(f'Opened tunnel on port {port}')
            ...
            
    # Releases any resources held by the Nabto client API
    nabto_client.shutdown()

### Tunnel status
The example above doesn't allow to query the current status of the tunnel because the context manager returns the port not the tunnel object.

If you want to query the tunnel status, don't use the context manager, instead create and open a tunnel like this:

    tunnel = nabto_client.NabtoTunnel(session, LOCAL_PORT, NABTO_HOST, REMOTE_HOST, REMOTE_PORT)
    print(f'Tunnel status is {tunnel.status()}') # -1 or TunnelStatus.CLOSED
    port = tunnel.openTcp()
    print(f'Opened tunnel on port {port}')
    print(f'Tunnel status is {tunnel.status()}') # 3 or TunnelStatus.LOCAL
    # ... do something with the tunnel
    tunnel.close()
    if nabto_client.TunnelStatus.CLOSED == tunnel.status():
        print(f'Tunnel is closed')

You can also run `example/cli.py` for an interactive example.

    python example/cli.py --device example.appmyproduct.com
passjoin 0.0.1
Python implementation of the Pass-join index
License: MIT

# Passjoin
Python implementation of the Pass-join index.

This index allows to efficiently query similar words within a distance threshold.

The implementation is based on this [paper](http://people.csail.mit.edu/dongdeng/papers/vldb2012-passjoin.pdf) and the existing Javascript implementation in the mnemoist package ([link](https://github.com/Yomguithereal/mnemonist)).


## Installation




## Usage

### Index creation
```python
from passjoin import Passjoin
from Levenshtein import distance  # or any string distance function

max_edit_distance = 1  # maximum edit distance for retrieval
corpus = ['pierre', 'pierr', 'jean', 'jeanne']

passjoin_index = Passjoin(corpus, max_edit_distance, distance)

```

### Index querying
```python

passjoin_index.get_word_variations('pierre')
>> {'pierre', 'pierr'}

passjoin_index.get_word_variations('jeann')
>> {'jean', 'jeanne'}

passjoin_index.get_word_variations('jeanine')
>> {'jeanne'}

```

## Contributing

Clone the project.

Install [pipenv](https://github.com/pypa/pipenv).

Run `pipenv install --dev`

Launch test with `pipenv run pytest`