umt-python 0.1.1__py3-none-any.whl → 0.3.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 CHANGED
@@ -1,32 +1,783 @@
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
1
+ from .advance import (
2
+ range_advance,
3
+ )
4
+ from .array import (
5
+ ValidatedSortRange,
6
+ apply_insertion_sort_if_needed,
7
+ array_sum,
8
+ arrays_join,
9
+ binary_search,
10
+ check_flag_alignment,
11
+ chunk,
12
+ compact,
13
+ compare_function_default,
14
+ drop,
15
+ dual_pivot_quick_sort,
16
+ first,
17
+ generate_number_array,
18
+ get_arrays_common,
19
+ get_arrays_diff,
20
+ group_by,
21
+ insertion_sort,
22
+ insertion_sort_range,
23
+ key_by,
24
+ merge_sort,
25
+ pop,
26
+ quick_sort,
27
+ random_select,
28
+ range_array,
29
+ shuffle,
30
+ shuffle_2d_array,
31
+ tim_sort,
32
+ ultra_number_sort,
33
+ uniq_by,
34
+ unique,
35
+ validate_range,
36
+ zip_arrays,
37
+ zip_longest,
38
+ )
39
+ from .async_util import (
40
+ AbortSignal,
41
+ DebouncedAsyncFunction,
42
+ Deferred,
43
+ SettledResult,
44
+ ThrottledAsyncFunction,
45
+ debounce_async,
46
+ defer,
47
+ p_settled,
48
+ parallel,
49
+ sleep,
50
+ throttle_async,
51
+ timeout,
52
+ wait_for,
53
+ )
54
+ from .color import (
55
+ cmyk_to_rgba,
56
+ hexa_to_rgba,
57
+ hsla_to_rgba,
58
+ rgba_to_cmyk,
59
+ rgba_to_hexa,
60
+ rgba_to_hsla,
61
+ )
62
+ from .consts import (
63
+ ONE_DAY_MS,
64
+ ONE_HOUR_MS,
65
+ ONE_MINUTE_MS,
66
+ ONE_MONTH_MS,
67
+ ONE_MONTH_MS_28,
68
+ ONE_MONTH_MS_29,
69
+ ONE_MONTH_MS_31,
70
+ ONE_SECOND_MS,
71
+ ONE_WEEK_MS,
72
+ ONE_YEAR_MS,
73
+ ONE_YEAR_MS_366,
74
+ HttpClientErrorStatus,
75
+ HttpInformationalStatus,
76
+ HttpRedirectionStatus,
77
+ HttpServerErrorStatus,
78
+ HttpStatus,
79
+ HttpSuccessStatus,
80
+ )
81
+ from .crypto import (
82
+ decode_base32,
83
+ decode_base32_to_string,
84
+ decode_base58,
85
+ decode_base58_to_string,
86
+ encode_base32,
87
+ encode_base58,
88
+ )
89
+ from .data_structure import (
90
+ LRUCache,
91
+ PriorityQueue,
92
+ TTLCache,
93
+ )
94
+ from .date import (
95
+ DAY_LIST,
96
+ add_duration,
97
+ birthday,
98
+ date_format,
99
+ date_now,
100
+ date_range,
101
+ day_of_week,
102
+ diff,
103
+ end_of,
104
+ format_relative,
105
+ get_day,
106
+ get_timezone_offset_string,
107
+ is_business_day,
108
+ is_leap_year,
109
+ is_same_day,
110
+ is_weekend,
111
+ ms_by_unit,
112
+ new_date_int,
113
+ new_date_string,
114
+ start_of,
115
+ sub_duration,
116
+ )
117
+ from .error import (
118
+ Error,
119
+ Result,
120
+ Success,
121
+ error_function,
122
+ flat_map_result,
123
+ map_result,
124
+ match_result,
125
+ retry,
126
+ safe_execute,
127
+ success_function,
128
+ )
129
+ from .function import (
130
+ DebouncedFunction,
131
+ MemoizedFunction,
132
+ OnceFunction,
133
+ ThrottledFunction,
134
+ curry,
135
+ debounce,
136
+ memoize,
137
+ once,
138
+ throttle,
139
+ )
140
+ from .ip import (
141
+ cidr_to_long,
142
+ cidr_to_subnet_mask,
143
+ get_ip_class,
144
+ get_network_address,
145
+ ip_to_binary_string,
146
+ ip_to_long,
147
+ is_in_range,
148
+ is_private_ip,
149
+ long_to_ip,
150
+ subnet_mask_to_cidr,
151
+ )
152
+ from .iterator import (
153
+ lazy_filter,
154
+ lazy_map,
155
+ lazy_take,
156
+ )
157
+ from .map import (
158
+ group_by_to_map,
159
+ zip_to_map,
160
+ )
161
+ from .math import (
162
+ PrimeFactor,
163
+ ProbabilityFraction,
164
+ ReducedFraction,
165
+ addition,
166
+ average,
167
+ bitwise,
168
+ calculator,
169
+ calculator_core,
170
+ calculator_initialization,
171
+ clamp,
172
+ convert_currency,
173
+ correlation_coefficient,
174
+ deg_to_rad,
175
+ deviation_value,
176
+ division,
177
+ factorial,
178
+ factorize,
179
+ flexible_number_conversion,
180
+ gcd,
181
+ get_decimal_length,
182
+ in_range,
183
+ is_double,
184
+ is_perfect_square,
185
+ is_prime_number,
186
+ lcm,
187
+ linear_congruential_generator,
188
+ literal_expression,
189
+ math_converter,
190
+ math_separator,
191
+ max_value,
192
+ median,
193
+ min_value,
194
+ mode,
195
+ multiples,
196
+ multiplication,
197
+ n_cr,
198
+ n_hr,
199
+ n_pr,
200
+ percentile,
201
+ prime_factorization,
202
+ quotient,
203
+ rad_to_deg,
204
+ random_int,
205
+ reduce_fraction,
206
+ repeated_trial,
207
+ round_of,
208
+ solve_equation,
209
+ standard_deviation,
210
+ subtraction,
211
+ sum_precise,
212
+ to_base_n,
213
+ uuidv7,
214
+ value_swap,
215
+ xoshiro256,
216
+ )
217
+ from .number import (
218
+ format_number,
219
+ to_ordinal,
220
+ to_percentage,
221
+ )
222
+ from .object import (
223
+ deep_clone,
224
+ flatten_object,
225
+ get_objects_common,
226
+ get_objects_diff,
227
+ invert,
228
+ map_keys,
229
+ object_get,
230
+ object_has,
231
+ object_is_empty,
232
+ object_is_plain,
233
+ object_key_by,
234
+ object_map_values,
235
+ object_merge,
236
+ object_merge_deep,
237
+ object_omit,
238
+ object_pick,
239
+ object_pick_deep,
240
+ object_set,
241
+ omit_by,
242
+ path_segments,
243
+ pick_by,
244
+ remove_prototype,
245
+ remove_prototype_deep,
246
+ remove_prototype_map,
247
+ remove_prototype_map_deep,
248
+ unflatten_object,
249
+ )
250
+ from .predicate import (
251
+ every,
252
+ is_not_nullish,
253
+ is_nullish,
254
+ matches,
255
+ not_,
256
+ some,
257
+ )
258
+ from .random import (
259
+ WeightedItem,
260
+ random_boolean,
261
+ random_choice,
262
+ random_float,
263
+ random_uuid,
264
+ seeded_random,
265
+ weighted_choice,
266
+ )
267
+ from .simple.date import (
268
+ birthday_simple,
269
+ day_of_week_simple,
270
+ now_simple,
271
+ )
272
+ from .simple.math import (
273
+ deviation_value_simple,
274
+ )
275
+ from .string import (
276
+ DEFAULT_RANDOM_STRING_CHARS,
277
+ HTML_ESCAPE_MAP,
278
+ HTML_UNESCAPE_MAP,
279
+ Formatter,
280
+ FuzzySearchResult,
281
+ apply_formatter,
282
+ camel_case,
283
+ capitalize,
284
+ capitalize_word,
285
+ constant_case,
286
+ count_occurrences,
287
+ deburr,
288
+ dedent,
289
+ default_formatters,
290
+ delete_spaces,
291
+ detect_mode,
292
+ ensure_prefix,
293
+ ensure_suffix,
294
+ escape_html,
295
+ format_string,
296
+ from_base64,
297
+ fuzzy_search,
298
+ get_value,
299
+ has_no_letters,
300
+ js_string,
301
+ kebab_case,
302
+ levenshtein_distance,
303
+ mask,
304
+ normalize_whitespace,
305
+ pad_end,
306
+ pad_start,
307
+ pascal_case,
308
+ random_string,
309
+ random_string_initialization,
310
+ remove_prefix,
311
+ remove_suffix,
312
+ reverse_string,
313
+ sanitize_string,
314
+ slugify,
315
+ snake_case,
316
+ split_by_length,
317
+ string_similarity,
318
+ strip_ansi,
319
+ strip_tags,
320
+ swap_case,
321
+ title_case,
322
+ to_base64,
323
+ to_full_width,
324
+ to_half_width,
325
+ trim_characters,
326
+ trim_end_characters,
327
+ trim_start_characters,
328
+ truncate,
329
+ uncapitalize,
330
+ unescape_html,
331
+ word_count,
332
+ words,
333
+ )
334
+ from .time import (
335
+ convert_time,
336
+ normalize_time_unit,
337
+ )
338
+ from .tool import (
339
+ Pipe,
340
+ Pipeline,
341
+ create_pipeline,
342
+ escape_regexp,
343
+ parse_json,
344
+ pipe,
345
+ unwrap,
346
+ )
347
+ from .ua import (
348
+ extract_browser_from_user_agent,
349
+ extract_device_from_user_agent,
350
+ extract_os_from_user_agent,
351
+ parse_user_agent,
352
+ )
353
+ from .unit import (
354
+ to_celsius,
355
+ to_kelvin,
356
+ unit_converter_initialization,
357
+ )
358
+ from .url import (
359
+ build_url,
360
+ is_absolute_url,
361
+ join_path,
362
+ parse_query_string,
363
+ )
364
+ from .validate import (
365
+ AnyReturnType,
366
+ ArrayOfReturnType,
367
+ BigIntReturnType,
368
+ BigIntRule,
369
+ DateReturnType,
370
+ EmailParts,
371
+ FileReturnType,
372
+ FunctionReturnType,
373
+ FunctionSchema,
374
+ FunctionValidator,
375
+ InstanceOfReturnType,
376
+ IsDeepEqualOptions,
377
+ MapReturnType,
378
+ NeverReturnType,
379
+ NumberReturnType,
380
+ NumberRule,
381
+ ParseEmailLevel,
382
+ ParseEmailOptions,
383
+ ParseEmailResult,
384
+ SetOfReturnType,
385
+ StringReturnType,
386
+ StringRule,
387
+ TemplateLiteralReturnType,
388
+ UnknownReturnType,
389
+ any_validator,
390
+ array_of,
391
+ bigint,
392
+ date,
393
+ file,
394
+ func,
395
+ instance_of,
396
+ is_array,
397
+ is_boolean,
398
+ is_browser,
399
+ is_bun,
400
+ is_deep_equal,
401
+ is_dictionary_object,
402
+ is_equal,
403
+ is_node,
404
+ is_node_webkit,
405
+ is_not_empty,
406
+ is_number,
407
+ is_string,
408
+ is_value_nan,
409
+ map_validator,
410
+ never_validator,
411
+ number,
412
+ parse_email,
413
+ set_of,
414
+ string,
415
+ template_literal,
416
+ unknown_validator,
417
+ )
15
418
 
16
419
  __all__ = [
420
+ "DAY_LIST",
421
+ "DEFAULT_RANDOM_STRING_CHARS",
422
+ "HTML_ESCAPE_MAP",
423
+ "HTML_UNESCAPE_MAP",
424
+ "ONE_DAY_MS",
425
+ "ONE_HOUR_MS",
426
+ "ONE_MINUTE_MS",
427
+ "ONE_MONTH_MS",
428
+ "ONE_MONTH_MS_28",
429
+ "ONE_MONTH_MS_29",
430
+ "ONE_MONTH_MS_31",
431
+ "ONE_SECOND_MS",
432
+ "ONE_WEEK_MS",
433
+ "ONE_YEAR_MS",
434
+ "ONE_YEAR_MS_366",
435
+ "AbortSignal",
436
+ "AnyReturnType",
437
+ "ArrayOfReturnType",
438
+ "BigIntReturnType",
439
+ "BigIntRule",
440
+ "DateReturnType",
441
+ "DebouncedAsyncFunction",
442
+ "DebouncedFunction",
443
+ "Deferred",
444
+ "EmailParts",
445
+ "Error",
446
+ "FileReturnType",
447
+ "Formatter",
448
+ "FunctionReturnType",
449
+ "FunctionSchema",
450
+ "FunctionValidator",
451
+ "FuzzySearchResult",
452
+ "HttpClientErrorStatus",
453
+ "HttpInformationalStatus",
454
+ "HttpRedirectionStatus",
455
+ "HttpServerErrorStatus",
456
+ "HttpStatus",
457
+ "HttpSuccessStatus",
458
+ "InstanceOfReturnType",
459
+ "IsDeepEqualOptions",
460
+ "LRUCache",
461
+ "MapReturnType",
462
+ "MemoizedFunction",
463
+ "NeverReturnType",
464
+ "NumberReturnType",
465
+ "NumberRule",
466
+ "OnceFunction",
467
+ "ParseEmailLevel",
468
+ "ParseEmailOptions",
469
+ "ParseEmailResult",
470
+ "Pipe",
471
+ "Pipeline",
472
+ "PrimeFactor",
473
+ "PriorityQueue",
474
+ "ProbabilityFraction",
475
+ "ReducedFraction",
476
+ "Result",
477
+ "SetOfReturnType",
478
+ "SettledResult",
479
+ "StringReturnType",
480
+ "StringRule",
481
+ "Success",
482
+ "TTLCache",
483
+ "TemplateLiteralReturnType",
484
+ "ThrottledAsyncFunction",
485
+ "ThrottledFunction",
486
+ "UnknownReturnType",
487
+ "ValidatedSortRange",
488
+ "WeightedItem",
489
+ "add_duration",
490
+ "addition",
491
+ "any_validator",
492
+ "apply_formatter",
493
+ "apply_insertion_sort_if_needed",
494
+ "array_of",
495
+ "array_sum",
496
+ "arrays_join",
497
+ "average",
498
+ "bigint",
499
+ "binary_search",
500
+ "birthday",
501
+ "birthday_simple",
502
+ "bitwise",
503
+ "build_url",
504
+ "calculator",
505
+ "calculator_core",
506
+ "calculator_initialization",
507
+ "camel_case",
508
+ "capitalize",
509
+ "capitalize_word",
510
+ "check_flag_alignment",
511
+ "chunk",
512
+ "cidr_to_long",
513
+ "cidr_to_subnet_mask",
514
+ "clamp",
515
+ "cmyk_to_rgba",
516
+ "compact",
517
+ "compare_function_default",
518
+ "constant_case",
519
+ "convert_currency",
520
+ "convert_time",
521
+ "correlation_coefficient",
522
+ "count_occurrences",
523
+ "create_pipeline",
524
+ "curry",
525
+ "date",
526
+ "date_format",
527
+ "date_now",
528
+ "date_range",
529
+ "day_of_week",
530
+ "day_of_week_simple",
531
+ "debounce",
532
+ "debounce_async",
533
+ "deburr",
534
+ "decode_base32",
535
+ "decode_base32_to_string",
536
+ "decode_base58",
537
+ "decode_base58_to_string",
538
+ "dedent",
539
+ "deep_clone",
540
+ "default_formatters",
541
+ "defer",
542
+ "deg_to_rad",
17
543
  "delete_spaces",
544
+ "detect_mode",
545
+ "deviation_value",
546
+ "deviation_value_simple",
547
+ "diff",
548
+ "division",
549
+ "drop",
550
+ "dual_pivot_quick_sort",
551
+ "encode_base32",
552
+ "encode_base58",
553
+ "end_of",
554
+ "ensure_prefix",
555
+ "ensure_suffix",
556
+ "error_function",
557
+ "escape_html",
558
+ "escape_regexp",
559
+ "every",
560
+ "extract_browser_from_user_agent",
561
+ "extract_device_from_user_agent",
562
+ "extract_os_from_user_agent",
563
+ "factorial",
564
+ "factorize",
565
+ "file",
566
+ "first",
567
+ "flat_map_result",
568
+ "flatten_object",
569
+ "flexible_number_conversion",
570
+ "format_number",
571
+ "format_relative",
18
572
  "format_string",
19
573
  "from_base64",
20
- "to_base64",
574
+ "func",
575
+ "fuzzy_search",
576
+ "gcd",
577
+ "generate_number_array",
578
+ "get_arrays_common",
579
+ "get_arrays_diff",
580
+ "get_day",
581
+ "get_decimal_length",
582
+ "get_ip_class",
583
+ "get_network_address",
584
+ "get_objects_common",
585
+ "get_objects_diff",
586
+ "get_timezone_offset_string",
587
+ "get_value",
588
+ "group_by",
589
+ "group_by_to_map",
21
590
  "has_no_letters",
591
+ "hexa_to_rgba",
592
+ "hsla_to_rgba",
593
+ "in_range",
594
+ "insertion_sort",
595
+ "insertion_sort_range",
596
+ "instance_of",
597
+ "invert",
598
+ "ip_to_binary_string",
599
+ "ip_to_long",
600
+ "is_absolute_url",
601
+ "is_array",
602
+ "is_boolean",
603
+ "is_browser",
604
+ "is_bun",
605
+ "is_business_day",
606
+ "is_deep_equal",
607
+ "is_dictionary_object",
608
+ "is_double",
609
+ "is_equal",
610
+ "is_in_range",
611
+ "is_leap_year",
612
+ "is_node",
613
+ "is_node_webkit",
614
+ "is_not_empty",
615
+ "is_not_nullish",
616
+ "is_nullish",
617
+ "is_number",
618
+ "is_perfect_square",
619
+ "is_prime_number",
620
+ "is_private_ip",
621
+ "is_same_day",
622
+ "is_string",
623
+ "is_value_nan",
624
+ "is_weekend",
625
+ "join_path",
626
+ "js_string",
627
+ "kebab_case",
628
+ "key_by",
629
+ "lazy_filter",
630
+ "lazy_map",
631
+ "lazy_take",
632
+ "lcm",
633
+ "levenshtein_distance",
634
+ "linear_congruential_generator",
635
+ "literal_expression",
636
+ "long_to_ip",
637
+ "map_keys",
638
+ "map_result",
639
+ "map_validator",
640
+ "mask",
641
+ "match_result",
642
+ "matches",
643
+ "math_converter",
644
+ "math_separator",
645
+ "max_value",
646
+ "median",
647
+ "memoize",
648
+ "merge_sort",
649
+ "min_value",
650
+ "mode",
651
+ "ms_by_unit",
652
+ "multiples",
653
+ "multiplication",
654
+ "n_cr",
655
+ "n_hr",
656
+ "n_pr",
657
+ "never_validator",
658
+ "new_date_int",
659
+ "new_date_string",
660
+ "normalize_time_unit",
661
+ "normalize_whitespace",
662
+ "not_",
663
+ "now_simple",
664
+ "number",
665
+ "object_get",
666
+ "object_has",
667
+ "object_is_empty",
668
+ "object_is_plain",
669
+ "object_key_by",
670
+ "object_map_values",
671
+ "object_merge",
672
+ "object_merge_deep",
673
+ "object_omit",
674
+ "object_pick",
675
+ "object_pick_deep",
676
+ "object_set",
677
+ "omit_by",
678
+ "once",
679
+ "p_settled",
22
680
  "pad_end",
23
681
  "pad_start",
682
+ "parallel",
683
+ "parse_email",
684
+ "parse_json",
685
+ "parse_query_string",
686
+ "parse_user_agent",
687
+ "pascal_case",
688
+ "path_segments",
689
+ "percentile",
690
+ "pick_by",
691
+ "pipe",
692
+ "pop",
693
+ "prime_factorization",
694
+ "quick_sort",
695
+ "quotient",
696
+ "rad_to_deg",
697
+ "random_boolean",
698
+ "random_choice",
699
+ "random_float",
700
+ "random_int",
701
+ "random_select",
24
702
  "random_string",
25
- "DEFAULT_RANDOM_STRING_CHARS",
26
703
  "random_string_initialization",
704
+ "random_uuid",
705
+ "range_advance",
706
+ "range_array",
707
+ "reduce_fraction",
708
+ "remove_prefix",
709
+ "remove_prototype",
710
+ "remove_prototype_deep",
711
+ "remove_prototype_map",
712
+ "remove_prototype_map_deep",
713
+ "remove_suffix",
714
+ "repeated_trial",
715
+ "retry",
27
716
  "reverse_string",
717
+ "rgba_to_cmyk",
718
+ "rgba_to_hexa",
719
+ "rgba_to_hsla",
720
+ "round_of",
721
+ "safe_execute",
722
+ "sanitize_string",
723
+ "seeded_random",
724
+ "set_of",
725
+ "shuffle",
726
+ "shuffle_2d_array",
727
+ "sleep",
728
+ "slugify",
729
+ "snake_case",
730
+ "solve_equation",
731
+ "some",
732
+ "split_by_length",
733
+ "standard_deviation",
734
+ "start_of",
735
+ "string",
736
+ "string_similarity",
737
+ "strip_ansi",
738
+ "strip_tags",
739
+ "sub_duration",
740
+ "subnet_mask_to_cidr",
741
+ "subtraction",
742
+ "success_function",
743
+ "sum_precise",
744
+ "swap_case",
745
+ "template_literal",
746
+ "throttle",
747
+ "throttle_async",
748
+ "tim_sort",
749
+ "timeout",
750
+ "title_case",
751
+ "to_base64",
752
+ "to_base_n",
753
+ "to_celsius",
754
+ "to_full_width",
28
755
  "to_half_width",
756
+ "to_kelvin",
757
+ "to_ordinal",
758
+ "to_percentage",
29
759
  "trim_characters",
30
760
  "trim_end_characters",
31
761
  "trim_start_characters",
762
+ "truncate",
763
+ "ultra_number_sort",
764
+ "uncapitalize",
765
+ "unescape_html",
766
+ "unflatten_object",
767
+ "uniq_by",
768
+ "unique",
769
+ "unit_converter_initialization",
770
+ "unknown_validator",
771
+ "unwrap",
772
+ "uuidv7",
773
+ "validate_range",
774
+ "value_swap",
775
+ "wait_for",
776
+ "weighted_choice",
777
+ "word_count",
778
+ "words",
779
+ "xoshiro256",
780
+ "zip_arrays",
781
+ "zip_longest",
782
+ "zip_to_map",
32
783
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: umt_python
3
- Version: 0.1.1
3
+ Version: 0.3.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
@@ -100,6 +101,14 @@ print(encoded) # "SGVsbG8gV29ybGQ="
100
101
  |----------|------|-------------|---------|
101
102
  | `has_no_letters` | `(text: str) -> bool` | Check if string contains no letters (only numbers, emojis, special chars) | `has_no_letters("123!@#") # True` / `has_no_letters("abc123") # False` |
102
103
 
104
+ ### Number Functions
105
+
106
+ | Function | Type | Description | Example |
107
+ |----------|------|-------------|---------|
108
+ | `format_number` | `(value: float \| int, *, locale: str \| None = None, minimum_fraction_digits: int \| None = None, maximum_fraction_digits: int \| None = None, style: Literal["decimal", "currency", "percent"] = "decimal", currency: str \| None = None) -> str` | Format a number with locale-aware separators, fraction-digit controls, and decimal/percent/currency styles. Mirrors `Intl.NumberFormat` from the TypeScript source. | `format_number(1234567.89) # "1,234,567.89"` / `format_number(1234567.89, locale="de-DE") # "1.234.567,89"` / `format_number(0.75, style="percent") # "75%"` / `format_number(1234.5, style="currency", currency="USD") # "$1,234.50"` |
109
+ | `to_ordinal` | `(value: int \| float) -> str` | Convert a number to its English ordinal string (handles 11th/12th/13th specially) | `to_ordinal(1) # "1st"` / `to_ordinal(11) # "11th"` / `to_ordinal(21) # "21st"` |
110
+ | `to_percentage` | `(value: float \| int, total: float \| int, decimals: int = 2) -> float` | Calculate the percentage of a value relative to a total (returns 0 when total is 0) | `to_percentage(1, 3) # 33.33` / `to_percentage(25, 100) # 25.0` |
111
+
103
112
  ## Constants
104
113
 
105
114
  - `DEFAULT_RANDOM_STRING_CHARS`: Default character pool for random string generation (ASCII letters + digits)
@@ -0,0 +1,6 @@
1
+ umt_python/__init__.py,sha256=lcmwS1o0vPesYxupEqby95gns077efahhdPGRGqRORo,14814
2
+ umt_python-0.3.0.dist-info/licenses/LICENSE,sha256=1sfH4YyDPcU1Flbmf9AwxZHlsxt0bMsoU7TpSvVPaTo,1069
3
+ umt_python-0.3.0.dist-info/METADATA,sha256=G6w-830tLthwlRja8aFKsW-7kBs0LTMEg50LW7Mm89Y,6412
4
+ umt_python-0.3.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ umt_python-0.3.0.dist-info/top_level.txt,sha256=JMzQArGg6QV0n-BiGlvfXempE7t93p2i0-2bH3XUkEk,11
6
+ umt_python-0.3.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.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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)
umt_python/from_base64.py DELETED
@@ -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
@@ -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
umt_python/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
umt_python/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_
@@ -1,31 +0,0 @@
1
- import random
2
- import string
3
-
4
- DEFAULT_RANDOM_STRING_CHARS = string.ascii_letters + string.digits
5
-
6
-
7
- def random_string(size: int = 8, char_pool: str = DEFAULT_RANDOM_STRING_CHARS) -> str:
8
- """
9
- Generates a random string.
10
-
11
- Args:
12
- size: Length of the random string. Defaults to 8.
13
- char_pool: String of characters to use for generating random string.
14
- Defaults to alphanumeric characters.
15
-
16
- Returns:
17
- Random string.
18
-
19
- Example:
20
- >>> len(random_string()) == 8
21
- True
22
- >>> len(random_string(10)) == 10
23
- True
24
- >>> all(c in 'abc' for c in random_string(5, 'abc'))
25
- True
26
- """
27
- if size == 0:
28
- return ""
29
- # When char_pool is empty and size > 0, random.choice will raise IndexError.
30
- # This is the expected behavior for the tests.
31
- 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)
@@ -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]
umt_python/to_base64.py DELETED
@@ -1,18 +0,0 @@
1
- import base64
2
-
3
-
4
- def to_base64(char: str) -> str:
5
- """
6
- Convert string to Base64.
7
-
8
- Args:
9
- char: String to convert to Base64.
10
-
11
- Returns:
12
- Base64 encoded string.
13
-
14
- Example:
15
- >>> to_base64("Hello World")
16
- 'SGVsbG8gV29ybGQ='
17
- """
18
- return base64.b64encode(char.encode("utf-8")).decode("utf-8")
@@ -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)
@@ -1,22 +0,0 @@
1
- from .trim_start_characters import trim_start_characters
2
- from .trim_end_characters import trim_end_characters
3
-
4
-
5
- def trim_characters(string_: str, chars: str) -> str:
6
- """
7
- Removes specified characters from both ends of a string.
8
-
9
- Args:
10
- string_: The string to trim.
11
- chars: The set of characters to remove.
12
-
13
- Returns:
14
- A new string with specified characters removed from both ends.
15
-
16
- Example:
17
- >>> trim_characters("-.-hello-.-", "-.")
18
- 'hello'
19
- >>> trim_characters("123abc123", "123")
20
- 'abc'
21
- """
22
- return trim_end_characters(trim_start_characters(string_, chars), chars)
@@ -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]
@@ -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
- umt_python/__init__.py,sha256=VZz3TwQJokyFAjRLAkeQzTrmLIaax-uyc6sj_ZKHV4g,998
2
- umt_python/delete_spaces.py,sha256=XuKvz33T9dSjlSF7YUbuNnGLVYQfs4oBIqoF8-v0c74,410
3
- umt_python/format_string.py,sha256=QOAZWNZUkyS_H4h98S5NGjHbSoU61CN4IxKkzNnZ_sg,1050
4
- umt_python/from_base64.py,sha256=ZWEFG3DpO4FL7CsBSa_xUyLbeo68JBgnQi-hr5X9g9o,627
5
- umt_python/has_no_letters.py,sha256=U8hZMbwYMJzn07rljZiAIhndaUqhgZWKCocSwVmnZ9w,540
6
- umt_python/pad_end.py,sha256=CIpIQeR3O0RmVFv_VBftzk7sOLSNtIgBe8ZH05jPkeA,917
7
- umt_python/pad_start.py,sha256=0tuZ9lLXKwQNOVck6Ov_ZlwOgttY4F5DqS0pIGLCeUs,987
8
- umt_python/random_string.py,sha256=gG6m7MdcnIDSfyCcqIYKulux3QRxYeMZrMNZRnwhpGk,898
9
- umt_python/random_string_initialization.py,sha256=sRIHuTFTQJXZCM4Y24nN4SuTd26M1tN_R01ZMAXTA4A,1151
10
- umt_python/reverse_string.py,sha256=zd5BrBeYy1PaglWnJMSDbZ7an2Ok2II4rORayZ2sGz4,300
11
- umt_python/to_base64.py,sha256=nGWR2anOAwkOQyjXCdD5mZbahHjG_469s8nWzFgyU7c,338
12
- umt_python/to_half_width.py,sha256=o6M0ChY5fpJo97ogoiroq9fkfohqxn5yuxhdqOn9Qvs,1252
13
- umt_python/trim_characters.py,sha256=dU_G-PZKvM09eRQVjCJ--2rHmaetGHdj-jLcmjyXi60,642
14
- umt_python/trim_end_characters.py,sha256=Cnr-tyjqoKB-hqIDV5PI0x1p2CleIyOGcIZ62hkwLMI,670
15
- umt_python/trim_start_characters.py,sha256=TcGa9T3ArIIxguvYf8I2EJ1AUUN3AzYk1Y-0YYprBk8,690
16
- umt_python-0.1.1.dist-info/licenses/LICENSE,sha256=1sfH4YyDPcU1Flbmf9AwxZHlsxt0bMsoU7TpSvVPaTo,1069
17
- umt_python-0.1.1.dist-info/METADATA,sha256=J7pGHZbxPbQYsiBxrA43rTZIjwSPloslE7xAThE7_sA,5111
18
- umt_python-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- umt_python-0.1.1.dist-info/top_level.txt,sha256=JMzQArGg6QV0n-BiGlvfXempE7t93p2i0-2bH3XUkEk,11
20
- umt_python-0.1.1.dist-info/RECORD,,