-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: Fix bug extracting meas_date (#10277)
* BUG: Fix bug extracting meas_date * STY: pydocstyle
- Loading branch information
Showing
5 changed files
with
141 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"""Localizations for meas_date extraction.""" | ||
# Authors: Eric Larson <larson.eric.d@gmail.com> | ||
# | ||
# License: BSD-3-Clause | ||
|
||
# This file was generated on 2021/01/31 on an Ubuntu system. | ||
# When getting "unsupported locale setting" on Ubuntu (e.g., with localepurge), | ||
# use "sudo locale-gen de_DE" etc. then "sudo update-locale". | ||
|
||
""" | ||
import datetime | ||
import locale | ||
print('_localized_abbr = {') | ||
for loc in ('en_US.utf8', 'de_DE', 'fr_FR', 'it_IT'): | ||
print(f' {repr(loc)}: {{') | ||
print(' "month": {', end='') | ||
month_abbr = set() | ||
for month in range(1, 13): # Month as locale’s abbreviated name | ||
locale.setlocale(locale.LC_TIME, "en_US.utf8") | ||
dt = datetime.datetime(year=2000, month=month, day=1) | ||
val = dt.strftime("%b").lower() | ||
locale.setlocale(locale.LC_TIME, loc) | ||
key = dt.strftime("%b").lower() | ||
month_abbr.add(key) | ||
print(f'{repr(key)}: {repr(val)}, ', end='') | ||
print('}, # noqa') | ||
print(' "weekday": {', end='') | ||
weekday_abbr = set() | ||
for day in range(1, 8): # Weekday as locale’s abbreviated name. | ||
locale.setlocale(locale.LC_TIME, "en_US.utf8") | ||
dt = datetime.datetime(year=2000, month=1, day=day) | ||
val = dt.strftime("%a").lower() | ||
locale.setlocale(locale.LC_TIME, loc) | ||
key = dt.strftime("%a").lower() | ||
assert key not in weekday_abbr, key | ||
weekday_abbr.add(key) | ||
print(f'{repr(key)}: {repr(val)}, ', end='') | ||
print('}, # noqa') | ||
print(' },') | ||
print('}\n') | ||
""" | ||
|
||
_localized_abbr = { | ||
'en_US.utf8': { | ||
"month": {'jan': 'jan', 'feb': 'feb', 'mar': 'mar', 'apr': 'apr', 'may': 'may', 'jun': 'jun', 'jul': 'jul', 'aug': 'aug', 'sep': 'sep', 'oct': 'oct', 'nov': 'nov', 'dec': 'dec', }, # noqa | ||
"weekday": {'sat': 'sat', 'sun': 'sun', 'mon': 'mon', 'tue': 'tue', 'wed': 'wed', 'thu': 'thu', 'fri': 'fri', }, # noqa | ||
}, | ||
'de_DE': { | ||
"month": {'jan': 'jan', 'feb': 'feb', 'mär': 'mar', 'apr': 'apr', 'mai': 'may', 'jun': 'jun', 'jul': 'jul', 'aug': 'aug', 'sep': 'sep', 'okt': 'oct', 'nov': 'nov', 'dez': 'dec', }, # noqa | ||
"weekday": {'sa': 'sat', 'so': 'sun', 'mo': 'mon', 'di': 'tue', 'mi': 'wed', 'do': 'thu', 'fr': 'fri', }, # noqa | ||
}, | ||
'fr_FR': { | ||
"month": {'janv.': 'jan', 'févr.': 'feb', 'mars': 'mar', 'avril': 'apr', 'mai': 'may', 'juin': 'jun', 'juil.': 'jul', 'août': 'aug', 'sept.': 'sep', 'oct.': 'oct', 'nov.': 'nov', 'déc.': 'dec', }, # noqa | ||
"weekday": {'sam.': 'sat', 'dim.': 'sun', 'lun.': 'mon', 'mar.': 'tue', 'mer.': 'wed', 'jeu.': 'thu', 'ven.': 'fri', }, # noqa | ||
}, | ||
'it_IT': { | ||
"month": {'gen': 'jan', 'feb': 'feb', 'mar': 'mar', 'apr': 'apr', 'mag': 'may', 'giu': 'jun', 'lug': 'jul', 'ago': 'aug', 'set': 'sep', 'ott': 'oct', 'nov': 'nov', 'dic': 'dec', }, # noqa | ||
"weekday": {'sab': 'sat', 'dom': 'sun', 'lun': 'mon', 'mar': 'tue', 'mer': 'wed', 'gio': 'thu', 'ven': 'fri', }, # noqa | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters