Skip to main content

Binary file wrapper

Project description

py-wrappers

Python wrapper for binary files

Usage

import wrapper

class Helm(wrapper.ExecWrapper):
    """
    helm binary wrapper

    helm = Helm(o='json')
    resp = helm.ls() => `helm ls -o=json`
    resp.raise_for_status()
    print(resp.json)

    helm = Helm()
    helm.repo.add.bitnami('https://charts.bitnami.com/bitnami')

    helm = Helm()
    resp = helm.upgrade.redis('bitnami/redis', install=None, o='json')
    # helm upgrade redis bitnami/redis --install -o json
    # or same
    resp = helm('upgrade', 'redis', 'bitnami/redis', '--install', o='json')
    # helm upgrade redis bitnami/redis --install -o json
    # or
    resp = helm.upgrade.redis('bitnami/redis', i=None, o='json')
    # helm upgrade redis bitnami/redis -i -o json
    """

    def __init__(self, **kwargs):
        super().__init__('helm', **kwargs)

    def __getattr__(self, item):
        h = Helm(**self._parent_kwargs)
        h._parent_attrs = self._parent_attrs.copy()
        h._parent_attrs.append(item.replace('_', '-', -1))

        return h

    def _pre(self, args, parent_kwargs, kwargs):
        ns_short = parent_kwargs.pop('n', None)
        parent_kwargs.setdefault('namespace', ns_short)

        out_short = parent_kwargs.pop('o', None)
        out = parent_kwargs.pop('output', out_short)

        out_short = kwargs.pop('o', out)
        kwargs.setdefault('output', out_short)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

bin_wrapper-1.0.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file bin_wrapper-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: bin_wrapper-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for bin_wrapper-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fce935560413206787102c6db221d5a011841be8c0e206c6af2bc5e63ff2c512
MD5 8a9e4c67078dcc0ca704e24891f9aa20
BLAKE2b-256 8e671d3267ab2e619251184ffcdc23ad3f96ce48233ae2770dd960953a6f9cd8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page