semvec/pypi-packages huggingface dataset:
xbool 1.1.0
General purpose bool/boolean utilities, extracting bools from strings.
Requires Python: >=3.10,<4.0
Keywords: bool,booltostr,str,environmental variable,utilites

![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.10|%203.11|%203.12&color=blue?style=flat-square&logo=python)
![PyPI version](https://badge.fury.io/py/xbool.svg?)

- [Introduction](#introduction)
- [Documentation](#documentation)
- [Install](#install)
- [Quick Start](#quick-start)
    * [bool_value](#bool_value)
    * [bool_env](#bool_env)
- [Licensing](#licensing)

# Introduction

General purpose bool/boolean utilities, extracting bools from strings.

Only two so far:

- `bool_value`, see **[bool_value docs](https://xyngular.github.io/py-xbool/latest/)**.
- `bool_env`, see **[bool_env docs](https://xyngular.github.io/py-xbool/latest/)**.

# Documentation

**[📄 Detailed Documentation](https://xyngular.github.io/py-xbool/latest/)** | **[🐍 PyPi](https://pypi.org/project/xbool/)**

# Install

```bash
# via pip
pip install xbool

# via poetry
poetry add xbool
```

# Quick Start

## bool_value

Generally converts objects to bool-values, special-casing strings
to use the built-in `distutils.util.strtobool` function to convert the string value
to a bool.

```python
from xbool import bool_value

# Convert string to bool
assert bool_value('true') is True
assert bool_value('false') is False

assert bool_value('y') is True
assert bool_value('n') is False

assert bool_value('on') is True
assert bool_value('off') is False

assert bool_value('t') is True
assert bool_value('f') is False

assert bool_value('yes') is True
assert bool_value('no') is False

assert bool_value('1') is True
assert bool_value('0') is False

# Any other string is generally considered False:
assert bool_value("some-other-string") is False

# Convert bools to bools:
assert bool_value(True) is True
assert bool_value(False) is False

# Generally, for non-strings, True-like objects return True:
some_object = object()
assert bool_value(some_object) is True

# And False-like objects return False:
assert bool_value(None) is False
```

## bool_env

Looks up environmental variable with passed in name.

Runs the env-var value though `bool_value` for you and returns the result.

Useful to easily get a bool-value from an environmental variable.

```python
from xbool import bool_env
import os

os.environ['SOME_ENV_VAR'] = "False"
assert bool_env('SOME_ENV_VAR') is False


os.environ['SOME_OTHER_ENV_VAR'] = "True"
assert bool_env('SOME_OTHER_ENV_VAR') is True
```


# Licensing

This library is licensed under the MIT-0 License. See the LICENSE file.
florida 0.0.6
A collection of Python utilities to simplify coding tasks
Requires Python: >=3.7
Keywords: python utilities tools

# Florida

<img src="https://github.com/wjbmattingly/florida/raw/main/images/florida.png" alt="florida logo" width="500" height="500">


Welcome to Florida, a Python utility library designed to simplify and enhance your coding experience. Florida is built with the goal of providing easy-to-use, efficient tools to aid developers in various tasks, making coding more intuitive and productive.

## Features

As of now, Florida includes the following feature:

- `dict2schema`: A function that generates a schema of a dictionary's organization, showing each key and the type of its value. The schema can be returned as a string or as a nested dictionary.
- `target2index`: A function that takes in a nested dictionary or list and a target key or index, and returns Python code snippets to access instances of that key or index. It's useful for navigating complex nested structures.

## Installation

Currently, Florida is not available on PyPI, so it can be installed by cloning the repository:

```bash
pip install florida
```

## Usage

```python
from florida import dict2schema

# Example dictionary
# Example dictionary
example_dict = {
    'key1': 'value1',
    'key2': {
        'subkey1': 'subvalue1',
        'subkey2': {
            'subsubkey1': 'subsubvalue1',
            "list1": [{"test": "case"}]
        },
        'subkey3': 123,
        'subkey4': [1, 2, 3]
    },
    'key3': True
}

# Get the schema as a string
print(dict2schema(example_dict, indent=0))

# Get the schema as a dictionary
# print(dict2schema(example_dict, style="dict"))
```

### Expected Output:
```
key1 (str)
key2 (dict)
    subkey1 (str)
    subkey2 (dict)
        subsubkey1 (str)
        list1 (list)
            0 (dict)
                test (str)
    subkey3 (int)
    subkey4 (list)
        0 (int)
        1 (int)
        2 (int)
key3 (bool)
```

## Using target2index

```python
from florida import target2index

# Example nested structure
nested_structure = {
    'item1': 'value1',
    'nested': {
        'item2': 'value2',
        'content': 'some text',
    },
    'list': [{'content': 'another text'}, {'item3': 'value3'}]
}

# Get the Python code to access 'content'
print(target2index('content', nested_structure))
```

### Expected Output

```python
['structure['nested']['content']',
'structure['list'][0]['content']']

```

## License
Florida is released under the MIT License.