;ò
H8í>c           @   s%  d  Z  d Z d Z d Z d Z d k Z d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ	 d e f d „  ƒ  YZ
 d d f d d f d d f d d f d d f d d f d d f d d f d d f d  d! f d" d# f d$ d% f d& d' f f Z d( „  Z e i d) e i ƒ Z d* „  Z d S(+   s"   Convert to and from Roman numeralss&   Mark Pilgrim (f8dy@diveintopython.org)s   1.4s   8 August 2001sg  Copyright (c) 2001 Mark Pilgrim

This program is part of "Dive Into Python", a free Python tutorial for
experienced programmers.  Visit http://diveintopython.org/ for the
latest version.

This program is free software; you can redistribute it and/or modify
it under the terms of the Python 2.1.1 license, available at
http://www.python.org/2.1.1/license.html
Ns
   RomanErrorc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s:   /mit/golem/arch/share/lib/python2.3/site-packages/roman.pys
   RomanError   s    s   OutOfRangeErrorc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s:   /mit/golem/arch/share/lib/python2.3/site-packages/roman.pys   OutOfRangeError   s    s   NotIntegerErrorc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s:   /mit/golem/arch/share/lib/python2.3/site-packages/roman.pys   NotIntegerError   s    s   InvalidRomanNumeralErrorc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s:   /mit/golem/arch/share/lib/python2.3/site-packages/roman.pys   InvalidRomanNumeralError   s    s   Miè  s   CMi„  s   Diô  s   CDi  s   Cid   s   XCiZ   s   Li2   s   XLi(   s   Xi
   s   IXi	   s   Vi   s   IVi   s   Ii   c         C   sš   d |  j  o
 d j  n o t d ‚ n t |  ƒ |  j o t d ‚ n d } x= t D]5 \ } } x& |  | j o | | 7} |  | 8}  qh WqY W| Sd S(   s    convert integer to Roman numerali    iˆ  s%   number out of range (must be 1..4999)s   decimals can not be converteds    N(   s   ns   OutOfRangeErrors   ints   NotIntegerErrors   results   romanNumeralMaps   numerals   integer(   s   ns   results   integers   numeral(    (    s:   /mit/golem/arch/share/lib/python2.3/site-packages/roman.pys   toRoman(   s       
s8  
    ^                   # beginning of string
    M{0,4}              # thousands - 0 to 4 M's
    (CM|CD|D?C{0,3})    # hundreds - 900 (CM), 400 (CD), 0-300 (0 to 3 C's),
                        #            or 500-800 (D, followed by 0 to 3 C's)
    (XC|XL|L?X{0,3})    # tens - 90 (XC), 40 (XL), 0-30 (0 to 3 X's),
                        #        or 50-80 (L, followed by 0 to 3 X's)
    (IX|IV|V?I{0,3})    # ones - 9 (IX), 4 (IV), 0-3 (0 to 3 I's),
                        #        or 5-8 (V, followed by 0 to 3 I's)
    $                   # end of string
    c         C   s¢   |  o t d ‚ n t i |  ƒ o t d |  ‚ n d } d } xT t D]L \ } } x= |  | | t	 | ƒ !| j o | | 7} | t	 | ƒ 7} qY WqJ W| Sd S(   s    convert Roman numeral to integers   Input can not be blanks   Invalid Roman numeral: %si    N(
   s   ss   InvalidRomanNumeralErrors   romanNumeralPatterns   searchs   results   indexs   romanNumeralMaps   numerals   integers   len(   s   ss   indexs   results   integers   numeral(    (    s:   /mit/golem/arch/share/lib/python2.3/site-packages/roman.pys	   fromRomanC   s       
(   s   __doc__s
   __author__s   __version__s   __date__s   __copyright__s   res	   Exceptions
   RomanErrors   OutOfRangeErrors   NotIntegerErrors   InvalidRomanNumeralErrors   romanNumeralMaps   toRomans   compiles   VERBOSEs   romanNumeralPatterns	   fromRoman(   s   __copyright__s   OutOfRangeErrors   InvalidRomanNumeralErrors
   RomanErrors   NotIntegerErrors   romanNumeralMaps
   __author__s   __date__s   res   toRomans   romanNumeralPatterns   __version__s	   fromRoman(    (    s:   /mit/golem/arch/share/lib/python2.3/site-packages/roman.pys   ?   s   	{	