REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.66 KB
Close
/opt/alt/python37/lib/python3.7/site-packages/babel/lists.py
Text
Base64
# -*- coding: utf-8 -*- """ babel.lists ~~~~~~~~~~~ Locale dependent formatting of lists. The default locale for the functions in this module is determined by the following environment variables, in that order: * ``LC_ALL``, and * ``LANG`` :copyright: (c) 2015-2021 by the Babel Team. :license: BSD, see LICENSE for more details. """ from babel.core import Locale, default_locale DEFAULT_LOCALE = default_locale() def format_list(lst, style='standard', locale=DEFAULT_LOCALE): """ Format the items in `lst` as a list. >>> format_list(['apples', 'oranges', 'pears'], locale='en') u'apples, oranges, and pears' >>> format_list(['apples', 'oranges', 'pears'], locale='zh') u'apples\u3001oranges\u548cpears' >>> format_list(['omena', 'peruna', 'aplari'], style='or', locale='fi') u'omena, peruna tai aplari' These styles are defined, but not all are necessarily available in all locales. The following text is verbatim from the Unicode TR35-49 spec [1]. * standard: A typical 'and' list for arbitrary placeholders. eg. "January, February, and March" * standard-short: A short version of a 'and' list, suitable for use with short or abbreviated placeholder values. eg. "Jan., Feb., and Mar." * or: A typical 'or' list for arbitrary placeholders. eg. "January, February, or March" * or-short: A short version of an 'or' list. eg. "Jan., Feb., or Mar." * unit: A list suitable for wide units. eg. "3 feet, 7 inches" * unit-short: A list suitable for short units eg. "3 ft, 7 in" * unit-narrow: A list suitable for narrow units, where space on the screen is very limited. eg. "3′ 7″" [1]: https://www.unicode.org/reports/tr35/tr35-49/tr35-general.html#ListPatterns :param lst: a sequence of items to format in to a list :param style: the style to format the list with. See above for description. :param locale: the locale """ locale = Locale.parse(locale) if not lst: return '' if len(lst) == 1: return lst[0] if style not in locale.list_patterns: raise ValueError('Locale %s does not support list formatting style %r (supported are %s)' % ( locale, style, list(sorted(locale.list_patterns)), )) patterns = locale.list_patterns[style] if len(lst) == 2: return patterns['2'].format(*lst) result = patterns['start'].format(lst[0], lst[1]) for elem in lst[2:-1]: result = patterns['middle'].format(result, elem) result = patterns['end'].format(result, lst[-1]) return result
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 3 × Files: 13
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
locale-data
DIR
-
drwxr-xr-x
2024-03-03 23:11:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
localtime
DIR
-
drwxr-xr-x
2024-03-03 23:11:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
messages
DIR
-
drwxr-xr-x
2024-03-03 23:11:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
core.py
36.04 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
dates.py
66.12 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
global.dat
248.46 KB
lrw-r--r--
2021-04-28 19:26:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
languages.py
2.68 KB
lrw-r--r--
2018-07-20 10:31:17
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
lists.py
2.66 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
localedata.py
7.75 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
numbers.py
38.94 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
plural.py
20.81 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
support.py
22.09 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
units.py
11.03 KB
lrw-r--r--
2021-04-28 19:13:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
util.py
7.40 KB
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_compat.py
1.65 KB
lrw-r--r--
2019-02-20 13:12:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
714 B
lrw-r--r--
2021-04-28 19:13:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).