<s> """<STR_LIT>""" <EOL> __version__ = '<STR_LIT>' <EOL> import os , subprocess <EOL> import time <EOL> import sys <EOL> import wikipediatools <EOL> import config <EOL> cache = None <EOL> class ParseError ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def getversion ( ) : <EOL> return '<STR_LIT>' % getversiondict ( ) <EOL> def getversiondict ( ) : <EOL> global cache <EOL> if cache : <EOL> return cache <EOL> try : <EOL> ( tag , rev , date ) = getversion_git ( ) <EOL> except Exception , e : <EOL> try : <EOL> ( tag , rev , date ) = getversion_svn ( ) <EOL> except Exception , e : <EOL> try : <EOL> ( tag , rev , date ) = getversion_nightly ( ) <EOL> except Exception , e : <EOL> import wikipedia <EOL> version = wikipedia . __version__ <EOL> if len ( version ) == <NUM_LIT:4> : <EOL> cache = dict ( tag = '<STR_LIT>' , rev = '<STR_LIT>' , date = '<STR_LIT>' ) <EOL> return cache <EOL> id , file , rev , date , ts , author , dollar = version . split ( '<STR_LIT:U+0020>' ) <EOL> tag = '<STR_LIT>' <EOL> date = time . strptime ( '<STR_LIT>' % ( date , ts ) , '<STR_LIT>' ) <EOL> rev += '<STR_LIT>' <EOL> datestring = time . strftime ( '<STR_LIT>' , date ) <EOL> cache = dict ( tag = tag , rev = rev , date = datestring ) <EOL> return cache <EOL> def getversion_svn ( ) : <EOL> entries = open ( os . path . join ( wikipediatools . get_base_dir ( ) , '<STR_LIT>' ) ) <EOL> for i in range ( <NUM_LIT:4> ) : <EOL> entries . readline ( ) <EOL> tag = entries . readline ( ) . strip ( ) <EOL> t = tag . split ( '<STR_LIT>' ) <EOL> t [ <NUM_LIT:1> ] = t [ <NUM_LIT:1> ] . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> tag = '<STR_LIT>' % ( t [ <NUM_LIT:0> ] , t [ <NUM_LIT:1> ] ) <EOL> for i in range ( <NUM_LIT:4> ) : <EOL> entries . readline ( ) <EOL> date = time . strptime ( entries . readline ( ) [ : <NUM_LIT> ] , '<STR_LIT>' ) <EOL> rev = entries . readline ( ) [ : - <NUM_LIT:1> ] <EOL> if not date or not tag or not rev : <EOL> raise ParseError <EOL> return ( tag , rev , date ) <EOL> def getversion_nightly ( ) : <EOL> data = open ( os . path . join ( wikipediatools . get_base_dir ( ) , '<STR_LIT:version>' ) ) <EOL> tag = data . readline ( ) . strip ( ) <EOL> date = time . strptime ( data . readline ( ) [ : <NUM_LIT> ] , '<STR_LIT>' ) <EOL> rev = data . readline ( ) . strip ( ) <EOL> if not date or not tag or not rev : <EOL> raise ParseError <EOL> return ( tag , rev , date ) <EOL> def syscall ( command ) : <EOL> return subprocess . Popen ( command , stdout = subprocess . PIPE , shell = True ) . communicate ( ) [ <NUM_LIT:0> ] . strip ( ) . splitlines ( ) [ <NUM_LIT:0> ] <EOL> def getversion_git ( ) : <EOL> date = time . gmtime ( int ( syscall ( '<STR_LIT>' ) ) ) <EOL> rev = syscall ( '<STR_LIT>' ) <EOL> return ( None , rev , date ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> print '<STR_LIT>' % getversion ( ) <EOL> print '<STR_LIT>' % sys . version <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , config . use_api <EOL> print '<STR_LIT>' , config . use_api_login </s>
