moon-string-ut 1.0.0__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,7 @@
1
+ © 2026 moon_string_ut
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the «Software»), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED «AS IS», WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: moon_string_ut
3
+ Version: 1.0.0
4
+ Summary: Str lib that have necessary functions!
5
+ Author-email: Moon Stoun <jdhcoolbut@gmail.com>
6
+ License-File: LICENSE
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.10.0
11
+ Description-Content-Type: text/markdown
12
+
13
+ This library adds useful functions for working with string values. I often end up implementing them myself!
14
+
15
+ slownprint(text, time) - Slowly prints text
16
+ slowinput(text, time) - Slowly prints text + input()
17
+ translate(text, lang) - Translates the selected text into the selected language*
18
+ etitle(text) - Uppercases every character after a space
19
+ to_ascii(text) - Converts the selected str variable to ASCII
20
+ norm_spaces(text) - Normalizes your spaces (EXAMPLE: enter "I was there yesterday" - returns "I was there yesterday")
21
+
22
+ * - Requires an internet connection
23
+
24
+ [12.06.2026] [lst update - 12.06.2026]
@@ -0,0 +1,12 @@
1
+ This library adds useful functions for working with string values. I often end up implementing them myself!
2
+
3
+ slownprint(text, time) - Slowly prints text
4
+ slowinput(text, time) - Slowly prints text + input()
5
+ translate(text, lang) - Translates the selected text into the selected language*
6
+ etitle(text) - Uppercases every character after a space
7
+ to_ascii(text) - Converts the selected str variable to ASCII
8
+ norm_spaces(text) - Normalizes your spaces (EXAMPLE: enter "I was there yesterday" - returns "I was there yesterday")
9
+
10
+ * - Requires an internet connection
11
+
12
+ [12.06.2026] [lst update - 12.06.2026]
File without changes
@@ -0,0 +1,75 @@
1
+ # Библиотека str_lib v.1.0.0
2
+ from googletrans import Translator
3
+ import importlib
4
+ import time as t
5
+ import random
6
+ import os
7
+
8
+ def slowprint(text, times):
9
+ for a in str(text):
10
+ print(a, end="", flush=True)
11
+ t.sleep(times)
12
+
13
+
14
+ def slowinput(text, times):
15
+ for a in str(text):
16
+ print(a, end="", flush=True)
17
+ t.sleep(times)
18
+ var = input()
19
+
20
+ return var
21
+
22
+ def translate(text: str, target_lang: str) -> str:
23
+ translator = Translator()
24
+
25
+ try:
26
+ # Определяем исходный язык текста
27
+ detected = translator.detect(text)
28
+ source_lang = detected.lang
29
+
30
+ # Проверяем, существует ли целевой язык
31
+ # googletrans поддерживает множество языков, но проверим базово
32
+ supported_langs = ['af', 'sq', 'am', 'ar', 'hy', 'az', 'eu', 'be', 'bn', 'bs',
33
+ 'bg', 'ca', 'ceb', 'ny', 'zh-cn', 'zh-tw', 'co', 'hr', 'cs',
34
+ 'da', 'nl', 'en', 'eo', 'et', 'tl', 'fi', 'fr', 'fy', 'gl',
35
+ 'ka', 'de', 'el', 'gu', 'ht', 'ha', 'haw', 'iw', 'hi', 'hmn',
36
+ 'hu', 'is', 'ig', 'id', 'ga', 'it', 'ja', 'jw', 'kn', 'kk',
37
+ 'km', 'ko', 'ku', 'ky', 'lo', 'la', 'lv', 'lt', 'lb', 'mk',
38
+ 'mg', 'ms', 'ml', 'mt', 'mi', 'mr', 'mn', 'my', 'ne', 'no',
39
+ 'or', 'ps', 'fa', 'pl', 'pt', 'pa', 'ro', 'ru', 'sm', 'gd',
40
+ 'sr', 'st', 'sn', 'sd', 'si', 'sk', 'sl', 'so', 'es', 'su',
41
+ 'sw', 'sv', 'tg', 'ta', 'te', 'th', 'tr', 'uk', 'ur', 'uz',
42
+ 'vi', 'cy', 'xh', 'yi', 'yo', 'zu']
43
+
44
+ if target_lang not in supported_langs:
45
+ raise ValueError(f"Язык '{target_lang}' не найден в списке поддерживаемых")
46
+
47
+ # Выполняем перевод
48
+ translated = translator.translate(text, dest = target_lang)
49
+
50
+ return translated.text
51
+
52
+ except Exception as e:
53
+ if "language" in str(e).lower():
54
+ raise ValueError(f"Язык '{target_lang}' не найден или не поддерживается")
55
+ raise Exception(f"Ошибка при переводе: {str(e)}")
56
+
57
+
58
+ def etitle(text):
59
+ splits = text.split(" ")
60
+ n = 0
61
+
62
+ for a in splits:
63
+ splits[n] = a.title()
64
+ n += 1
65
+
66
+ return " ".join(splits)
67
+
68
+
69
+ def norm_spaces(s):
70
+ return " ".join(s.split())
71
+
72
+
73
+ def to_ascii(s):
74
+ return " ".join(str(ord(char)) for char in s)
75
+
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "moon_string_ut"
7
+ version = "1.0.0"
8
+ authors = [
9
+ { name="Moon Stoun", email="jdhcoolbut@gmail.com"},
10
+ ]
11
+ description = "Str lib that have necessary functions!"
12
+ readme = "README.md"
13
+ requires-python = ">=3.10.0"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ [tool.hatch.build]
21
+ packages = ["src/foo"]