<s> import shared <EOL> import ConfigParser <EOL> import sys <EOL> import os <EOL> import locale <EOL> import random <EOL> import string <EOL> import platform <EOL> from distutils . version import StrictVersion <EOL> from namecoin import ensureNamecoinOptions <EOL> storeConfigFilesInSameDirectoryAsProgramByDefault = False <EOL> def loadConfig ( ) : <EOL> if shared . appdata : <EOL> shared . config . read ( shared . appdata + '<STR_LIT>' ) <EOL> try : <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> print '<STR_LIT>' + shared . appdata <EOL> needToCreateKeysFile = False <EOL> except : <EOL> needToCreateKeysFile = True <EOL> else : <EOL> shared . config . read ( '<STR_LIT>' ) <EOL> try : <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> print '<STR_LIT>' <EOL> needToCreateKeysFile = False <EOL> shared . appdata = '<STR_LIT>' <EOL> except : <EOL> shared . appdata = shared . lookupAppdataFolder ( ) <EOL> shared . config . read ( shared . appdata + '<STR_LIT>' ) <EOL> try : <EOL> shared . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> print '<STR_LIT>' , shared . appdata <EOL> needToCreateKeysFile = False <EOL> except : <EOL> needToCreateKeysFile = True <EOL> if needToCreateKeysFile : <EOL> shared . config . add_section ( '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT:port>' , '<STR_LIT>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> if '<STR_LIT>' in sys . platform : <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> else : <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:true>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:true>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:none>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:localhost>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> shared . networkDefaultProofOfWorkNonceTrialsPerByte * <NUM_LIT:2> ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , str ( <EOL> shared . networkDefaultPayloadLengthExtraBytes ) ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:false>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:0>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:0>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:true>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:True>' ) <EOL> shared . config . set ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' . join ( random . choice ( "<STR_LIT>" ) for x in range ( <NUM_LIT:12> ) ) ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> shared . config . set ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> ensureNamecoinOptions ( ) <EOL> if storeConfigFilesInSameDirectoryAsProgramByDefault : <EOL> shared . appdata = '<STR_LIT>' <EOL> print '<STR_LIT>' <EOL> else : <EOL> print '<STR_LIT>' , shared . appdata <EOL> if not os . path . exists ( shared . appdata ) : <EOL> os . makedirs ( shared . appdata ) <EOL> if not sys . platform . startswith ( '<STR_LIT>' ) : <EOL> os . umask ( <NUM_LIT> ) <EOL> with open ( shared . appdata + '<STR_LIT>' , '<STR_LIT:wb>' ) as configfile : <EOL> shared . config . write ( configfile ) <EOL> def isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections ( ) : <EOL> try : <EOL> VER_THIS = StrictVersion ( platform . version ( ) ) <EOL> if sys . platform [ <NUM_LIT:0> : <NUM_LIT:3> ] == "<STR_LIT>" : <EOL> return StrictVersion ( "<STR_LIT>" ) <= VER_THIS and StrictVersion ( "<STR_LIT>" ) >= VER_THIS <EOL> return False <EOL> except Exception as err : <EOL> print '<STR_LIT>' , err <EOL> return False </s>
