Ignore:
Timestamp:
Sep 29, 2017, 9:59:40 AM (20 months ago)
Author:
cameron
Message:

Updates for Python 3; some refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/UCD-scripts/casefold.py

    r5642 r5653  
    4242      fold_val = m.group(3)
    4343      if fold_t == 'T':
    44          print "Skipping Turkic entry"
     44         print("Skipping Turkic entry")
    4545         continue  # skip Turkic
    4646      if fold_t == 'F':
     
    4848      else:
    4949          fold_val = int(fold_val, 16)
    50       if fold_value.has_key(codepoint): fold_value[codepoint].append(fold_val)
     50      if codepoint in fold_value: fold_value[codepoint].append(fold_val)
    5151      else: fold_value[codepoint] = [fold_val]
    5252   return (fold_type, fold_value)
     
    8282      for v in folds:
    8383        if not isinstance(v, int): continue # skip nonsimple case folds
    84         if not cl_map.has_key(v): cl_map[v] = [k]
     84        if not v in cl_map: cl_map[v] = [k]
    8585        else: cl_map[v].append(k)
    86         if not cl_map.has_key(k): cl_map[k] = [v]
     86        if not k in cl_map: cl_map[k] = [v]
    8787        else: cl_map[k].append(v)
    8888   newEntries = True
     
    124124         projected = []
    125125         for (cp0, offset) in open_entries:
    126             even_odd_offset_group = (abs(cp - cp0)/ abs(offset)) & 1
     126            even_odd_offset_group = int(abs(cp - cp0)/ abs(offset)) & 1
    127127            if even_odd_offset_group == 0:
    128128               projected_foldcp = cp + offset
Note: See TracChangeset for help on using the changeset viewer.