orionis 0.717.0__py3-none-any.whl → 0.719.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.
- orionis/metadata/framework.py +1 -1
- orionis/support/types/stringable.py +37 -380
- {orionis-0.717.0.dist-info → orionis-0.719.0.dist-info}/METADATA +1 -1
- {orionis-0.717.0.dist-info → orionis-0.719.0.dist-info}/RECORD +7 -7
- {orionis-0.717.0.dist-info → orionis-0.719.0.dist-info}/WHEEL +0 -0
- {orionis-0.717.0.dist-info → orionis-0.719.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.717.0.dist-info → orionis-0.719.0.dist-info}/top_level.txt +0 -0
orionis/metadata/framework.py
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import re
|
|
2
1
|
import base64
|
|
3
|
-
import json
|
|
4
2
|
import hashlib
|
|
3
|
+
import html
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
import unicodedata
|
|
5
8
|
import urllib.parse
|
|
6
9
|
import uuid
|
|
7
|
-
import os
|
|
8
|
-
import html
|
|
9
|
-
import textwrap
|
|
10
|
-
import functools
|
|
11
10
|
from datetime import datetime
|
|
12
|
-
from typing import Any, Callable,
|
|
13
|
-
import unicodedata
|
|
11
|
+
from typing import Any, Callable, Dict, Iterable, List, Optional, Union
|
|
14
12
|
|
|
15
13
|
class Stringable(str):
|
|
16
14
|
|
|
@@ -203,31 +201,6 @@ class Stringable(str):
|
|
|
203
201
|
# Check if string ends with any of the provided needles
|
|
204
202
|
return any(str(self).endswith(needle) for needle in needles)
|
|
205
203
|
|
|
206
|
-
# Alias for backwards compatibility
|
|
207
|
-
def ends_with(self, needles: Union[str, Iterable[str]]) -> bool:
|
|
208
|
-
"""
|
|
209
|
-
Alias for endsWith method to maintain backwards compatibility.
|
|
210
|
-
|
|
211
|
-
Checks if the string ends with any of the given substrings.
|
|
212
|
-
|
|
213
|
-
Parameters
|
|
214
|
-
----------
|
|
215
|
-
needles : str or Iterable[str]
|
|
216
|
-
Substring or substrings to check at the end of the string.
|
|
217
|
-
|
|
218
|
-
Returns
|
|
219
|
-
-------
|
|
220
|
-
bool
|
|
221
|
-
True if the string ends with any of the needle values, False otherwise.
|
|
222
|
-
"""
|
|
223
|
-
|
|
224
|
-
# Convert single string to list for uniform processing
|
|
225
|
-
if isinstance(needles, str):
|
|
226
|
-
needles = [needles]
|
|
227
|
-
|
|
228
|
-
# Check if string ends with any of the provided needles
|
|
229
|
-
return any(str(self).endswith(needle) for needle in needles)
|
|
230
|
-
|
|
231
204
|
def exactly(self, value: Any) -> bool:
|
|
232
205
|
"""
|
|
233
206
|
Check if the string is exactly equal to a given value.
|
|
@@ -278,33 +251,6 @@ class Stringable(str):
|
|
|
278
251
|
# Return True if the string has one or more characters
|
|
279
252
|
return not self.isEmpty()
|
|
280
253
|
|
|
281
|
-
# Aliases for backwards compatibility
|
|
282
|
-
def is_empty(self) -> bool:
|
|
283
|
-
"""
|
|
284
|
-
Alias for isEmpty method to maintain backwards compatibility.
|
|
285
|
-
|
|
286
|
-
Returns
|
|
287
|
-
-------
|
|
288
|
-
bool
|
|
289
|
-
True if the string is empty, False otherwise.
|
|
290
|
-
"""
|
|
291
|
-
|
|
292
|
-
# Call the camelCase method for compatibility
|
|
293
|
-
return self.isEmpty()
|
|
294
|
-
|
|
295
|
-
def is_not_empty(self) -> bool:
|
|
296
|
-
"""
|
|
297
|
-
Alias for isNotEmpty method to maintain backwards compatibility.
|
|
298
|
-
|
|
299
|
-
Returns
|
|
300
|
-
-------
|
|
301
|
-
bool
|
|
302
|
-
True if the string is not empty, False otherwise.
|
|
303
|
-
"""
|
|
304
|
-
|
|
305
|
-
# Call the camelCase method for compatibility
|
|
306
|
-
return self.isNotEmpty()
|
|
307
|
-
|
|
308
254
|
def lower(self) -> "Stringable":
|
|
309
255
|
"""
|
|
310
256
|
Convert the string to lowercase.
|
|
@@ -425,20 +371,6 @@ class Stringable(str):
|
|
|
425
371
|
else:
|
|
426
372
|
return Stringable(re.sub(r'<[^>]*>', '', str(self)))
|
|
427
373
|
|
|
428
|
-
# Alias for backwards compatibility
|
|
429
|
-
def strip_tags(self) -> "Stringable":
|
|
430
|
-
"""
|
|
431
|
-
Alias for stripTags method to maintain backwards compatibility.
|
|
432
|
-
|
|
433
|
-
Returns
|
|
434
|
-
-------
|
|
435
|
-
Stringable
|
|
436
|
-
New Stringable with HTML/PHP tags removed.
|
|
437
|
-
"""
|
|
438
|
-
|
|
439
|
-
# Call the camelCase method for compatibility
|
|
440
|
-
return self.stripTags()
|
|
441
|
-
|
|
442
374
|
def toBase64(self) -> "Stringable":
|
|
443
375
|
"""
|
|
444
376
|
Encode the string to Base64.
|
|
@@ -600,95 +532,6 @@ class Stringable(str):
|
|
|
600
532
|
# Check for common truthy values
|
|
601
533
|
return str(self).strip().lower() in ("1", "true", "on", "yes")
|
|
602
534
|
|
|
603
|
-
# Aliases for backwards compatibility
|
|
604
|
-
def to_base64(self) -> "Stringable":
|
|
605
|
-
"""
|
|
606
|
-
Alias for toBase64 method to maintain backwards compatibility.
|
|
607
|
-
|
|
608
|
-
Returns
|
|
609
|
-
-------
|
|
610
|
-
Stringable
|
|
611
|
-
New Stringable with base64 encoded content.
|
|
612
|
-
"""
|
|
613
|
-
|
|
614
|
-
# Call the camelCase method for compatibility
|
|
615
|
-
return self.toBase64()
|
|
616
|
-
|
|
617
|
-
def from_base64(self, strict: bool = False) -> "Stringable":
|
|
618
|
-
"""
|
|
619
|
-
Alias for fromBase64 method to maintain backwards compatibility.
|
|
620
|
-
|
|
621
|
-
Parameters
|
|
622
|
-
----------
|
|
623
|
-
strict : bool, optional
|
|
624
|
-
If True, raise exception on decode errors. Default is False.
|
|
625
|
-
|
|
626
|
-
Returns
|
|
627
|
-
-------
|
|
628
|
-
Stringable
|
|
629
|
-
New Stringable with base64 decoded content.
|
|
630
|
-
"""
|
|
631
|
-
|
|
632
|
-
# Call the camelCase method for compatibility
|
|
633
|
-
return self.fromBase64(strict)
|
|
634
|
-
|
|
635
|
-
def to_string(self) -> str:
|
|
636
|
-
"""
|
|
637
|
-
Alias for toString method to maintain backwards compatibility.
|
|
638
|
-
|
|
639
|
-
Returns
|
|
640
|
-
-------
|
|
641
|
-
str
|
|
642
|
-
String representation.
|
|
643
|
-
"""
|
|
644
|
-
|
|
645
|
-
# Call the camelCase method for compatibility
|
|
646
|
-
return self.toString()
|
|
647
|
-
|
|
648
|
-
def to_integer(self, base: int = 10) -> int:
|
|
649
|
-
"""
|
|
650
|
-
Alias for toInteger method to maintain backwards compatibility.
|
|
651
|
-
|
|
652
|
-
Parameters
|
|
653
|
-
----------
|
|
654
|
-
base : int, optional
|
|
655
|
-
Base for conversion. Default is 10.
|
|
656
|
-
|
|
657
|
-
Returns
|
|
658
|
-
-------
|
|
659
|
-
int
|
|
660
|
-
Integer representation.
|
|
661
|
-
"""
|
|
662
|
-
|
|
663
|
-
# Call the camelCase method for compatibility
|
|
664
|
-
return self.toInteger(base)
|
|
665
|
-
|
|
666
|
-
def to_float(self) -> float:
|
|
667
|
-
"""
|
|
668
|
-
Alias for toFloat method to maintain backwards compatibility.
|
|
669
|
-
|
|
670
|
-
Returns
|
|
671
|
-
-------
|
|
672
|
-
float
|
|
673
|
-
Float representation.
|
|
674
|
-
"""
|
|
675
|
-
|
|
676
|
-
# Call the camelCase method for compatibility
|
|
677
|
-
return self.toFloat()
|
|
678
|
-
|
|
679
|
-
def to_boolean(self) -> bool:
|
|
680
|
-
"""
|
|
681
|
-
Alias for toBoolean method to maintain backwards compatibility.
|
|
682
|
-
|
|
683
|
-
Returns
|
|
684
|
-
-------
|
|
685
|
-
bool
|
|
686
|
-
Boolean representation.
|
|
687
|
-
"""
|
|
688
|
-
|
|
689
|
-
# Call the camelCase method for compatibility
|
|
690
|
-
return self.toBoolean()
|
|
691
|
-
|
|
692
535
|
def __getitem__(self, key):
|
|
693
536
|
"""
|
|
694
537
|
Get item by index or slice.
|
|
@@ -720,7 +563,6 @@ class Stringable(str):
|
|
|
720
563
|
# Return the string representation
|
|
721
564
|
return super().__str__()
|
|
722
565
|
|
|
723
|
-
# camelCase wrappers for native Python string methods that use snake_case
|
|
724
566
|
def isAlnum(self) -> bool:
|
|
725
567
|
"""
|
|
726
568
|
Check if all characters in the string are alphanumeric.
|
|
@@ -943,7 +785,6 @@ class Stringable(str):
|
|
|
943
785
|
# Use Python's built-in zfill to pad with zeros while preserving sign
|
|
944
786
|
return Stringable(str(self).zfill(width))
|
|
945
787
|
|
|
946
|
-
# Text conversion methods
|
|
947
788
|
def ascii(self, language: str = 'en') -> "Stringable":
|
|
948
789
|
"""
|
|
949
790
|
Transliterate a UTF-8 value to ASCII.
|
|
@@ -1043,7 +884,7 @@ class Stringable(str):
|
|
|
1043
884
|
"""
|
|
1044
885
|
return self.studly()
|
|
1045
886
|
|
|
1046
|
-
def slug(self, separator: str = '-',
|
|
887
|
+
def slug(self, separator: str = '-', dictionary: Optional[Dict[str, str]] = None) -> "Stringable":
|
|
1047
888
|
"""
|
|
1048
889
|
Generate a URL friendly "slug" from a given string.
|
|
1049
890
|
|
|
@@ -1051,8 +892,6 @@ class Stringable(str):
|
|
|
1051
892
|
----------
|
|
1052
893
|
separator : str, optional
|
|
1053
894
|
The separator to use, by default '-'
|
|
1054
|
-
language : str, optional
|
|
1055
|
-
The language for transliteration, by default 'en'
|
|
1056
895
|
dictionary : dict, optional
|
|
1057
896
|
Dictionary for character replacements, by default {'@': 'at'}
|
|
1058
897
|
|
|
@@ -1165,7 +1004,6 @@ class Stringable(str):
|
|
|
1165
1004
|
return Stringable(self)
|
|
1166
1005
|
return Stringable(self[0].lower() + self[1:])
|
|
1167
1006
|
|
|
1168
|
-
# Validation methods
|
|
1169
1007
|
def isAscii(self) -> bool:
|
|
1170
1008
|
"""
|
|
1171
1009
|
Determine if a given string is 7 bit ASCII.
|
|
@@ -1260,7 +1098,6 @@ class Stringable(str):
|
|
|
1260
1098
|
ulid_pattern = r'^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$'
|
|
1261
1099
|
return bool(re.match(ulid_pattern, str(self).upper()))
|
|
1262
1100
|
|
|
1263
|
-
# String manipulation methods
|
|
1264
1101
|
def chopStart(self, needle: Union[str, List[str]]) -> "Stringable":
|
|
1265
1102
|
"""
|
|
1266
1103
|
Remove the given string if it exists at the start of the current string.
|
|
@@ -1328,7 +1165,7 @@ class Stringable(str):
|
|
|
1328
1165
|
pattern = re.escape(character) + '+'
|
|
1329
1166
|
return Stringable(re.sub(pattern, character, str(self)))
|
|
1330
1167
|
|
|
1331
|
-
def mask(self, character: str, index: int, length: Optional[int] = None
|
|
1168
|
+
def mask(self, character: str, index: int, length: Optional[int] = None) -> "Stringable":
|
|
1332
1169
|
"""
|
|
1333
1170
|
Masks a portion of a string with a repeated character.
|
|
1334
1171
|
|
|
@@ -1340,8 +1177,6 @@ class Stringable(str):
|
|
|
1340
1177
|
Starting index for masking
|
|
1341
1178
|
length : int, optional
|
|
1342
1179
|
Length to mask, by default None (to end of string)
|
|
1343
|
-
encoding : str, optional
|
|
1344
|
-
String encoding, by default 'UTF-8'
|
|
1345
1180
|
|
|
1346
1181
|
Returns
|
|
1347
1182
|
-------
|
|
@@ -1524,7 +1359,6 @@ class Stringable(str):
|
|
|
1524
1359
|
"""
|
|
1525
1360
|
return Stringable(str(self).rstrip(characters))
|
|
1526
1361
|
|
|
1527
|
-
# Search and positioning methods
|
|
1528
1362
|
def charAt(self, index: int) -> Union[str, bool]:
|
|
1529
1363
|
"""
|
|
1530
1364
|
Get the character at the specified index.
|
|
@@ -1690,7 +1524,6 @@ class Stringable(str):
|
|
|
1690
1524
|
|
|
1691
1525
|
return excerpt
|
|
1692
1526
|
|
|
1693
|
-
# Text and file methods
|
|
1694
1527
|
def basename(self, suffix: str = '') -> "Stringable":
|
|
1695
1528
|
"""
|
|
1696
1529
|
Get the trailing name component of the path.
|
|
@@ -1833,7 +1666,6 @@ class Stringable(str):
|
|
|
1833
1666
|
s = prefix + s
|
|
1834
1667
|
return Stringable(s)
|
|
1835
1668
|
|
|
1836
|
-
# Array and split methods
|
|
1837
1669
|
def explode(self, delimiter: str, limit: int = -1) -> List[str]:
|
|
1838
1670
|
"""
|
|
1839
1671
|
Explode the string into a list using a delimiter.
|
|
@@ -1871,7 +1703,7 @@ class Stringable(str):
|
|
|
1871
1703
|
pattern : str or int
|
|
1872
1704
|
Regular expression pattern or length for splitting
|
|
1873
1705
|
limit : int, optional
|
|
1874
|
-
Maximum splits, by default -1
|
|
1706
|
+
Maximum splits, by default -1 (no limit)
|
|
1875
1707
|
flags : int, optional
|
|
1876
1708
|
Regex flags, by default 0
|
|
1877
1709
|
|
|
@@ -1886,7 +1718,9 @@ class Stringable(str):
|
|
|
1886
1718
|
return [s[i:i+pattern] for i in range(0, len(s), pattern)]
|
|
1887
1719
|
else:
|
|
1888
1720
|
# Split by regex
|
|
1889
|
-
|
|
1721
|
+
# In re.split, maxsplit=0 means no limit, -1 means no splits
|
|
1722
|
+
maxsplit = 0 if limit == -1 else limit
|
|
1723
|
+
segments = re.split(pattern, str(self), maxsplit=maxsplit, flags=flags)
|
|
1890
1724
|
return segments if segments else []
|
|
1891
1725
|
|
|
1892
1726
|
def ucsplit(self) -> List[str]:
|
|
@@ -2302,24 +2136,24 @@ class Stringable(str):
|
|
|
2302
2136
|
s = str(self)
|
|
2303
2137
|
if len(s) == 0:
|
|
2304
2138
|
return Stringable(s)
|
|
2305
|
-
|
|
2139
|
+
|
|
2306
2140
|
# Split by uppercase letters to find words
|
|
2307
2141
|
words = re.findall(r'[A-Z][a-z]*|[a-z]+', s)
|
|
2308
2142
|
if not words:
|
|
2309
2143
|
return Stringable(s)
|
|
2310
|
-
|
|
2144
|
+
|
|
2311
2145
|
# Determine if we need plural
|
|
2312
2146
|
if isinstance(count, (list, tuple)):
|
|
2313
2147
|
need_plural = len(count) != 1
|
|
2314
2148
|
else:
|
|
2315
2149
|
need_plural = count != 1
|
|
2316
|
-
|
|
2150
|
+
|
|
2317
2151
|
if need_plural:
|
|
2318
2152
|
# Pluralize the last word
|
|
2319
2153
|
last_word = words[-1]
|
|
2320
2154
|
pluralized = Stringable(last_word).plural(count)
|
|
2321
2155
|
words[-1] = pluralized.studly().value()
|
|
2322
|
-
|
|
2156
|
+
|
|
2323
2157
|
return Stringable(''.join(words))
|
|
2324
2158
|
|
|
2325
2159
|
def singular(self) -> "Stringable":
|
|
@@ -2378,7 +2212,6 @@ class Stringable(str):
|
|
|
2378
2212
|
else:
|
|
2379
2213
|
return [callback_str, default]
|
|
2380
2214
|
|
|
2381
|
-
# Conditional methods (when)
|
|
2382
2215
|
def when(self, condition: Union[bool, Callable], callback: Callable, default: Optional[Callable] = None) -> "Stringable":
|
|
2383
2216
|
"""
|
|
2384
2217
|
Execute the given callback if condition is true.
|
|
@@ -2506,7 +2339,7 @@ class Stringable(str):
|
|
|
2506
2339
|
Stringable
|
|
2507
2340
|
Result of callback execution or self
|
|
2508
2341
|
"""
|
|
2509
|
-
return self.when(self.
|
|
2342
|
+
return self.when(self.endsWith(needles), callback, default)
|
|
2510
2343
|
|
|
2511
2344
|
def whenDoesntEndWith(self, needles: Union[str, List[str]], callback: Callable, default: Optional[Callable] = None) -> "Stringable":
|
|
2512
2345
|
"""
|
|
@@ -2526,7 +2359,7 @@ class Stringable(str):
|
|
|
2526
2359
|
Stringable
|
|
2527
2360
|
Result of callback execution or self
|
|
2528
2361
|
"""
|
|
2529
|
-
return self.when(not self.
|
|
2362
|
+
return self.when(not self.endsWith(needles), callback, default)
|
|
2530
2363
|
|
|
2531
2364
|
def whenExactly(self, value: str, callback: Callable, default: Optional[Callable] = None) -> "Stringable":
|
|
2532
2365
|
"""
|
|
@@ -2634,18 +2467,19 @@ class Stringable(str):
|
|
|
2634
2467
|
"""
|
|
2635
2468
|
return self.when(self.test(pattern), callback, default)
|
|
2636
2469
|
|
|
2637
|
-
|
|
2638
|
-
def convertCase(self, mode: int = None, encoding: Optional[str] = 'UTF-8') -> "Stringable":
|
|
2470
|
+
def convertCase(self, mode: int = None) -> "Stringable":
|
|
2639
2471
|
"""
|
|
2640
2472
|
Convert the case of a string.
|
|
2641
2473
|
|
|
2642
2474
|
Parameters
|
|
2643
2475
|
----------
|
|
2644
2476
|
mode : int, optional
|
|
2645
|
-
Case conversion mode
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2477
|
+
Case conversion mode:
|
|
2478
|
+
0 or None - MB_CASE_FOLD (casefold)
|
|
2479
|
+
1 - MB_CASE_UPPER (upper)
|
|
2480
|
+
2 - MB_CASE_LOWER (lower)
|
|
2481
|
+
3 - MB_CASE_TITLE (title)
|
|
2482
|
+
by default None (MB_CASE_FOLD)
|
|
2649
2483
|
Returns
|
|
2650
2484
|
-------
|
|
2651
2485
|
Stringable
|
|
@@ -2860,7 +2694,6 @@ class Stringable(str):
|
|
|
2860
2694
|
matches = re.findall(pattern, str(self))
|
|
2861
2695
|
return list(matches[0]) if matches else []
|
|
2862
2696
|
|
|
2863
|
-
# Additional methods for compatibility
|
|
2864
2697
|
def prepend(self, *values: str) -> "Stringable":
|
|
2865
2698
|
"""
|
|
2866
2699
|
Prepend the given values to the string.
|
|
@@ -2877,7 +2710,7 @@ class Stringable(str):
|
|
|
2877
2710
|
"""
|
|
2878
2711
|
return Stringable(''.join(values) + str(self))
|
|
2879
2712
|
|
|
2880
|
-
def substr(self, start: int, length: Optional[int] = None
|
|
2713
|
+
def substr(self, start: int, length: Optional[int] = None) -> "Stringable":
|
|
2881
2714
|
"""
|
|
2882
2715
|
Returns the portion of the string specified by the start and length parameters.
|
|
2883
2716
|
|
|
@@ -2887,8 +2720,6 @@ class Stringable(str):
|
|
|
2887
2720
|
Starting position
|
|
2888
2721
|
length : int, optional
|
|
2889
2722
|
Length to extract, by default None
|
|
2890
|
-
encoding : str, optional
|
|
2891
|
-
String encoding (for compatibility), by default 'UTF-8'
|
|
2892
2723
|
|
|
2893
2724
|
Returns
|
|
2894
2725
|
-------
|
|
@@ -2901,7 +2732,6 @@ class Stringable(str):
|
|
|
2901
2732
|
else:
|
|
2902
2733
|
return Stringable(s[start:start + length])
|
|
2903
2734
|
|
|
2904
|
-
# Additional compatibility methods
|
|
2905
2735
|
def doesntContain(self, needles: Union[str, List[str]], ignore_case: bool = False) -> bool:
|
|
2906
2736
|
"""
|
|
2907
2737
|
Determine if a given string doesn't contain a given substring.
|
|
@@ -2952,7 +2782,7 @@ class Stringable(str):
|
|
|
2952
2782
|
bool
|
|
2953
2783
|
True if string doesn't end with any needle, False otherwise
|
|
2954
2784
|
"""
|
|
2955
|
-
return not self.
|
|
2785
|
+
return not self.endsWith(needles)
|
|
2956
2786
|
|
|
2957
2787
|
def startsWith(self, needles: Union[str, List[str]]) -> bool:
|
|
2958
2788
|
"""
|
|
@@ -2972,7 +2802,6 @@ class Stringable(str):
|
|
|
2972
2802
|
needles = [needles]
|
|
2973
2803
|
return any(str(self).startswith(needle) for needle in needles)
|
|
2974
2804
|
|
|
2975
|
-
# Methods for array-like behavior and JSON serialization
|
|
2976
2805
|
def jsonSerialize(self) -> str:
|
|
2977
2806
|
"""
|
|
2978
2807
|
Convert the object to a string when JSON encoded.
|
|
@@ -3020,55 +2849,6 @@ class Stringable(str):
|
|
|
3020
2849
|
"""
|
|
3021
2850
|
return str(self)[offset]
|
|
3022
2851
|
|
|
3023
|
-
def offsetSet(self, offset: int, value: str) -> None:
|
|
3024
|
-
"""
|
|
3025
|
-
Set the value at the given offset.
|
|
3026
|
-
|
|
3027
|
-
Note: Strings are immutable in Python, so this method exists primarily
|
|
3028
|
-
for interface compatibility and cannot actually modify the string in place.
|
|
3029
|
-
|
|
3030
|
-
Parameters
|
|
3031
|
-
----------
|
|
3032
|
-
offset : int
|
|
3033
|
-
The offset position to set.
|
|
3034
|
-
value : str
|
|
3035
|
-
The value to set at the specified offset.
|
|
3036
|
-
|
|
3037
|
-
Returns
|
|
3038
|
-
-------
|
|
3039
|
-
None
|
|
3040
|
-
This method does not return a value due to string immutability.
|
|
3041
|
-
"""
|
|
3042
|
-
|
|
3043
|
-
# Since strings are immutable, we can't actually modify in place
|
|
3044
|
-
# This method exists for interface compatibility but doesn't modify self
|
|
3045
|
-
s = list(str(self))
|
|
3046
|
-
s[offset] = value
|
|
3047
|
-
# Note: This doesn't actually modify self due to immutability
|
|
3048
|
-
|
|
3049
|
-
def offsetUnset(self, offset: int) -> None:
|
|
3050
|
-
"""
|
|
3051
|
-
Unset the value at the given offset.
|
|
3052
|
-
|
|
3053
|
-
Note: Strings are immutable in Python, so this method exists primarily
|
|
3054
|
-
for interface compatibility and cannot actually remove characters in place.
|
|
3055
|
-
|
|
3056
|
-
Parameters
|
|
3057
|
-
----------
|
|
3058
|
-
offset : int
|
|
3059
|
-
The offset position to unset.
|
|
3060
|
-
|
|
3061
|
-
Returns
|
|
3062
|
-
-------
|
|
3063
|
-
None
|
|
3064
|
-
This method does not return a value due to string immutability.
|
|
3065
|
-
"""
|
|
3066
|
-
|
|
3067
|
-
# Since strings are immutable, we can't actually modify in place
|
|
3068
|
-
# This method exists for interface compatibility but doesn't modify self
|
|
3069
|
-
pass
|
|
3070
|
-
|
|
3071
|
-
# Additional Laravel methods that might be missing
|
|
3072
2852
|
def isPattern(self, pattern: Union[str, List[str]], ignore_case: bool = False) -> bool:
|
|
3073
2853
|
"""
|
|
3074
2854
|
Determine if a given string matches a given pattern.
|
|
@@ -3131,72 +2911,6 @@ class Stringable(str):
|
|
|
3131
2911
|
|
|
3132
2912
|
return all(needle in s for needle in needles)
|
|
3133
2913
|
|
|
3134
|
-
# Additional string transformation methods
|
|
3135
|
-
def markdown(self, options: Optional[Dict] = None, extensions: Optional[List] = None) -> "Stringable":
|
|
3136
|
-
"""
|
|
3137
|
-
Convert GitHub flavored Markdown into HTML.
|
|
3138
|
-
Note: This is a placeholder - would need a markdown library for full implementation.
|
|
3139
|
-
|
|
3140
|
-
Parameters
|
|
3141
|
-
----------
|
|
3142
|
-
options : dict, optional
|
|
3143
|
-
Markdown processing options, by default None
|
|
3144
|
-
extensions : list, optional
|
|
3145
|
-
Markdown extensions, by default None
|
|
3146
|
-
|
|
3147
|
-
Returns
|
|
3148
|
-
-------
|
|
3149
|
-
Stringable
|
|
3150
|
-
A new Stringable with HTML (placeholder implementation)
|
|
3151
|
-
"""
|
|
3152
|
-
# Placeholder implementation - would need python-markdown or similar
|
|
3153
|
-
return Stringable(str(self))
|
|
3154
|
-
|
|
3155
|
-
def inlineMarkdown(self, options: Optional[Dict] = None, extensions: Optional[List] = None) -> "Stringable":
|
|
3156
|
-
"""
|
|
3157
|
-
Convert inline Markdown into HTML.
|
|
3158
|
-
Note: This is a placeholder - would need a markdown library for full implementation.
|
|
3159
|
-
|
|
3160
|
-
Parameters
|
|
3161
|
-
----------
|
|
3162
|
-
options : dict, optional
|
|
3163
|
-
Markdown processing options, by default None
|
|
3164
|
-
extensions : list, optional
|
|
3165
|
-
Markdown extensions, by default None
|
|
3166
|
-
|
|
3167
|
-
Returns
|
|
3168
|
-
-------
|
|
3169
|
-
Stringable
|
|
3170
|
-
A new Stringable with HTML (placeholder implementation)
|
|
3171
|
-
"""
|
|
3172
|
-
# Placeholder implementation - would need python-markdown or similar
|
|
3173
|
-
return Stringable(str(self))
|
|
3174
|
-
|
|
3175
|
-
def dump(self, *args) -> "Stringable":
|
|
3176
|
-
"""
|
|
3177
|
-
Dump the string to stdout for debugging purposes.
|
|
3178
|
-
|
|
3179
|
-
Outputs the current string value along with any additional arguments to
|
|
3180
|
-
the console, useful for debugging and inspection during development.
|
|
3181
|
-
|
|
3182
|
-
Parameters
|
|
3183
|
-
----------
|
|
3184
|
-
*args : Any
|
|
3185
|
-
Additional arguments to output alongside the string.
|
|
3186
|
-
|
|
3187
|
-
Returns
|
|
3188
|
-
-------
|
|
3189
|
-
Stringable
|
|
3190
|
-
The same Stringable instance for method chaining.
|
|
3191
|
-
"""
|
|
3192
|
-
|
|
3193
|
-
# Print the string value along with any additional arguments
|
|
3194
|
-
print(str(self), *args)
|
|
3195
|
-
|
|
3196
|
-
# Return self to allow method chaining
|
|
3197
|
-
return self
|
|
3198
|
-
|
|
3199
|
-
# Additional Laravel-compatible methods
|
|
3200
2914
|
def whenIs(self, pattern: Union[str, List[str]], callback: Callable, default: Optional[Callable] = None) -> "Stringable":
|
|
3201
2915
|
"""
|
|
3202
2916
|
Execute the given callback if the string matches a given pattern.
|
|
@@ -3271,44 +2985,6 @@ class Stringable(str):
|
|
|
3271
2985
|
"""
|
|
3272
2986
|
return self.when(self.isUlid(), callback, default)
|
|
3273
2987
|
|
|
3274
|
-
def isPattern(self, pattern: Union[str, List[str]], ignore_case: bool = False) -> bool:
|
|
3275
|
-
"""
|
|
3276
|
-
Determine if a given string matches a given pattern.
|
|
3277
|
-
|
|
3278
|
-
This method supports wildcard patterns using * and ? characters.
|
|
3279
|
-
|
|
3280
|
-
Parameters
|
|
3281
|
-
----------
|
|
3282
|
-
pattern : str or list
|
|
3283
|
-
Pattern(s) to match against
|
|
3284
|
-
ignore_case : bool, optional
|
|
3285
|
-
Whether to ignore case, by default False
|
|
3286
|
-
|
|
3287
|
-
Returns
|
|
3288
|
-
-------
|
|
3289
|
-
bool
|
|
3290
|
-
True if string matches pattern, False otherwise
|
|
3291
|
-
"""
|
|
3292
|
-
if isinstance(pattern, str):
|
|
3293
|
-
pattern = [pattern]
|
|
3294
|
-
|
|
3295
|
-
s = str(self)
|
|
3296
|
-
if ignore_case:
|
|
3297
|
-
s = s.lower()
|
|
3298
|
-
|
|
3299
|
-
for p in pattern:
|
|
3300
|
-
if ignore_case:
|
|
3301
|
-
p = p.lower()
|
|
3302
|
-
|
|
3303
|
-
# Convert wildcard pattern to regex
|
|
3304
|
-
regex_pattern = re.escape(p).replace(r'\*', '.*').replace(r'\?', '.')
|
|
3305
|
-
regex_pattern = f'^{regex_pattern}$'
|
|
3306
|
-
|
|
3307
|
-
if re.match(regex_pattern, s):
|
|
3308
|
-
return True
|
|
3309
|
-
|
|
3310
|
-
return False
|
|
3311
|
-
|
|
3312
2988
|
def toDate(self, format_str: Optional[str] = None) -> Optional[datetime]:
|
|
3313
2989
|
"""
|
|
3314
2990
|
Convert the string to a datetime object.
|
|
@@ -3324,15 +3000,14 @@ class Stringable(str):
|
|
|
3324
3000
|
Parsed datetime object or None if parsing fails
|
|
3325
3001
|
"""
|
|
3326
3002
|
|
|
3327
|
-
|
|
3328
3003
|
s = str(self)
|
|
3329
|
-
|
|
3004
|
+
|
|
3330
3005
|
if format_str:
|
|
3331
3006
|
try:
|
|
3332
3007
|
return datetime.strptime(s, format_str)
|
|
3333
3008
|
except ValueError:
|
|
3334
3009
|
return None
|
|
3335
|
-
|
|
3010
|
+
|
|
3336
3011
|
# Try common date formats
|
|
3337
3012
|
common_formats = [
|
|
3338
3013
|
'%Y-%m-%d',
|
|
@@ -3344,16 +3019,16 @@ class Stringable(str):
|
|
|
3344
3019
|
'%d-%m-%Y',
|
|
3345
3020
|
'%m-%d-%Y'
|
|
3346
3021
|
]
|
|
3347
|
-
|
|
3022
|
+
|
|
3348
3023
|
for fmt in common_formats:
|
|
3349
3024
|
try:
|
|
3350
3025
|
return datetime.strptime(s, fmt)
|
|
3351
3026
|
except ValueError:
|
|
3352
3027
|
continue
|
|
3353
|
-
|
|
3028
|
+
|
|
3354
3029
|
return None
|
|
3355
3030
|
|
|
3356
|
-
def encrypt(self
|
|
3031
|
+
def encrypt(self) -> "Stringable":
|
|
3357
3032
|
"""
|
|
3358
3033
|
Encrypt the string (placeholder implementation).
|
|
3359
3034
|
|
|
@@ -3362,19 +3037,17 @@ class Stringable(str):
|
|
|
3362
3037
|
|
|
3363
3038
|
Parameters
|
|
3364
3039
|
----------
|
|
3365
|
-
|
|
3366
|
-
Whether to serialize the value before encryption, by default False
|
|
3040
|
+
None
|
|
3367
3041
|
|
|
3368
3042
|
Returns
|
|
3369
3043
|
-------
|
|
3370
3044
|
Stringable
|
|
3371
3045
|
Encrypted string (base64 encoded for this placeholder)
|
|
3372
3046
|
"""
|
|
3373
|
-
|
|
3374
|
-
# In a real implementation, use proper encryption
|
|
3047
|
+
|
|
3375
3048
|
return self.toBase64()
|
|
3376
3049
|
|
|
3377
|
-
def decrypt(self
|
|
3050
|
+
def decrypt(self) -> "Stringable":
|
|
3378
3051
|
"""
|
|
3379
3052
|
Decrypt the string (placeholder implementation).
|
|
3380
3053
|
|
|
@@ -3383,16 +3056,14 @@ class Stringable(str):
|
|
|
3383
3056
|
|
|
3384
3057
|
Parameters
|
|
3385
3058
|
----------
|
|
3386
|
-
|
|
3387
|
-
Whether to unserialize the value after decryption, by default False
|
|
3059
|
+
None
|
|
3388
3060
|
|
|
3389
3061
|
Returns
|
|
3390
3062
|
-------
|
|
3391
3063
|
Stringable
|
|
3392
3064
|
Decrypted string
|
|
3393
3065
|
"""
|
|
3394
|
-
|
|
3395
|
-
# In a real implementation, use proper decryption
|
|
3066
|
+
|
|
3396
3067
|
return self.fromBase64()
|
|
3397
3068
|
|
|
3398
3069
|
def toHtmlString(self) -> "Stringable":
|
|
@@ -3407,20 +3078,6 @@ class Stringable(str):
|
|
|
3407
3078
|
# Escape HTML entities
|
|
3408
3079
|
return Stringable(html.escape(str(self)))
|
|
3409
3080
|
|
|
3410
|
-
def dd(self, *args) -> None:
|
|
3411
|
-
"""
|
|
3412
|
-
Dump the string and halt execution.
|
|
3413
|
-
|
|
3414
|
-
Parameters
|
|
3415
|
-
----------
|
|
3416
|
-
*args : Any
|
|
3417
|
-
Additional arguments to dump
|
|
3418
|
-
"""
|
|
3419
|
-
print(str(self), *args)
|
|
3420
|
-
import sys
|
|
3421
|
-
sys.exit(1)
|
|
3422
|
-
|
|
3423
|
-
# Additional method aliases and compatibility methods
|
|
3424
3081
|
def tap(self, callback: Callable) -> "Stringable":
|
|
3425
3082
|
"""
|
|
3426
3083
|
Call the given callback with the string and return the string.
|
|
@@ -207,7 +207,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=IrPQJwvQVLRm5Qnz0Cxon4
|
|
|
207
207
|
orionis/foundation/providers/testing_provider.py,sha256=eI1p2lUlxl25b5Z487O4nmqLE31CTDb4c3Q21xFadkE,1615
|
|
208
208
|
orionis/foundation/providers/workers_provider.py,sha256=GdHENYV_yGyqmHJHn0DCyWmWId5xWjD48e6Zq2PGCWY,1674
|
|
209
209
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
210
|
-
orionis/metadata/framework.py,sha256=
|
|
210
|
+
orionis/metadata/framework.py,sha256=EkYVacd164De7CcfqRBTxk0nm468sJ7GQIzFmISp4gc,4689
|
|
211
211
|
orionis/metadata/package.py,sha256=s1JeGJPwdVh4jO3IOfmpwMuJ_oX6Vf9NL7jgPEQNf5Y,16050
|
|
212
212
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
213
213
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -348,7 +348,7 @@ orionis/support/standard/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
|
348
348
|
orionis/support/standard/contracts/std.py,sha256=SJ44qIFDCp4jHL18k4sji5Mt_MN16lpg-0ku1qudh04,3331
|
|
349
349
|
orionis/support/standard/exceptions/__init__.py,sha256=GovJ24C8fCOlnU5_TrMJKngYNcJ1rvJnF9WFTA8ktyw,96
|
|
350
350
|
orionis/support/standard/exceptions/standard.py,sha256=BM0VHLRYD7SzoMJkaA7BxY5280v81hlj1Xslu0UaFag,788
|
|
351
|
-
orionis/support/types/stringable.py,sha256=
|
|
351
|
+
orionis/support/types/stringable.py,sha256=6Kx1tXULZX_Mjoha3_-RQfVD35RA7WbWTKjdVDv84ow,93981
|
|
352
352
|
orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
|
|
353
353
|
orionis/support/wrapper/dataclass.py,sha256=D2g9vHc6F0T7qLpzDwWUAiohcYz8Gcs2Ph5rLaOhqMo,9432
|
|
354
354
|
orionis/support/wrapper/dot_dict.py,sha256=T8xWwwOhBZHNeXRwE_CxvOwG9UFxsLqNmOJjV2CNIrc,7284
|
|
@@ -401,8 +401,8 @@ orionis/test/validators/workers.py,sha256=HcZ3cnrk6u7cvM1xZpn_lsglHAq69_jx9RcTSv
|
|
|
401
401
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
402
402
|
orionis/test/view/render.py,sha256=arysoswhkV2vUd2aVMZRPpmH317jaWbgjDpQ_AWQ5AE,5663
|
|
403
403
|
orionis/test/view/report.stub,sha256=QLqqCdRoENr3ECiritRB3DO_MOjRQvgBh5jxZ3Hs1r0,28189
|
|
404
|
-
orionis-0.
|
|
405
|
-
orionis-0.
|
|
406
|
-
orionis-0.
|
|
407
|
-
orionis-0.
|
|
408
|
-
orionis-0.
|
|
404
|
+
orionis-0.719.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
|
|
405
|
+
orionis-0.719.0.dist-info/METADATA,sha256=h88WnuRcIzuWuMQ6k2oYEZG_4ZwJcmsNB3cYzEE8jAU,4931
|
|
406
|
+
orionis-0.719.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
407
|
+
orionis-0.719.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
|
|
408
|
+
orionis-0.719.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|