none-shall-parse 0.2.2__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.
- none_shall_parse/imeis.py +212 -0
- none_shall_parse/lists.py +2 -4
- none_shall_parse/parse.py +4 -5
- none_shall_parse/strings.py +132 -16
- none_shall_parse/types.py +31 -0
- {none_shall_parse-0.2.2.dist-info → none_shall_parse-0.3.0.dist-info}/METADATA +1 -1
- none_shall_parse-0.3.0.dist-info/RECORD +9 -0
- none_shall_parse-0.2.2.dist-info/RECORD +0 -7
- {none_shall_parse-0.2.2.dist-info → none_shall_parse-0.3.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
3
|
+
LUHN_DOUBLES = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_luhn_digit(n: Union[str, int]) -> int:
|
|
7
|
+
"""
|
|
8
|
+
Calculates the Luhn checksum digit for a given number.
|
|
9
|
+
|
|
10
|
+
The function processes a number using the Luhn algorithm. It computes
|
|
11
|
+
the Luhn checksum digit based on the provided digits, ensuring that the
|
|
12
|
+
resulting number adheres to the Luhn standard. The method is useful for
|
|
13
|
+
validating numerical identifiers like credit card numbers or IMEIs.
|
|
14
|
+
|
|
15
|
+
Parameters:
|
|
16
|
+
n (str | int): A number represented as a string or integer that
|
|
17
|
+
requires Luhn checksum digit calculation.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
int: The Luhn checksum digit as an integer.
|
|
21
|
+
"""
|
|
22
|
+
chars = [int(ch) for ch in str(n)]
|
|
23
|
+
firsts = [ch for ch in chars[0::2]]
|
|
24
|
+
doubles = [LUHN_DOUBLES[ch] for ch in chars[1::2]]
|
|
25
|
+
check = 10 - divmod(sum((sum(firsts), sum(doubles))), 10)[1]
|
|
26
|
+
return divmod(check, 10)[1]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def is_valid_luhn(n: Union[str, int]) -> bool:
|
|
30
|
+
"""
|
|
31
|
+
Determines if a given number, represented as a string or integer, adheres
|
|
32
|
+
to the Luhn algorithm.
|
|
33
|
+
|
|
34
|
+
The Luhn algorithm, also known as the mod 10 algorithm, is a simple checksum
|
|
35
|
+
formula used to validate identification numbers such as credit card numbers.
|
|
36
|
+
|
|
37
|
+
Parameters:
|
|
38
|
+
n : Union[str, int]
|
|
39
|
+
The input number to be validated. It can be provided as a string or an integer.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
bool
|
|
43
|
+
Returns True if the input number satisfies the Luhn algorithm; otherwise, False.
|
|
44
|
+
"""
|
|
45
|
+
n = "".join(
|
|
46
|
+
[
|
|
47
|
+
e
|
|
48
|
+
for e in n
|
|
49
|
+
if e
|
|
50
|
+
in [
|
|
51
|
+
0,
|
|
52
|
+
1,
|
|
53
|
+
2,
|
|
54
|
+
3,
|
|
55
|
+
4,
|
|
56
|
+
5,
|
|
57
|
+
6,
|
|
58
|
+
7,
|
|
59
|
+
8,
|
|
60
|
+
9,
|
|
61
|
+
"0",
|
|
62
|
+
"1",
|
|
63
|
+
"2",
|
|
64
|
+
"3",
|
|
65
|
+
"4",
|
|
66
|
+
"5",
|
|
67
|
+
"6",
|
|
68
|
+
"7",
|
|
69
|
+
"8",
|
|
70
|
+
"9",
|
|
71
|
+
]
|
|
72
|
+
]
|
|
73
|
+
)
|
|
74
|
+
chars = [int(ch) for ch in str(n)][::-1] # Reversed Digits
|
|
75
|
+
firsts = [ch for ch in chars[0::2]]
|
|
76
|
+
doubles = [LUHN_DOUBLES[ch] for ch in chars[1::2]]
|
|
77
|
+
final = sum((sum(firsts), sum(doubles)))
|
|
78
|
+
return divmod(final, 10)[1] == 0
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def is_valid_imei(n: Union[str, int]) -> bool:
|
|
82
|
+
"""
|
|
83
|
+
Determines whether the given number is a valid IMEI (International Mobile
|
|
84
|
+
Equipment Identity) number.
|
|
85
|
+
|
|
86
|
+
An IMEI number is a 15-digit unique identifier for a mobile device. This function
|
|
87
|
+
first checks that the length of the input is 15 characters and then validates
|
|
88
|
+
it using the Luhn algorithm.
|
|
89
|
+
|
|
90
|
+
Parameters:
|
|
91
|
+
n: Union[str, int]
|
|
92
|
+
The number to be checked, represented as a string or integer.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
bool
|
|
96
|
+
True if the given number is a valid IMEI, otherwise False.
|
|
97
|
+
"""
|
|
98
|
+
return len(str(n)) == 15 and is_valid_luhn(n)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def normalize_imei(c: Union[str, int]) -> str:
|
|
102
|
+
"""
|
|
103
|
+
Normalizes the given IMEI number by extracting the first 14 digits and appending
|
|
104
|
+
the calculated Luhn check digit to make it a valid IMEI.
|
|
105
|
+
|
|
106
|
+
The IMEI (International Mobile Equipment Identity) is a unique identifier
|
|
107
|
+
typically consisting of 15 digits. This function ensures that the provided
|
|
108
|
+
IMEI-like input is converted into a valid IMEI format by calculating and appending
|
|
109
|
+
the appropriate check digit.
|
|
110
|
+
|
|
111
|
+
Parameters:
|
|
112
|
+
c: Union[str, int]
|
|
113
|
+
The input IMEI or a value resembling an IMEI. It can be provided as a string
|
|
114
|
+
or an integer.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
str
|
|
118
|
+
A 15-digit valid IMEI as a string.
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
Exception
|
|
122
|
+
Raises any exceptions occurring internally within the `get_luhn_digit` function
|
|
123
|
+
if the calculation of the check digit fails.
|
|
124
|
+
|
|
125
|
+
Notes:
|
|
126
|
+
This function assumes the presence of the `get_luhn_digit` function for Luhn
|
|
127
|
+
digit calculation.
|
|
128
|
+
"""
|
|
129
|
+
t = str(c)[:14]
|
|
130
|
+
check_digit = get_luhn_digit(t)
|
|
131
|
+
return "%s%s" % (t, check_digit)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def get_tac_from_imei(n: Union[str, int]) -> tuple[bool, str]:
|
|
135
|
+
"""
|
|
136
|
+
Determines the validity of an IMEI number and extracts its TAC if valid.
|
|
137
|
+
|
|
138
|
+
This function checks whether a provided IMEI (International Mobile Equipment
|
|
139
|
+
Identity) number is valid based on IMEI validation rules. If the given IMEI
|
|
140
|
+
is valid, the function also extracts and returns the TAC (Type Allocation
|
|
141
|
+
Code), which corresponds to the first 8 digits of the IMEI.
|
|
142
|
+
|
|
143
|
+
Parameters:
|
|
144
|
+
n (str): The IMEI number to be validated and processed.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
tuple: A tuple containing a boolean indicating whether the IMEI is valid
|
|
148
|
+
and a string representing the TAC if valid or a placeholder if invalid.
|
|
149
|
+
"""
|
|
150
|
+
tac = "Not a Valid IMEI"
|
|
151
|
+
is_valid = is_valid_imei(n)
|
|
152
|
+
if not is_valid:
|
|
153
|
+
return False, tac
|
|
154
|
+
else:
|
|
155
|
+
tac = str(n)[:8]
|
|
156
|
+
return True, tac
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def decrement_imei(n: Union[str, int]) -> tuple[bool, str]:
|
|
160
|
+
"""
|
|
161
|
+
Decrements the given IMEI number by one and normalizes it.
|
|
162
|
+
|
|
163
|
+
This function validates the provided IMEI number. If it is a valid IMEI, the
|
|
164
|
+
function decrements the first 14 digits by one and computes the new IMEI
|
|
165
|
+
checksum to generate a normalized IMEI. If the provided IMEI is not valid,
|
|
166
|
+
it returns a failure status and an error message.
|
|
167
|
+
|
|
168
|
+
Parameters:
|
|
169
|
+
n: int
|
|
170
|
+
The IMEI number to be validated and decremented.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
tuple[bool, str]
|
|
174
|
+
A tuple where the first element is a boolean indicating whether the
|
|
175
|
+
operation was successful, and the second element is the resulting IMEI
|
|
176
|
+
or an error message if the input was invalid.
|
|
177
|
+
"""
|
|
178
|
+
result = "Not a Valid IMEI"
|
|
179
|
+
is_valid = is_valid_imei(n)
|
|
180
|
+
if not is_valid:
|
|
181
|
+
return False, result
|
|
182
|
+
else:
|
|
183
|
+
result = normalize_imei(int(str(n)[:14]) - 1)
|
|
184
|
+
return True, result
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def increment_imei(n: Union[str, int]) -> tuple[bool, str]:
|
|
188
|
+
"""
|
|
189
|
+
Determines if a given IMEI number is valid and increments it by 1 if valid.
|
|
190
|
+
|
|
191
|
+
This function first checks if the provided IMEI number is valid using the
|
|
192
|
+
is_valid_imei function. If the input is a valid IMEI, it increments the IMEI
|
|
193
|
+
value by 1 while retaining only the first 14 digits. If the input is not valid,
|
|
194
|
+
it returns a predefined invalid result.
|
|
195
|
+
|
|
196
|
+
Parameters:
|
|
197
|
+
n: int
|
|
198
|
+
IMEI number to be validated and potentially incremented.
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
tuple[bool, str]
|
|
202
|
+
A tuple where the first element is a boolean indicating whether the operation
|
|
203
|
+
was successful, and the second element is a string containing the incremented
|
|
204
|
+
IMEI number if valid or an error message if not valid.
|
|
205
|
+
"""
|
|
206
|
+
result = "Not a Valid IMEI"
|
|
207
|
+
is_valid = is_valid_imei(n)
|
|
208
|
+
if not is_valid:
|
|
209
|
+
return False, result
|
|
210
|
+
else:
|
|
211
|
+
result = normalize_imei(int(str(n)[:14]) + 1)
|
|
212
|
+
return True, result
|
none_shall_parse/lists.py
CHANGED
none_shall_parse/parse.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Callable, Any
|
|
2
2
|
from typing import Union
|
|
3
3
|
|
|
4
|
-
from .strings import slugify
|
|
5
|
-
|
|
6
|
-
ChoicesType = Sequence[Tuple[Union[int, str], str]]
|
|
4
|
+
from src.none_shall_parse.strings import slugify
|
|
5
|
+
from src.none_shall_parse.types import ChoicesType, StringLike
|
|
7
6
|
|
|
8
7
|
_true_set = {'yes', 'true', 't', 'y', '1'}
|
|
9
8
|
_false_set = {'no', 'false', 'f', 'n', '0'}
|
|
@@ -125,7 +124,7 @@ def int_or_none(s: int | float | str | None) -> int | None:
|
|
|
125
124
|
|
|
126
125
|
def choices_code_to_string(
|
|
127
126
|
choices: ChoicesType, default: str | None = None,
|
|
128
|
-
to_slug: bool = False) -> Callable[[Union[int,
|
|
127
|
+
to_slug: bool = False) -> Callable[[Union[int, StringLike]], StringLike | None]:
|
|
129
128
|
"""
|
|
130
129
|
Converts a code to a corresponding string representation based on provided choices.
|
|
131
130
|
The function allows optional fallback to a default value and can slugify the resulting string
|
none_shall_parse/strings.py
CHANGED
|
@@ -6,6 +6,7 @@ import re
|
|
|
6
6
|
import secrets
|
|
7
7
|
import string
|
|
8
8
|
import unicodedata
|
|
9
|
+
from typing import Any
|
|
9
10
|
|
|
10
11
|
_control_chars = "".join(
|
|
11
12
|
map(chr, itertools.chain(range(0x00, 0x20), range(0x7F, 0xA0))))
|
|
@@ -13,7 +14,7 @@ _re_control_char = re.compile("[%s]" % re.escape(_control_chars))
|
|
|
13
14
|
_re_combine_whitespace = re.compile(r"\s+")
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
def slugify(value, allow_unicode=False):
|
|
17
|
+
def slugify(value: object, allow_unicode: bool = False) -> str:
|
|
17
18
|
"""
|
|
18
19
|
Maps directly to Django's slugify function.
|
|
19
20
|
Convert to ASCII if 'allow_unicode' is False. Convert spaces or repeated
|
|
@@ -38,10 +39,26 @@ def random_16():
|
|
|
38
39
|
return "".join(random.choices(string.ascii_letters + string.digits, k=16))
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
def to_human_string(s):
|
|
42
|
+
def to_human_string(s: Any) -> tuple[Any | str, bool]:
|
|
42
43
|
"""
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
Cleans up a string by removing extra whitespace and control characters.
|
|
45
|
+
|
|
46
|
+
Removes unnecessary whitespace and control characters from the input string.
|
|
47
|
+
This function is designed to validate and clean user-provided string input
|
|
48
|
+
while preserving input that does not require modification. It returns the
|
|
49
|
+
cleaned string along with a boolean indicating whether changes were made
|
|
50
|
+
to the original string.
|
|
51
|
+
|
|
52
|
+
Parameters:
|
|
53
|
+
s : any
|
|
54
|
+
The input value to clean and validate. If it is not a string, it is
|
|
55
|
+
returned unchanged with a modification flag of False.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
tuple
|
|
59
|
+
A tuple where the first element is the cleaned string (or the original
|
|
60
|
+
input if it is not a string), and the second element is a boolean
|
|
61
|
+
indicating whether the string was modified.
|
|
45
62
|
"""
|
|
46
63
|
if not isinstance(s, str):
|
|
47
64
|
return s, False
|
|
@@ -53,7 +70,28 @@ def to_human_string(s):
|
|
|
53
70
|
return clean_string, True
|
|
54
71
|
|
|
55
72
|
|
|
56
|
-
def is_quoted_string(s, strip=False):
|
|
73
|
+
def is_quoted_string(s: str, strip: bool = False) -> tuple[bool, str]:
|
|
74
|
+
"""
|
|
75
|
+
Checks if a given string is enclosed in quotes and optionally strips the quotes.
|
|
76
|
+
|
|
77
|
+
The function determines whether a given string starts and ends with matching quotes,
|
|
78
|
+
either single quotes (') or double quotes ("). If the string is quoted and
|
|
79
|
+
the `strip` parameter is set to True, it removes the enclosing quotes and returns
|
|
80
|
+
the unquoted string.
|
|
81
|
+
|
|
82
|
+
Parameters:
|
|
83
|
+
s : str
|
|
84
|
+
The input string to check and possibly process.
|
|
85
|
+
strip : bool, optional
|
|
86
|
+
Indicates whether to remove the enclosing quotes if the string is quoted.
|
|
87
|
+
Defaults to False.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
tuple[bool, str]
|
|
91
|
+
A tuple where the first element is a boolean indicating whether the string
|
|
92
|
+
is quoted, and the second element is the original string or the stripped
|
|
93
|
+
version if `strip` is True.
|
|
94
|
+
"""
|
|
57
95
|
is_quoted = False
|
|
58
96
|
result = s
|
|
59
97
|
if not isinstance(s, str):
|
|
@@ -70,7 +108,32 @@ def is_quoted_string(s, strip=False):
|
|
|
70
108
|
return is_quoted, result
|
|
71
109
|
|
|
72
110
|
|
|
73
|
-
def is_numeric_string(s, convert=False):
|
|
111
|
+
def is_numeric_string(s: str, convert: bool = False) -> tuple[bool, str | int | float]:
|
|
112
|
+
"""
|
|
113
|
+
Checks if the given string represents a numeric value and optionally converts it.
|
|
114
|
+
|
|
115
|
+
This function determines if the provided string represents a numeric value.
|
|
116
|
+
If the input is numeric and the `convert` flag is set to True, it returns
|
|
117
|
+
the numeric value converted to either an integer (if the float represents
|
|
118
|
+
an integer) or a float. If the input is not numeric, it returns the original
|
|
119
|
+
input string.
|
|
120
|
+
|
|
121
|
+
Parameters
|
|
122
|
+
----------
|
|
123
|
+
s : str
|
|
124
|
+
The input string to check.
|
|
125
|
+
convert : bool, optional
|
|
126
|
+
A flag indicating whether to convert the numeric string to a numeric
|
|
127
|
+
type (default is False).
|
|
128
|
+
|
|
129
|
+
Returns
|
|
130
|
+
-------
|
|
131
|
+
tuple
|
|
132
|
+
A tuple containing a boolean and the result:
|
|
133
|
+
- A boolean indicating whether the input string is numeric or not.
|
|
134
|
+
- The numeric value if `convert` is True and the string is numeric;
|
|
135
|
+
otherwise, the original string.
|
|
136
|
+
"""
|
|
74
137
|
is_numeric = False
|
|
75
138
|
result = s
|
|
76
139
|
f = None
|
|
@@ -88,7 +151,7 @@ def is_numeric_string(s, convert=False):
|
|
|
88
151
|
return is_numeric, result
|
|
89
152
|
|
|
90
153
|
|
|
91
|
-
def custom_slug(s):
|
|
154
|
+
def custom_slug(s: str) -> str:
|
|
92
155
|
# Remove all non-word characters (everything except numbers and letters)
|
|
93
156
|
s = re.sub(r"[^\w\s]", "", s)
|
|
94
157
|
|
|
@@ -98,27 +161,80 @@ def custom_slug(s):
|
|
|
98
161
|
return s
|
|
99
162
|
|
|
100
163
|
|
|
101
|
-
def b64_encode(s):
|
|
102
|
-
|
|
164
|
+
def b64_encode(s: str | bytes) -> str:
|
|
165
|
+
"""
|
|
166
|
+
Encodes a string or bytes into its Base64 representation.
|
|
167
|
+
|
|
168
|
+
This function takes an input, either a string or bytes, and encodes it
|
|
169
|
+
into its Base64 representation. If the input is a string, it is first
|
|
170
|
+
encoded into bytes using UTF-8 encoding. The resulting Base64 encoded
|
|
171
|
+
value is returned as a string.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
s: The input to encode, which can be either a string or bytes.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
The Base64 encoded representation of the input as a string.
|
|
178
|
+
"""
|
|
179
|
+
if isinstance(s, str):
|
|
180
|
+
s = s.encode("utf-8")
|
|
181
|
+
return base64.b64encode(s).decode("utf-8")
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def b64_decode(s: str) -> bytes:
|
|
185
|
+
"""
|
|
186
|
+
Decodes a Base64 encoded string to its original binary format.
|
|
187
|
+
|
|
188
|
+
This function takes a Base64 encoded string and decodes it to its
|
|
189
|
+
original bytes form. Base64 encoding may omit padding characters, so
|
|
190
|
+
the function ensures the input is properly padded before decoding.
|
|
191
|
+
|
|
192
|
+
Parameters:
|
|
193
|
+
s: str
|
|
194
|
+
A Base64 encoded string that needs to be decoded.
|
|
103
195
|
|
|
196
|
+
Returns:
|
|
197
|
+
bytes
|
|
198
|
+
The decoded binary data.
|
|
104
199
|
|
|
105
|
-
|
|
200
|
+
Raises:
|
|
201
|
+
ValueError
|
|
202
|
+
If the input string contains invalid Base64 characters.
|
|
203
|
+
"""
|
|
106
204
|
pad = "=" * (-len(s) % 4)
|
|
107
205
|
return base64.b64decode(s + pad)
|
|
108
206
|
|
|
109
207
|
|
|
110
|
-
def calc_hash(*args):
|
|
208
|
+
def calc_hash(*args: Any) -> str:
|
|
111
209
|
"""
|
|
112
|
-
Calculate a hash
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
the
|
|
210
|
+
Calculate and return a SHA-1 hash for the given arguments.
|
|
211
|
+
|
|
212
|
+
This function joins the provided arguments into a single string, encodes it
|
|
213
|
+
using UTF-16, and calculates the SHA-1 hash of the resulting bytes.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
*args: A variable number of arguments to include in the hash.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
str: The computed SHA-1 hash as a hexadecimal string.
|
|
116
220
|
"""
|
|
117
221
|
s = '_'.join(map(str, args))
|
|
118
222
|
return hashlib.sha1(s.encode("utf-16")).hexdigest()
|
|
119
223
|
|
|
120
224
|
|
|
121
|
-
def generate_random_password(n=10):
|
|
225
|
+
def generate_random_password(n: int = 10) -> str:
|
|
226
|
+
"""
|
|
227
|
+
Generates a random password meeting specific criteria for complexity. The
|
|
228
|
+
function ensures the password contains at least one lowercase letter, one
|
|
229
|
+
uppercase letter, and at least three numeric digits. The length of the
|
|
230
|
+
password can be customized using the 'n' parameter.
|
|
231
|
+
|
|
232
|
+
Parameters:
|
|
233
|
+
n (int): Length of the password to be generated. Default is 10.
|
|
234
|
+
|
|
235
|
+
Returns:
|
|
236
|
+
str: A randomly generated password that meets the specified criteria.
|
|
237
|
+
"""
|
|
122
238
|
alphabet = string.ascii_letters + string.digits
|
|
123
239
|
while True:
|
|
124
240
|
password = "".join(secrets.choice(alphabet) for i in range(n))
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Protocol, Sequence, Tuple, Union, TypeVar
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class StringLike(Protocol):
|
|
5
|
+
"""
|
|
6
|
+
Protocol that defines the expected behavior for string-like objects.
|
|
7
|
+
|
|
8
|
+
This protocol specifies the methods and properties that an object
|
|
9
|
+
must implement to be considered string-like. It defines basic
|
|
10
|
+
string operations such as getting the string representation and
|
|
11
|
+
length, string concatenation, containment checks, and several
|
|
12
|
+
commonly used string manipulation methods. Objects adhering to
|
|
13
|
+
this protocol can mimic the behavior of standard Python strings.
|
|
14
|
+
"""
|
|
15
|
+
def __str__(self) -> str: ...
|
|
16
|
+
def __len__(self) -> int: ...
|
|
17
|
+
def __add__(self, other: str) -> str: ...
|
|
18
|
+
def __contains__(self, item: str) -> bool: ...
|
|
19
|
+
|
|
20
|
+
# Most commonly used string methods
|
|
21
|
+
def upper(self) -> str: ...
|
|
22
|
+
def lower(self) -> str: ...
|
|
23
|
+
def strip(self) -> str: ...
|
|
24
|
+
def startswith(self, prefix: str) -> bool: ...
|
|
25
|
+
def endswith(self, suffix: str) -> bool: ...
|
|
26
|
+
def replace(self, old: str, new: str) -> str: ...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
ChoicesType = Sequence[Tuple[Union[int, str], StringLike]]
|
|
30
|
+
|
|
31
|
+
T = TypeVar('T')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: none-shall-parse
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Trinity Shared Python utilities.
|
|
5
5
|
Author: Andries Niemandt, Jan Badenhorst
|
|
6
6
|
Author-email: Andries Niemandt <andries.niemandt@trintel.co.za>, Jan Badenhorst <jan@trintel.co.za>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
none_shall_parse/__init__.py,sha256=ElNUb98vffLm3_IvHJWLklIPWvr0p84SdpVLHof2n1o,548
|
|
2
|
+
none_shall_parse/imeis.py,sha256=sNLGeeGU0K4SvTb4xp-yuV0P3c-JjYDanble9f09uBc,6911
|
|
3
|
+
none_shall_parse/lists.py,sha256=3s9Oi0-aUVcfzhIdW6N9-z7ZI56VxTa3WRDj1zAiJQI,1705
|
|
4
|
+
none_shall_parse/parse.py,sha256=U4FUuQqtqgEKEC-3blUd78EFYyQHbBgbWW194VXdcYw,6905
|
|
5
|
+
none_shall_parse/strings.py,sha256=HAcaDOHkrUZ_pDfNjfh89GQ5EJeBo6WjH5of1B11vos,7950
|
|
6
|
+
none_shall_parse/types.py,sha256=SGHhzzIxC9_89STRa9eAQt18_cZVuklpj2cUnyrW8l0,1121
|
|
7
|
+
none_shall_parse-0.3.0.dist-info/WHEEL,sha256=4n27za1eEkOnA7dNjN6C5-O2rUiw6iapszm14Uj-Qmk,79
|
|
8
|
+
none_shall_parse-0.3.0.dist-info/METADATA,sha256=d-W1OJJiftIMIVXi3EzRYfgAWLu_74FYrchoBHmROOs,1676
|
|
9
|
+
none_shall_parse-0.3.0.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
none_shall_parse/__init__.py,sha256=ElNUb98vffLm3_IvHJWLklIPWvr0p84SdpVLHof2n1o,548
|
|
2
|
-
none_shall_parse/lists.py,sha256=IndbwxaxvByFtW88AtHyNOTDDp-E1EWLz_KY7OCcBIU,1712
|
|
3
|
-
none_shall_parse/parse.py,sha256=99A_Xo3n2I2zGsgJcobjRPhgNOO1HytpZHs_hmr7t2c,6878
|
|
4
|
-
none_shall_parse/strings.py,sha256=_fvsQtUyjqmPj_c4NjeOsAPrd5LOzNb4SX16-ZyZIEA,3511
|
|
5
|
-
none_shall_parse-0.2.2.dist-info/WHEEL,sha256=4n27za1eEkOnA7dNjN6C5-O2rUiw6iapszm14Uj-Qmk,79
|
|
6
|
-
none_shall_parse-0.2.2.dist-info/METADATA,sha256=iCpKl9FrsBF2jCeC9aciK7Wc0oMWciAxfgx-obdobvg,1676
|
|
7
|
-
none_shall_parse-0.2.2.dist-info/RECORD,,
|
|
File without changes
|