fishertools 0.2.0__tar.gz → 0.3.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.
Files changed (120) hide show
  1. fishertools-0.3.1/PKG-INFO +510 -0
  2. fishertools-0.3.1/README.md +471 -0
  3. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/__init__.py +26 -5
  4. fishertools-0.3.1/fishertools/config/__init__.py +24 -0
  5. fishertools-0.3.1/fishertools/config/manager.py +247 -0
  6. fishertools-0.3.1/fishertools/config/models.py +96 -0
  7. fishertools-0.3.1/fishertools/config/parser.py +265 -0
  8. fishertools-0.3.1/fishertools/documentation/__init__.py +38 -0
  9. fishertools-0.3.1/fishertools/documentation/api.py +242 -0
  10. fishertools-0.3.1/fishertools/documentation/generator.py +502 -0
  11. fishertools-0.3.1/fishertools/documentation/models.py +126 -0
  12. fishertools-0.3.1/fishertools/documentation/visual.py +583 -0
  13. fishertools-0.3.1/fishertools/errors/__init__.py +37 -0
  14. fishertools-0.3.1/fishertools/errors/exception_types.py +282 -0
  15. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/errors/explainer.py +87 -1
  16. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/errors/formatters.py +34 -6
  17. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/errors/models.py +73 -1
  18. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/errors/patterns.py +40 -0
  19. fishertools-0.3.1/fishertools/errors/recovery.py +467 -0
  20. fishertools-0.3.1/fishertools/examples/__init__.py +22 -0
  21. fishertools-0.3.1/fishertools/examples/cli_example.py +156 -0
  22. fishertools-0.3.1/fishertools/examples/learn_example.py +65 -0
  23. fishertools-0.3.1/fishertools/examples/logger_example.py +176 -0
  24. fishertools-0.3.1/fishertools/examples/menu_example.py +101 -0
  25. fishertools-0.3.1/fishertools/examples/models.py +118 -0
  26. fishertools-0.3.1/fishertools/examples/repository.py +770 -0
  27. fishertools-0.3.1/fishertools/examples/storage_example.py +175 -0
  28. fishertools-0.3.1/fishertools/input_utils.py +185 -0
  29. fishertools-0.3.1/fishertools/integration.py +451 -0
  30. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/learn/__init__.py +2 -1
  31. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/learn/examples.py +88 -1
  32. fishertools-0.3.1/fishertools/learning/__init__.py +32 -0
  33. fishertools-0.3.1/fishertools/learning/core.py +349 -0
  34. fishertools-0.3.1/fishertools/learning/models.py +112 -0
  35. fishertools-0.3.1/fishertools/learning/progress.py +314 -0
  36. fishertools-0.3.1/fishertools/learning/session.py +500 -0
  37. fishertools-0.3.1/fishertools/learning/tutorial.py +626 -0
  38. fishertools-0.3.1/fishertools/patterns/__init__.py +46 -0
  39. fishertools-0.3.1/fishertools/patterns/cli.py +175 -0
  40. fishertools-0.3.1/fishertools/patterns/logger.py +140 -0
  41. fishertools-0.3.1/fishertools/patterns/menu.py +99 -0
  42. fishertools-0.3.1/fishertools/patterns/storage.py +127 -0
  43. fishertools-0.3.1/fishertools/readme_transformer.py +631 -0
  44. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/safe/__init__.py +5 -1
  45. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/safe/collections.py +9 -1
  46. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/safe/files.py +121 -1
  47. fishertools-0.3.1/fishertools/transform_readme.py +105 -0
  48. fishertools-0.3.1/fishertools.egg-info/PKG-INFO +510 -0
  49. fishertools-0.3.1/fishertools.egg-info/SOURCES.txt +112 -0
  50. {fishertools-0.2.0 → fishertools-0.3.1}/pyproject.toml +1 -1
  51. {fishertools-0.2.0 → fishertools-0.3.1}/setup.py +1 -1
  52. fishertools-0.3.1/tests/test_config/__init__.py +3 -0
  53. fishertools-0.3.1/tests/test_config/test_basic_config.py +57 -0
  54. fishertools-0.3.1/tests/test_config/test_config_error_handling.py +287 -0
  55. fishertools-0.3.1/tests/test_config/test_config_properties.py +435 -0
  56. fishertools-0.3.1/tests/test_documentation/__init__.py +3 -0
  57. fishertools-0.3.1/tests/test_documentation/test_documentation_properties.py +253 -0
  58. fishertools-0.3.1/tests/test_documentation/test_visual_documentation_properties.py +444 -0
  59. fishertools-0.3.1/tests/test_errors/test_exception_types.py +446 -0
  60. fishertools-0.3.1/tests/test_errors/test_exception_types_pbt.py +333 -0
  61. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_errors/test_patterns.py +52 -0
  62. fishertools-0.3.1/tests/test_examples/__init__.py +3 -0
  63. fishertools-0.3.1/tests/test_examples/test_example_repository_properties.py +204 -0
  64. fishertools-0.3.1/tests/test_examples/test_specific_examples.py +303 -0
  65. fishertools-0.3.1/tests/test_input_utils/__init__.py +1 -0
  66. fishertools-0.3.1/tests/test_input_utils/test_input_utils.py +65 -0
  67. fishertools-0.3.1/tests/test_integration_enhancements.py +462 -0
  68. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_learn/test_examples.py +179 -1
  69. fishertools-0.3.1/tests/test_learn/test_explain_properties.py +307 -0
  70. fishertools-0.3.1/tests/test_learning/__init__.py +3 -0
  71. fishertools-0.3.1/tests/test_learning/test_interactive_learning_properties.py +337 -0
  72. fishertools-0.3.1/tests/test_learning/test_learning_system_properties.py +194 -0
  73. fishertools-0.3.1/tests/test_learning/test_progress_tracking_properties.py +279 -0
  74. fishertools-0.3.1/tests/test_patterns_cli.py +611 -0
  75. fishertools-0.3.1/tests/test_patterns_docstrings.py +473 -0
  76. fishertools-0.3.1/tests/test_patterns_logger.py +465 -0
  77. fishertools-0.3.1/tests/test_patterns_menu.py +440 -0
  78. fishertools-0.3.1/tests/test_patterns_storage.py +447 -0
  79. fishertools-0.3.1/tests/test_readme_transformer/__init__.py +1 -0
  80. fishertools-0.3.1/tests/test_readme_transformer/test_readme_infrastructure.py +1023 -0
  81. fishertools-0.3.1/tests/test_readme_transformer/test_transform_readme_integration.py +431 -0
  82. fishertools-0.3.1/tests/test_safe/test_files.py +222 -0
  83. fishertools-0.3.1/tests/test_structure_enhancements.py +115 -0
  84. fishertools-0.2.0/PKG-INFO +0 -256
  85. fishertools-0.2.0/README.md +0 -217
  86. fishertools-0.2.0/fishertools/errors/__init__.py +0 -23
  87. fishertools-0.2.0/fishertools.egg-info/PKG-INFO +0 -256
  88. fishertools-0.2.0/fishertools.egg-info/SOURCES.txt +0 -49
  89. fishertools-0.2.0/tests/test_safe/test_files.py +0 -104
  90. {fishertools-0.2.0 → fishertools-0.3.1}/LICENSE +0 -0
  91. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/decorators.py +0 -0
  92. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/errors/exceptions.py +0 -0
  93. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/helpers.py +0 -0
  94. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/learn/tips.py +0 -0
  95. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/legacy/__init__.py +0 -0
  96. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/legacy/deprecated.py +0 -0
  97. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/legacy/deprecation.py +0 -0
  98. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/safe/strings.py +0 -0
  99. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools/utils.py +0 -0
  100. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools.egg-info/dependency_links.txt +0 -0
  101. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools.egg-info/requires.txt +0 -0
  102. {fishertools-0.2.0 → fishertools-0.3.1}/fishertools.egg-info/top_level.txt +0 -0
  103. {fishertools-0.2.0 → fishertools-0.3.1}/setup.cfg +0 -0
  104. {fishertools-0.2.0 → fishertools-0.3.1}/tests/__init__.py +0 -0
  105. {fishertools-0.2.0 → fishertools-0.3.1}/tests/conftest.py +0 -0
  106. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_errors/__init__.py +0 -0
  107. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_errors/test_api.py +0 -0
  108. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_errors/test_error_handling.py +0 -0
  109. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_errors/test_explainer.py +0 -0
  110. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_errors/test_formatters.py +0 -0
  111. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_errors/test_models.py +0 -0
  112. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_integration.py +0 -0
  113. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_learn/__init__.py +0 -0
  114. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_learn/test_tips.py +0 -0
  115. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_legacy/__init__.py +0 -0
  116. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_legacy/test_backward_compatibility.py +0 -0
  117. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_legacy/test_deprecation_warnings.py +0 -0
  118. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_safe/__init__.py +0 -0
  119. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_safe/test_collections_properties.py +0 -0
  120. {fishertools-0.2.0 → fishertools-0.3.1}/tests/test_structure.py +0 -0
@@ -0,0 +1,510 @@
1
+ Metadata-Version: 2.4
2
+ Name: fishertools
3
+ Version: 0.3.1
4
+ Summary: Fishertools - инструменты, которые делают Python удобнее и безопаснее для новичков
5
+ Home-page: https://github.com/f1sherFM/My_1st_library_python
6
+ Author: f1sherFM
7
+ Author-email: f1sherFM <kirillka229top@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/f1sherFM/My_1st_library_python
10
+ Project-URL: Repository, https://github.com/f1sherFM/My_1st_library_python
11
+ Project-URL: Issues, https://github.com/f1sherFM/My_1st_library_python/issues
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests>=2.25.0
28
+ Requires-Dist: click>=8.0.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
31
+ Requires-Dist: hypothesis>=6.0.0; extra == "dev"
32
+ Requires-Dist: black>=24.0.0; extra == "dev"
33
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
34
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
35
+ Dynamic: author
36
+ Dynamic: home-page
37
+ Dynamic: license-file
38
+ Dynamic: requires-python
39
+
40
+ **Инструменты, которые делают Python удобнее и безопаснее для новичков**
41
+ ```bash
42
+ pip install fishertools
43
+ ```
44
+ | Задача | Что вызвать |
45
+ |--------|-------------|
46
+ | Объяснить ошибку | explain_error(e) |
47
+ | Красиво показать traceback | explain_error(e) |
48
+ | Безопасно читать файл | safe_read_file(path) |
49
+ ## Для кого эта библиотека
50
+
51
+ - Ты только начал изучать Python
52
+ - Сообщения об ошибках кажутся страшными и непонятными
53
+ - Хочешь, чтобы ошибки объяснялись на нормальном русском с примерами
54
+ # Fishertools
55
+
56
+ **Инструменты, которые делают Python удобнее и безопаснее для новичков**
57
+
58
+ Fishertools - это Python библиотека, созданная специально для начинающих разработчиков. Она предоставляет понятные объяснения ошибок, безопасные утилиты и обучающие инструменты.
59
+
60
+ ## 🎯 Основные возможности
61
+
62
+ ### 🚨 Объяснение ошибок Python
63
+ Получайте понятные объяснения ошибок на русском языке с советами по исправлению:
64
+
65
+ ```python
66
+ from fishertools import explain_error
67
+
68
+ try:
69
+ numbers = [1, 2, 3]
70
+ print(numbers[10])
71
+ except Exception as e:
72
+ explain_error(e)
73
+ ```
74
+
75
+ **Вывод:**
76
+ ```
77
+ 🚨 Ошибка Python: IndexError
78
+
79
+ ═══ Сообщение об ошибке ═══
80
+ list index out of range
81
+
82
+ ═══ Что это означает ═══
83
+ Вы пытаетесь получить элемент списка по индексу, которого не существует.
84
+ Индексы в Python начинаются с 0, а максимальный индекс равен длине списка минус 1.
85
+
86
+ ═══ Как исправить ═══
87
+ Проверьте длину списка перед обращением к элементу или используйте
88
+ безопасные методы получения элементов.
89
+
90
+ ═══ Пример ═══
91
+ ┌─ Правильный код ─┐
92
+ numbers = [1, 2, 3]
93
+ if len(numbers) > 10:
94
+ print(numbers[10])
95
+ else:
96
+ print("Индекс слишком большой!")
97
+ └───────────────────┘
98
+ ```
99
+
100
+ ### 🛡️ Безопасные утилиты
101
+ Функции, которые предотвращают типичные ошибки новичков:
102
+
103
+ ```python
104
+ from fishertools.safe import safe_get, safe_divide, safe_read_file
105
+
106
+ # Безопасное получение элемента
107
+ numbers = [1, 2, 3]
108
+ result = safe_get(numbers, 10, "не найден") # "не найден"
109
+
110
+ # Безопасное деление
111
+ result = safe_divide(10, 0, 0) # 0 вместо ошибки
112
+
113
+ # Безопасное чтение файла
114
+ content = safe_read_file("file.txt", default="файл не найден")
115
+ ```
116
+
117
+ ### 📚 Обучающие инструменты
118
+ Изучайте Python на примерах и лучших практиках:
119
+
120
+ ```python
121
+ from fishertools.learn import show_best_practice, generate_example
122
+
123
+ # Показать лучшие практики
124
+ show_best_practice("variables")
125
+
126
+ # Сгенерировать пример кода
127
+ example = generate_example("functions")
128
+ print(example)
129
+ ```
130
+
131
+ ### 🎓 Объяснение Python концепций
132
+ Получайте структурированные объяснения Python тем с примерами:
133
+
134
+ ```python
135
+ from fishertools.learn import explain
136
+
137
+ # Получить объяснение темы
138
+ explanation = explain("list")
139
+ print(explanation["description"])
140
+ print(explanation["when_to_use"])
141
+ print(explanation["example"])
142
+ ```
143
+
144
+ ### 🔧 Готовые паттерны
145
+ Используйте готовые шаблоны для типичных задач:
146
+
147
+ ```python
148
+ from fishertools.patterns import simple_menu, JSONStorage, SimpleLogger, SimpleCLI
149
+
150
+ # Интерактивное меню
151
+ simple_menu({
152
+ "Опция 1": lambda: print("Выбрана опция 1"),
153
+ "Опция 2": lambda: print("Выбрана опция 2")
154
+ })
155
+
156
+ # Сохранение данных в JSON
157
+ storage = JSONStorage("data.json")
158
+ storage.save({"name": "Alice", "age": 30})
159
+
160
+ # Логирование
161
+ logger = SimpleLogger("app.log")
162
+ logger.info("Приложение запущено")
163
+
164
+ # CLI приложение
165
+ cli = SimpleCLI("myapp", "Мое приложение")
166
+ @cli.command("greet", "Поздравить пользователя")
167
+ def greet(name):
168
+ print(f"Привет, {name}!")
169
+ cli.run()
170
+ ```
171
+
172
+ ### 🔄 Обратная совместимость
173
+ Все полезные функции из предыдущих версий сохранены:
174
+
175
+ ```python
176
+ from fishertools.legacy import hash_string, generate_password, QuickConfig
177
+
178
+ # Старые функции работают как прежде
179
+ password = generate_password(12)
180
+ hash_value = hash_string("my_string")
181
+ config = QuickConfig({"debug": True})
182
+ ```
183
+
184
+ ## 📦 Установка
185
+
186
+ ```bash
187
+ pip install fishertools
188
+ ```
189
+
190
+ Или из исходников:
191
+ ```bash
192
+ git clone https://github.com/f1sherFM/My_1st_library_python.git
193
+ cd My_1st_library_python
194
+ pip install -e .
195
+ ```
196
+
197
+ ## 🚀 Быстрый старт
198
+
199
+ ```python
200
+ from fishertools import explain_error
201
+
202
+ # Основная функция - объяснение ошибок
203
+ try:
204
+ result = 10 / 0
205
+ except Exception as e:
206
+ explain_error(e)
207
+
208
+ # Безопасные утилиты
209
+ from fishertools.safe import safe_get, safe_divide
210
+ safe_result = safe_get([1, 2, 3], 5, "default")
211
+
212
+ # Обучающие инструменты
213
+ from fishertools.learn import show_best_practice
214
+ show_best_practice("functions")
215
+ ```
216
+
217
+ ## 📚 Обучающие инструменты v0.3.1
218
+
219
+ ### Объяснение Python концепций с помощью explain()
220
+
221
+ Функция `explain()` предоставляет структурированные объяснения для 30+ Python тем с примерами кода:
222
+
223
+ ```python
224
+ from fishertools.learn import explain
225
+
226
+ # Получить объяснение темы
227
+ explanation = explain("list")
228
+ print(explanation["description"]) # Что это такое
229
+ print(explanation["when_to_use"]) # Когда использовать
230
+ print(explanation["example"]) # Пример кода
231
+ ```
232
+
233
+ **Поддерживаемые темы:**
234
+
235
+ - **Типы данных**: int, float, str, bool, list, tuple, set, dict
236
+ - **Управляющие конструкции**: if, for, while, break, continue
237
+ - **Функции**: function, return, lambda, *args, **kwargs
238
+ - **Обработка ошибок**: try, except, finally, raise
239
+ - **Работа с файлами**: open, read, write, with
240
+
241
+ **Пример использования:**
242
+
243
+ ```python
244
+ from fishertools.learn import explain
245
+
246
+ # Объяснение списков
247
+ list_info = explain("list")
248
+ print(list_info)
249
+ # {
250
+ # "description": "Упорядоченная коллекция элементов",
251
+ # "when_to_use": "Используйте, когда нужно хранить несколько элементов в порядке",
252
+ # "example": "items = [1, 2, 3]\nitems.append(4)\nprint(items[0])"
253
+ # }
254
+
255
+ # Объяснение цикла for
256
+ for_info = explain("for")
257
+ print(for_info["example"])
258
+ ```
259
+
260
+ ### Готовые паттерны для типичных задач
261
+
262
+ Модуль `fishertools.patterns` предоставляет готовые шаблоны для типичных программных задач.
263
+
264
+ #### 1. simple_menu() - Интерактивное меню
265
+
266
+ Создавайте интерактивные консольные меню без лишнего кода:
267
+
268
+ ```python
269
+ from fishertools.patterns import simple_menu
270
+
271
+ def show_greeting():
272
+ print("Привет! 👋")
273
+
274
+ def show_goodbye():
275
+ print("До свидания! 👋")
276
+
277
+ def show_help():
278
+ print("Это справка по приложению")
279
+
280
+ simple_menu({
281
+ "Поздравить": show_greeting,
282
+ "Попрощаться": show_goodbye,
283
+ "Справка": show_help
284
+ })
285
+ ```
286
+
287
+ **Особенности:**
288
+ - Автоматическая нумерация опций
289
+ - Обработка некорректного ввода
290
+ - Команды "quit" и "exit" для выхода
291
+ - Повторный запрос при ошибке
292
+
293
+ #### 2. JSONStorage - Сохранение данных
294
+
295
+ Сохраняйте и загружайте данные в JSON без обработки ошибок:
296
+
297
+ ```python
298
+ from fishertools.patterns import JSONStorage
299
+
300
+ # Создание хранилища
301
+ storage = JSONStorage("users.json")
302
+
303
+ # Сохранение данных
304
+ users = [
305
+ {"name": "Alice", "age": 30},
306
+ {"name": "Bob", "age": 25}
307
+ ]
308
+ storage.save(users)
309
+
310
+ # Загрузка данных
311
+ loaded_users = storage.load()
312
+ print(loaded_users)
313
+
314
+ # Проверка существования файла
315
+ if storage.exists():
316
+ print("Файл существует")
317
+ ```
318
+
319
+ **Особенности:**
320
+ - Автоматическое создание директорий
321
+ - Автоматическое создание файла при сохранении
322
+ - Обработка ошибок файловых операций
323
+ - Простой API для сохранения/загрузки
324
+
325
+ #### 3. SimpleLogger - Логирование
326
+
327
+ Добавляйте логирование в приложение с временными метками:
328
+
329
+ ```python
330
+ from fishertools.patterns import SimpleLogger
331
+
332
+ # Создание логгера
333
+ logger = SimpleLogger("app.log")
334
+
335
+ # Логирование сообщений
336
+ logger.info("Приложение запущено")
337
+ logger.warning("Низкий уровень памяти")
338
+ logger.error("Ошибка подключения")
339
+ ```
340
+
341
+ **Формат логов:**
342
+ ```
343
+ [2024-01-15 10:30:45] [INFO] Приложение запущено
344
+ [2024-01-15 10:30:46] [WARNING] Низкий уровень памяти
345
+ [2024-01-15 10:30:47] [ERROR] Ошибка подключения
346
+ ```
347
+
348
+ **Особенности:**
349
+ - Автоматические временные метки
350
+ - Три уровня логирования: INFO, WARNING, ERROR
351
+ - Автоматическое создание файла логов
352
+ - Добавление к существующему файлу
353
+
354
+ #### 4. SimpleCLI - Командная строка
355
+
356
+ Создавайте CLI приложения с минимальным кодом:
357
+
358
+ ```python
359
+ from fishertools.patterns import SimpleCLI
360
+
361
+ # Создание CLI приложения
362
+ cli = SimpleCLI("myapp", "Мое приложение")
363
+
364
+ # Регистрация команд через декоратор
365
+ @cli.command("greet", "Поздравить пользователя")
366
+ def greet(name):
367
+ print(f"Привет, {name}!")
368
+
369
+ @cli.command("add", "Сложить два числа")
370
+ def add(a, b):
371
+ result = int(a) + int(b)
372
+ print(f"Результат: {result}")
373
+
374
+ # Запуск приложения
375
+ if __name__ == "__main__":
376
+ cli.run()
377
+ ```
378
+
379
+ **Использование:**
380
+ ```bash
381
+ python myapp.py greet Alice
382
+ # Привет, Alice!
383
+
384
+ python myapp.py add 5 3
385
+ # Результат: 8
386
+
387
+ python myapp.py --help
388
+ # Показать все доступные команды
389
+ ```
390
+
391
+ **Особенности:**
392
+ - Регистрация команд через декоратор
393
+ - Автоматический парсинг аргументов
394
+ - Встроенная справка (--help)
395
+ - Обработка неправильных команд
396
+
397
+ ### Примеры использования
398
+
399
+ Полные примеры использования всех компонентов находятся в директории `fishertools/examples/`:
400
+
401
+ - `learn_example.py` - Примеры использования explain()
402
+ - `menu_example.py` - Примеры simple_menu()
403
+ - `storage_example.py` - Примеры JSONStorage
404
+ - `logger_example.py` - Примеры SimpleLogger
405
+ - `cli_example.py` - Примеры SimpleCLI
406
+
407
+ Вы можете запустить любой пример:
408
+ ```bash
409
+ python -m fishertools.examples.learn_example
410
+ python -m fishertools.examples.menu_example
411
+ python -m fishertools.examples.storage_example
412
+ python -m fishertools.examples.logger_example
413
+ python -m fishertools.examples.cli_example
414
+ ```
415
+
416
+ ## 📖 Документация
417
+
418
+ ### Поддерживаемые типы ошибок
419
+
420
+ Fishertools объясняет следующие типы ошибок Python:
421
+
422
+ - **TypeError** - ошибки типов данных
423
+ - **ValueError** - неправильные значения
424
+ - **AttributeError** - отсутствующие атрибуты
425
+ - **IndexError** - выход за границы списка
426
+ - **KeyError** - отсутствующие ключи словаря
427
+ - **ImportError** - проблемы с импортом модулей
428
+ - **SyntaxError** - синтаксические ошибки
429
+
430
+ ### Безопасные утилиты
431
+
432
+ - `safe_get(collection, index, default)` - безопасное получение элемента
433
+ - `safe_divide(a, b, default)` - деление без ошибки на ноль
434
+ - `safe_max(collection, default)` - максимум из коллекции
435
+ - `safe_min(collection, default)` - минимум из коллекции
436
+ - `safe_sum(collection, default)` - сумма элементов
437
+ - `safe_read_file(path, default)` - чтение файла без ошибок
438
+
439
+ ### Обучающие функции
440
+
441
+ - `show_best_practice(topic)` - показать лучшие практики
442
+ - `generate_example(concept)` - сгенерировать пример кода
443
+ - `list_available_concepts()` - список доступных концепций
444
+ - `list_available_topics()` - список доступных тем
445
+
446
+ ## 🧪 Тестирование
447
+
448
+ Библиотека покрыта comprehensive тестами:
449
+
450
+ ```bash
451
+ # Запуск всех тестов
452
+ pytest
453
+
454
+ # Запуск property-based тестов
455
+ pytest -k "property"
456
+
457
+ # Запуск с покрытием
458
+ pytest --cov=fishertools
459
+ ```
460
+
461
+ ## 🛠️ Разработка
462
+
463
+ ```bash
464
+ # Установка для разработки
465
+ pip install -e ".[dev]"
466
+
467
+ # Форматирование кода
468
+ black fishertools tests
469
+
470
+ # Проверка типов
471
+ mypy fishertools
472
+
473
+ # Линтинг
474
+ ruff check fishertools
475
+ ```
476
+
477
+ ## 📋 Требования
478
+
479
+ - Python 3.8+
480
+ - requests >= 2.25.0
481
+ - click >= 8.0.0
482
+
483
+ Для разработки:
484
+ - pytest >= 8.0.0
485
+ - hypothesis >= 6.0.0 (для property-based тестов)
486
+ - black >= 24.0.0
487
+ - ruff >= 0.1.0
488
+ - mypy >= 1.8.0
489
+
490
+ ## 🤝 Вклад в проект
491
+
492
+ Мы приветствуем вклад в развитие проекта! Пожалуйста:
493
+
494
+ 1. Форкните репозиторий
495
+ 2. Создайте ветку для новой функции
496
+ 3. Добавьте тесты для новой функциональности
497
+ 4. Убедитесь, что все тесты проходят
498
+ 5. Создайте Pull Request
499
+
500
+ ## 📄 Лицензия
501
+
502
+ MIT License - см. файл [LICENSE](LICENSE)
503
+
504
+ ## 🙏 Благодарности
505
+
506
+ Спасибо всем, кто помогает делать Python более доступным для новичков!
507
+
508
+ ---
509
+
510
+ **Fishertools** - потому что каждый заслуживает понятные инструменты для изучения программирования! 🐍✨