contrib/python3-babel/import.patch

81 lines
3.7 KiB
Diff

From 2a826bb1ad9996a1c1e2d3e86a493d01d7f12c09 Mon Sep 17 00:00:00 2001
From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
Date: Tue, 5 May 2020 21:32:52 +0000
Subject: [PATCH] simplify iteration code in "import_cldr.py"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As Miro Hrončok pointed out we don't need ".iter()" in the script.
---
scripts/import_cldr.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py
index 2ed3af91..7ea6481a 100755
--- a/scripts/import_cldr.py
+++ b/scripts/import_cldr.py
@@ -598,7 +598,7 @@ def parse_calendar_months(data, calendar):
for width in ctxt.findall('monthWidth'):
width_type = width.attrib['type']
widths = ctxts.setdefault(width_type, {})
- for elem in width.iter():
+ for elem in width:
if elem.tag == 'month':
_import_type_text(widths, elem, int(elem.attrib['type']))
elif elem.tag == 'alias':
@@ -616,7 +616,7 @@ def parse_calendar_days(data, calendar):
for width in ctxt.findall('dayWidth'):
width_type = width.attrib['type']
widths = ctxts.setdefault(width_type, {})
- for elem in width.iter():
+ for elem in width:
if elem.tag == 'day':
_import_type_text(widths, elem, weekdays[elem.attrib['type']])
elif elem.tag == 'alias':
@@ -634,7 +634,7 @@ def parse_calendar_quarters(data, calendar):
for width in ctxt.findall('quarterWidth'):
width_type = width.attrib['type']
widths = ctxts.setdefault(width_type, {})
- for elem in width.iter():
+ for elem in width:
if elem.tag == 'quarter':
_import_type_text(widths, elem, int(elem.attrib['type']))
elif elem.tag == 'alias':
@@ -649,7 +649,7 @@ def parse_calendar_eras(data, calendar):
for width in calendar.findall('eras/*'):
width_type = NAME_MAP[width.tag]
widths = eras.setdefault(width_type, {})
- for elem in width.iter():
+ for elem in width:
if elem.tag == 'era':
_import_type_text(widths, elem, type=int(elem.attrib.get('type')))
elif elem.tag == 'alias':
@@ -676,7 +676,7 @@ def parse_calendar_periods(data, calendar):
def parse_calendar_date_formats(data, calendar):
date_formats = data.setdefault('date_formats', {})
for format in calendar.findall('dateFormats'):
- for elem in format.iter():
+ for elem in format:
if elem.tag == 'dateFormatLength':
type = elem.attrib.get('type')
if _should_skip_elem(elem, type, date_formats):
@@ -696,7 +696,7 @@ def parse_calendar_date_formats(data, calendar):
def parse_calendar_time_formats(data, calendar):
time_formats = data.setdefault('time_formats', {})
for format in calendar.findall('timeFormats'):
- for elem in format.iter():
+ for elem in format:
if elem.tag == 'timeFormatLength':
type = elem.attrib.get('type')
if _should_skip_elem(elem, type, time_formats):
@@ -717,7 +717,7 @@ def parse_calendar_datetime_skeletons(data, calendar):
datetime_formats = data.setdefault('datetime_formats', {})
datetime_skeletons = data.setdefault('datetime_skeletons', {})
for format in calendar.findall('dateTimeFormats'):
- for elem in format.iter():
+ for elem in format:
if elem.tag == 'dateTimeFormatLength':
type = elem.attrib.get('type')
if _should_skip_elem(elem, type, datetime_formats):