Skip to main content

si type metric

Project description

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

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

bflag-0.0.9.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

bflag-0.0.9-py3-none-any.whl (18.7 kB view hashes)

Uploaded Python 3

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