bflag 0.0.9

Last updated:

0 purchases

bflag 0.0.9 Image
bflag 0.0.9 Images
Add to Cart

Description:

bflag 0.0.9

bflag

Developer Guide
Setup
# create conda environment
$ mamba env create -f env.yml

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

Install
pip install -e .

# install from pypi
pip install bflag

nbdev
# activate conda environment
$ conda activate bflag

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

# make changes under nbs/ directory
# ...

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

Note: it might be useful to use the following snippet to enable hot
reloading:
%load_ext autoreload
%autoreload 2

Publishing
# publish to pypi
$ nbdev_pypi

# publish to conda
$ nbdev_conda --build_args '-c conda-forge'

Usage
Installation
Install latest from the GitHub
repository:
$ pip install git+https://github.com/dsm-72/bflag.git

or from conda
$ conda install -c dsm-72 bflag

or from pypi
$ pip install bflag

Examples
(fpos, fneg, fint, fnum, fstr, fzero, fnone)

(fpos(ispos(v)),
fneg(isneg(v)),
fint(isint(v)),
fnum(isnum(v)),
fstr(isstr(v)),
fzero(iszero(v)),
fnone(isnone(v)))

fpos(2), fpos(-2)

(True, False)

values = [-3, -2, -1, 0, 1, 2, 3]

# Using the map method to evaluate all values against a flag
print(fpos.map(values)) # [False, False, False, False, True, True, True]
print(fneg.map(values)) # [True, True, True, False, False, False, False]

# Check if any value satisfies the flag
print(fpos.any(values)) # True
print(fneg.any(values)) # True

# Check if all values satisfy the flag
print(fpos.all(values)) # False
print(fneg.all(values)) # False

[False, False, False, False, True, True, True]
[True, True, True, False, False, False, False]
True
True
False
False

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.