Next / Previous / Contents / Shipman's homepage

7.11. indexer: startModule()

This function opens the output Python module isoents.py and writes the introductory block to it.

indexer
# - - -   s t a r t M o d u l e

def startModule():
    '''Create the isoents.py file and write the introductory block.

      [ if isoents.py can be opened new for writing ->
          that file  :=  so opened and filled with the introductory
                         comments
          return that file ]
    '''
    outModule = open(OUT_MODULE_PY, 'w')
    outModule.write(
"""''' isoents.py: Python declarations for ISO-9573 Unicode entities

  Do not edit this file directly.  It is mechanically produced using
  a program described here:
    http://www.nmt.edu/~shipman/soft/isoents/
  This file defines Python constants for each of the Unicode entities
  defined in ISO/IEC TR 9573-13.  Refer to:
    http://www.w3.org/2003/entities/2007xml/unicode.xml
  Each constant defines a one-character Unicode string whose name has
  the form "U_name" where the name is the same as the Unicode entity name,
  except that periods are replaced by underbars, e.g., &b.Omega;
  becomes "U_b_Omega".
'''
""")
    return outModule