Skip to main content

POSIX parameter expansion in Python

Project description

POSIX Parameter Expansion

This is an experiment to create a Python library to enable POSIX parameter expansion from a string.

Obvious Test Cases

    >>> from pe import expand
    >>> foo = 'abc/123-def.ghi'
    >>> # Bland Expansion
    >>> expand('abc $foo abc')
    'abc abc/123-def.ghi abc'
    >>> expand('abc${foo}abc')
    'abcabc/123-def.ghiabc'
    >>>
    >>> # Default Value Expansion
    >>> expand('-${foo:-bar}-')
    '-abc/123-def.ghi-'
    >>> expand('-${bar:-bar}-')
    '-bar-'

Default Value Expansion

    >>> foo = 'abc/123-def.ghi'
    >>> expand('abc $foo abc')
    'abc abc/123-def.ghi abc'
    >>> expand('abc${foo}abc')
    'abcabc/123-def.ghiabc'

Project details


Download files

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

Source Distribution

parameter-expansion-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

parameter_expansion-0.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file parameter-expansion-0.1.0.tar.gz.

File metadata

  • Download URL: parameter-expansion-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.0 Darwin/20.5.0

File hashes

Hashes for parameter-expansion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad9e14daa00d67e5291b1daa386bdbbb973696a933357c19a29779e86c825b66
MD5 2d30f37b146607a11ddf67582d4c6873
BLAKE2b-256 c8a89f57523431c879bb92d407a6ab412a93ccd3444c9201ef71df5ab6e715fc

See more details on using hashes here.

File details

Details for the file parameter_expansion-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for parameter_expansion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 757b840670ac44a0aac91e5dbed90e59020071e502c16f0dcb28a34155213d74
MD5 c388cc7bfbcfec1edf9e6134612a147c
BLAKE2b-256 1851fccfc09cb8f5349635fbb9d07c4706e6e87d6273ed68fbb43c66d7a66218

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