Metadata-Version: 2.5
Name: qwuiklib
Version: 1.0.0
Summary: A lightweight terminal utility library
Project-URL: Homepage, https://github.com/qwuikky99/QwuikLib
Project-URL: Issues, https://github.com/qwuikky99/QwuikLib/issues
Author-email: qwuikky99 <qwuikky99@gmail.com>
License-Expression: Unlicense
License-File: UNLICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# QwuikLib
## (pronounced quick-lib)
is a Python terminal utility that adds useful functions for CLI programs.

<details>
<summary>About</summary>
QwuikLib is a library that adds terminal utility functions such as `typewrite()` or `summarize()`.
These functions aren't general purpose and all do their own specific task.
Every function has docstrings, alongside a GitHub wiki.
</details>
<details>
<summary>Functions</summary>
## `summarize(iterable=[1,2,3], skip_strings: bool = True, convert_numerals: bool = False)`
`summarize()` is a slight evolution of `sum()` that takes an iterable and sums up all of its contents.
The evolution, however, is that it can also add strings to the sum.
The strings can contribute their length to the sum.
If `convert_numerals` is `True`, strings like "42" will be converted into integers and strings like "4.2" into floats. Instead of their length, they will now contribute the number inside them.
<details><summary>Example use</summary>
<pre><code>
amazing_iterable = [1, 2, 3]
print(summarize(amazing_iterable))
# Out: 6
# The base mode works exactly like sum(), except it *skips* unsupported types instead of throwing an error.
amazing_iterable2 = [1, "hello", "world", [1, 2]]
print(summarize(amazing_iterable2))
# Out: 1
# Skips strings and other types by default. Nested lists also aren't accounted for.
print(summarize(amazing_iterable2, False))
# Out: 11
# With skip_strings set to False, it instead adds the lengths of each string. Still skips all unsupported types.
# In this example, "hello" and "world" contribute 5 each, with 1 contributing... 1. 5 * 2 + 1 = 11.
amazing_iterable3 = [1, "2", 3]
print(summarize(amazing_iterable3, False, True))
# Out: 6
# With skip_strings set to False and convert_numerals set to True, every string that only contains numbers will be converted to integer and contribute its amount to the sum.
# In this example, 1 and 3 contribute 1 and 3 respectively, while "2" is converted and contributes 2.
</code></pre>
</details>