Skip to content

Commit 0ca3e6d

Browse files
authored
Merge pull request #1174 from verhovsky: Remove u string prefix from docs
2 parents de44e18 + 17d20c8 commit 0ca3e6d

File tree

18 files changed

+344
-346
lines changed

18 files changed

+344
-346
lines changed

babel/core.py

Lines changed: 62 additions & 62 deletions
Large diffs are not rendered by default.

babel/dates.py

Lines changed: 85 additions & 85 deletions
Large diffs are not rendered by default.

babel/lists.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def format_list(
4444
Format the items in `lst` as a list.
4545
4646
>>> format_list(['apples', 'oranges', 'pears'], locale='en')
47-
u'apples, oranges, and pears'
47+
'apples, oranges, and pears'
4848
>>> format_list(['apples', 'oranges', 'pears'], locale='zh')
49-
u'apples\u3001oranges\u548cpears'
49+
'apples、oranges和pears'
5050
>>> format_list(['omena', 'peruna', 'aplari'], style='or', locale='fi')
51-
u'omena, peruna tai aplari'
51+
'omena, peruna tai aplari'
5252
5353
Not all styles are necessarily available in all locales.
5454
The function will attempt to fall back to replacement styles according to the rules

babel/localedata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def load(name: os.PathLike[str] | str, merge_inherited: bool = True) -> dict[str
125125
126126
>>> d = load('en_US')
127127
>>> d['languages']['sv']
128-
u'Swedish'
128+
'Swedish'
129129
130130
Note that the results are cached, and subsequent requests for the same
131131
locale return the same dictionary:

babel/messages/catalog.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -712,19 +712,19 @@ def __setitem__(self, id: _MessageID, message: Message) -> None:
712712
"""Add or update the message with the specified ID.
713713
714714
>>> catalog = Catalog()
715-
>>> catalog[u'foo'] = Message(u'foo')
716-
>>> catalog[u'foo']
717-
<Message u'foo' (flags: [])>
715+
>>> catalog['foo'] = Message('foo')
716+
>>> catalog['foo']
717+
<Message 'foo' (flags: [])>
718718
719719
If a message with that ID is already in the catalog, it is updated
720720
to include the locations and flags of the new message.
721721
722722
>>> catalog = Catalog()
723-
>>> catalog[u'foo'] = Message(u'foo', locations=[('main.py', 1)])
724-
>>> catalog[u'foo'].locations
723+
>>> catalog['foo'] = Message('foo', locations=[('main.py', 1)])
724+
>>> catalog['foo'].locations
725725
[('main.py', 1)]
726-
>>> catalog[u'foo'] = Message(u'foo', locations=[('utils.py', 5)])
727-
>>> catalog[u'foo'].locations
726+
>>> catalog['foo'] = Message('foo', locations=[('utils.py', 5)])
727+
>>> catalog['foo'].locations
728728
[('main.py', 1), ('utils.py', 5)]
729729
730730
:param id: the message ID
@@ -768,10 +768,10 @@ def add(
768768
"""Add or update the message with the specified ID.
769769
770770
>>> catalog = Catalog()
771-
>>> catalog.add(u'foo')
771+
>>> catalog.add('foo')
772772
<Message ...>
773-
>>> catalog[u'foo']
774-
<Message u'foo' (flags: [])>
773+
>>> catalog['foo']
774+
<Message 'foo' (flags: [])>
775775
776776
This method simply constructs a `Message` object with the given
777777
arguments and invokes `__setitem__` with that object.
@@ -847,11 +847,11 @@ def update(
847847
>>> template.add(('salad', 'salads'), locations=[('util.py', 42)])
848848
<Message ...>
849849
>>> catalog = Catalog(locale='de_DE')
850-
>>> catalog.add('blue', u'blau', locations=[('main.py', 98)])
850+
>>> catalog.add('blue', 'blau', locations=[('main.py', 98)])
851851
<Message ...>
852-
>>> catalog.add('head', u'Kopf', locations=[('util.py', 33)])
852+
>>> catalog.add('head', 'Kopf', locations=[('util.py', 33)])
853853
<Message ...>
854-
>>> catalog.add(('salad', 'salads'), (u'Salat', u'Salate'),
854+
>>> catalog.add(('salad', 'salads'), ('Salat', 'Salate'),
855855
... locations=[('util.py', 38)])
856856
<Message ...>
857857
@@ -866,13 +866,13 @@ def update(
866866
867867
>>> msg2 = catalog['blue']
868868
>>> msg2.string
869-
u'blau'
869+
'blau'
870870
>>> msg2.locations
871871
[('main.py', 100)]
872872
873873
>>> msg3 = catalog['salad']
874874
>>> msg3.string
875-
(u'Salat', u'Salate')
875+
('Salat', 'Salate')
876876
>>> msg3.locations
877877
[('util.py', 42)]
878878

babel/messages/extract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def extract(
403403
>>> from io import BytesIO
404404
>>> for message in extract('python', BytesIO(source)):
405405
... print(message)
406-
(3, u'Hello, world!', [], None)
406+
(3, 'Hello, world!', [], None)
407407
408408
:param method: an extraction method (a callable), or
409409
a string specifying the extraction method (.e.g. "python");

babel/messages/mofile.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def write_mo(fileobj: SupportsWrite[bytes], catalog: Catalog, use_fuzzy: bool =
116116
>>> catalog = Catalog(locale='en_US')
117117
>>> catalog.add('foo', 'Voh')
118118
<Message ...>
119-
>>> catalog.add((u'bar', u'baz'), (u'Bahr', u'Batz'))
119+
>>> catalog.add(('bar', 'baz'), ('Bahr', 'Batz'))
120120
<Message ...>
121121
>>> catalog.add('fuz', 'Futz', flags=['fuzzy'])
122122
<Message ...>
@@ -133,19 +133,19 @@ def write_mo(fileobj: SupportsWrite[bytes], catalog: Catalog, use_fuzzy: bool =
133133
... translations.ugettext = translations.gettext
134134
... translations.ungettext = translations.ngettext
135135
>>> translations.ugettext('foo')
136-
u'Voh'
136+
'Voh'
137137
>>> translations.ungettext('bar', 'baz', 1)
138-
u'Bahr'
138+
'Bahr'
139139
>>> translations.ungettext('bar', 'baz', 2)
140-
u'Batz'
140+
'Batz'
141141
>>> translations.ugettext('fuz')
142-
u'fuz'
142+
'fuz'
143143
>>> translations.ugettext('Fizz')
144-
u'Fizz'
144+
'Fizz'
145145
>>> translations.ugettext('Fuzz')
146-
u'Fuzz'
146+
'Fuzz'
147147
>>> translations.ugettext('Fuzzes')
148-
u'Fuzzes'
148+
'Fuzzes'
149149
150150
:param fileobj: the file-like object to write to
151151
:param catalog: the `Catalog` instance

babel/messages/pofile.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ def read_po(
382382
... print((message.id, message.string))
383383
... print(' ', (message.locations, sorted(list(message.flags))))
384384
... print(' ', (message.user_comments, message.auto_comments))
385-
(u'foo %(name)s', u'quux %(name)s')
386-
([(u'main.py', 1)], [u'fuzzy', u'python-format'])
385+
('foo %(name)s', 'quux %(name)s')
386+
([('main.py', 1)], ['fuzzy', 'python-format'])
387387
([], [])
388-
((u'bar', u'baz'), (u'bar', u'baaz'))
389-
([(u'main.py', 3)], [])
390-
([u'A user comment'], [u'An auto comment'])
388+
(('bar', 'baz'), ('bar', 'baaz'))
389+
([('main.py', 3)], [])
390+
(['A user comment'], ['An auto comment'])
391391
392392
.. versionadded:: 1.0
393393
Added support for explicit charset argument.
@@ -526,10 +526,10 @@ def write_po(
526526
message catalog to the provided file-like object.
527527
528528
>>> catalog = Catalog()
529-
>>> catalog.add(u'foo %(name)s', locations=[('main.py', 1)],
529+
>>> catalog.add('foo %(name)s', locations=[('main.py', 1)],
530530
... flags=('fuzzy',))
531531
<Message...>
532-
>>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)])
532+
>>> catalog.add(('bar', 'baz'), locations=[('main.py', 3)])
533533
<Message...>
534534
>>> from io import BytesIO
535535
>>> buf = BytesIO()

0 commit comments

Comments
 (0)