lb-lazy-num 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2026 logic-break
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software for NON-COMMERCIAL PURPOSES ONLY, subject to the following
6
+ conditions:
7
+
8
+ 1. The above copyright notice and this permission notice shall be included in all
9
+ copies or substantial portions of the Software.
10
+
11
+ 2. The Software, or any substantial portion thereof, may NOT be sold, resold,
12
+ licensed, or otherwise exploited for any commercial advantage or private
13
+ monetary gain without prior written permission from the copyright holder.
14
+
15
+ 3. Any derivative works or software incorporating this Software must also be
16
+ distributed under these same non-commercial terms.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
@@ -0,0 +1,56 @@
1
+ Metadata-Version: 2.4
2
+ Name: lb-lazy-num
3
+ Version: 0.0.1
4
+ Summary: Simple convert library for lazy developers
5
+ Home-page: https://github.com/logic-break/logic-break/tree/main/libraries/lb_lazy_num
6
+ Author: logic-break
7
+ Author-email: abibasqabiba@gmail.com
8
+ License: Non-Commercial
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: license
22
+ Dynamic: license-file
23
+ Dynamic: requires-python
24
+ Dynamic: summary
25
+
26
+
27
+ # lb_lazy_input
28
+ © Copyright logic-break 2026
29
+
30
+ https://github.com/logic-break/logic-break/tree/main/libraries/lb_lazy_input
31
+
32
+ > lib made for lazy, by lazy
33
+
34
+ installation:
35
+
36
+ pip install lb-lazy-num
37
+
38
+ **NOTE: in code, you must import lb_lazy_num**
39
+
40
+
41
+ # Usage
42
+
43
+ - .format_num(value, precision=2) : converts from 1000000 to 1M, supports up to Qi, if more than Qi, returns unchanged value
44
+ - .convert_size(value_str, target_unit) : returns converted size, for example .convert_size("1024MB", "GB") wil return 1GB, this supports up to PB, if more idk :)
45
+
46
+ # Example:
47
+
48
+ import lb_lazy_input
49
+
50
+ z = input("Enter value:\n")
51
+ x = input("Convert this value from: (B, KB, MB, GB, TB, PB)\n")
52
+ c = input("Convert this value to: \n")
53
+
54
+ v = z + x
55
+ result = lb_lazy_input.convert_size(v, c)
56
+ print(result)
@@ -0,0 +1,31 @@
1
+
2
+ # lb_lazy_input
3
+ © Copyright logic-break 2026
4
+
5
+ https://github.com/logic-break/logic-break/tree/main/libraries/lb_lazy_input
6
+
7
+ > lib made for lazy, by lazy
8
+
9
+ installation:
10
+
11
+ pip install lb-lazy-num
12
+
13
+ **NOTE: in code, you must import lb_lazy_num**
14
+
15
+
16
+ # Usage
17
+
18
+ - .format_num(value, precision=2) : converts from 1000000 to 1M, supports up to Qi, if more than Qi, returns unchanged value
19
+ - .convert_size(value_str, target_unit) : returns converted size, for example .convert_size("1024MB", "GB") wil return 1GB, this supports up to PB, if more idk :)
20
+
21
+ # Example:
22
+
23
+ import lb_lazy_input
24
+
25
+ z = input("Enter value:\n")
26
+ x = input("Convert this value from: (B, KB, MB, GB, TB, PB)\n")
27
+ c = input("Convert this value to: \n")
28
+
29
+ v = z + x
30
+ result = lb_lazy_input.convert_size(v, c)
31
+ print(result)
@@ -0,0 +1,56 @@
1
+ Metadata-Version: 2.4
2
+ Name: lb-lazy-num
3
+ Version: 0.0.1
4
+ Summary: Simple convert library for lazy developers
5
+ Home-page: https://github.com/logic-break/logic-break/tree/main/libraries/lb_lazy_num
6
+ Author: logic-break
7
+ Author-email: abibasqabiba@gmail.com
8
+ License: Non-Commercial
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: license
22
+ Dynamic: license-file
23
+ Dynamic: requires-python
24
+ Dynamic: summary
25
+
26
+
27
+ # lb_lazy_input
28
+ © Copyright logic-break 2026
29
+
30
+ https://github.com/logic-break/logic-break/tree/main/libraries/lb_lazy_input
31
+
32
+ > lib made for lazy, by lazy
33
+
34
+ installation:
35
+
36
+ pip install lb-lazy-num
37
+
38
+ **NOTE: in code, you must import lb_lazy_num**
39
+
40
+
41
+ # Usage
42
+
43
+ - .format_num(value, precision=2) : converts from 1000000 to 1M, supports up to Qi, if more than Qi, returns unchanged value
44
+ - .convert_size(value_str, target_unit) : returns converted size, for example .convert_size("1024MB", "GB") wil return 1GB, this supports up to PB, if more idk :)
45
+
46
+ # Example:
47
+
48
+ import lb_lazy_input
49
+
50
+ z = input("Enter value:\n")
51
+ x = input("Convert this value from: (B, KB, MB, GB, TB, PB)\n")
52
+ c = input("Convert this value to: \n")
53
+
54
+ v = z + x
55
+ result = lb_lazy_input.convert_size(v, c)
56
+ print(result)
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ lb_lazy_num.py
4
+ setup.py
5
+ lb_lazy_num.egg-info/PKG-INFO
6
+ lb_lazy_num.egg-info/SOURCES.txt
7
+ lb_lazy_num.egg-info/dependency_links.txt
8
+ lb_lazy_num.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ lb_lazy_num
@@ -0,0 +1,59 @@
1
+ """
2
+ Lol russian guy made this lib, and why are you here ?
3
+ """
4
+
5
+ import re
6
+
7
+ def format_num(val, prec=2):
8
+ try:
9
+ n = float(val)
10
+ except:
11
+ return str(val)
12
+
13
+ # Fallback для слишком здоровых чисел
14
+ if abs(n) >= 1e21:
15
+ return str(val)
16
+
17
+ sign = "-" if n < 0 else ""
18
+ n = abs(n)
19
+
20
+ # Идем по убывающей
21
+ for limit, sfx in [(1e18, 'Qi'), (1e15, 'P'), (1e12, 'T'),
22
+ (1e9, 'B'), (1e6, 'M'), (1e3, 'K')]:
23
+ if n >= limit:
24
+ # Считаем и убираем лишние нули одной строкой
25
+ res = f"{n/limit:.{prec}f}".rstrip('0').rstrip('.')
26
+ return f"{sign}{res}{sfx}"
27
+
28
+ # Если число меньше тысячи
29
+ res = f"{n:.{prec}f}".rstrip('0').rstrip('.')
30
+ return f"{sign}{res}"
31
+
32
+ def convert_size(raw, to):
33
+ # Коэффициенты 1024
34
+ u_map = {u: 1024**i for i, u in enumerate(['B', 'KB', 'MB', 'GB', 'TB', 'PB'])}
35
+
36
+ try:
37
+ # Дергаем цифры и буквы, игнорим пробелы
38
+ m = re.match(r"([0-9.]+)\s*([a-zA-Z]+)", raw.strip())
39
+ if not m: return raw
40
+
41
+ val, unit = float(m.group(1)), m.group(2).upper()
42
+ to = to.upper()
43
+
44
+ # Фиксим короткие записи типа 'M' или 'G'
45
+ curr = unit if unit.endswith('B') or unit == 'B' else f"{unit}B"
46
+ targ = to if to.endswith('B') or to == 'B' else f"{to}B"
47
+
48
+ if curr not in u_map or targ not in u_map:
49
+ return raw
50
+
51
+ # Считаем через байты
52
+ res = (val * u_map[curr]) / u_map[targ]
53
+
54
+ # Красиво причесываем результат
55
+ out = f"{res:.10f}".rstrip('0').rstrip('.') if res < 1 else f"{res:.2f}".rstrip('0').rstrip('.')
56
+ return f"{out}{targ}"
57
+
58
+ except:
59
+ return raw
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,20 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name='lb-lazy-num',
5
+ version='0.0.1',
6
+ py_modules=['lb_lazy_num'],
7
+ description='Simple convert library for lazy developers',
8
+ long_description=open('README.md', encoding='utf-8').read(),
9
+ long_description_content_type='text/markdown',
10
+ author='logic-break',
11
+ author_email='abibasqabiba@gmail.com',
12
+ url='https://github.com/logic-break/logic-break/tree/main/libraries/lb_lazy_num',
13
+ license='Non-Commercial',
14
+ classifiers=[
15
+ 'Programming Language :: Python :: 3',
16
+ 'Operating System :: OS Independent',
17
+ 'Topic :: Software Development :: Libraries :: Python Modules',
18
+ ],
19
+ python_requires='>=3.6',
20
+ )