string-utils-funct 1.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.
- string_utils_funct-1.0.1/.idea/.gitignore +3 -0
- string_utils_funct-1.0.1/.idea/Moon_lib.iml +10 -0
- string_utils_funct-1.0.1/.idea/inspectionProfiles/Project_Default.xml +12 -0
- string_utils_funct-1.0.1/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- string_utils_funct-1.0.1/.idea/misc.xml +7 -0
- string_utils_funct-1.0.1/.idea/modules.xml +8 -0
- string_utils_funct-1.0.1/.idea/workspace.xml +161 -0
- string_utils_funct-1.0.1/LICENSE +7 -0
- string_utils_funct-1.0.1/PKG-INFO +24 -0
- string_utils_funct-1.0.1/README.md +11 -0
- string_utils_funct-1.0.1/pyproject.toml +22 -0
- string_utils_funct-1.0.1/src/string_utils_funct/__init__.py +0 -0
- string_utils_funct-1.0.1/src/string_utils_funct/main.py +78 -0
- string_utils_funct-1.0.1/src/string_utils_funct/requirements.txt +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="PYTHON_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
|
6
|
+
</content>
|
|
7
|
+
<orderEntry type="inheritedJdk" />
|
|
8
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
9
|
+
</component>
|
|
10
|
+
</module>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
|
5
|
+
<option name="ignoredIdentifiers">
|
|
6
|
+
<list>
|
|
7
|
+
<option value="OOP.look" />
|
|
8
|
+
</list>
|
|
9
|
+
</option>
|
|
10
|
+
</inspection_tool>
|
|
11
|
+
</profile>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="Black">
|
|
4
|
+
<option name="sdkName" value="Python 3.12 (Moon_lib)" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (Moon_lib)" project-jdk-type="Python SDK" />
|
|
7
|
+
</project>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="f04b49bb-d24f-4efe-b82c-ec1f79a50fde" name="Changes" comment="" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="FileTemplateManagerImpl">
|
|
14
|
+
<option name="RECENT_TEMPLATES">
|
|
15
|
+
<list>
|
|
16
|
+
<option value="Python Script" />
|
|
17
|
+
</list>
|
|
18
|
+
</option>
|
|
19
|
+
</component>
|
|
20
|
+
<component name="ProjectColorInfo">{
|
|
21
|
+
"associatedIndex": 7
|
|
22
|
+
}</component>
|
|
23
|
+
<component name="ProjectId" id="3EJgtPivlRSvE5jpf7qWc8TTjDq" />
|
|
24
|
+
<component name="ProjectViewState">
|
|
25
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
26
|
+
<option name="showLibraryContents" value="true" />
|
|
27
|
+
</component>
|
|
28
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
29
|
+
"keyToString": {
|
|
30
|
+
"Python.abbddabc.executor": "Run",
|
|
31
|
+
"Python.dbbdaaba.executor": "Run",
|
|
32
|
+
"Python.main (1).executor": "Run",
|
|
33
|
+
"Python.main.executor": "Run",
|
|
34
|
+
"RunOnceActivity.ShowReadmeOnStart": "true"
|
|
35
|
+
}
|
|
36
|
+
}]]></component>
|
|
37
|
+
<component name="RecentsManager">
|
|
38
|
+
<key name="MoveFile.RECENT_KEYS">
|
|
39
|
+
<recent name="$PROJECT_DIR$/src/string_utils_func" />
|
|
40
|
+
<recent name="$PROJECT_DIR$/src" />
|
|
41
|
+
<recent name="$PROJECT_DIR$/src/foo/str_lib" />
|
|
42
|
+
<recent name="$PROJECT_DIR$" />
|
|
43
|
+
<recent name="$PROJECT_DIR$/src/foo" />
|
|
44
|
+
</key>
|
|
45
|
+
</component>
|
|
46
|
+
<component name="RunManager" selected="Python.main (1)">
|
|
47
|
+
<configuration name="abbddabc" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
|
48
|
+
<module name="Moon_lib" />
|
|
49
|
+
<option name="ENV_FILES" value="" />
|
|
50
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
51
|
+
<option name="PARENT_ENVS" value="true" />
|
|
52
|
+
<envs>
|
|
53
|
+
<env name="PYTHONUNBUFFERED" value="1" />
|
|
54
|
+
</envs>
|
|
55
|
+
<option name="SDK_HOME" value="" />
|
|
56
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
57
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
58
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
59
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
60
|
+
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/abbddabc.py" />
|
|
61
|
+
<option name="PARAMETERS" value="" />
|
|
62
|
+
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
63
|
+
<option name="EMULATE_TERMINAL" value="false" />
|
|
64
|
+
<option name="MODULE_MODE" value="false" />
|
|
65
|
+
<option name="REDIRECT_INPUT" value="false" />
|
|
66
|
+
<option name="INPUT_FILE" value="" />
|
|
67
|
+
<method v="2" />
|
|
68
|
+
</configuration>
|
|
69
|
+
<configuration name="dbbdaaba" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
|
70
|
+
<module name="Moon_lib" />
|
|
71
|
+
<option name="ENV_FILES" value="" />
|
|
72
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
73
|
+
<option name="PARENT_ENVS" value="true" />
|
|
74
|
+
<envs>
|
|
75
|
+
<env name="PYTHONUNBUFFERED" value="1" />
|
|
76
|
+
</envs>
|
|
77
|
+
<option name="SDK_HOME" value="" />
|
|
78
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
79
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
80
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
81
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
82
|
+
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/dbbdaaba.py" />
|
|
83
|
+
<option name="PARAMETERS" value="" />
|
|
84
|
+
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
85
|
+
<option name="EMULATE_TERMINAL" value="false" />
|
|
86
|
+
<option name="MODULE_MODE" value="false" />
|
|
87
|
+
<option name="REDIRECT_INPUT" value="false" />
|
|
88
|
+
<option name="INPUT_FILE" value="" />
|
|
89
|
+
<method v="2" />
|
|
90
|
+
</configuration>
|
|
91
|
+
<configuration name="main (1)" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
|
92
|
+
<module name="Moon_lib" />
|
|
93
|
+
<option name="ENV_FILES" value="" />
|
|
94
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
95
|
+
<option name="PARENT_ENVS" value="true" />
|
|
96
|
+
<envs>
|
|
97
|
+
<env name="PYTHONUNBUFFERED" value="1" />
|
|
98
|
+
</envs>
|
|
99
|
+
<option name="SDK_HOME" value="" />
|
|
100
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/string_utils_func" />
|
|
101
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
102
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
103
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
104
|
+
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/string_utils_func/main.py" />
|
|
105
|
+
<option name="PARAMETERS" value="" />
|
|
106
|
+
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
107
|
+
<option name="EMULATE_TERMINAL" value="false" />
|
|
108
|
+
<option name="MODULE_MODE" value="false" />
|
|
109
|
+
<option name="REDIRECT_INPUT" value="false" />
|
|
110
|
+
<option name="INPUT_FILE" value="" />
|
|
111
|
+
<method v="2" />
|
|
112
|
+
</configuration>
|
|
113
|
+
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
|
114
|
+
<module name="Moon_lib" />
|
|
115
|
+
<option name="ENV_FILES" value="" />
|
|
116
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
117
|
+
<option name="PARENT_ENVS" value="true" />
|
|
118
|
+
<envs>
|
|
119
|
+
<env name="PYTHONUNBUFFERED" value="1" />
|
|
120
|
+
</envs>
|
|
121
|
+
<option name="SDK_HOME" value="" />
|
|
122
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
123
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
124
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
125
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
126
|
+
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
|
|
127
|
+
<option name="PARAMETERS" value="" />
|
|
128
|
+
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
129
|
+
<option name="EMULATE_TERMINAL" value="false" />
|
|
130
|
+
<option name="MODULE_MODE" value="false" />
|
|
131
|
+
<option name="REDIRECT_INPUT" value="false" />
|
|
132
|
+
<option name="INPUT_FILE" value="" />
|
|
133
|
+
<method v="2" />
|
|
134
|
+
</configuration>
|
|
135
|
+
<recent_temporary>
|
|
136
|
+
<list>
|
|
137
|
+
<item itemvalue="Python.main (1)" />
|
|
138
|
+
<item itemvalue="Python.abbddabc" />
|
|
139
|
+
<item itemvalue="Python.dbbdaaba" />
|
|
140
|
+
</list>
|
|
141
|
+
</recent_temporary>
|
|
142
|
+
</component>
|
|
143
|
+
<component name="SharedIndexes">
|
|
144
|
+
<attachedChunks>
|
|
145
|
+
<set>
|
|
146
|
+
<option value="bundled-python-sdk-98f27166c754-ba05f1cad1b1-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-242.21829.153" />
|
|
147
|
+
</set>
|
|
148
|
+
</attachedChunks>
|
|
149
|
+
</component>
|
|
150
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
151
|
+
<component name="TaskManager">
|
|
152
|
+
<task active="true" id="Default" summary="Default task">
|
|
153
|
+
<changelist id="f04b49bb-d24f-4efe-b82c-ec1f79a50fde" name="Changes" comment="" />
|
|
154
|
+
<created>1779902300341</created>
|
|
155
|
+
<option name="number" value="Default" />
|
|
156
|
+
<option name="presentableId" value="Default" />
|
|
157
|
+
<updated>1779902300341</updated>
|
|
158
|
+
</task>
|
|
159
|
+
<servers />
|
|
160
|
+
</component>
|
|
161
|
+
</project>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
© 2026 string_utils_funct
|
|
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: string_utils_funct
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Str lib that have necessary functions!
|
|
5
|
+
Author-email: Moon Stoun <jdhcoolbut@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
This library adds useful functions for working with string values. I often end up implementing them myself!
|
|
15
|
+
Before use, install all dependencies with the command - pip install -r requirements.txt
|
|
16
|
+
|
|
17
|
+
slownprint(text, time) - Slowly prints text
|
|
18
|
+
slowinput(text, time) - Slowly prints text + input()
|
|
19
|
+
translate(text, lang) - Translates the selected text into the selected language (needs internet connection and)
|
|
20
|
+
etitle(text) - Uppercases every character after a space
|
|
21
|
+
to_ascii(text) - Converts the selected str variable to ASCII
|
|
22
|
+
norm_spaces(text) - Normalizes your spaces (EXAMPLE: enter "I was there yesterday" - returns "I was there yesterday")
|
|
23
|
+
|
|
24
|
+
[14.06.2026 Moon Stoun©]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
This library adds useful functions for working with string values. I often end up implementing them myself!
|
|
2
|
+
Before use, install all dependencies with the command - pip install -r requirements.txt
|
|
3
|
+
|
|
4
|
+
slownprint(text, time) - Slowly prints text
|
|
5
|
+
slowinput(text, time) - Slowly prints text + input()
|
|
6
|
+
translate(text, lang) - Translates the selected text into the selected language (needs internet connection and)
|
|
7
|
+
etitle(text) - Uppercases every character after a space
|
|
8
|
+
to_ascii(text) - Converts the selected str variable to ASCII
|
|
9
|
+
norm_spaces(text) - Normalizes your spaces (EXAMPLE: enter "I was there yesterday" - returns "I was there yesterday")
|
|
10
|
+
|
|
11
|
+
[14.06.2026 Moon Stoun©]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "string_utils_funct"
|
|
7
|
+
version = "1.0.1"
|
|
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"
|
|
14
|
+
license = { text = "MIT" } # Добавьте эту строку для явного указания лицензии
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[tool.hatch.build.targets.wheel]
|
|
22
|
+
packages = ["src/string_utils_funct"]
|
|
File without changes
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Библиотека str_lib v.1.0.1
|
|
2
|
+
import time as t
|
|
3
|
+
try:
|
|
4
|
+
from googletrans import Translator
|
|
5
|
+
except ModuleNotFoundError:
|
|
6
|
+
for b in str("install all dependencies with the command - pip install -r requirements.txt"):
|
|
7
|
+
print(b, end="", flush=True)
|
|
8
|
+
t.sleep(0.1)
|
|
9
|
+
|
|
10
|
+
def slowprint(text, times):
|
|
11
|
+
for a in str(text):
|
|
12
|
+
print(a, end="", flush=True)
|
|
13
|
+
t.sleep(times)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def slowinput(text, times):
|
|
17
|
+
for a in str(text):
|
|
18
|
+
print(a, end="", flush=True)
|
|
19
|
+
t.sleep(times)
|
|
20
|
+
var = input()
|
|
21
|
+
|
|
22
|
+
return var
|
|
23
|
+
|
|
24
|
+
def translate(text: str, target_lang: str) -> str:
|
|
25
|
+
translator = Translator()
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
# Определяем исходный язык текста
|
|
29
|
+
detected = translator.detect(text)
|
|
30
|
+
source_lang = detected.lang
|
|
31
|
+
|
|
32
|
+
# Проверяем, существует ли целевой язык
|
|
33
|
+
# googletrans поддерживает множество языков, но проверим базово
|
|
34
|
+
supported_langs = ['af', 'sq', 'am', 'ar', 'hy', 'az', 'eu', 'be', 'bn', 'bs',
|
|
35
|
+
'bg', 'ca', 'ceb', 'ny', 'zh-cn', 'zh-tw', 'co', 'hr', 'cs',
|
|
36
|
+
'da', 'nl', 'en', 'eo', 'et', 'tl', 'fi', 'fr', 'fy', 'gl',
|
|
37
|
+
'ka', 'de', 'el', 'gu', 'ht', 'ha', 'haw', 'iw', 'hi', 'hmn',
|
|
38
|
+
'hu', 'is', 'ig', 'id', 'ga', 'it', 'ja', 'jw', 'kn', 'kk',
|
|
39
|
+
'km', 'ko', 'ku', 'ky', 'lo', 'la', 'lv', 'lt', 'lb', 'mk',
|
|
40
|
+
'mg', 'ms', 'ml', 'mt', 'mi', 'mr', 'mn', 'my', 'ne', 'no',
|
|
41
|
+
'or', 'ps', 'fa', 'pl', 'pt', 'pa', 'ro', 'ru', 'sm', 'gd',
|
|
42
|
+
'sr', 'st', 'sn', 'sd', 'si', 'sk', 'sl', 'so', 'es', 'su',
|
|
43
|
+
'sw', 'sv', 'tg', 'ta', 'te', 'th', 'tr', 'uk', 'ur', 'uz',
|
|
44
|
+
'vi', 'cy', 'xh', 'yi', 'yo', 'zu']
|
|
45
|
+
|
|
46
|
+
if target_lang not in supported_langs:
|
|
47
|
+
raise ValueError(f"Language '{target_lang}' was not found in the list of supported languages.")
|
|
48
|
+
|
|
49
|
+
# Выполняем перевод
|
|
50
|
+
translated = translator.translate(text, dest = target_lang)
|
|
51
|
+
|
|
52
|
+
return translated.text
|
|
53
|
+
|
|
54
|
+
except Exception as e:
|
|
55
|
+
if "language" in str(e).lower():
|
|
56
|
+
raise ValueError(f"Language '{target_lang}' not found or not supported")
|
|
57
|
+
raise Exception(f"Translation error: {str(e)}")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def etitle(text):
|
|
61
|
+
splits = text.split(" ")
|
|
62
|
+
n = 0
|
|
63
|
+
|
|
64
|
+
for a in splits:
|
|
65
|
+
splits[n] = a.title()
|
|
66
|
+
n += 1
|
|
67
|
+
|
|
68
|
+
return " ".join(splits)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def norm_spaces(s):
|
|
72
|
+
return " ".join(s.split())
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def to_ascii(s):
|
|
76
|
+
return " ".join(str(ord(char)) for char in s)
|
|
77
|
+
|
|
78
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
googletrans==4.0.0rc1
|