<s> import os <EOL> import tempfile <EOL> try : <EOL> from ConfigParser import SafeConfigParser <EOL> except ImportError : <EOL> from configparser import SafeConfigParser <EOL> from os . path import expanduser <EOL> class PathDefaults ( object ) : <EOL> """<STR_LIT>""" <EOL> @ staticmethod <EOL> def readField ( field ) : <EOL> configFileName = expanduser ( "<STR_LIT>" ) + os . sep + "<STR_LIT>" <EOL> if not os . path . exists ( configFileName ) : <EOL> print ( "<STR_LIT>" + configFileName ) <EOL> defaultConfig = "<STR_LIT>" <EOL> defaultConfig += "<STR_LIT>" + expanduser ( "<STR_LIT>" ) + os . sep + "<STR_LIT:data>" + os . sep + "<STR_LIT:\n>" <EOL> defaultConfig += "<STR_LIT>" + expanduser ( "<STR_LIT>" ) + os . sep + "<STR_LIT>" + os . sep + "<STR_LIT:\n>" <EOL> configFile = open ( configFileName , "<STR_LIT:w>" ) <EOL> configFile . write ( defaultConfig ) <EOL> configFile . close ( ) <EOL> parser = SafeConfigParser ( ) <EOL> parser . read ( configFileName ) <EOL> return parser . get ( '<STR_LIT>' , field ) <EOL> @ staticmethod <EOL> def getSourceDir ( ) : <EOL> """<STR_LIT>""" <EOL> dir = os . path . abspath ( __file__ ) <EOL> dir , head = os . path . split ( dir ) <EOL> dir , head = os . path . split ( dir ) <EOL> return dir <EOL> @ staticmethod <EOL> def getDataDir ( ) : <EOL> """<STR_LIT>""" <EOL> return PathDefaults . readField ( "<STR_LIT:data>" ) <EOL> @ staticmethod <EOL> def getOutputDir ( ) : <EOL> """<STR_LIT>""" <EOL> return PathDefaults . readField ( "<STR_LIT>" ) <EOL> @ staticmethod <EOL> def getTempDir ( ) : <EOL> return tempfile . gettempdir ( ) + os . sep </s>
