# What is this?
The tools I find myself copying and pasting between every python project.
# How do I use this?
`pip install blissful_basics`
```python
from blissful_basics import print, flatten, to_pure, stringify, stats, product, countdown, large_pickle_save, large_pickle_load, FS, Object
#
# print helpers
#
if 1:
# settings
print.indent.string = " "
# recursively indents function calls
@print.indent.function
def my_func(counter=5):
if counter <= 0: return
print(f"function call {counter} start")
my_func(counter-1)
print(f"function call {counter} done")
my_func()
# function call 5 start
# function call 4 start
# function call 3 start
# function call 2 start
# function call 1 start
# function call 1 done
# function call 2 done
# function call 3 done
# function call 4 done
# function call 5 done
# simple indent
with print.indent:
print("howdy1")
with print.indent:
print("howdy2")
print("howdy3")
# howdy1
# howdy2
# howdy3
# also indents stuff from the function
with print.indent.block("stuff"):
print("hi")
my_func()
# stuff
# hi
# function call 5 start
# function call 4 start
# function call 3 start
# function call 2 start
# function call 1 start
# function call 1 done
# function call 2 done
# function call 3 done
# function call 4 done
# function call 5 done
#
# to_pure()
#
if 1:
import numpy
import torch
to_pure(numpy.array([1,2,3,4,5])) # [1,2,3,4,5]
to_pure(torch.tensor([1,2,3,4,5])) # [1,2,3,4,5] # even if its on a GPU device
#
# stats
#
if 1:
stats([1,2,3,4,5])
# Object(
# max = 5,
# min = 1,
# range = 4,
# count = 5,
# sum = 15,
# average = 3.0,
# stdev = 1.5811388300841898,
# median = 3,
# q1 = 1.5,
# q3 = 4.5,
# normalized = (0.0, 0.25, 0.5, 0.75, 1.0),
# )
#
# plain object
#
if 1:
a = Object(thing=10)
a.thing # 10
a.thing = 99
a.thing # 99
```
Raw data
{
"_id": null,
"home_page": "https://github.com/jeff-hykin/blissful_basics.git",
"name": "blissful-basics",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Jeff Hykin",
"author_email": "jeff.hykin@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cc/15/dfbf414fb6d1456c779c87791aa5457fa34c78a88eb221faf3450f6ca621/blissful_basics-0.2.37.tar.gz",
"platform": null,
"description": "# What is this?\n\nThe tools I find myself copying and pasting between every python project.\n\n# How do I use this?\n\n`pip install blissful_basics`\n\n\n```python\nfrom blissful_basics import print, flatten, to_pure, stringify, stats, product, countdown, large_pickle_save, large_pickle_load, FS, Object\n\n# \n# print helpers\n# \nif 1:\n # settings\n print.indent.string = \" \"\n \n # recursively indents function calls\n @print.indent.function \n def my_func(counter=5):\n if counter <= 0: return\n print(f\"function call {counter} start\")\n my_func(counter-1)\n print(f\"function call {counter} done\")\n \n \n my_func()\n \n # function call 5 start\n # function call 4 start\n # function call 3 start\n # function call 2 start\n # function call 1 start\n # function call 1 done\n # function call 2 done\n # function call 3 done\n # function call 4 done\n # function call 5 done\n \n \n # simple indent\n with print.indent:\n print(\"howdy1\")\n with print.indent:\n print(\"howdy2\")\n print(\"howdy3\")\n \n # howdy1\n # howdy2\n # howdy3\n \n # also indents stuff from the function\n with print.indent.block(\"stuff\"):\n print(\"hi\")\n my_func()\n \n # stuff\n # hi\n # function call 5 start\n # function call 4 start\n # function call 3 start\n # function call 2 start\n # function call 1 start\n # function call 1 done\n # function call 2 done\n # function call 3 done\n # function call 4 done\n # function call 5 done\n\n# \n# to_pure()\n# \nif 1:\n import numpy\n import torch\n\n to_pure(numpy.array([1,2,3,4,5])) # [1,2,3,4,5]\n to_pure(torch.tensor([1,2,3,4,5])) # [1,2,3,4,5] # even if its on a GPU device\n\n# \n# stats\n# \nif 1:\n stats([1,2,3,4,5])\n # Object(\n # max = 5,\n # min = 1,\n # range = 4,\n # count = 5,\n # sum = 15,\n # average = 3.0,\n # stdev = 1.5811388300841898,\n # median = 3,\n # q1 = 1.5,\n # q3 = 4.5,\n # normalized = (0.0, 0.25, 0.5, 0.75, 1.0),\n # )\n\n# \n# plain object\n# \nif 1:\n a = Object(thing=10)\n a.thing # 10\n a.thing = 99\n a.thing # 99\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Tools I need in every python project",
"version": "0.2.37",
"project_urls": {
"Homepage": "https://github.com/jeff-hykin/blissful_basics.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ac5497ad3e399cc5add0155a43dc4c108cdce1170e90fa03be695aee2bbd28f2",
"md5": "3f9dbb33149733ad7a88796e77b85aca",
"sha256": "83834e9b1e487c3bdab49c5ce7d47428a69d6b5953acdacd28f8db3bbcd83ada"
},
"downloads": -1,
"filename": "blissful_basics-0.2.37-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3f9dbb33149733ad7a88796e77b85aca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3532606,
"upload_time": "2024-04-12T15:27:00",
"upload_time_iso_8601": "2024-04-12T15:27:00.215763Z",
"url": "https://files.pythonhosted.org/packages/ac/54/97ad3e399cc5add0155a43dc4c108cdce1170e90fa03be695aee2bbd28f2/blissful_basics-0.2.37-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cc15dfbf414fb6d1456c779c87791aa5457fa34c78a88eb221faf3450f6ca621",
"md5": "d4ebffafbe440d8f0c6171698ed35984",
"sha256": "4d951df5e23151c7c26f9d540670dcd58f29e667a1363e23b40337ff6b2015a6"
},
"downloads": -1,
"filename": "blissful_basics-0.2.37.tar.gz",
"has_sig": false,
"md5_digest": "d4ebffafbe440d8f0c6171698ed35984",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3509926,
"upload_time": "2024-04-12T15:27:02",
"upload_time_iso_8601": "2024-04-12T15:27:02.420409Z",
"url": "https://files.pythonhosted.org/packages/cc/15/dfbf414fb6d1456c779c87791aa5457fa34c78a88eb221faf3450f6ca621/blissful_basics-0.2.37.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-12 15:27:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jeff-hykin",
"github_project": "blissful_basics",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "blissful-basics"
}