Read the instance settings

@returns {Object} The instance settings
353765
function () {
      var fileContent = self._readFileSync();

      return defaults((fileContent.instances || {})[this._id], self._options.instanceDefaults);
    }
190448
function findUppyInstances () {
  const instances = []
  for (let i = 0; i < localStorage.length; i++) {
    const key = localStorage.key(i)
    if (/^uppyState:/.test(key)) {
      instances.push(key.slice('uppyState:'.length))
    }
  }
  return instances
}
1342229
def readInstances(self, makeGlyphs=True, makeKerning=True, makeInfo=True):
        
        for instanceElement in self.root.findall('.instances/instance'):
            self._readSingleInstanceElement(instanceElement, makeGlyphs=makeGlyphs, makeKerning=makeKerning, makeInfo=makeInfo)
151949
function () {
            var res = this.__resources;
            if (!res) {
                var src = this.$resources;
                if (src) {
                    this.__resources = res = {};
                    for (var itm in src) {
                        if (src.hasOwnProperty(itm)) {
                            res[itm] = this[itm];
                        }
                    }
                }
            }
            return res;
        }
1343885
function getSettings(desktopPath) {
    let settings = {};
    try {
        settings = JSON.parse(
            fs.readFileSync(path.join(desktopPath, 'settings.json'), 'UTF-8')
        );
    } catch (e) {
        return {};
    }
    return settings;
}
1130994
function simple_instance_setters (setters) {
        var stateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'instances';
        var instanceKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';

        // loop over the setter keys and make a mutation for each
        return Object.keys(setters).reduce(function (mutations, name) {

            // attach our new mutation to result
            return Object.assign({}, mutations, defineProperty({}, name, function (state, payload) {
                // find the instance that we're mutating
                var instance = findInstance(state, stateKey, instanceKey, payload);

                if (instance) {
                    var value = findValue(payload, instanceKey);

                    // if the setter name has a dot, then resolve the
                    // state path before feeding our value into it.
                    if (setters[name].indexOf('.') > -1) {
                        var obj = setters[name].split('.');
                        var key = obj.pop();

                        resolveObjectPath(instance, obj)[key] = value;
                    } else {
                        // otherwise, just set the instance state to our value
                        instance[setters[name]] = value;
                    }
                } else {
                    // if the instance wasn't found, let the dev know with a warning
                    console.warn('An instance with an identifier of ' + instanceKey + ' was not found.');
                }
            }));
        }, {});
    }
578506
function(inst) {
                // `can.__reading` makes a note that `id` was just read.
                can.__reading(inst, inst.constructor.id);
                // Use `__get` instead of `attr` for performance. (But that means we have to remember to call `can.__reading`.)
                return inst.__get(inst.constructor.id);
            }
849559
def read_settings(self):
        
        extent = setting('user_extent', None, str)
        if extent:
            extent = QgsGeometry.fromWkt(extent)
            if not extent.isGeosValid():
                extent = None

        crs = setting('user_extent_crs', None, str)
        if crs:
            crs = QgsCoordinateReferenceSystem(crs)
            if not crs.isValid():
                crs = None

        mode = setting('analysis_extents_mode', HAZARD_EXPOSURE_VIEW)
        if crs and extent and mode == HAZARD_EXPOSURE_BOUNDINGBOX:
            self.extent.set_user_extent(extent, crs)

        # It's better to set the show_rubber_bands after setting the user
        # extent.
        self.extent.show_rubber_bands = setting(
            'showRubberBands', False, bool)

        flag = setting('visibleLayersOnlyFlag', True, bool)
        self.show_only_visible_layers_flag = flag

        flag = setting('set_layer_from_title_flag', True, bool)
        self.set_layer_from_title_flag = flag

        self.zoom_to_impact_flag = setting('setZoomToImpactFlag', True, bool)

        # whether exposure layer should be hidden after model completes
        self.hide_exposure_flag = setting('setHideExposureFlag', False, bool)

        # whether to show or not dev only options
        self.developer_mode = setting('developer_mode', False, bool)

        # If we use selected features only
        flag = setting('useSelectedFeaturesOnly', True, bool)
        self.use_selected_features_only = flag
        # We need to re-trigger the aggregation combobox with the new flag.
        index = self.aggregation_layer_combo.currentIndex()
        self.aggregation_layer_combo.setCurrentIndex(index)

        # whether to show or not a custom Logo
        flag = setting('organisation_logo_path', supporters_logo_path(), str)
        self.organisation_logo_path = flag

        # Changed default to False for new users in 3.2 - see #2171
        show_logos_flag = setting(
            'showOrganisationLogoInDockFlag', False, bool)

        # Flag to check valid organization logo
        invalid_logo_size = False
        logo_not_exist = False

        if self.organisation_logo_path:
            dock_width = float(self.width())

            # Dont let the image be more than 100px height
            maximum_height = 100.0  # px
            pixmap = QPixmap(self.organisation_logo_path)
            # it will throw Overflow Error if pixmap.height() == 0
            if pixmap.height() > 0:

                height_ratio = maximum_height / pixmap.height()
                maximum_width = int(pixmap.width() * height_ratio)

                # Don't let the image be more than the dock width wide
                if maximum_width > dock_width:
                    width_ratio = dock_width / float(pixmap.width())
                    maximum_height = int(pixmap.height() * width_ratio)
                    maximum_width = dock_width

                too_high = pixmap.height() > maximum_height
                too_wide = pixmap.width() > dock_width

                if too_wide or too_high:
                    pixmap = pixmap.scaled(
                        maximum_width, maximum_height, Qt.KeepAspectRatio)

                self.organisation_logo.setMaximumWidth(maximum_width)
                # We have manually scaled using logic above
                self.organisation_logo.setScaledContents(False)
                self.organisation_logo.setPixmap(pixmap)
            else:
                # handle zero pixmap height and or nonexistent files
                if not os.path.exists(self.organisation_logo_path):
                    logo_not_exist = True
                else:
                    invalid_logo_size = True

        if (self.organisation_logo_path
                and show_logos_flag
                and not invalid_logo_size
                and not logo_not_exist):
            self._show_organisation_logo()
        else:
            self.organisation_logo.hide()

        # RM: this is a fix for nonexistent organization logo or zero height
        if logo_not_exist:
            # noinspection PyCallByClass
            QMessageBox.warning(
                self, self.tr('InaSAFE %s' % self.inasafe_version),
                self.tr(
                    'The file for organization logo in %s doesn\'t exists. '
                    'Please check in Plugins -> InaSAFE -> Options that your '
                    'paths are still correct and update them if needed.' %
                    self.organisation_logo_path
                ), QMessageBox.Ok)
        if invalid_logo_size:
            # noinspection PyCallByClass
            QMessageBox.warning(
                self,
                self.tr('InaSAFE %s' % self.inasafe_version),
                self.tr(
                    'The file for organization logo has zero height. Please '
                    'provide valid file for organization logo.'
                ), QMessageBox.Ok)
        if logo_not_exist or invalid_logo_size:
            set_setting('organisation_logo_path', supporters_logo_path())
768993
public ConfigSettings read()
	{

		ConfigSettings config = new ConfigSettings(ConfigEnum.IMPORT);

		String name;
		Node node;
		NodeList list = root.getChildNodes();

		int length = list.getLength();
		for (int i = 0; i < length; i++) {
			node = list.item(i);

			name = node.getNodeName().toUpperCase();

			if (name.equals(SECTION_MODE)) {
				parseModeConfig(node, config);
			}
			else if (name.equals(SECTION_EXTERNALS)) {
				parseExternalsConfig(node, config);
			}
			else if (name.equals(SECTION_INPUT)) {
				parseInputConfig(node, config);
			}
			else if (name.equals(SECTION_OUTPUT)) {
				parseOutputConfig(node, config);
			}
			else if (name.equals(SECTION_CACHE)) {
				parseCacheConfig(node, config);
			}
			else if (name.equals(SECTION_LOGGING)) {
				parseLoggingConfig(node, config);
			}
			else if (name.equals(SECTION_DEBUG)) {
				parseDebugConfig(node, config);
			}
			else if (name.equals(SECTION_FILTER)) {
				parseFilterConfig(node, config);
			}
		}

		return config;
	}
628216
function read(context) {
    const projectRoot = getProjectRoot(context);
    const configXml = getConfigXml(projectRoot);
    const branchXml = getBranchXml(configXml);
    const branchPreferences = getBranchPreferences(
      context,
      configXml,
      branchXml
    );

    validateBranchPreferences(branchPreferences);

    return branchPreferences;
  }
199876
function readTemplate() {
    return fs.readFileSync(path.resolve.apply(null, [__dirname, settings.paths.templates, ...arguments]), 'utf8');
}
92527
function(){
            this._configs = this._configs;
            var keys = [], key;

            for (key in this._configs) {
                if ( Lang.hasOwnProperty(this._configs, key) && 
                        !Lang.isUndefined(this._configs[key]) ) {
                    keys[keys.length] = key;
                }
            }
            
            return keys;
        }
139096
function() {
        var a  = storage.getItem(this.key)
        if (a) {
          a = JSON.parse(a)
        }
        if (a === null) storage.setItem(this.key, JSON.stringify([])) // lazy init
        return JSON.parse(storage.getItem(this.key))
      }
677314
function() {
    var data   = {};

    if (this.data && !isObject(this.data)) {
      return this.data;
    }

    // TODO - don't do this yet until virt properties are checked
    // var keys   = Object.keys(this);
    var keys = Object.keys(this.data ? this.data : this);

    for (var i = 0, n = keys.length; i < n; i++) {
      var key = keys[i];

      if (key in this.constructor.prototype || key.charCodeAt(0) === 95) {
        continue;
      }

      data[key] = this[key];
    }

    return data;
  }
1313726
def read_instances(self):
        
        logger.debug('Reading instances from: %s', self.instances_path)
        if os.path.exists(self.instances_path):
            with open(self.instances_path, 'r') as f:
                list_ = yaml.load(f.read())
                self.cluster = Cluster.from_list(list_, settings=self.settings)
627195
function _getConfig() {
        var copy = {},
            property;

        for (property in _config) {
            if (_config.hasOwnProperty(property)) {
                copy[property] = _config[property];
            }
        }
 
        return copy;
    }
541101
async function onUIGetSettingsSchema(schemaJson, curSettings) {
    const readJSON = (basename) => {
        return JSON.parse(pi.pluginfs.readFileSync(basename).toString());
    };
    const schemaDefaultJson = readJSON('settings_schema_default.json');
    const schemaWlanJson = readJSON('settings_schema_wlan.json');
    if (!curSettings) curSettings
        = {webapi:{api_filter:{}},mqtt:{},network:{}};

    let setProp = {};// schema_json.properties;
    // API Filters settings are not implemented yet
    let filters = localStorage.getItem('API_FILTERS'
        ,{clientA:{filter:''},clientB:{filter:''},clientC:{filter:''}}); // Sample clients
    for( let clname in filters ){
        setProp[clname] = {
            title: clname+' client allowed path in regexp',
            type: 'string',
        };
        let filter = filters[clname].filter;

        if (filter != null) {
            setProp[clname].default = filter;
        }

        curSettings.webapi.api_filter[clname] = filter;
    }
    schemaJson.properties.webapi.properties.api_filter.properties = setProp;


    return listNetInterfaces().then(([interfaces, bWlanExist]) => {
        let curInterf;
        let curAp;
        if (typeof curSettings.network.interfaces == 'object') {
            for (let k of Object.keys(curSettings.network.interfaces)) {
                curInterf = k;
                if (k.indexOf('wlan')==0) {
                    curAp = curSettings.network.interfaces[k].apname;
                }
            }
        }

        // Previously set interface does not exist any more..
        if (curInterf != undefined && interfaces.indexOf(curInterf)<0) {
            log(`Previously set interface ${curInterf} does not exist now`);
            interfaces.unshift(curInterf);
        }

        interfaces.forEach((interf)=>{
            let prop = {};

            prop[interf] = (interf.indexOf('wlan')==0 ?
                schemaWlanJson : schemaDefaultJson);

            schemaJson.properties.network.properties.interfaces.oneOf.push({
                title: interf,
                type: 'object',
                additionalProperties: false,
                properties: prop,
            });
        });

        if (schemaJson.properties.network.properties.interfaces.oneOf.length==0) {
            throw new Error({error: 'No network available.'});
        }

        if (!bWlanExist) {
            return schemaJson;
        }

        return scanWiFi().then((aps) => {
            const enumap = schemaWlanJson.properties.apname.enum;
            for (const ap of aps) {
                enumap.push(ap);
            }
            if (enumap.length == 0) {
                log('No valid Wifi IP found.');
            }
            if (curAp !=undefined && enumap.indexOf(curAp)<0) {
                log(`Previously set AP ${curAp} is invisible now`);
                enumap.unshift(curAp);
            }
            return schemaJson;
        });
    }).catch((err) => {
        //console.error('err:'+JSON.stringify(err));
        delete schemaJson.properties.network.properties.interfaces;
        delete schemaJson.properties.network.properties.detail;
        delete schemaJson.properties.network.properties.root_passwd;
        /* eslint-disable max-len */
        schemaJson.properties.network.properties.network_settings = {
            type: 'object',
            description:
`nmcli should be installed to setup network configuration. Execute

"$ sudo apt-get install network-manager"

or

"$ sudo yum install NetworkManager"

Also, you need to free your network devices from existing framework by, for example, edit /etc/network/interfaces to contain only two lines:

"auto lo",
"iface lo inet loopback"

and reboot. In addition, you may want to uninstall dhcpcd5 (if exist) by

"$ sudo apt-get purge dhcpcd5"`,
        };
        /* eslint-enable max-len */
        return schemaJson;
    });
}