CMD + K

strfix

Community

Literal Enum

Installation

To install this package, run one of the following:

Conda
$conda install dsm-72::strfix

Usage Tracking

0.0.1
1 / 8 versions selected
Downloads (Last 6 months): 0

Description

strfix

Developer Guide

Setup

# create conda environment
$ mamba env create -f env.yml

# update conda environment
$ mamba env update -n strfix --file env.yml

Install

pip install -e .

 conda environment
$ conda activate strfix

# make sure the strfix package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to the strfix package
$ nbdev_prepare

Publishing

# publish to pypi
$ nbdev_pypi

# publish to conda
$ nbdev_conda --build_args '-c conda-forge'
$ nbdev_conda --mambabuild --build_args '-c conda-forge -c dsm-72'

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/dsm-72/strfix.git

or from conda

$ conda install -c dsm-72 strfix

or from pypi

$ pip install strfix

Documentation

Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

Examples

The character used to prefix the string sep: ClassVar[str] = '' # The separator used to split the prefix into parts chainable: ClassVar[bool] = False addw_sep: ClassVar[bool] = True pass


``` python
xa = X_('a')
xb = X_('b')
da = dict(X_a='hi', X_b=2)
xa, xb, da
(X_a, X_b, {'X_a': 'hi', 'X_b': 2})
'hi' + xa, f'hi{xa}'
('hi_X_a', 'hiX_a')
xa + xb, xa + xa, xb + xb
(X_a_b, X_a_a, X_b_b)

Postfix

class _hvg(Postfix):
    fix: ClassVar[str] = 'hvg' # The character used to prefix the string
    sep: ClassVar[str] = '_'   # The separator used to split the prefix into parts
    chainable: ClassVar[bool] = True
    add_w_sep: ClassVar[bool] = True
    pass
xa = _hvg('a')
xb = _hvg('b')
da = dict(a_hvg='hi', b_hvg=2)
xa, xb, da
(a_hvg, b_hvg, {'a_hvg': 'hi', 'b_hvg': 2})
'hi' + xa, f'hi{xa}', 'hi' + xa + xb
(hi_a_hvg, 'hia_hvg', hi_a_b_hvg)
xa + xb, xa + xa, xb + xb
(a_b_hvg, a_a_hvg, b_b_hvg)

Extension

GZ = Ext('....gz')
GZ.isaxv(GZ), GZ, GZ.addp('gz')
(True, .gz, '.gz')
'file' + GZ, f"{'file'}{GZ}", GZ + GZ
('file.gz', 'file.gz', '.gz.gz')

About

Summary

Literal Enum

Last Updated

Aug 29, 2023 at 18:25

License

Apache Software

Total Downloads

9

Supported Platforms

noarch