A library to share some common methods and helpers in projects.
Find a file
tom 18306b8182
Some checks failed
continuous-integration/drone/push Build is failing
doc: Update generic documentation
2024-07-11 10:53:53 +02:00
.devcontainer Initial commit 2024-05-28 13:55:05 +02:00
.github Initial commit 2024-05-28 13:55:05 +02:00
.vscode Initial commit 2024-05-28 13:55:05 +02:00
examples Initial commit 2024-05-28 13:55:05 +02:00
inetsix_helpers chore: Code backport 2024-05-28 14:12:58 +02:00
tests chore: Code backport 2024-05-28 14:12:58 +02:00
.drone.yml ci: Implement multi-pipeline with docker build (#1) 2024-05-28 22:39:41 +02:00
.editorconfig Initial commit 2024-05-28 13:55:05 +02:00
.gitignore Initial commit 2024-05-28 13:55:05 +02:00
.pre-commit-config.yaml Initial commit 2024-05-28 13:55:05 +02:00
codecov.yaml Initial commit 2024-05-28 13:55:05 +02:00
CONTRIBUTING.md Initial commit 2024-05-28 13:55:05 +02:00
Dockerfile Initial commit 2024-05-28 13:55:05 +02:00
LICENCE Initial commit 2024-05-28 13:55:05 +02:00
pyproject.toml chore: Code backport 2024-05-28 14:12:58 +02:00
README.md doc: Update generic documentation 2024-07-11 10:53:53 +02:00

Inetsix Helpers Python Library

Ruff Numpy Build Status License

Description

inetsix-helpers is a Python library designed to share common methods and helpers in projects. It facilitates project development by providing custom types, filters, and search functions.

Usage Example

Search for a value in a nested dictionary

from inetsix_helpers.lookup import get_value_from_nested_dict

# Example dictionary
dictionary = {
    "vlan": {
        "id": 10,
        "name": "VLAN10",
        "description": "This is VLAN 10"
    },
    "hostname": "example.com"
}

# Use the get_value_from_nested_dict function
vlan_id = get_value_from_nested_dict(dictionary, "vlan.id", required=True)
hostname = get_value_from_nested_dict(dictionary, "hostname", required=True)

print(vlan_id)  # The output will be 10
print(hostname)  # The output will be 'example.com'

Compress a list of VLANs

from inetsix_helpers.filters import list_compress

# VLAN list
vlan_list = list(range(10, 18))

# Use the list_compress function
compressed_vlan_list = list_compress(vlan_list)

print(compressed_vlan_list)  # The output will be '10-17'

Installation

Installation with Pip

pip install git+https://git.as73.inetsix.net/tom/python-helpers.git

Installation with Git

# Clone repository
git clone git@git.as73.inetsix.net:tom/python-helpers.git

# Move to repository folder
cd python-helpers

# Install project using pip
pip install .

Usage

After installation, you can import the inetsix-helpers modules into your Python code.

from inetsix_helpers import custom_types, filters, lookup
...

Contribution

Please read contribution guide for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for more details.