summaryrefslogtreecommitdiff
path: root/python3-babel/import.patch
blob: 4a45de86b5bfd5394701f0a1eab6c48ec546c457 (plain)
    1 From 2a826bb1ad9996a1c1e2d3e86a493d01d7f12c09 Mon Sep 17 00:00:00 2001
    2 From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
    3 Date: Tue, 5 May 2020 21:32:52 +0000
    4 Subject: [PATCH] simplify iteration code in "import_cldr.py"
    5 MIME-Version: 1.0
    6 Content-Type: text/plain; charset=UTF-8
    7 Content-Transfer-Encoding: 8bit
    8 
    9 As Miro Hrončok pointed out we don't need ".iter()" in the script.
   10 ---
   11  scripts/import_cldr.py | 14 +++++++-------
   12  1 file changed, 7 insertions(+), 7 deletions(-)
   13 
   14 diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py
   15 index 2ed3af91..7ea6481a 100755
   16 --- a/scripts/import_cldr.py
   17 +++ b/scripts/import_cldr.py
   18 @@ -598,7 +598,7 @@ def parse_calendar_months(data, calendar):
   19          for width in ctxt.findall('monthWidth'):
   20              width_type = width.attrib['type']
   21              widths = ctxts.setdefault(width_type, {})
   22 -            for elem in width.iter():
   23 +            for elem in width:
   24                  if elem.tag == 'month':
   25                      _import_type_text(widths, elem, int(elem.attrib['type']))
   26                  elif elem.tag == 'alias':
   27 @@ -616,7 +616,7 @@ def parse_calendar_days(data, calendar):
   28          for width in ctxt.findall('dayWidth'):
   29              width_type = width.attrib['type']
   30              widths = ctxts.setdefault(width_type, {})
   31 -            for elem in width.iter():
   32 +            for elem in width:
   33                  if elem.tag == 'day':
   34                      _import_type_text(widths, elem, weekdays[elem.attrib['type']])
   35                  elif elem.tag == 'alias':
   36 @@ -634,7 +634,7 @@ def parse_calendar_quarters(data, calendar):
   37          for width in ctxt.findall('quarterWidth'):
   38              width_type = width.attrib['type']
   39              widths = ctxts.setdefault(width_type, {})
   40 -            for elem in width.iter():
   41 +            for elem in width:
   42                  if elem.tag == 'quarter':
   43                      _import_type_text(widths, elem, int(elem.attrib['type']))
   44                  elif elem.tag == 'alias':
   45 @@ -649,7 +649,7 @@ def parse_calendar_eras(data, calendar):
   46      for width in calendar.findall('eras/*'):
   47          width_type = NAME_MAP[width.tag]
   48          widths = eras.setdefault(width_type, {})
   49 -        for elem in width.iter():
   50 +        for elem in width:
   51              if elem.tag == 'era':
   52                  _import_type_text(widths, elem, type=int(elem.attrib.get('type')))
   53              elif elem.tag == 'alias':
   54 @@ -676,7 +676,7 @@ def parse_calendar_periods(data, calendar):
   55  def parse_calendar_date_formats(data, calendar):
   56      date_formats = data.setdefault('date_formats', {})
   57      for format in calendar.findall('dateFormats'):
   58 -        for elem in format.iter():
   59 +        for elem in format:
   60              if elem.tag == 'dateFormatLength':
   61                  type = elem.attrib.get('type')
   62                  if _should_skip_elem(elem, type, date_formats):
   63 @@ -696,7 +696,7 @@ def parse_calendar_date_formats(data, calendar):
   64  def parse_calendar_time_formats(data, calendar):
   65      time_formats = data.setdefault('time_formats', {})
   66      for format in calendar.findall('timeFormats'):
   67 -        for elem in format.iter():
   68 +        for elem in format:
   69              if elem.tag == 'timeFormatLength':
   70                  type = elem.attrib.get('type')
   71                  if _should_skip_elem(elem, type, time_formats):
   72 @@ -717,7 +717,7 @@ def parse_calendar_datetime_skeletons(data, calendar):
   73      datetime_formats = data.setdefault('datetime_formats', {})
   74      datetime_skeletons = data.setdefault('datetime_skeletons', {})
   75      for format in calendar.findall('dateTimeFormats'):
   76 -        for elem in format.iter():
   77 +        for elem in format:
   78              if elem.tag == 'dateTimeFormatLength':
   79                  type = elem.attrib.get('type')
   80                  if _should_skip_elem(elem, type, datetime_formats):

Generated by cgit