plur 1.0.0__py3-none-any.whl → 1.1.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.
plur/__init__.py
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import typing as t
|
|
2
2
|
|
|
3
3
|
__all__ = (
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
'DEFAULT_PLURALS',
|
|
5
|
+
'plur',
|
|
6
6
|
)
|
|
7
7
|
|
|
8
|
-
DEFAULT_PLURALS = (
|
|
8
|
+
DEFAULT_PLURALS = ('-s',)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def plur(
|
|
12
12
|
word: str,
|
|
13
13
|
*plurals: str,
|
|
14
|
-
sep: str =
|
|
14
|
+
sep: str = ' ',
|
|
15
15
|
num_first: bool = True,
|
|
16
|
-
zero: str =
|
|
16
|
+
zero: str = '',
|
|
17
17
|
) -> t.Callable[[t.Union[int, t.Sequence]], str]:
|
|
18
18
|
"""`plur()` returns a pluralizer
|
|
19
19
|
|
|
@@ -40,9 +40,9 @@ def plur(
|
|
|
40
40
|
n = len(count) if isinstance(count, t.Sequence) else count
|
|
41
41
|
i = min(n, len(words) - 1)
|
|
42
42
|
p = words[i]
|
|
43
|
-
if p.startswith(
|
|
43
|
+
if p.startswith('-'):
|
|
44
44
|
p = word + p[1:]
|
|
45
45
|
|
|
46
|
-
return f
|
|
46
|
+
return f'{n}{sep}{p}' if num_first else f'{p}{sep}{n}'
|
|
47
47
|
|
|
48
48
|
return pluralizer
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: plur
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: 🔢 Simple universal word pluralizer 🔢
|
|
5
5
|
Author: Tom Ritchford
|
|
6
|
-
Author-email: tom@swirly.com
|
|
7
|
-
Requires-Python: >=3.8
|
|
6
|
+
Author-email: Tom Ritchford <tom@swirly.com>
|
|
8
7
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
11
8
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Python: >=3.10
|
|
13
14
|
Description-Content-Type: text/markdown
|
|
14
15
|
|
|
15
16
|
# plur: 🔢 simple universal word pluralizer 🔢
|
|
@@ -58,4 +59,3 @@ For words you use a lot, you can defer operation:
|
|
|
58
59
|
ox = plur('ox', '-en')
|
|
59
60
|
|
|
60
61
|
print(dog(dogs), 'live in my house with', ox(ox_list))
|
|
61
|
-
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
plur/__init__.py,sha256=ANCBfnsiOe5LFUZH5_10T3LqzPs3a2n62VQVOYa1T8o,1105
|
|
2
|
+
plur/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
plur-1.1.0.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
|
|
4
|
+
plur-1.1.0.dist-info/METADATA,sha256=-YWnVICzGfznL_W5PkC6zSmJhxYTZjij4bYVbWveUJU,1450
|
|
5
|
+
plur-1.1.0.dist-info/RECORD,,
|
plur-1.0.0.dist-info/RECORD
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
plur/__init__.py,sha256=SxaKx2jY-zn60-LdAdFIGPkL-IRzzNiI2GW-4obdbTA,1105
|
|
2
|
-
plur/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
plur-1.0.0.dist-info/METADATA,sha256=lHkuKaZ6i8HWTAlMqpM_jHhw71355MahMQ8kTy8EzFc,1381
|
|
4
|
-
plur-1.0.0.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
|
|
5
|
-
plur-1.0.0.dist-info/RECORD,,
|