umt-python 0.1.1__tar.gz → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: umt_python
3
- Version: 0.1.1
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
@@ -3,19 +3,18 @@ build-backend = "setuptools.build_meta"
3
3
  requires = ["setuptools>=61.0", "wheel"]
4
4
 
5
5
  [tool.setuptools]
6
- package-dir = {"umt_python" = "src"}
6
+ package-dir = { "umt_python" = "src" }
7
7
  packages = ["umt_python"]
8
8
 
9
9
  [project]
10
- authors = [
11
- {name = "riya-amemiya", email = "riyaamemiya@gmail.com"},
12
- ]
10
+ authors = [{ name = "riya-amemiya", email = "riyaamemiya@gmail.com" }]
13
11
  classifiers = [
14
12
  "Programming Language :: Python :: 3",
15
- "Programming Language :: Python :: 3.9",
16
13
  "Programming Language :: Python :: 3.10",
17
14
  "Programming Language :: Python :: 3.11",
18
15
  "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
19
18
  "Operating System :: OS Independent",
20
19
  "Topic :: Software Development :: Libraries :: Python Modules",
21
20
  "Topic :: Utilities",
@@ -24,8 +23,8 @@ description = "A collection of useful utility functions for various tasks in Pyt
24
23
  license = "MIT"
25
24
  name = "umt_python"
26
25
  readme = "README.md"
27
- requires-python = ">=3.9"
28
- version = "0.1.1"
26
+ requires-python = ">=3.10"
27
+ version = "0.2.0"
29
28
 
30
29
  [project.urls]
31
30
  "Bug Tracker" = "https://github.com/riya-amemiya/UMT/issues"
@@ -34,7 +33,37 @@ version = "0.1.1"
34
33
 
35
34
  [dependency-groups]
36
35
  dev = [
37
- "pyright==1.1.402",
38
- "pytest==8.4.1",
39
- "ruff==0.12.2",
36
+ "pyright==1.1.408",
37
+ "pytest==9.0.2",
38
+ "pytest-cov==7.0.0",
39
+ "ruff==0.15.4",
40
+ ]
41
+
42
+ [tool.ruff.lint]
43
+ select = [
44
+ "ANN",
45
+ "ARG",
46
+ "A",
47
+ "C4",
48
+ "DTZ",
49
+ "E",
50
+ "W",
51
+ "F",
52
+ "FIX",
53
+ "UP",
54
+ "B",
55
+ "SIM",
56
+ "I",
57
+ "RET",
58
+ "PT",
59
+ "N",
60
+ "PERF",
61
+ "PL",
62
+ "FURB",
63
+ "RUF",
40
64
  ]
65
+ ignore = ["E501", "FBT003", "A005", "PLR2004", "PLR0911","PLR0912","PLR0913"]
66
+
67
+ [tool.ruff.lint.per-file-ignores]
68
+ "tests/**/*.py" = ["ALL"]
69
+ "src/string/to_half_width.py" = ["RUF"]
@@ -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.1
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,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/__init__.py
5
+ umt_python.egg-info/PKG-INFO
6
+ umt_python.egg-info/SOURCES.txt
7
+ umt_python.egg-info/dependency_links.txt
8
+ umt_python.egg-info/top_level.txt
@@ -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
- ]
@@ -1,20 +0,0 @@
1
- import re
2
-
3
-
4
- def delete_spaces(string_: str) -> str:
5
- """
6
- Removes all whitespace characters from a string.
7
-
8
- Args:
9
- string_: Input string.
10
-
11
- Returns:
12
- String with all whitespace characters removed.
13
-
14
- Example:
15
- >>> delete_spaces("Hello World")
16
- 'HelloWorld'
17
- >>> delete_spaces(" tab\\t space ")
18
- 'tabspace'
19
- """
20
- return re.sub(r"\s", "", string_)
@@ -1,32 +0,0 @@
1
- import re
2
-
3
-
4
- def format_string(template: str, *values: object) -> str:
5
- """
6
- Replaces placeholders in a template string with specified values.
7
- Placeholders are in the format {0}, {1}, {2}... and corresponding
8
- values are passed as arguments.
9
-
10
- Args:
11
- template: Template string containing placeholders.
12
- *values: Values to replace the placeholders in the template.
13
-
14
- Returns:
15
- String with placeholders replaced with values.
16
-
17
- Example:
18
- >>> format_string("Hello, {0}!", "World")
19
- 'Hello, World!'
20
- >>> format_string("The sum of {0} and {1} is {2}.", 1, 2, 3)
21
- 'The sum of 1 and 2 is 3.'
22
- >>> format_string("Not enough values: {0} {1}", "val1") # Mimics TS behavior
23
- 'Not enough values: val1 {1}'
24
- """
25
-
26
- def replace(match):
27
- index = int(match.group(1))
28
- if index < len(values):
29
- return str(values[index])
30
- return match.group(0) # Return the original placeholder if value not found
31
-
32
- return re.sub(r"{(\d+)}", replace, template)
@@ -1,27 +0,0 @@
1
- import base64
2
- import binascii
3
-
4
-
5
- def from_base64(base64_string: str) -> str:
6
- """
7
- Converts Base64 to string.
8
-
9
- Args:
10
- base64_string: Base64 encoded string.
11
-
12
- Returns:
13
- Decoded string from Base64.
14
-
15
- Raises:
16
- ValueError: When input is not a valid Base64 string.
17
-
18
- Example:
19
- >>> from_base64("SGVsbG8gV29ybGQ=")
20
- 'Hello World'
21
- """
22
- if not base64_string:
23
- return ""
24
- try:
25
- return base64.b64decode(base64_string.encode("utf-8")).decode("utf-8")
26
- except (binascii.Error, UnicodeDecodeError) as e:
27
- raise ValueError("Invalid Base64 string") from e