Metadata-Version: 2.5
Name: tarive
Version: 0.2.1
Summary: Python pattern toolbox: loops, operators, errors, dicts, DFS/BFS, recursion, classes.
Project-URL: Homepage, https://github.com/Tar-ive/tarive
Project-URL: Repository, https://github.com/Tar-ive/tarive
Author-email: Saksham Tarive <adhsaksham27@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: bfs,dfs,idle,patterns,recursion,toolbox
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# tarive

Python pattern toolbox for IDLE: loops, operators, errors, dicts/sets, DFS/BFS, recursion, and classes.

```bash
pip install tarive
```

```python
from tarive import all, toolbox

print(toolbox)           # table of contents
print(toolbox.loops)     # for / while examples
print(all)               # every helper + how to import it
```

`toolbox` is a `ToolBox` instance. Each chapter is a folder of methods. After the dot you get that chapter's helpers:

```python
import tarive as tv

tv.patterns.graphs.dfs(graph, start)
tv.patterns.graphs.bfs(graph, start)
tv.patterns.graphs.dfs_path(graph, start, goal)
tv.patterns.graphs.bfs_path(graph, start, goal)

print(tv.patterns.graphs)    # method list + lesson
```

| Chapter | IDLE |
|---|---|
| for / while | `print(toolbox.loops)` |
| operators | `print(toolbox.operators)` |
| try / except | `print(toolbox.errors)` |
| dict and set | `print(toolbox.dicts)` |
| DFS / BFS | `print(toolbox.graphs)` |
| recursion | `print(toolbox.recursion)` |
| getters, setters, iterators | `print(toolbox.classes)` |

## Run helpers

```python
from tarive.toolbox import toolbox

graph = {"A": ["B", "C"], "B": ["D"], "C": ["D"], "D": []}
print(toolbox.bfs(graph, "A"))           # ['A', 'B', 'C', 'D']
print(toolbox.try_int("hi"))             # 0
print(toolbox.count_items("banana"))     # {'b': 1, 'a': 3, 'n': 2}
print(toolbox.factorial(5))              # 120
```

```python
@toolbox.auto_iter
@toolbox.auto_get_set
class Student:
    def __init__(self, name, age, gpa):
        self.__name = name
        self.__age = age
        self.__gpa = gpa

s = Student("Ana", 19, 3.8)
print(s.get_name())   # Ana
print(list(s))        # ['Ana', 19, 3.8]
```

If you write your own `get_x` / `set_x` / `__iter__`, that version is kept and the rest are filled in.

## Input, totals, and reports

```python
weeks = toolbox.get_integer_input("How many weeks? ", 1)
print(toolbox.print_money(1234.56))          # $1,234.56
toolbox.print_report_header("FINAL REPORT")
```

Also included: `get_float_input`, `get_float_range_input`, `get_choice_input`, `update_running_totals`, `track_min_max`, `categorize_and_count`, `build_threshold_advice`, `check_percentage_threshold`, `print_separator`, `print_profit_bar`, `compute_week_metrics`, `try_float`, `unique`, `merge_dicts`, `dfs`, `dfs_path`, `bfs_path`, `fibonacci`, `flatten`.

See `examples/bookstore_tracker.py` for a full program using the report helpers.

If IDLE says `No module named 'tarive'`, install into **that** Python:

```bash
python3 -m pip install tarive
```
