hammad-python 0.0.10__py3-none-any.whl → 0.0.11__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.
- hammad/__init__.py +64 -10
- hammad/based/__init__.py +52 -0
- hammad/based/fields.py +546 -0
- hammad/based/model.py +968 -0
- hammad/based/utils.py +455 -0
- hammad/cache/__init__.py +30 -0
- hammad/{cache.py → cache/_cache.py} +83 -12
- hammad/cli/__init__.py +25 -0
- hammad/cli/plugins/__init__.py +786 -0
- hammad/cli/styles/__init__.py +5 -0
- hammad/cli/styles/animations.py +548 -0
- hammad/cli/styles/settings.py +135 -0
- hammad/cli/styles/types.py +358 -0
- hammad/cli/styles/utils.py +480 -0
- hammad/data/__init__.py +51 -0
- hammad/data/collections/__init__.py +32 -0
- hammad/data/collections/base_collection.py +58 -0
- hammad/data/collections/collection.py +227 -0
- hammad/data/collections/searchable_collection.py +556 -0
- hammad/data/collections/vector_collection.py +497 -0
- hammad/data/databases/__init__.py +21 -0
- hammad/data/databases/database.py +551 -0
- hammad/data/types/__init__.py +33 -0
- hammad/data/types/files/__init__.py +1 -0
- hammad/data/types/files/audio.py +81 -0
- hammad/data/types/files/configuration.py +475 -0
- hammad/data/types/files/document.py +195 -0
- hammad/data/types/files/file.py +358 -0
- hammad/data/types/files/image.py +80 -0
- hammad/json/__init__.py +21 -0
- hammad/{utils/json → json}/converters.py +4 -1
- hammad/logging/__init__.py +27 -0
- hammad/logging/decorators.py +432 -0
- hammad/logging/logger.py +534 -0
- hammad/pydantic/__init__.py +43 -0
- hammad/{utils/pydantic → pydantic}/converters.py +2 -1
- hammad/pydantic/models/__init__.py +28 -0
- hammad/pydantic/models/arbitrary_model.py +46 -0
- hammad/pydantic/models/cacheable_model.py +79 -0
- hammad/pydantic/models/fast_model.py +318 -0
- hammad/pydantic/models/function_model.py +176 -0
- hammad/pydantic/models/subscriptable_model.py +63 -0
- hammad/text/__init__.py +37 -0
- hammad/text/text.py +1068 -0
- hammad/text/utils/__init__.py +1 -0
- hammad/{utils/text → text/utils}/converters.py +2 -2
- hammad/text/utils/markdown/__init__.py +1 -0
- hammad/{utils → text/utils}/markdown/converters.py +3 -3
- hammad/{utils → text/utils}/markdown/formatting.py +1 -1
- hammad/{utils/typing/utils.py → typing/__init__.py} +75 -2
- hammad/web/__init__.py +42 -0
- hammad/web/http/__init__.py +1 -0
- hammad/web/http/client.py +944 -0
- hammad/web/openapi/client.py +740 -0
- hammad/web/search/__init__.py +1 -0
- hammad/web/search/client.py +936 -0
- hammad/web/utils.py +463 -0
- hammad/yaml/__init__.py +30 -0
- hammad/yaml/converters.py +19 -0
- {hammad_python-0.0.10.dist-info → hammad_python-0.0.11.dist-info}/METADATA +14 -8
- hammad_python-0.0.11.dist-info/RECORD +65 -0
- hammad/database.py +0 -447
- hammad/logger.py +0 -273
- hammad/types/color.py +0 -951
- hammad/utils/json/__init__.py +0 -0
- hammad/utils/markdown/__init__.py +0 -0
- hammad/utils/pydantic/__init__.py +0 -0
- hammad/utils/text/__init__.py +0 -0
- hammad/utils/typing/__init__.py +0 -0
- hammad_python-0.0.10.dist-info/RECORD +0 -22
- /hammad/{types/__init__.py → py.typed} +0 -0
- /hammad/{utils → web/openapi}/__init__.py +0 -0
- {hammad_python-0.0.10.dist-info → hammad_python-0.0.11.dist-info}/WHEEL +0 -0
- {hammad_python-0.0.10.dist-info → hammad_python-0.0.11.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,358 @@
|
|
1
|
+
"""hammad.cli.styles.types"""
|
2
|
+
|
3
|
+
from typing import Literal, Union
|
4
|
+
from typing_extensions import TypeAliasType
|
5
|
+
|
6
|
+
__all__ = (
|
7
|
+
"CLIStyleError",
|
8
|
+
"CLIStyleVerticalOverflowMethod",
|
9
|
+
"CLIStyleJustifyMethod",
|
10
|
+
"CLIStyleOverflowMethod",
|
11
|
+
"CLIStyleColorName",
|
12
|
+
"CLIStyleStyleName",
|
13
|
+
"CLIStyleBoxName",
|
14
|
+
"CLIStyleType",
|
15
|
+
"CLIStyleBackgroundType",
|
16
|
+
)
|
17
|
+
|
18
|
+
|
19
|
+
class CLIStyleError(Exception):
|
20
|
+
"""Exception raised for any errors related to the
|
21
|
+
rich styling of some rendered content."""
|
22
|
+
|
23
|
+
def __init__(self, message: str) -> None:
|
24
|
+
self.message = message
|
25
|
+
super().__init__(self.message)
|
26
|
+
|
27
|
+
|
28
|
+
CLIStyleVerticalOverflowMethod = TypeAliasType(
|
29
|
+
"CLIStyleVerticalOverflowMethod",
|
30
|
+
Literal[
|
31
|
+
"crop",
|
32
|
+
"ellipsis",
|
33
|
+
"visible",
|
34
|
+
],
|
35
|
+
)
|
36
|
+
"""Literal helper alias providing type hinting for the various compatible
|
37
|
+
vertical overflow methods within the `rich` library."""
|
38
|
+
|
39
|
+
|
40
|
+
CLIStyleJustifyMethod = TypeAliasType(
|
41
|
+
"CLIStyleJustifyMethod",
|
42
|
+
Literal[
|
43
|
+
"left",
|
44
|
+
"center",
|
45
|
+
"right",
|
46
|
+
],
|
47
|
+
)
|
48
|
+
"""Literal helper alias providing type hinting for the various compatible
|
49
|
+
justify methods within the `rich` library."""
|
50
|
+
|
51
|
+
|
52
|
+
CLIStyleOverflowMethod = TypeAliasType(
|
53
|
+
"CLIStyleOverflowMethod",
|
54
|
+
Literal[
|
55
|
+
"crop",
|
56
|
+
"fold",
|
57
|
+
"ellipsis",
|
58
|
+
"ignore",
|
59
|
+
],
|
60
|
+
)
|
61
|
+
"""Literal helper alias providing type hinting for the various compatible
|
62
|
+
overflow methods within the `rich` library."""
|
63
|
+
|
64
|
+
|
65
|
+
CLIStyleColorName = TypeAliasType(
|
66
|
+
"CLIStyleColorName",
|
67
|
+
Literal[
|
68
|
+
"black",
|
69
|
+
"red",
|
70
|
+
"green",
|
71
|
+
"yellow",
|
72
|
+
"blue",
|
73
|
+
"magenta",
|
74
|
+
"cyan",
|
75
|
+
"white",
|
76
|
+
"bright_black",
|
77
|
+
"bright_red",
|
78
|
+
"bright_green",
|
79
|
+
"bright_yellow",
|
80
|
+
"bright_blue",
|
81
|
+
"bright_magenta",
|
82
|
+
"bright_cyan",
|
83
|
+
"bright_white",
|
84
|
+
"grey0",
|
85
|
+
"navy_blue",
|
86
|
+
"dark_blue",
|
87
|
+
"blue3",
|
88
|
+
"blue1",
|
89
|
+
"dark_green",
|
90
|
+
"deep_sky_blue4",
|
91
|
+
"dodger_blue3",
|
92
|
+
"dodger_blue2",
|
93
|
+
"green4",
|
94
|
+
"spring_green4",
|
95
|
+
"turquoise4",
|
96
|
+
"deep_sky_blue3",
|
97
|
+
"dodger_blue1",
|
98
|
+
"dark_cyan",
|
99
|
+
"light_sea_green",
|
100
|
+
"deep_sky_blue2",
|
101
|
+
"deep_sky_blue1",
|
102
|
+
"green3",
|
103
|
+
"spring_green3",
|
104
|
+
"cyan3",
|
105
|
+
"dark_turquoise",
|
106
|
+
"turquoise2",
|
107
|
+
"green1",
|
108
|
+
"spring_green2",
|
109
|
+
"spring_green1",
|
110
|
+
"medium_spring_green",
|
111
|
+
"cyan2",
|
112
|
+
"cyan1",
|
113
|
+
"purple4",
|
114
|
+
"purple3",
|
115
|
+
"blue_violet",
|
116
|
+
"grey37",
|
117
|
+
"medium_purple4",
|
118
|
+
"slate_blue3",
|
119
|
+
"royal_blue1",
|
120
|
+
"chartreuse4",
|
121
|
+
"pale_turquoise4",
|
122
|
+
"steel_blue",
|
123
|
+
"steel_blue3",
|
124
|
+
"cornflower_blue",
|
125
|
+
"dark_sea_green4",
|
126
|
+
"cadet_blue",
|
127
|
+
"sky_blue3",
|
128
|
+
"chartreuse3",
|
129
|
+
"sea_green3",
|
130
|
+
"aquamarine3",
|
131
|
+
"medium_turquoise",
|
132
|
+
"steel_blue1",
|
133
|
+
"sea_green2",
|
134
|
+
"sea_green1",
|
135
|
+
"dark_slate_gray2",
|
136
|
+
"dark_red",
|
137
|
+
"dark_magenta",
|
138
|
+
"orange4",
|
139
|
+
"light_pink4",
|
140
|
+
"plum4",
|
141
|
+
"medium_purple3",
|
142
|
+
"slate_blue1",
|
143
|
+
"wheat4",
|
144
|
+
"grey53",
|
145
|
+
"light_slate_grey",
|
146
|
+
"medium_purple",
|
147
|
+
"light_slate_blue",
|
148
|
+
"yellow4",
|
149
|
+
"dark_sea_green",
|
150
|
+
"light_sky_blue3",
|
151
|
+
"sky_blue2",
|
152
|
+
"chartreuse2",
|
153
|
+
"pale_green3",
|
154
|
+
"dark_slate_gray3",
|
155
|
+
"sky_blue1",
|
156
|
+
"chartreuse1",
|
157
|
+
"light_green",
|
158
|
+
"aquamarine1",
|
159
|
+
"dark_slate_gray1",
|
160
|
+
"deep_pink4",
|
161
|
+
"medium_violet_red",
|
162
|
+
"dark_violet",
|
163
|
+
"purple",
|
164
|
+
"medium_orchid3",
|
165
|
+
"medium_orchid",
|
166
|
+
"dark_goldenrod",
|
167
|
+
"rosy_brown",
|
168
|
+
"grey63",
|
169
|
+
"medium_purple2",
|
170
|
+
"medium_purple1",
|
171
|
+
"dark_khaki",
|
172
|
+
"navajo_white3",
|
173
|
+
"grey69",
|
174
|
+
"light_steel_blue3",
|
175
|
+
"light_steel_blue",
|
176
|
+
"dark_olive_green3",
|
177
|
+
"dark_sea_green3",
|
178
|
+
"light_cyan3",
|
179
|
+
"light_sky_blue1",
|
180
|
+
"green_yellow",
|
181
|
+
"dark_olive_green2",
|
182
|
+
"pale_green1",
|
183
|
+
"dark_sea_green2",
|
184
|
+
"pale_turquoise1",
|
185
|
+
"red3",
|
186
|
+
"deep_pink3",
|
187
|
+
"magenta3",
|
188
|
+
"dark_orange3",
|
189
|
+
"indian_red",
|
190
|
+
"hot_pink3",
|
191
|
+
"hot_pink2",
|
192
|
+
"orchid",
|
193
|
+
"orange3",
|
194
|
+
"light_salmon3",
|
195
|
+
"light_pink3",
|
196
|
+
"pink3",
|
197
|
+
"plum3",
|
198
|
+
"violet",
|
199
|
+
"gold3",
|
200
|
+
"light_goldenrod3",
|
201
|
+
"tan",
|
202
|
+
"misty_rose3",
|
203
|
+
"thistle3",
|
204
|
+
"plum2",
|
205
|
+
"yellow3",
|
206
|
+
"khaki3",
|
207
|
+
"light_yellow3",
|
208
|
+
"grey84",
|
209
|
+
"light_steel_blue1",
|
210
|
+
"yellow2",
|
211
|
+
"dark_olive_green1",
|
212
|
+
"dark_sea_green1",
|
213
|
+
"honeydew2",
|
214
|
+
"light_cyan1",
|
215
|
+
"red1",
|
216
|
+
"deep_pink2",
|
217
|
+
"deep_pink1",
|
218
|
+
"magenta2",
|
219
|
+
"magenta1",
|
220
|
+
"orange_red1",
|
221
|
+
"indian_red1",
|
222
|
+
"hot_pink",
|
223
|
+
"medium_orchid1",
|
224
|
+
"dark_orange",
|
225
|
+
"salmon1",
|
226
|
+
"light_coral",
|
227
|
+
"pale_violet_red1",
|
228
|
+
"orchid2",
|
229
|
+
"orchid1",
|
230
|
+
"orange1",
|
231
|
+
"sandy_brown",
|
232
|
+
"light_salmon1",
|
233
|
+
"light_pink1",
|
234
|
+
"pink1",
|
235
|
+
"plum1",
|
236
|
+
"gold1",
|
237
|
+
"light_goldenrod2",
|
238
|
+
"navajo_white1",
|
239
|
+
"misty_rose1",
|
240
|
+
"thistle1",
|
241
|
+
"yellow1",
|
242
|
+
"light_goldenrod1",
|
243
|
+
"khaki1",
|
244
|
+
"wheat1",
|
245
|
+
"cornsilk1",
|
246
|
+
"grey100",
|
247
|
+
"grey3",
|
248
|
+
"grey7",
|
249
|
+
"grey11",
|
250
|
+
"grey15",
|
251
|
+
"grey19",
|
252
|
+
"grey23",
|
253
|
+
"grey27",
|
254
|
+
"grey30",
|
255
|
+
"grey35",
|
256
|
+
"grey39",
|
257
|
+
"grey42",
|
258
|
+
"grey46",
|
259
|
+
"grey50",
|
260
|
+
"grey54",
|
261
|
+
"grey58",
|
262
|
+
"grey62",
|
263
|
+
"grey66",
|
264
|
+
"grey70",
|
265
|
+
"grey74",
|
266
|
+
"grey78",
|
267
|
+
"grey82",
|
268
|
+
"grey85",
|
269
|
+
"grey89",
|
270
|
+
"grey93",
|
271
|
+
"default",
|
272
|
+
],
|
273
|
+
)
|
274
|
+
"""Literal helper alias providing type hinting for the various compatible color names
|
275
|
+
within the `rich` library."""
|
276
|
+
|
277
|
+
|
278
|
+
CLIStyleStyleName = TypeAliasType(
|
279
|
+
"CLIStyleStyleName",
|
280
|
+
Literal[
|
281
|
+
"dim",
|
282
|
+
"d",
|
283
|
+
"bold",
|
284
|
+
"b",
|
285
|
+
"italic",
|
286
|
+
"i",
|
287
|
+
"underline",
|
288
|
+
"u",
|
289
|
+
"blink",
|
290
|
+
"blink2",
|
291
|
+
"reverse",
|
292
|
+
"r",
|
293
|
+
"conceal",
|
294
|
+
"c",
|
295
|
+
"strike",
|
296
|
+
"s",
|
297
|
+
"underline2",
|
298
|
+
"uu",
|
299
|
+
"frame",
|
300
|
+
"encircle",
|
301
|
+
"overline",
|
302
|
+
"o",
|
303
|
+
"on",
|
304
|
+
"not",
|
305
|
+
"link",
|
306
|
+
"none",
|
307
|
+
],
|
308
|
+
)
|
309
|
+
"""Literal helper alias providing type hinting for the various compatible
|
310
|
+
style names within the `rich` library."""
|
311
|
+
|
312
|
+
|
313
|
+
CLIStyleBoxName = TypeAliasType(
|
314
|
+
"StyleBoxName",
|
315
|
+
Literal[
|
316
|
+
"ascii",
|
317
|
+
"ascii2",
|
318
|
+
"ascii_double_head",
|
319
|
+
"square",
|
320
|
+
"square_double_head",
|
321
|
+
"minimal",
|
322
|
+
"minimal_heavy_head",
|
323
|
+
"minimal_double_head",
|
324
|
+
"simple",
|
325
|
+
"simple_head",
|
326
|
+
"simple_heavy",
|
327
|
+
"horizontals",
|
328
|
+
"rounded",
|
329
|
+
"heavy",
|
330
|
+
"heavy_edge",
|
331
|
+
"heavy_head",
|
332
|
+
"double",
|
333
|
+
"double_edge",
|
334
|
+
"markdown",
|
335
|
+
],
|
336
|
+
)
|
337
|
+
"""Literal helper alias providing type hinting for the various compatible
|
338
|
+
box names within the `rich` library."""
|
339
|
+
|
340
|
+
|
341
|
+
# ------------------------------------------------------------
|
342
|
+
# 'Exported' (Hinted) Typed
|
343
|
+
|
344
|
+
|
345
|
+
CLIStyleType = TypeAliasType(
|
346
|
+
"CLIStyleType", Union[str | CLIStyleStyleName, CLIStyleColorName]
|
347
|
+
)
|
348
|
+
"""Union helper alias for the accepted inputs within modules
|
349
|
+
that incorporate the `style` parameter within the
|
350
|
+
`hammad` package."""
|
351
|
+
|
352
|
+
|
353
|
+
CLIStyleBackgroundType = TypeAliasType(
|
354
|
+
"CLIStyleBackgroundType", Union[str | CLIStyleBoxName, CLIStyleColorName]
|
355
|
+
)
|
356
|
+
"""Union helper alias for the accepted inputs within modules
|
357
|
+
that incorporate the `bg` parameter within the
|
358
|
+
`hammad` package."""
|