icukit 0.1.2__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.
Files changed (71) hide show
  1. icukit/__init__.py +530 -0
  2. icukit/alpha_index.py +279 -0
  3. icukit/bidi.py +245 -0
  4. icukit/breaker.py +370 -0
  5. icukit/calendar.py +179 -0
  6. icukit/cli/__init__.py +5 -0
  7. icukit/cli/__main__.py +7 -0
  8. icukit/cli/base.py +87 -0
  9. icukit/cli/command/__init__.py +59 -0
  10. icukit/cli/command/alpha_index.py +141 -0
  11. icukit/cli/command/bidi.py +176 -0
  12. icukit/cli/command/breaker.py +263 -0
  13. icukit/cli/command/calendar.py +113 -0
  14. icukit/cli/command/collator.py +286 -0
  15. icukit/cli/command/compact.py +100 -0
  16. icukit/cli/command/datetime.py +702 -0
  17. icukit/cli/command/discover.py +215 -0
  18. icukit/cli/command/displayname.py +255 -0
  19. icukit/cli/command/duration.py +243 -0
  20. icukit/cli/command/help_cmd.py +86 -0
  21. icukit/cli/command/idna.py +118 -0
  22. icukit/cli/command/listfmt.py +94 -0
  23. icukit/cli/command/locale.py +757 -0
  24. icukit/cli/command/measure.py +433 -0
  25. icukit/cli/command/message.py +171 -0
  26. icukit/cli/command/parse.py +179 -0
  27. icukit/cli/command/plural.py +221 -0
  28. icukit/cli/command/regex.py +520 -0
  29. icukit/cli/command/region.py +209 -0
  30. icukit/cli/command/script.py +203 -0
  31. icukit/cli/command/search.py +293 -0
  32. icukit/cli/command/sort.py +117 -0
  33. icukit/cli/command/spoof.py +158 -0
  34. icukit/cli/command/timezone.py +160 -0
  35. icukit/cli/command/transliterate.py +391 -0
  36. icukit/cli/command/unicode.py +451 -0
  37. icukit/cli/command_trie.py +116 -0
  38. icukit/cli/locale_helpers.py +87 -0
  39. icukit/cli/logging_setup.py +35 -0
  40. icukit/cli/main.py +235 -0
  41. icukit/cli/output_helpers.py +55 -0
  42. icukit/cli/subcommand_base.py +306 -0
  43. icukit/collator.py +211 -0
  44. icukit/compact.py +91 -0
  45. icukit/datetime.py +657 -0
  46. icukit/discover.py +163 -0
  47. icukit/displayname.py +317 -0
  48. icukit/duration.py +297 -0
  49. icukit/errors.py +151 -0
  50. icukit/formatters.py +209 -0
  51. icukit/idna.py +237 -0
  52. icukit/list_format.py +133 -0
  53. icukit/locale.py +896 -0
  54. icukit/measure.py +601 -0
  55. icukit/message.py +182 -0
  56. icukit/parse.py +217 -0
  57. icukit/plural.py +243 -0
  58. icukit/regex.py +599 -0
  59. icukit/region.py +225 -0
  60. icukit/script.py +281 -0
  61. icukit/search.py +347 -0
  62. icukit/spoof.py +283 -0
  63. icukit/timezone.py +195 -0
  64. icukit/transliterator.py +280 -0
  65. icukit/unicode.py +380 -0
  66. icukit-0.1.2.dist-info/METADATA +168 -0
  67. icukit-0.1.2.dist-info/RECORD +71 -0
  68. icukit-0.1.2.dist-info/WHEEL +5 -0
  69. icukit-0.1.2.dist-info/entry_points.txt +3 -0
  70. icukit-0.1.2.dist-info/licenses/LICENSE +21 -0
  71. icukit-0.1.2.dist-info/top_level.txt +1 -0
icukit/__init__.py ADDED
@@ -0,0 +1,530 @@
1
+ """ICU toolkit for Python.
2
+
3
+ Provides a Pythonic interface to the ICU library for Unicode and
4
+ internationalization support.
5
+ """
6
+
7
+ __version__ = "0.1.0"
8
+
9
+ from .alpha_index import (
10
+ AlphabeticIndex,
11
+ create_index_buckets,
12
+ get_bucket_for_name,
13
+ get_bucket_labels,
14
+ )
15
+ from .bidi import (
16
+ DIRECTION_LTR,
17
+ DIRECTION_MIXED,
18
+ DIRECTION_NEUTRAL,
19
+ DIRECTION_RTL,
20
+ get_base_direction,
21
+ get_bidi_info,
22
+ has_bidi_controls,
23
+ list_bidi_controls,
24
+ strip_bidi_controls,
25
+ )
26
+ from .breaker import (
27
+ BREAK_CHARACTER,
28
+ BREAK_LINE,
29
+ BREAK_SENTENCE,
30
+ BREAK_WORD,
31
+ Breaker,
32
+ break_graphemes,
33
+ break_lines,
34
+ break_sentences,
35
+ break_words,
36
+ )
37
+ from .calendar import get_calendar_info, is_valid_calendar, list_calendars, list_calendars_info
38
+ from .collator import (
39
+ STRENGTH_IDENTICAL,
40
+ STRENGTH_PRIMARY,
41
+ STRENGTH_QUATERNARY,
42
+ STRENGTH_SECONDARY,
43
+ STRENGTH_TERTIARY,
44
+ compare_strings,
45
+ get_collator_info,
46
+ get_sort_key,
47
+ list_collation_types,
48
+ sort_strings,
49
+ )
50
+ from .compact import STYLE_LONG as COMPACT_STYLE_LONG
51
+ from .compact import STYLE_SHORT as COMPACT_STYLE_SHORT
52
+ from .compact import CompactFormatter
53
+ from .datetime import (
54
+ PATTERNS,
55
+ STYLE_FULL,
56
+ STYLE_LONG,
57
+ STYLE_MEDIUM,
58
+ STYLE_NONE,
59
+ STYLE_SHORT,
60
+ WIDTH_ABBREVIATED,
61
+ DateTimeFormatter,
62
+ format_datetime,
63
+ format_relative,
64
+ get_am_pm_strings,
65
+ get_date_symbols,
66
+ get_era_names,
67
+ get_month_names,
68
+ get_weekday_names,
69
+ parse_datetime,
70
+ )
71
+ from .displayname import (
72
+ DisplayNames,
73
+ get_currency_name,
74
+ get_currency_symbol,
75
+ get_language_name,
76
+ get_locale_name,
77
+ get_region_name,
78
+ get_script_name,
79
+ )
80
+ from .duration import WIDTH_NARROW as DURATION_WIDTH_NARROW
81
+ from .duration import WIDTH_SHORT as DURATION_WIDTH_SHORT
82
+ from .duration import WIDTH_WIDE as DURATION_WIDTH_WIDE
83
+ from .duration import DurationFormatter, format_duration, parse_iso_duration
84
+ from .errors import (
85
+ AlphaIndexError,
86
+ BidiError,
87
+ BreakerError,
88
+ CalendarError,
89
+ CollatorError,
90
+ DateTimeError,
91
+ DisplayNameError,
92
+ DurationError,
93
+ FormatError,
94
+ ICUKitError,
95
+ IDNAError,
96
+ ListFormatError,
97
+ LocaleError,
98
+ MeasureError,
99
+ MessageError,
100
+ NormalizationError,
101
+ ParseError,
102
+ PatternError,
103
+ PluralError,
104
+ RegionError,
105
+ ScriptError,
106
+ SearchError,
107
+ SpoofError,
108
+ TimezoneError,
109
+ TransliteratorError,
110
+ )
111
+ from .idna import (
112
+ IDNAConverter,
113
+ idna_decode,
114
+ idna_decode_label,
115
+ idna_encode,
116
+ idna_encode_label,
117
+ is_ascii_domain,
118
+ )
119
+ from .list_format import STYLE_AND, STYLE_OR, STYLE_UNIT, ListFormatter, format_list
120
+ from .locale import (
121
+ COMPACT_LONG,
122
+ COMPACT_SHORT,
123
+ EXEMPLAR_AUXILIARY,
124
+ EXEMPLAR_INDEX,
125
+ EXEMPLAR_PUNCTUATION,
126
+ EXEMPLAR_STANDARD,
127
+ add_likely_subtags,
128
+ canonicalize_locale,
129
+ format_compact,
130
+ format_currency,
131
+ format_number,
132
+ format_ordinal,
133
+ format_percent,
134
+ format_scientific,
135
+ format_spellout,
136
+ get_default_locale,
137
+ get_display_name,
138
+ get_exemplar_characters,
139
+ get_exemplar_info,
140
+ get_language_display_name,
141
+ get_locale_attributes,
142
+ get_locale_extended,
143
+ get_locale_info,
144
+ get_locale_scripts,
145
+ get_number_symbols,
146
+ is_valid_locale,
147
+ list_exemplar_types,
148
+ list_languages,
149
+ list_locales,
150
+ list_locales_info,
151
+ minimize_subtags,
152
+ parse_locale,
153
+ )
154
+ from .measure import (
155
+ WIDTH_NARROW,
156
+ WIDTH_SHORT,
157
+ WIDTH_WIDE,
158
+ MeasureFormatter,
159
+ can_convert,
160
+ convert_units,
161
+ format_measure,
162
+ get_unit_abbreviation,
163
+ get_unit_info,
164
+ get_units_by_type,
165
+ list_unit_types,
166
+ list_units,
167
+ resolve_unit,
168
+ )
169
+ from .message import MessageFormatter, format_message
170
+ from .parse import NumberParser, parse_currency, parse_number, parse_percent
171
+ from .plural import (
172
+ CATEGORY_FEW,
173
+ CATEGORY_MANY,
174
+ CATEGORY_ONE,
175
+ CATEGORY_OTHER,
176
+ CATEGORY_TWO,
177
+ CATEGORY_ZERO,
178
+ TYPE_CARDINAL,
179
+ TYPE_ORDINAL,
180
+ get_ordinal_category,
181
+ get_plural_category,
182
+ get_plural_rules_info,
183
+ list_ordinal_categories,
184
+ list_plural_categories,
185
+ )
186
+ from .regex import (
187
+ CASE_INSENSITIVE,
188
+ COMMENTS,
189
+ DOTALL,
190
+ MULTILINE,
191
+ UnicodeRegex,
192
+ list_unicode_categories,
193
+ list_unicode_properties,
194
+ list_unicode_scripts,
195
+ regex_find,
196
+ regex_replace,
197
+ regex_split,
198
+ )
199
+ from .region import (
200
+ get_contained_regions,
201
+ get_region_info,
202
+ list_region_types,
203
+ list_regions,
204
+ list_regions_info,
205
+ )
206
+ from .script import (
207
+ detect_script,
208
+ detect_scripts,
209
+ get_char_script,
210
+ get_script_info,
211
+ is_cased,
212
+ is_rtl,
213
+ list_scripts,
214
+ list_scripts_info,
215
+ )
216
+ from .search import StringSearcher, search_all, search_count, search_first, search_replace
217
+ from .spoof import (
218
+ CONFUSABLE_MIXED_SCRIPT,
219
+ CONFUSABLE_NONE,
220
+ CONFUSABLE_SINGLE_SCRIPT,
221
+ CONFUSABLE_WHOLE_SCRIPT,
222
+ SpoofChecker,
223
+ are_confusable,
224
+ check_string,
225
+ get_confusable_info,
226
+ get_confusable_type,
227
+ get_skeleton,
228
+ )
229
+ from .timezone import (
230
+ get_equivalent_timezones,
231
+ get_timezone_info,
232
+ get_timezone_offset,
233
+ list_timezones,
234
+ list_timezones_info,
235
+ )
236
+ from .transliterator import (
237
+ CommonTransliterators,
238
+ Transliterator,
239
+ get_transliterator_info,
240
+ list_transliterators,
241
+ list_transliterators_info,
242
+ transliterate,
243
+ )
244
+ from .unicode import (
245
+ NFC,
246
+ NFD,
247
+ NFKC,
248
+ NFKD,
249
+ get_block_characters,
250
+ get_category_characters,
251
+ get_char_category,
252
+ get_char_info,
253
+ get_char_name,
254
+ is_normalized,
255
+ list_blocks,
256
+ list_categories,
257
+ normalize,
258
+ )
259
+
260
+ __all__ = [
261
+ "__version__",
262
+ # Errors
263
+ "ICUKitError",
264
+ "LocaleError",
265
+ "FormatError",
266
+ "ParseError",
267
+ "PatternError",
268
+ "TransliteratorError",
269
+ "ScriptError",
270
+ "NormalizationError",
271
+ "RegionError",
272
+ "SearchError",
273
+ "TimezoneError",
274
+ "CalendarError",
275
+ "CollatorError",
276
+ "BidiError",
277
+ "BreakerError",
278
+ "MessageError",
279
+ "ListFormatError",
280
+ "DateTimeError",
281
+ "MeasureError",
282
+ "SearchError",
283
+ "SpoofError",
284
+ "IDNAError",
285
+ "AlphaIndexError",
286
+ "PluralError",
287
+ "DurationError",
288
+ "DisplayNameError",
289
+ # Measure
290
+ "MeasureFormatter",
291
+ "format_measure",
292
+ "convert_units",
293
+ "can_convert",
294
+ "get_unit_info",
295
+ "get_units_by_type",
296
+ "resolve_unit",
297
+ "get_unit_abbreviation",
298
+ "list_units",
299
+ "list_unit_types",
300
+ "WIDTH_WIDE",
301
+ "WIDTH_SHORT",
302
+ "WIDTH_NARROW",
303
+ # Discover
304
+ "discover_features",
305
+ "search_features",
306
+ "get_api_exports",
307
+ "get_api_info",
308
+ "get_cli_commands",
309
+ # DateTime
310
+ "DateTimeFormatter",
311
+ "format_datetime",
312
+ "format_relative",
313
+ "parse_datetime",
314
+ "STYLE_FULL",
315
+ "STYLE_LONG",
316
+ "STYLE_MEDIUM",
317
+ "STYLE_SHORT",
318
+ "STYLE_NONE",
319
+ "PATTERNS",
320
+ # Date/time symbols
321
+ "WIDTH_ABBREVIATED",
322
+ "get_month_names",
323
+ "get_weekday_names",
324
+ "get_era_names",
325
+ "get_am_pm_strings",
326
+ "get_date_symbols",
327
+ # List Format
328
+ "ListFormatter",
329
+ "format_list",
330
+ "STYLE_AND",
331
+ "STYLE_OR",
332
+ "STYLE_UNIT",
333
+ # Message
334
+ "MessageFormatter",
335
+ "format_message",
336
+ # Breaker
337
+ "Breaker",
338
+ "break_sentences",
339
+ "break_words",
340
+ "break_lines",
341
+ "break_graphemes",
342
+ "BREAK_SENTENCE",
343
+ "BREAK_WORD",
344
+ "BREAK_LINE",
345
+ "BREAK_CHARACTER",
346
+ # Bidi
347
+ "get_base_direction",
348
+ "get_bidi_info",
349
+ "strip_bidi_controls",
350
+ "has_bidi_controls",
351
+ "list_bidi_controls",
352
+ "DIRECTION_LTR",
353
+ "DIRECTION_RTL",
354
+ "DIRECTION_MIXED",
355
+ "DIRECTION_NEUTRAL",
356
+ # Collation
357
+ "sort_strings",
358
+ "compare_strings",
359
+ "get_sort_key",
360
+ "list_collation_types",
361
+ "get_collator_info",
362
+ "STRENGTH_PRIMARY",
363
+ "STRENGTH_SECONDARY",
364
+ "STRENGTH_TERTIARY",
365
+ "STRENGTH_QUATERNARY",
366
+ "STRENGTH_IDENTICAL",
367
+ # Transliteration
368
+ "Transliterator",
369
+ "CommonTransliterators",
370
+ "transliterate",
371
+ "list_transliterators",
372
+ "get_transliterator_info",
373
+ "list_transliterators_info",
374
+ # Regex
375
+ "UnicodeRegex",
376
+ "regex_find",
377
+ "regex_replace",
378
+ "regex_split",
379
+ "list_unicode_properties",
380
+ "list_unicode_categories",
381
+ "list_unicode_scripts",
382
+ "CASE_INSENSITIVE",
383
+ "MULTILINE",
384
+ "DOTALL",
385
+ "COMMENTS",
386
+ # Script
387
+ "detect_script",
388
+ "detect_scripts",
389
+ "get_char_script",
390
+ "get_script_info",
391
+ "is_cased",
392
+ "is_rtl",
393
+ "list_scripts",
394
+ "list_scripts_info",
395
+ # Unicode
396
+ "normalize",
397
+ "is_normalized",
398
+ "get_char_name",
399
+ "get_char_category",
400
+ "get_char_info",
401
+ "list_categories",
402
+ "list_blocks",
403
+ "get_block_characters",
404
+ "get_category_characters",
405
+ "NFC",
406
+ "NFD",
407
+ "NFKC",
408
+ "NFKD",
409
+ # Region
410
+ "list_regions",
411
+ "list_regions_info",
412
+ "get_region_info",
413
+ "get_contained_regions",
414
+ "list_region_types",
415
+ # Search
416
+ "search_all",
417
+ "search_first",
418
+ "search_count",
419
+ "search_replace",
420
+ "StringSearcher",
421
+ # Spoof/Confusables
422
+ "are_confusable",
423
+ "get_confusable_type",
424
+ "get_skeleton",
425
+ "check_string",
426
+ "get_confusable_info",
427
+ "SpoofChecker",
428
+ "CONFUSABLE_NONE",
429
+ "CONFUSABLE_SINGLE_SCRIPT",
430
+ "CONFUSABLE_MIXED_SCRIPT",
431
+ "CONFUSABLE_WHOLE_SCRIPT",
432
+ # IDNA
433
+ "idna_encode",
434
+ "idna_decode",
435
+ "idna_encode_label",
436
+ "idna_decode_label",
437
+ "is_ascii_domain",
438
+ "IDNAConverter",
439
+ # Alphabetic Index
440
+ "create_index_buckets",
441
+ "get_bucket_labels",
442
+ "get_bucket_for_name",
443
+ "AlphabeticIndex",
444
+ # Timezone
445
+ "list_timezones",
446
+ "list_timezones_info",
447
+ "get_timezone_info",
448
+ "get_timezone_offset",
449
+ "get_equivalent_timezones",
450
+ # Calendar
451
+ "list_calendars",
452
+ "list_calendars_info",
453
+ "get_calendar_info",
454
+ "is_valid_calendar",
455
+ # Locale
456
+ "list_locales",
457
+ "list_locales_info",
458
+ "list_languages",
459
+ "parse_locale",
460
+ "get_locale_info",
461
+ "get_locale_attributes",
462
+ "get_locale_scripts",
463
+ "get_locale_extended",
464
+ "add_likely_subtags",
465
+ "minimize_subtags",
466
+ "canonicalize_locale",
467
+ "get_display_name",
468
+ "get_language_display_name",
469
+ "is_valid_locale",
470
+ "get_default_locale",
471
+ # Exemplar characters
472
+ "get_exemplar_characters",
473
+ "get_exemplar_info",
474
+ "list_exemplar_types",
475
+ "EXEMPLAR_STANDARD",
476
+ "EXEMPLAR_AUXILIARY",
477
+ "EXEMPLAR_INDEX",
478
+ "EXEMPLAR_PUNCTUATION",
479
+ # Number symbols
480
+ "get_number_symbols",
481
+ # Number formatting
482
+ "format_number",
483
+ "format_currency",
484
+ "format_percent",
485
+ "format_scientific",
486
+ "format_spellout",
487
+ "format_ordinal",
488
+ "format_compact",
489
+ "COMPACT_SHORT",
490
+ "COMPACT_LONG",
491
+ # Plural
492
+ "get_plural_category",
493
+ "get_ordinal_category",
494
+ "list_plural_categories",
495
+ "list_ordinal_categories",
496
+ "get_plural_rules_info",
497
+ "CATEGORY_ZERO",
498
+ "CATEGORY_ONE",
499
+ "CATEGORY_TWO",
500
+ "CATEGORY_FEW",
501
+ "CATEGORY_MANY",
502
+ "CATEGORY_OTHER",
503
+ "TYPE_CARDINAL",
504
+ "TYPE_ORDINAL",
505
+ # Parse
506
+ "NumberParser",
507
+ "parse_number",
508
+ "parse_currency",
509
+ "parse_percent",
510
+ # Duration
511
+ "DurationFormatter",
512
+ "format_duration",
513
+ "parse_iso_duration",
514
+ "DURATION_WIDTH_WIDE",
515
+ "DURATION_WIDTH_SHORT",
516
+ "DURATION_WIDTH_NARROW",
517
+ # Display Names
518
+ "DisplayNames",
519
+ "get_language_name",
520
+ "get_script_name",
521
+ "get_region_name",
522
+ "get_currency_name",
523
+ "get_currency_symbol",
524
+ "get_locale_name",
525
+ # Compact Numbers
526
+ "CompactFormatter",
527
+ "format_compact",
528
+ "COMPACT_STYLE_SHORT",
529
+ "COMPACT_STYLE_LONG",
530
+ ]