Skip to content

Commit 2a826bb

Browse files
FelixSchwarzakx
authored andcommitted
simplify iteration code in "import_cldr.py"
As Miro Hrončok pointed out we don't need ".iter()" in the script.
1 parent 7bdaa28 commit 2a826bb

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

scripts/import_cldr.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def parse_calendar_months(data, calendar):
598598
for width in ctxt.findall('monthWidth'):
599599
width_type = width.attrib['type']
600600
widths = ctxts.setdefault(width_type, {})
601-
for elem in width.iter():
601+
for elem in width:
602602
if elem.tag == 'month':
603603
_import_type_text(widths, elem, int(elem.attrib['type']))
604604
elif elem.tag == 'alias':
@@ -616,7 +616,7 @@ def parse_calendar_days(data, calendar):
616616
for width in ctxt.findall('dayWidth'):
617617
width_type = width.attrib['type']
618618
widths = ctxts.setdefault(width_type, {})
619-
for elem in width.iter():
619+
for elem in width:
620620
if elem.tag == 'day':
621621
_import_type_text(widths, elem, weekdays[elem.attrib['type']])
622622
elif elem.tag == 'alias':
@@ -634,7 +634,7 @@ def parse_calendar_quarters(data, calendar):
634634
for width in ctxt.findall('quarterWidth'):
635635
width_type = width.attrib['type']
636636
widths = ctxts.setdefault(width_type, {})
637-
for elem in width.iter():
637+
for elem in width:
638638
if elem.tag == 'quarter':
639639
_import_type_text(widths, elem, int(elem.attrib['type']))
640640
elif elem.tag == 'alias':
@@ -649,7 +649,7 @@ def parse_calendar_eras(data, calendar):
649649
for width in calendar.findall('eras/*'):
650650
width_type = NAME_MAP[width.tag]
651651
widths = eras.setdefault(width_type, {})
652-
for elem in width.iter():
652+
for elem in width:
653653
if elem.tag == 'era':
654654
_import_type_text(widths, elem, type=int(elem.attrib.get('type')))
655655
elif elem.tag == 'alias':
@@ -676,7 +676,7 @@ def parse_calendar_periods(data, calendar):
676676
def parse_calendar_date_formats(data, calendar):
677677
date_formats = data.setdefault('date_formats', {})
678678
for format in calendar.findall('dateFormats'):
679-
for elem in format.iter():
679+
for elem in format:
680680
if elem.tag == 'dateFormatLength':
681681
type = elem.attrib.get('type')
682682
if _should_skip_elem(elem, type, date_formats):
@@ -696,7 +696,7 @@ def parse_calendar_date_formats(data, calendar):
696696
def parse_calendar_time_formats(data, calendar):
697697
time_formats = data.setdefault('time_formats', {})
698698
for format in calendar.findall('timeFormats'):
699-
for elem in format.iter():
699+
for elem in format:
700700
if elem.tag == 'timeFormatLength':
701701
type = elem.attrib.get('type')
702702
if _should_skip_elem(elem, type, time_formats):
@@ -717,7 +717,7 @@ def parse_calendar_datetime_skeletons(data, calendar):
717717
datetime_formats = data.setdefault('datetime_formats', {})
718718
datetime_skeletons = data.setdefault('datetime_skeletons', {})
719719
for format in calendar.findall('dateTimeFormats'):
720-
for elem in format.iter():
720+
for elem in format:
721721
if elem.tag == 'dateTimeFormatLength':
722722
type = elem.attrib.get('type')
723723
if _should_skip_elem(elem, type, datetime_formats):

0 commit comments

Comments
 (0)