umt-python 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
umt_python/__init__.py ADDED
@@ -0,0 +1,459 @@
1
+ from .array import (
2
+ ValidatedSortRange,
3
+ apply_insertion_sort_if_needed,
4
+ array_sum,
5
+ arrays_join,
6
+ binary_search,
7
+ check_flag_alignment,
8
+ chunk,
9
+ compact,
10
+ compare_function_default,
11
+ drop,
12
+ dual_pivot_quick_sort,
13
+ first,
14
+ generate_number_array,
15
+ get_arrays_common,
16
+ get_arrays_diff,
17
+ group_by,
18
+ insertion_sort,
19
+ insertion_sort_range,
20
+ key_by,
21
+ merge_sort,
22
+ pop,
23
+ quick_sort,
24
+ random_select,
25
+ range_array,
26
+ shuffle,
27
+ shuffle_2d_array,
28
+ tim_sort,
29
+ ultra_number_sort,
30
+ uniq_by,
31
+ unique,
32
+ validate_range,
33
+ zip_arrays,
34
+ zip_longest,
35
+ )
36
+ from .color import (
37
+ cmyk_to_rgba,
38
+ hexa_to_rgba,
39
+ hsla_to_rgba,
40
+ rgba_to_cmyk,
41
+ rgba_to_hexa,
42
+ rgba_to_hsla,
43
+ )
44
+ from .consts import (
45
+ ONE_DAY_MS,
46
+ ONE_HOUR_MS,
47
+ ONE_MINUTE_MS,
48
+ ONE_MONTH_MS,
49
+ ONE_MONTH_MS_28,
50
+ ONE_MONTH_MS_29,
51
+ ONE_MONTH_MS_31,
52
+ ONE_SECOND_MS,
53
+ ONE_WEEK_MS,
54
+ ONE_YEAR_MS,
55
+ ONE_YEAR_MS_366,
56
+ HttpClientErrorStatus,
57
+ HttpInformationalStatus,
58
+ HttpRedirectionStatus,
59
+ HttpServerErrorStatus,
60
+ HttpSuccessStatus,
61
+ )
62
+ from .crypto import (
63
+ decode_base32,
64
+ decode_base32_to_string,
65
+ decode_base58,
66
+ decode_base58_to_string,
67
+ encode_base32,
68
+ encode_base58,
69
+ )
70
+ from .data_structure import (
71
+ PriorityQueue,
72
+ )
73
+ from .date import (
74
+ DAY_LIST,
75
+ birthday,
76
+ date_format,
77
+ date_now,
78
+ date_range,
79
+ day_of_week,
80
+ get_day,
81
+ get_timezone_offset_string,
82
+ is_leap_year,
83
+ new_date_int,
84
+ new_date_string,
85
+ )
86
+ from .error import (
87
+ Error,
88
+ Result,
89
+ Success,
90
+ retry,
91
+ safe_execute,
92
+ )
93
+ from .function import (
94
+ curry,
95
+ )
96
+ from .ip import (
97
+ cidr_to_long,
98
+ cidr_to_subnet_mask,
99
+ get_ip_class,
100
+ get_network_address,
101
+ ip_to_binary_string,
102
+ ip_to_long,
103
+ is_in_range,
104
+ is_private_ip,
105
+ long_to_ip,
106
+ subnet_mask_to_cidr,
107
+ )
108
+ from .iterator import (
109
+ lazy_filter,
110
+ lazy_map,
111
+ lazy_take,
112
+ )
113
+ from .math import (
114
+ PrimeFactor,
115
+ ProbabilityFraction,
116
+ ReducedFraction,
117
+ addition,
118
+ average,
119
+ bitwise,
120
+ correlation_coefficient,
121
+ deg_to_rad,
122
+ deviation_value,
123
+ division,
124
+ factorial,
125
+ factorize,
126
+ flexible_number_conversion,
127
+ gcd,
128
+ get_decimal_length,
129
+ is_double,
130
+ is_perfect_square,
131
+ is_prime_number,
132
+ lcm,
133
+ linear_congruential_generator,
134
+ math_converter,
135
+ math_separator,
136
+ max_value,
137
+ median,
138
+ min_value,
139
+ mode,
140
+ multiples,
141
+ multiplication,
142
+ n_cr,
143
+ n_hr,
144
+ n_pr,
145
+ percentile,
146
+ prime_factorization,
147
+ quotient,
148
+ rad_to_deg,
149
+ random_int,
150
+ reduce_fraction,
151
+ repeated_trial,
152
+ round_of,
153
+ solve_equation,
154
+ standard_deviation,
155
+ subtraction,
156
+ to_base_n,
157
+ uuidv7,
158
+ value_swap,
159
+ xoshiro256,
160
+ )
161
+ from .number import (
162
+ to_ordinal,
163
+ )
164
+ from .object import (
165
+ object_has,
166
+ object_is_empty,
167
+ object_map_values,
168
+ object_merge,
169
+ object_merge_deep,
170
+ object_omit,
171
+ object_pick,
172
+ object_pick_deep,
173
+ )
174
+ from .predicate import (
175
+ every,
176
+ )
177
+ from .simple.math import (
178
+ deviation_value_simple,
179
+ )
180
+ from .string import (
181
+ DEFAULT_RANDOM_STRING_CHARS,
182
+ HTML_ESCAPE_MAP,
183
+ HTML_UNESCAPE_MAP,
184
+ FuzzySearchResult,
185
+ camel_case,
186
+ delete_spaces,
187
+ escape_html,
188
+ format_string,
189
+ from_base64,
190
+ fuzzy_search,
191
+ has_no_letters,
192
+ kebab_case,
193
+ levenshtein_distance,
194
+ pad_end,
195
+ pad_start,
196
+ random_string,
197
+ random_string_initialization,
198
+ reverse_string,
199
+ slugify,
200
+ string_similarity,
201
+ to_base64,
202
+ to_half_width,
203
+ trim_characters,
204
+ trim_end_characters,
205
+ trim_start_characters,
206
+ truncate,
207
+ unescape_html,
208
+ )
209
+ from .time import (
210
+ convert_time,
211
+ normalize_time_unit,
212
+ )
213
+ from .tool import (
214
+ Pipe,
215
+ Pipeline,
216
+ create_pipeline,
217
+ parse_json,
218
+ pipe,
219
+ )
220
+ from .ua import (
221
+ extract_browser_from_user_agent,
222
+ extract_device_from_user_agent,
223
+ extract_os_from_user_agent,
224
+ parse_user_agent,
225
+ )
226
+ from .unit import (
227
+ to_celsius,
228
+ to_kelvin,
229
+ unit_converter_initialization,
230
+ )
231
+ from .url import (
232
+ is_absolute_url,
233
+ join_path,
234
+ )
235
+ from .validate import (
236
+ EmailParts,
237
+ IsDeepEqualOptions,
238
+ ParseEmailLevel,
239
+ ParseEmailOptions,
240
+ ParseEmailResult,
241
+ is_array,
242
+ is_deep_equal,
243
+ is_dictionary_object,
244
+ is_equal,
245
+ is_not_empty,
246
+ is_number,
247
+ is_string,
248
+ is_value_nan,
249
+ parse_email,
250
+ )
251
+
252
+ __all__ = [
253
+ "DAY_LIST",
254
+ "DEFAULT_RANDOM_STRING_CHARS",
255
+ "HTML_ESCAPE_MAP",
256
+ "HTML_UNESCAPE_MAP",
257
+ "ONE_DAY_MS",
258
+ "ONE_HOUR_MS",
259
+ "ONE_MINUTE_MS",
260
+ "ONE_MONTH_MS",
261
+ "ONE_MONTH_MS_28",
262
+ "ONE_MONTH_MS_29",
263
+ "ONE_MONTH_MS_31",
264
+ "ONE_SECOND_MS",
265
+ "ONE_WEEK_MS",
266
+ "ONE_YEAR_MS",
267
+ "ONE_YEAR_MS_366",
268
+ "EmailParts",
269
+ "Error",
270
+ "FuzzySearchResult",
271
+ "HttpClientErrorStatus",
272
+ "HttpInformationalStatus",
273
+ "HttpRedirectionStatus",
274
+ "HttpServerErrorStatus",
275
+ "HttpSuccessStatus",
276
+ "IsDeepEqualOptions",
277
+ "ParseEmailLevel",
278
+ "ParseEmailOptions",
279
+ "ParseEmailResult",
280
+ "Pipe",
281
+ "Pipeline",
282
+ "PrimeFactor",
283
+ "PriorityQueue",
284
+ "ProbabilityFraction",
285
+ "ReducedFraction",
286
+ "Result",
287
+ "Success",
288
+ "ValidatedSortRange",
289
+ "addition",
290
+ "apply_insertion_sort_if_needed",
291
+ "array_sum",
292
+ "arrays_join",
293
+ "average",
294
+ "binary_search",
295
+ "birthday",
296
+ "bitwise",
297
+ "camel_case",
298
+ "check_flag_alignment",
299
+ "chunk",
300
+ "cidr_to_long",
301
+ "cidr_to_subnet_mask",
302
+ "cmyk_to_rgba",
303
+ "compact",
304
+ "compare_function_default",
305
+ "convert_time",
306
+ "correlation_coefficient",
307
+ "create_pipeline",
308
+ "curry",
309
+ "date_format",
310
+ "date_now",
311
+ "date_range",
312
+ "day_of_week",
313
+ "decode_base32",
314
+ "decode_base32_to_string",
315
+ "decode_base58",
316
+ "decode_base58_to_string",
317
+ "deg_to_rad",
318
+ "delete_spaces",
319
+ "deviation_value",
320
+ "deviation_value_simple",
321
+ "division",
322
+ "drop",
323
+ "dual_pivot_quick_sort",
324
+ "encode_base32",
325
+ "encode_base58",
326
+ "escape_html",
327
+ "every",
328
+ "extract_browser_from_user_agent",
329
+ "extract_device_from_user_agent",
330
+ "extract_os_from_user_agent",
331
+ "factorial",
332
+ "factorize",
333
+ "first",
334
+ "flexible_number_conversion",
335
+ "format_string",
336
+ "from_base64",
337
+ "fuzzy_search",
338
+ "gcd",
339
+ "generate_number_array",
340
+ "get_arrays_common",
341
+ "get_arrays_diff",
342
+ "get_day",
343
+ "get_decimal_length",
344
+ "get_ip_class",
345
+ "get_network_address",
346
+ "get_timezone_offset_string",
347
+ "group_by",
348
+ "has_no_letters",
349
+ "hexa_to_rgba",
350
+ "hsla_to_rgba",
351
+ "insertion_sort",
352
+ "insertion_sort_range",
353
+ "ip_to_binary_string",
354
+ "ip_to_long",
355
+ "is_absolute_url",
356
+ "is_array",
357
+ "is_deep_equal",
358
+ "is_dictionary_object",
359
+ "is_double",
360
+ "is_equal",
361
+ "is_in_range",
362
+ "is_leap_year",
363
+ "is_not_empty",
364
+ "is_number",
365
+ "is_perfect_square",
366
+ "is_prime_number",
367
+ "is_private_ip",
368
+ "is_string",
369
+ "is_value_nan",
370
+ "join_path",
371
+ "kebab_case",
372
+ "key_by",
373
+ "lazy_filter",
374
+ "lazy_map",
375
+ "lazy_take",
376
+ "lcm",
377
+ "levenshtein_distance",
378
+ "linear_congruential_generator",
379
+ "long_to_ip",
380
+ "math_converter",
381
+ "math_separator",
382
+ "max_value",
383
+ "median",
384
+ "merge_sort",
385
+ "min_value",
386
+ "mode",
387
+ "multiples",
388
+ "multiplication",
389
+ "n_cr",
390
+ "n_hr",
391
+ "n_pr",
392
+ "new_date_int",
393
+ "new_date_string",
394
+ "normalize_time_unit",
395
+ "object_has",
396
+ "object_is_empty",
397
+ "object_map_values",
398
+ "object_merge",
399
+ "object_merge_deep",
400
+ "object_omit",
401
+ "object_pick",
402
+ "object_pick_deep",
403
+ "pad_end",
404
+ "pad_start",
405
+ "parse_email",
406
+ "parse_json",
407
+ "parse_user_agent",
408
+ "percentile",
409
+ "pipe",
410
+ "pop",
411
+ "prime_factorization",
412
+ "quick_sort",
413
+ "quotient",
414
+ "rad_to_deg",
415
+ "random_int",
416
+ "random_select",
417
+ "random_string",
418
+ "random_string_initialization",
419
+ "range_array",
420
+ "reduce_fraction",
421
+ "repeated_trial",
422
+ "retry",
423
+ "reverse_string",
424
+ "rgba_to_cmyk",
425
+ "rgba_to_hexa",
426
+ "rgba_to_hsla",
427
+ "round_of",
428
+ "safe_execute",
429
+ "shuffle",
430
+ "shuffle_2d_array",
431
+ "slugify",
432
+ "solve_equation",
433
+ "standard_deviation",
434
+ "string_similarity",
435
+ "subnet_mask_to_cidr",
436
+ "subtraction",
437
+ "tim_sort",
438
+ "to_base64",
439
+ "to_base_n",
440
+ "to_celsius",
441
+ "to_half_width",
442
+ "to_kelvin",
443
+ "to_ordinal",
444
+ "trim_characters",
445
+ "trim_end_characters",
446
+ "trim_start_characters",
447
+ "truncate",
448
+ "ultra_number_sort",
449
+ "unescape_html",
450
+ "uniq_by",
451
+ "unique",
452
+ "unit_converter_initialization",
453
+ "uuidv7",
454
+ "validate_range",
455
+ "value_swap",
456
+ "xoshiro256",
457
+ "zip_arrays",
458
+ "zip_longest",
459
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: umt_python
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: A collection of useful utility functions for various tasks in Python, focusing on string manipulation and formatting.
5
5
  Author-email: riya-amemiya <riyaamemiya@gmail.com>
6
6
  License-Expression: MIT
@@ -8,14 +8,15 @@ Project-URL: Bug Tracker, https://github.com/riya-amemiya/UMT/issues
8
8
  Project-URL: Homepage, https://github.com/riya-amemiya/UMT
9
9
  Project-URL: Repository, https://github.com/riya-amemiya/UMT
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
15
16
  Classifier: Operating System :: OS Independent
16
17
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
18
  Classifier: Topic :: Utilities
18
- Requires-Python: >=3.9
19
+ Requires-Python: >=3.10
19
20
  Description-Content-Type: text/markdown
20
21
  License-File: LICENSE
21
22
  Dynamic: license-file
@@ -0,0 +1,6 @@
1
+ umt_python/__init__.py,sha256=Q46wkUI6c2atLpR1qqIGhQqbtvXWDbV75ywUaVwgSIw,8737
2
+ umt_python-0.2.0.dist-info/licenses/LICENSE,sha256=1sfH4YyDPcU1Flbmf9AwxZHlsxt0bMsoU7TpSvVPaTo,1069
3
+ umt_python-0.2.0.dist-info/METADATA,sha256=koT12tuAdfDtqCsJbmAaGeIUH-_3_kP_XkFgC2zl22Q,5164
4
+ umt_python-0.2.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
5
+ umt_python-0.2.0.dist-info/top_level.txt,sha256=JMzQArGg6QV0n-BiGlvfXempE7t93p2i0-2bH3XUkEk,11
6
+ umt_python-0.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (82.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1 @@
1
+ umt_python
__init__.py DELETED
@@ -1,32 +0,0 @@
1
- from .delete_spaces import delete_spaces
2
- from .format_string import format_string
3
- from .from_base64 import from_base64
4
- from .to_base64 import to_base64
5
- from .has_no_letters import has_no_letters
6
- from .pad_end import pad_end
7
- from .pad_start import pad_start
8
- from .random_string import random_string, DEFAULT_RANDOM_STRING_CHARS
9
- from .random_string_initialization import random_string_initialization
10
- from .reverse_string import reverse_string
11
- from .to_half_width import to_half_width
12
- from .trim_characters import trim_characters
13
- from .trim_end_characters import trim_end_characters
14
- from .trim_start_characters import trim_start_characters
15
-
16
- __all__ = [
17
- "delete_spaces",
18
- "format_string",
19
- "from_base64",
20
- "to_base64",
21
- "has_no_letters",
22
- "pad_end",
23
- "pad_start",
24
- "random_string",
25
- "DEFAULT_RANDOM_STRING_CHARS",
26
- "random_string_initialization",
27
- "reverse_string",
28
- "to_half_width",
29
- "trim_characters",
30
- "trim_end_characters",
31
- "trim_start_characters",
32
- ]
delete_spaces.py DELETED
@@ -1,19 +0,0 @@
1
- import re
2
-
3
- def delete_spaces(string_: str) -> str:
4
- """
5
- Removes all whitespace characters from a string.
6
-
7
- Args:
8
- string_: Input string.
9
-
10
- Returns:
11
- String with all whitespace characters removed.
12
-
13
- Example:
14
- >>> delete_spaces("Hello World")
15
- 'HelloWorld'
16
- >>> delete_spaces(" tab\\t space ")
17
- 'tabspace'
18
- """
19
- return re.sub(r'\s', '', string_)
format_string.py DELETED
@@ -1,30 +0,0 @@
1
- import re
2
-
3
- def format_string(template: str, *values: object) -> str:
4
- """
5
- Replaces placeholders in a template string with specified values.
6
- Placeholders are in the format {0}, {1}, {2}... and corresponding
7
- values are passed as arguments.
8
-
9
- Args:
10
- template: Template string containing placeholders.
11
- *values: Values to replace the placeholders in the template.
12
-
13
- Returns:
14
- String with placeholders replaced with values.
15
-
16
- Example:
17
- >>> format_string("Hello, {0}!", "World")
18
- 'Hello, World!'
19
- >>> format_string("The sum of {0} and {1} is {2}.", 1, 2, 3)
20
- 'The sum of 1 and 2 is 3.'
21
- >>> format_string("Not enough values: {0} {1}", "val1") # Mimics TS behavior
22
- 'Not enough values: val1 {1}'
23
- """
24
- def replace(match):
25
- index = int(match.group(1))
26
- if index < len(values):
27
- return str(values[index])
28
- return match.group(0) # Return the original placeholder if value not found
29
-
30
- return re.sub(r'{(\d+)}', replace, template)
from_base64.py DELETED
@@ -1,25 +0,0 @@
1
- import base64
2
-
3
- def from_base64(base64_string: str) -> str:
4
- """
5
- Converts Base64 to string.
6
-
7
- Args:
8
- base64_string: Base64 encoded string.
9
-
10
- Returns:
11
- Decoded string from Base64.
12
-
13
- Raises:
14
- ValueError: When input is not a valid Base64 string.
15
-
16
- Example:
17
- >>> from_base64("SGVsbG8gV29ybGQ=")
18
- 'Hello World'
19
- """
20
- if not base64_string:
21
- return ""
22
- try:
23
- return base64.b64decode(base64_string.encode('utf-8')).decode('utf-8')
24
- except Exception as e:
25
- raise ValueError("Invalid Base64 string") from e
has_no_letters.py DELETED
@@ -1,22 +0,0 @@
1
- def has_no_letters(text: str) -> bool:
2
- """
3
- Checks if the string contains no letters (contains only emojis, numbers, or special characters).
4
-
5
- Args:
6
- text: The string to check.
7
-
8
- Returns:
9
- True if the string has no letters, False otherwise.
10
-
11
- Example:
12
- >>> has_no_letters("123")
13
- True
14
- >>> has_no_letters("🌟123#")
15
- True
16
- >>> has_no_letters("abc123")
17
- False
18
- """
19
- for char_code in text:
20
- if char_code.isalpha():
21
- return False
22
- return True
pad_end.py DELETED
@@ -1,29 +0,0 @@
1
- def pad_end(string_: str, target_length: int, pad_string: str) -> str:
2
- """
3
- Adds the specified string to the end of the string until it reaches the specified length.
4
-
5
- Args:
6
- string_: The original string to apply padding.
7
- target_length: The target length after padding.
8
- pad_string: The string to use for padding.
9
-
10
- Returns:
11
- The string after padding has been applied.
12
-
13
- Example:
14
- >>> pad_end("abc", 5, "0")
15
- 'abc00'
16
- >>> pad_end("hello", 8, "123")
17
- 'hello123'
18
- >>> pad_end("world", 3, "!") # target_length is less than string length
19
- 'world'
20
- >>> pad_end("test", 6, "") # pad_string is empty
21
- 'test'
22
- """
23
- if not pad_string:
24
- return string_
25
- result = string_
26
- while len(result) < target_length:
27
- needed = target_length - len(result)
28
- result += pad_string[:needed]
29
- return result
pad_start.py DELETED
@@ -1,36 +0,0 @@
1
- def pad_start(string_: str, target_length: int, pad_string: str) -> str:
2
- """
3
- Pads the start of a string with another string until the target length is reached.
4
-
5
- Args:
6
- string_: The original string to pad.
7
- target_length: The target length after padding.
8
- pad_string: The string to use for padding.
9
-
10
- Returns:
11
- The padded string.
12
-
13
- Raises:
14
- ValueError: If pad_string is empty.
15
-
16
- Example:
17
- >>> pad_start("123", 5, "0")
18
- '00123'
19
- >>> pad_start("abc", 8, "def")
20
- 'defdeabc'
21
- >>> pad_start("world", 3, "!") # target_length is less than string length
22
- 'world'
23
- """
24
- if not pad_string:
25
- raise ValueError("pad_string cannot be empty")
26
-
27
- if len(string_) >= target_length:
28
- return string_
29
-
30
- padding = ""
31
- padding_length = target_length - len(string_)
32
-
33
- while len(padding) < padding_length:
34
- padding += pad_string
35
-
36
- return padding[:padding_length] + string_
random_string.py DELETED
@@ -1,30 +0,0 @@
1
- import random
2
- import string
3
-
4
- DEFAULT_RANDOM_STRING_CHARS = string.ascii_letters + string.digits
5
-
6
- def random_string(size: int = 8, char_pool: str = DEFAULT_RANDOM_STRING_CHARS) -> str:
7
- """
8
- Generates a random string.
9
-
10
- Args:
11
- size: Length of the random string. Defaults to 8.
12
- char_pool: String of characters to use for generating random string.
13
- Defaults to alphanumeric characters.
14
-
15
- Returns:
16
- Random string.
17
-
18
- Example:
19
- >>> len(random_string()) == 8
20
- True
21
- >>> len(random_string(10)) == 10
22
- True
23
- >>> all(c in 'abc' for c in random_string(5, 'abc'))
24
- True
25
- """
26
- if size == 0:
27
- return ""
28
- # When char_pool is empty and size > 0, random.choice will raise IndexError.
29
- # This is the expected behavior for the tests.
30
- return ''.join(random.choice(char_pool) for _ in range(size))
@@ -1,33 +0,0 @@
1
- from typing import Callable
2
- from .random_string import random_string, DEFAULT_RANDOM_STRING_CHARS
3
-
4
-
5
- def random_string_initialization(
6
- char_pool: str = DEFAULT_RANDOM_STRING_CHARS,
7
- ) -> Callable[[int], str]:
8
- """
9
- Initializes a function that generates random strings with a specific character pool.
10
-
11
- Args:
12
- char_pool: String of characters to use for generating random strings.
13
- Defaults to alphanumeric characters.
14
-
15
- Returns:
16
- A function that generates random strings (size: int) -> str.
17
-
18
- Example:
19
- >>> from .random_string import DEFAULT_RANDOM_STRING_CHARS # For doctest
20
- >>> custom_random = random_string_initialization("xyz")
21
- >>> r_string = custom_random(3)
22
- >>> len(r_string) == 3
23
- True
24
- >>> all(c in "xyz" for c in r_string)
25
- True
26
- >>> default_pool_func = random_string_initialization()
27
- >>> another_string = default_pool_func(5)
28
- >>> len(another_string) == 5
29
- True
30
- >>> all(c in DEFAULT_RANDOM_STRING_CHARS for c in another_string)
31
- True
32
- """
33
- return lambda size: random_string(size, char_pool)
reverse_string.py DELETED
@@ -1,17 +0,0 @@
1
- def reverse_string(char: str) -> str:
2
- """
3
- Reverses a string.
4
-
5
- Args:
6
- char: String to reverse.
7
-
8
- Returns:
9
- Reversed string.
10
-
11
- Example:
12
- >>> reverse_string("Hello")
13
- 'olleH'
14
- >>> reverse_string("madam")
15
- 'madam'
16
- """
17
- return char[::-1]
to_base64.py DELETED
@@ -1,17 +0,0 @@
1
- import base64
2
-
3
- def to_base64(char: str) -> str:
4
- """
5
- Convert string to Base64.
6
-
7
- Args:
8
- char: String to convert to Base64.
9
-
10
- Returns:
11
- Base64 encoded string.
12
-
13
- Example:
14
- >>> to_base64("Hello World")
15
- 'SGVsbG8gV29ybGQ='
16
- """
17
- return base64.b64encode(char.encode('utf-8')).decode('utf-8')
to_half_width.py DELETED
@@ -1,32 +0,0 @@
1
- def to_half_width(string_: str) -> str:
2
- """
3
- Convert full-width characters (zenkaku) to half-width characters (hankaku).
4
- This implementation specifically targets full-width alphanumeric characters and some symbols.
5
-
6
- Args:
7
- string_: String to convert.
8
-
9
- Returns:
10
- Converted string.
11
-
12
- Example:
13
- >>> to_half_width("Hello World 123")
14
- 'Hello World 123'
15
- >>> to_half_width("ABCdef")
16
- 'ABCdef'
17
- >>> to_half_width("!"#$%&'()*+,-./") # Full-width symbols
18
- "!\"#$%&'()*+,-./"
19
- >>> to_half_width(" ") # Full-width space
20
- ' '
21
- """
22
- # Mapping for full-width to half-width for ASCII range based on Unicode block
23
- # Full-width exclamation mark to tilde: U+FF01 to U+FF5E
24
- # Half-width corresponding characters: U+0021 to U+007E
25
- # The difference is 0xFEE0 (65248)
26
- # Full-width space U+3000 -> Half-width space U+0020
27
- translation_table = {}
28
- for i in range(0xFF01, 0xFF5F): # Covers full-width '!' to '~'
29
- translation_table[i] = i - 0xFEE0
30
- translation_table[0x3000] = 0x0020 # Full-width space to half-width space
31
-
32
- return string_.translate(translation_table)
trim_characters.py DELETED
@@ -1,21 +0,0 @@
1
- from .trim_start_characters import trim_start_characters
2
- from .trim_end_characters import trim_end_characters
3
-
4
- def trim_characters(string_: str, chars: str) -> str:
5
- """
6
- Removes specified characters from both ends of a string.
7
-
8
- Args:
9
- string_: The string to trim.
10
- chars: The set of characters to remove.
11
-
12
- Returns:
13
- A new string with specified characters removed from both ends.
14
-
15
- Example:
16
- >>> trim_characters("-.-hello-.-", "-.")
17
- 'hello'
18
- >>> trim_characters("123abc123", "123")
19
- 'abc'
20
- """
21
- return trim_end_characters(trim_start_characters(string_, chars), chars)
trim_end_characters.py DELETED
@@ -1,23 +0,0 @@
1
- def trim_end_characters(string_: str, chars: str) -> str:
2
- """
3
- Removes specified characters from the end of a string.
4
-
5
- Args:
6
- string_: The input string to trim.
7
- chars: Characters to remove from the end.
8
-
9
- Returns:
10
- A new string with specified characters removed from the end.
11
-
12
- Example:
13
- >>> trim_end_characters("hello!!!", "!")
14
- 'hello'
15
- >>> trim_end_characters("123---", "-")
16
- '123'
17
- >>> trim_end_characters("abc123", "xyz")
18
- 'abc123'
19
- """
20
- end_index = len(string_)
21
- while end_index > 0 and string_[end_index - 1] in chars:
22
- end_index -= 1
23
- return string_[:end_index]
trim_start_characters.py DELETED
@@ -1,23 +0,0 @@
1
- def trim_start_characters(string_: str, chars: str) -> str:
2
- """
3
- Removes specified characters from the start of a string.
4
-
5
- Args:
6
- string_: The input string to trim.
7
- chars: Characters to remove from the start.
8
-
9
- Returns:
10
- A new string with specified characters removed from the start.
11
-
12
- Example:
13
- >>> trim_start_characters("!!!hello", "!")
14
- 'hello'
15
- >>> trim_start_characters("---123", "-")
16
- '123'
17
- >>> trim_start_characters("abc123", "xyz")
18
- 'abc123'
19
- """
20
- start_index = 0
21
- while start_index < len(string_) and string_[start_index] in chars:
22
- start_index += 1
23
- return string_[start_index:]
@@ -1,20 +0,0 @@
1
- __init__.py,sha256=VZz3TwQJokyFAjRLAkeQzTrmLIaax-uyc6sj_ZKHV4g,998
2
- delete_spaces.py,sha256=-mSYxzSGr-7-q8cwSw2vGdT-nqFCTE91bQMXaxASWkg,409
3
- format_string.py,sha256=xzL1GWtm6ScWihwpSdVvLAFQxl9NRd6iKM6xFpH7ODs,1047
4
- from_base64.py,sha256=vldBQe_8Z-dsuDHYNX9TXxW-rj8NbeQmxhwcwPZ4k6M,583
5
- has_no_letters.py,sha256=U8hZMbwYMJzn07rljZiAIhndaUqhgZWKCocSwVmnZ9w,540
6
- pad_end.py,sha256=CIpIQeR3O0RmVFv_VBftzk7sOLSNtIgBe8ZH05jPkeA,917
7
- pad_start.py,sha256=0AosSpYf9aOPnTPu-ET5tioxhdK-a983iX1uMmX-QGE,991
8
- random_string.py,sha256=kpV5ZgjDztFwkeKpV9zgybXfQ8YYw-3ZFNyM06we61A,897
9
- random_string_initialization.py,sha256=sRIHuTFTQJXZCM4Y24nN4SuTd26M1tN_R01ZMAXTA4A,1151
10
- reverse_string.py,sha256=zd5BrBeYy1PaglWnJMSDbZ7an2Ok2II4rORayZ2sGz4,300
11
- to_base64.py,sha256=RDTlzbjHxnL4elO24k7x6XbZ-SFzguJPwW1xD_flLIw,337
12
- to_half_width.py,sha256=xw1FXcbyqCFKwfofj9FT-hHlzGdl8fWuGyrVqlfNDb4,1254
13
- trim_characters.py,sha256=cuNhwE6yyKG0d5ogouOufur0O24BJ22uAA_5RRjJXK4,641
14
- trim_end_characters.py,sha256=Cnr-tyjqoKB-hqIDV5PI0x1p2CleIyOGcIZ62hkwLMI,670
15
- trim_start_characters.py,sha256=TcGa9T3ArIIxguvYf8I2EJ1AUUN3AzYk1Y-0YYprBk8,690
16
- umt_python-0.1.0.dist-info/licenses/LICENSE,sha256=1sfH4YyDPcU1Flbmf9AwxZHlsxt0bMsoU7TpSvVPaTo,1069
17
- umt_python-0.1.0.dist-info/METADATA,sha256=ro255Am3UjSxtNPLY6NUGrvcVAFpbS53pIlCDkTldys,5111
18
- umt_python-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- umt_python-0.1.0.dist-info/top_level.txt,sha256=E6bnKdLKlF_McWeJ2DcD2ApFGe3MEWvEAssItHZf_Kw,222
20
- umt_python-0.1.0.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- __init__
2
- delete_spaces
3
- format_string
4
- from_base64
5
- has_no_letters
6
- pad_end
7
- pad_start
8
- random_string
9
- random_string_initialization
10
- reverse_string
11
- to_base64
12
- to_half_width
13
- trim_characters
14
- trim_end_characters
15
- trim_start_characters