Skip to content

Commit

Permalink
Convert unicode literals to characters
Browse files Browse the repository at this point in the history
  • Loading branch information
verhovsky committed Jan 16, 2025
1 parent 73c9106 commit 5c8b75a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions babel/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ def time_zones(self) -> localedata.LocaleDataDict:
>>> Locale('en', 'US').time_zones['Europe/London']['long']['daylight']
'British Summer Time'
>>> Locale('en', 'US').time_zones['America/St_Johns']['city']
'St. John\u2019s'
'St. John’s'
"""
return self._data['time_zones']

Expand Down Expand Up @@ -870,7 +870,7 @@ def zone_formats(self) -> localedata.LocaleDataDict:
>>> Locale('en', 'US').zone_formats['fallback']
'%(1)s (%(0)s)'
>>> Locale('pt', 'BR').zone_formats['region']
'Hor\\xe1rio %s'
'Horário %s'
.. versionadded:: 0.9
"""
Expand Down Expand Up @@ -981,7 +981,7 @@ def interval_formats(self) -> localedata.LocaleDataDict:
smallest changing component:
>>> Locale('fi_FI').interval_formats['MEd']['d']
['E d.\u2009\u2013\u2009', 'E d.M.']
['E d.\u2009\u2009', 'E d.M.']
.. seealso::
Expand Down Expand Up @@ -1045,7 +1045,7 @@ def measurement_systems(self) -> localedata.LocaleDataDict:
"""Localized names for various measurement systems.
>>> Locale('fr', 'FR').measurement_systems['US']
'am\\xe9ricain'
'américain'
>>> Locale('en', 'US').measurement_systems['US']
'US'
Expand Down
22 changes: 11 additions & 11 deletions babel/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def get_timezone_location(
>>> tz = get_timezone('Europe/Berlin')
>>> get_timezone_name(tz, locale='de_DE')
'Mitteleurop\\xe4ische Zeit'
'Mitteleuropäische Zeit'
.. versionadded:: 0.9
Expand Down Expand Up @@ -586,9 +586,9 @@ def get_timezone_name(
>>> tz = get_timezone('Europe/Berlin')
>>> get_timezone_name(tz, locale='de_DE')
'Mitteleurop\xe4ische Zeit'
'Mitteleuropäische Zeit'
>>> get_timezone_name(tz, locale='pt_BR')
'Hor\xe1rio da Europa Central'
'Horário da Europa Central'
On the other hand, if the country uses multiple timezones, the city is also
included in the representation:
Expand Down Expand Up @@ -1049,16 +1049,16 @@ def format_interval(
>>> from datetime import date, time
>>> format_interval(date(2016, 1, 15), date(2016, 1, 17), "yMd", locale="fi")
'15.\u201317.1.2016'
'15.–17.1.2016'
>>> format_interval(time(12, 12), time(16, 16), "Hm", locale="en_GB")
'12:12\u201316:16'
'12:12–16:16'
>>> format_interval(time(5, 12), time(16, 16), "hm", locale="en_US")
'5:12\u202fAM\u2009\u20094:16\u202fPM'
>>> format_interval(time(16, 18), time(16, 24), "Hm", locale="it")
'16:18\u201316:24'
'16:18–16:24'
If the start instant equals the end instant, the interval is formatted like the instant.
Expand All @@ -1068,10 +1068,10 @@ def format_interval(
Unknown skeletons fall back to "default" formatting.
>>> format_interval(date(2015, 1, 1), date(2017, 1, 1), "wzq", locale="ja")
'2015/01/01\uff5e2017/01/01'
'2015/01/01~2017/01/01'
>>> format_interval(time(16, 18), time(16, 24), "xxx", locale="ja")
'16:18:00\uff5e16:24:00'
'16:18:00~16:24:00'
>>> format_interval(date(2016, 1, 15), date(2016, 1, 17), "xxx", locale="de")
'15.01.2016\u2009\u200917.01.2016'
Expand Down Expand Up @@ -1884,17 +1884,17 @@ def split_interval_pattern(pattern: str) -> list[str]:
- https://www.unicode.org/reports/tr35/tr35-dates.html#intervalFormats
>>> split_interval_pattern('E d.M. – E d.M.')
['E d.M. \u2013 ', 'E d.M.']
['E d.M. ', 'E d.M.']
>>> split_interval_pattern("Y 'text' Y 'more text'")
["Y 'text '", "Y 'more text'"]
>>> split_interval_pattern('E, MMM d – E')
['E, MMM d \u2013 ', 'E']
['E, MMM d ', 'E']
>>> split_interval_pattern("MMM d")
['MMM d']
>>> split_interval_pattern("y G")
['y G']
>>> split_interval_pattern('MMM d – d')
['MMM d \u2013 ', 'd']
['MMM d ', 'd']
:param pattern: Interval pattern string
:return: list of "subpatterns"
Expand Down
2 changes: 1 addition & 1 deletion babel/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def format_list(
>>> format_list(['apples', 'oranges', 'pears'], locale='en')
'apples, oranges, and pears'
>>> format_list(['apples', 'oranges', 'pears'], locale='zh')
'apples\u3001oranges\u548cpears'
'apples、oranges和pears'
>>> format_list(['omena', 'peruna', 'aplari'], style='or', locale='fi')
'omena, peruna tai aplari'
Expand Down
2 changes: 1 addition & 1 deletion babel/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ def format_percent(
The format pattern can also be specified explicitly:
>>> format_percent(25.1234, '#,##0\u2030', locale='en_US')
'25,123\u2030'
'25,123'
By default the locale is allowed to truncate and round a high-precision
number by forcing its format pattern onto the decimal part. You can bypass
Expand Down
4 changes: 2 additions & 2 deletions docs/dates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,6 @@ display a list of time-zones to the user.
>>> dt = _localize(tz, datetime(2007, 8, 15))
>>> get_timezone_name(dt, locale=Locale.parse('de_DE'))
'Mitteleurop\xe4ische Sommerzeit'
'Mitteleuropäische Sommerzeit'
>>> get_timezone_name(tz, locale=Locale.parse('de_DE'))
'Mitteleurop\xe4ische Zeit'
'Mitteleuropäische Zeit'

0 comments on commit 5c8b75a

Please sign in to comment.