def _load_settings(validate=True):
 settings = {'units': DEFAULT_UNITS, 'icons': DEFAULT_ICONS, 'days': 3, 'version': 2}
 if os.path.exists(settings_file):
  with open(settings_file, 'rt') as sf:
   s = json.load(sf)
   if ('version' not in s):
    _migrate_settings(s)
   settings.update(s)
 if validate:
  if ('service' not in settings):
   raise SetupError('You need to set your weather service', 'Use the "wset service" command.')
  if ('location' not in settings):
   raise SetupError('Missing default location', 'You must specify a default location with the "wset location" command')
 return settings

def _load_settings ( validate = True ) : settings = { 'units' : DEFAULT_UNITS , 'icons' : DEFAULT_ICONS , 'days' : 3 , 'version' : 2 } if os . path . exists ( settings_file ) : with open ( settings_file , 'rt' ) as sf : s = json . load ( sf ) if ( 'version' not in s ) : _migrate_settings ( s ) settings . update ( s ) if validate : if ( 'service' not in settings ) : raise SetupError ( 'You need to set your weather service' , 'Use the "wset service" command.' ) if ( 'location' not in settings ) : raise SetupError ( 'Missing default location' , 'You must specify a default location with the "wset location" command' ) return settings
get an the location and units to use .