³ò
©ÎžFc           @   s/  d  Z  d Z d Z y e Wn d \ Z Z n Xyž d d k Z d d k Z d d k Z d d k Z d d k	 Z	 e i
 i e i
 i e	 i e i ƒ  ƒ d d d	 ƒ ƒ e e e i
 ƒ Z d d
 k l Z l Z Wn1 y e i i d e ƒ Wn e GHn X‚  n Xe i
 i e i d ƒ d Z e i
 i e ƒ d Z e i d ƒ i e ƒ i ƒ  Z d „  Z d „  Z d „  Z d „  Z d „  Z  e! d j ož e Z" e i d Z# e e j oR yD e$ e# ƒ o3 e% d e# d ƒ o e i d Z" e i d Z# n WqÿqÿXn e% d e" e e& e# ƒ ƒ f ƒ p d GHn d S(   s>  Language of the Year, for learning 10 words a day in your LOTY

   Create a subdirectory in $HOME called xxx_vocabulary,
   where xxx is your LOTY; for example german_vocabulary. Put text files
   in it formatted as:
   loty_word<TAB>native_word
   for example:
   Kopf    head
   Ellenbogen      elbow
   Knie    knees.  
    loty - Language of the Year vocabulary tester
    Copyright (C) 2007  John Comeau <jc.unternet.net>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    s7   Not all needed libraries found, upgrade or check path: i   i    iÿÿÿÿNi   t   libt   python(   t   gplt	   jclicenses   %s
s   [0-9A-Za-z]+c          G   s   t  S(   N(   t   False(   t   whatever(    (    s	   ./loty.pyt
   DebugPrint9   s    c          G   s´   |  \ } } t  | ƒ t i j o t | ƒ } n t t d ƒ o | i | ƒ Sn^ d } xP t d t | ƒ ƒ D]9 } | | | } | t | ƒ d j o | | } qo qo W| Sd S(   s   for pythons without str.joint   joint    i    i   N(	   t   typet   typest
   StringTypet   evalt   hasattrt   strR   t   ranget   len(   t   argst   stringt   arrayt   joinedt   index(    (    s	   ./loty.pyR   <   s    & c          G   sg   |  \ } } t  | ƒ p
 d } n t d d ƒ o | i | ƒ Sn  t i t i | ƒ ƒ i | ƒ Sd S(   s   for pythons without str.splitR   t   splitN(   R   t   NoneR   R   t   ret   compilet   escape(   R   R   t   string_to_split(    (    s	   ./loty.pyR   J   s
    c    	      G   sæ   |  d } xÕ | D]Í } t  t i i |  d | ƒ ƒ } t t i | i ƒ  ƒ } | i ƒ  xƒ | D]{ } y | i	 d ƒ \ } } Wn d | GHn X| GHt
 i i d ƒ t
 i i ƒ  i ƒ  } | | j o	 d GHq_ d | GHq_ Wq Wd S(	   s   display and score a testi   i   s   	s*   bad line, maybe missing tab, must edit: %ss   Now type native equivalent: s   Correct!s/   That isn't what my records show, which is: '%s'N(   t   opent   ost   pathR   t   mapR   t   stript	   readlinest   closeR   t   syst   stdoutt   writet   stdint   readline(	   R   t   filest   filenamet   filet   linest   linet   foreignt   nativet   answer(    (    s	   ./loty.pyt   testU   s$    
 
 	c          G   sz   t  t i i t i d ƒ d ƒ ƒ i ƒ  i ƒ  } t d | ƒ t i i t i d ƒ d | ƒ } t i i | t	 d ƒ d S(   s   main program, tests user until 10 words are correct

    uses text files under $HOME/<LOTY>_vocabulary
    the LOTY is specified in $HOME/.lotyt   HOMEs   .lotys   processing %ss   %s_vocabularyN(   R   R   R   R   t   getenvt   readR    R   t   walkR0   R   (   R   t   languaget	   directory(    (    s	   ./loty.pyt   lotyi   s    0"t   __main__s   type(%s) == types.FunctionTypei   s   %s%sR   (   i   i    ('   t   __doc__t	   Copyrightt   errormessaget   TrueR   R#   R   R
   R   t   pwdR   t   appendR   t   getpwuidt   geteuidt   reprt   com.jcomeauR   R   t   stderrR%   R   t   argvt   myselft   splitextt   commandR   t   searcht   groupt   originalselfR   R0   R7   t   __name__t   functionR   R   R   t   tuple(    (    (    s	   ./loty.pys   <module>   sD   <5						
"",