bflag


Namebflag JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/dsm-72/bflag
Summarysi type metric
upload_time2023-10-26 14:31:39
maintainer
docs_urlNone
authordsm-72
requires_python>=3.11
licenseApache Software License 2.0
keywords python bool flag bflag boolean flag fool booly boolish
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bflag

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Developer Guide

### Setup

``` sh
# 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

``` sh
pip install -e .

# install from pypi
pip install bflag
```

### nbdev

``` sh
# 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:

``` python
%load_ext autoreload
%autoreload 2
```

### Publishing

``` sh
# publish to pypi
$ nbdev_pypi

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

# Usage

## Installation

Install latest from the GitHub
[repository](https://github.com/dsm-72/bflag):

``` sh
$ pip install git+https://github.com/dsm-72/bflag.git
```

or from [conda](https://anaconda.org/dsm-72/bflag)

``` sh
$ conda install -c dsm-72 bflag
```

or from [pypi](https://pypi.org/project/bflag/)

``` sh
$ pip install bflag
```

## Examples

``` python
(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)))

``` python
fpos(2), fpos(-2)
```

    (True, False)

``` python
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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dsm-72/bflag",
    "name": "bflag",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "python bool flag bflag boolean flag fool booly boolish",
    "author": "dsm-72",
    "author_email": "sumner.magruder@yale.edu",
    "download_url": "https://files.pythonhosted.org/packages/9d/e2/cf68c27804438b07d9c9bcf08df6ee5239299161520c1b3348a04235d80e/bflag-0.0.9.tar.gz",
    "platform": null,
    "description": "# bflag\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Developer Guide\n\n### Setup\n\n``` sh\n# create conda environment\n$ mamba env create -f env.yml\n\n# update conda environment\n$ mamba env update -n bflag --file env.yml\n# $ mamba env update -n bflag --file env.mac.yml\n```\n\n### Install\n\n``` sh\npip install -e .\n\n# install from pypi\npip install bflag\n```\n\n### nbdev\n\n``` sh\n# activate conda environment\n$ conda activate bflag\n\n# make sure the bflag package is installed in development mode\n$ pip install -e .\n\n# make changes under nbs/ directory\n# ...\n\n# compile to have changes apply to the bflag package\n$ nbdev_prepare\n```\n\nNote: it might be useful to use the following snippet to enable hot\nreloading:\n\n``` python\n%load_ext autoreload\n%autoreload 2\n```\n\n### Publishing\n\n``` sh\n# publish to pypi\n$ nbdev_pypi\n\n# publish to conda\n$ nbdev_conda --build_args '-c conda-forge'\n```\n\n# Usage\n\n## Installation\n\nInstall latest from the GitHub\n[repository](https://github.com/dsm-72/bflag):\n\n``` sh\n$ pip install git+https://github.com/dsm-72/bflag.git\n```\n\nor from [conda](https://anaconda.org/dsm-72/bflag)\n\n``` sh\n$ conda install -c dsm-72 bflag\n```\n\nor from [pypi](https://pypi.org/project/bflag/)\n\n``` sh\n$ pip install bflag\n```\n\n## Examples\n\n``` python\n(fpos, fneg, fint, fnum, fstr, fzero, fnone)\n```\n\n    (fpos(ispos(v)),\n     fneg(isneg(v)),\n     fint(isint(v)),\n     fnum(isnum(v)),\n     fstr(isstr(v)),\n     fzero(iszero(v)),\n     fnone(isnone(v)))\n\n``` python\nfpos(2), fpos(-2)\n```\n\n    (True, False)\n\n``` python\nvalues = [-3, -2, -1, 0, 1, 2, 3]\n\n# Using the map method to evaluate all values against a flag\nprint(fpos.map(values))  # [False, False, False, False, True, True, True]\nprint(fneg.map(values))  # [True, True, True, False, False, False, False]\n\n# Check if any value satisfies the flag\nprint(fpos.any(values))  # True\nprint(fneg.any(values))  # True\n\n# Check if all values satisfy the flag\nprint(fpos.all(values))  # False\nprint(fneg.all(values))  # False\n```\n\n    [False, False, False, False, True, True, True]\n    [True, True, True, False, False, False, False]\n    True\n    True\n    False\n    False\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "si type metric",
    "version": "0.0.9",
    "project_urls": {
        "Homepage": "https://github.com/dsm-72/bflag"
    },
    "split_keywords": [
        "python",
        "bool",
        "flag",
        "bflag",
        "boolean",
        "flag",
        "fool",
        "booly",
        "boolish"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e09e87d662d9cc5a01258233fa22659cd6d5b5baad19e3974484441b73469ef",
                "md5": "7363dff59d51cddd355af203406be550",
                "sha256": "b86ad2f5c32f38d842d7cbed54183765301a0337f03f560381efb98e54ee44a9"
            },
            "downloads": -1,
            "filename": "bflag-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7363dff59d51cddd355af203406be550",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 18708,
            "upload_time": "2023-10-26T14:31:37",
            "upload_time_iso_8601": "2023-10-26T14:31:37.858806Z",
            "url": "https://files.pythonhosted.org/packages/0e/09/e87d662d9cc5a01258233fa22659cd6d5b5baad19e3974484441b73469ef/bflag-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9de2cf68c27804438b07d9c9bcf08df6ee5239299161520c1b3348a04235d80e",
                "md5": "eeb3aa6d74b89d505e5eaf26ffa0d9ec",
                "sha256": "6d5766445ee93f69843a85f8d7d20f0c73b0da1662f0f02c9445c71a7b0b7ba5"
            },
            "downloads": -1,
            "filename": "bflag-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "eeb3aa6d74b89d505e5eaf26ffa0d9ec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 15527,
            "upload_time": "2023-10-26T14:31:39",
            "upload_time_iso_8601": "2023-10-26T14:31:39.444352Z",
            "url": "https://files.pythonhosted.org/packages/9d/e2/cf68c27804438b07d9c9bcf08df6ee5239299161520c1b3348a04235d80e/bflag-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-26 14:31:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dsm-72",
    "github_project": "bflag",
    "github_not_found": true,
    "lcname": "bflag"
}
        
Elapsed time: 2.33382s