lb-valid-input 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,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: lb-valid-input
3
+ Version: 0.0.1
4
+ Summary: Simple input library for lazy developers
5
+ Home-page: https://github.com/logic-break/logic-break/tree/main/libraries/lb_valid_input
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_valid_input
28
+ © Copyright logic-break 2026
29
+
30
+ https://github.com/logic-break/logic-break/tree/main/libraries/lb_valid_input
31
+
32
+ > lib made for lazy, by lazy
33
+
34
+ installation:
35
+
36
+ pip install lb-valid-input
37
+
38
+ **NOTE: in code, you must import lb_valid_input**
39
+
40
+
41
+ # Usage:
42
+
43
+ **`.numberinput(prompt, min_val, max_val)`** Safely gets a number (int/float). Prevents crashes from text input and checks optional min/max range.
44
+ **`.choiceinput(question, choices)`** Asks a question with a list of options. Forces the user to pick one from the list (case-insensitive).
45
+ **`.choiceinput(question, choices)`** Asks a question with a list of options. Forces the user to pick one from the list (case-insensitive).
46
+
47
+ # Example:
48
+ ```
49
+ import lb_valid_input as lbi
50
+
51
+ # It will ask "What do you want to do? (Deposit, Withdraw, Exit)"
52
+ action = lbi.choiceinput("What do you want to do?", ["Deposit", "Withdraw", "Exit"])
53
+
54
+ if action == "Deposit":
55
+ amount = lbi.numberinput("Enter amount to deposit: ", min_val=0.01)
56
+ print(f"Successfully deposited ${amount}")
57
+
58
+ elif action == "Withdraw":
59
+ amount = lbi.rangeinput("Enter amount to withdraw (10-1000): ", 10, 1000)
60
+ print(f"Please take your ${amount}")
61
+
62
+ else:
63
+ print("Goodbye!")
64
+ ```
@@ -0,0 +1,39 @@
1
+
2
+ # lb_valid_input
3
+ © Copyright logic-break 2026
4
+
5
+ https://github.com/logic-break/logic-break/tree/main/libraries/lb_valid_input
6
+
7
+ > lib made for lazy, by lazy
8
+
9
+ installation:
10
+
11
+ pip install lb-valid-input
12
+
13
+ **NOTE: in code, you must import lb_valid_input**
14
+
15
+
16
+ # Usage:
17
+
18
+ **`.numberinput(prompt, min_val, max_val)`** Safely gets a number (int/float). Prevents crashes from text input and checks optional min/max range.
19
+ **`.choiceinput(question, choices)`** Asks a question with a list of options. Forces the user to pick one from the list (case-insensitive).
20
+ **`.choiceinput(question, choices)`** Asks a question with a list of options. Forces the user to pick one from the list (case-insensitive).
21
+
22
+ # Example:
23
+ ```
24
+ import lb_valid_input as lbi
25
+
26
+ # It will ask "What do you want to do? (Deposit, Withdraw, Exit)"
27
+ action = lbi.choiceinput("What do you want to do?", ["Deposit", "Withdraw", "Exit"])
28
+
29
+ if action == "Deposit":
30
+ amount = lbi.numberinput("Enter amount to deposit: ", min_val=0.01)
31
+ print(f"Successfully deposited ${amount}")
32
+
33
+ elif action == "Withdraw":
34
+ amount = lbi.rangeinput("Enter amount to withdraw (10-1000): ", 10, 1000)
35
+ print(f"Please take your ${amount}")
36
+
37
+ else:
38
+ print("Goodbye!")
39
+ ```
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: lb-valid-input
3
+ Version: 0.0.1
4
+ Summary: Simple input library for lazy developers
5
+ Home-page: https://github.com/logic-break/logic-break/tree/main/libraries/lb_valid_input
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_valid_input
28
+ © Copyright logic-break 2026
29
+
30
+ https://github.com/logic-break/logic-break/tree/main/libraries/lb_valid_input
31
+
32
+ > lib made for lazy, by lazy
33
+
34
+ installation:
35
+
36
+ pip install lb-valid-input
37
+
38
+ **NOTE: in code, you must import lb_valid_input**
39
+
40
+
41
+ # Usage:
42
+
43
+ **`.numberinput(prompt, min_val, max_val)`** Safely gets a number (int/float). Prevents crashes from text input and checks optional min/max range.
44
+ **`.choiceinput(question, choices)`** Asks a question with a list of options. Forces the user to pick one from the list (case-insensitive).
45
+ **`.choiceinput(question, choices)`** Asks a question with a list of options. Forces the user to pick one from the list (case-insensitive).
46
+
47
+ # Example:
48
+ ```
49
+ import lb_valid_input as lbi
50
+
51
+ # It will ask "What do you want to do? (Deposit, Withdraw, Exit)"
52
+ action = lbi.choiceinput("What do you want to do?", ["Deposit", "Withdraw", "Exit"])
53
+
54
+ if action == "Deposit":
55
+ amount = lbi.numberinput("Enter amount to deposit: ", min_val=0.01)
56
+ print(f"Successfully deposited ${amount}")
57
+
58
+ elif action == "Withdraw":
59
+ amount = lbi.rangeinput("Enter amount to withdraw (10-1000): ", 10, 1000)
60
+ print(f"Please take your ${amount}")
61
+
62
+ else:
63
+ print("Goodbye!")
64
+ ```
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ lb_valid_input.py
4
+ setup.py
5
+ lb_valid_input.egg-info/PKG-INFO
6
+ lb_valid_input.egg-info/SOURCES.txt
7
+ lb_valid_input.egg-info/dependency_links.txt
8
+ lb_valid_input.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ lb_valid_input
@@ -0,0 +1,41 @@
1
+ def numberinput(prompt=">>> ", min_val=None, max_val=None):
2
+ """Asks for a number with optional range check."""
3
+ while True:
4
+ data = input(prompt).strip().replace(",", ".")
5
+ try:
6
+ val = float(data)
7
+ if val.is_integer():
8
+ val = int(val)
9
+ if min_val is not None and val < min_val:
10
+ print(f"Error: Min value is {min_val}")
11
+ continue
12
+ if max_val is not None and val > max_val:
13
+ print(f"Error: Max value is {max_val}")
14
+ continue
15
+ return val
16
+ except ValueError:
17
+ print("Error: Enter a valid number.")
18
+
19
+ def choiceinput(question, choices):
20
+ """
21
+ Automatically formats the prompt as: Question (Choice1, Choice2):
22
+ Example: choiceinput("Закрыть счет?", ["Да", "Нет"])
23
+ """
24
+ # Создаем строку вариантов для промпта: "Да, Нет"
25
+ options_str = ", ".join(choices)
26
+ full_prompt = f"{question} ({options_str}): "
27
+
28
+ # Список для проверки (в нижнем регистре)
29
+ valid_choices = [str(c).lower() for c in choices]
30
+
31
+ while True:
32
+ data = input(full_prompt).strip().lower()
33
+ if data in valid_choices:
34
+ # Возвращаем тот вариант, который совпал (в оригинальном регистре)
35
+ index = valid_choices.index(data)
36
+ return choices[index]
37
+ print(f"Error: Please choose from {options_str}")
38
+
39
+ def rangeinput(prompt, start, end):
40
+ """Shortcut for range check."""
41
+ return numberinput(prompt, min_val=start, max_val=end)
@@ -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-valid-input',
5
+ version='0.0.1',
6
+ py_modules=['lb_valid_input'],
7
+ description='Simple input 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_valid_input',
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
+ )