Reads result map from file
552835
public function readMap()
    {
        $fileData = include $this->file;
        $this->map = !is_array($fileData) ? $this->map : $fileData;
    }
1225984
def get_label_map(opts):
    '''  '''
    result = {}
    try:  # get labels from filesystem
        for entry in os.scandir(diskdir):
            if entry.name.startswith('.'):
                continue
            if islink(entry.path):
                target = os.readlink(entry.path)
            else:
                target = entry.path
            result[target] = entry.name
        if opts.debug:
            print('\n\nlabel_map:', result)
    except FileNotFoundError:
        pass

    return result
291620
def dump_map(file: TextIO = sys.stdout) -> None:
    
    pp = pprint.PrettyPrinter(indent=4, stream=file)
    print("Type map: ", file=file)
    pp.pprint(TYPE_MAP)
820287
public static Map<String, String> getContentMap(File file, String separator) throws IOException {
    List<String> content = getContentLines(file);
    Map<String, String> map = new LinkedHashMap<String, String>();
      
    for (String line : content) {
      String[] spl = line.split(separator);
      if (line.trim().length() > 0) {
        map.put(spl[0], (spl.length > 1 ? spl[1] : ""));
      }
    }
    
    return map;
  }
592234
private static LineMap parseSmap(ReadStreamOld is)
    throws IOException
  {
    String smap = is.readln();

    if (! smap.equals("SMAP"))
      throw new IOException(L.l("Illegal header"));
      

    String outputFile = is.readln().trim();
    String defaultStratum = is.readln().trim();

    String stratum = defaultStratum;
    HashMap<String,String> fileMap = new HashMap<String,String>();

    LineMap lineMap = new LineMap(outputFile);
      
    loop:
    while (true) {
      int ch = is.read();

      if (ch < 0)
        break;

      if (ch != '*')
        throw new IOException(L.l("unexpected character '{0}'",
                                  String.valueOf((char) ch)));

      int code = is.read();
      String value = is.readln();

      switch (code) {
      case 'E':
        break loop;

      case 'S':
        stratum = value.trim();
        break;

      case 'F':
        while ((ch = is.read()) > 0 && ch != '*') {
          if (ch == '+') {
            String first = is.readln().trim();
            String second = is.readln().trim();

            int p = first.indexOf(' ');
            String key = first.substring(0, p);
            String file = first.substring(p + 1).trim();

            if (fileMap.size() == 0)
              fileMap.put("", second);

            fileMap.put(key, second);
          }
          else {
            String first = is.readln().trim();

            int p = first.indexOf(' ');
            String key = first.substring(0, p);
            String file = first.substring(p + 1).trim();

            if (fileMap.size() == 0)
              fileMap.put("", file);

            fileMap.put(key, file);
          }
        }
        if (ch == '*')
          is.unread();
        break;

      case 'L':
        while ((ch = is.read()) != '*' && ch > 0) {
          is.unread();

          String line = is.readln().trim();

          addMap(line, fileMap, lineMap);
        }
        if (ch == '*')
          is.unread();
        break;

      default:
        while ((ch = is.read()) != '*') {
          is.readln();
        }
        if (ch == '*')
          is.unread();
        break;
      }
    }
    
    
    return lineMap;
  }
1260435
@Override
    protected HashMap readFile(HashMap brMap) throws IOException {
        HashMap ret = new HashMap();
        ArrayList<HashMap> files = readDailyData(brMap, new HashMap());
//        compressData(files);
        ret.put("weathers", files);

        return ret;
    }
546233
public static void readAbbrList(String dataFile, Map map) throws IOException {
		BufferedReader fin = new BufferedReader(new FileReader(dataFile));
		
		String line;
		while ((line = fin.readLine()) != null) {
		    StringTokenizer strTok = new StringTokenizer(line, " \t\r\n");
		    
		    if (strTok.countTokens() <= 0) {
			continue;
		    } 
		    
		    String token = strTok.nextToken();
		    
		    map.put(token.toLowerCase(), token.toLowerCase());
		}
    }
800525
def get_label_map(opts):
    '''  '''
    results = {}
    try:
        for entry in os.scandir(diskdir):
            target = normpath(join(diskdir, os.readlink(entry.path)))
            decoded_name = entry.name.encode('utf8').decode('unicode_escape')
            results[target] = decoded_name
        if opts.debug:
            print('\n\nlabel_map:', results)
    except FileNotFoundError:
        pass
    return results
960939
@Override
    protected HashMap readFile(HashMap brMap) throws IOException {

        HashMap ret = new HashMap();
        ArrayList<HashMap> expArr = new ArrayList<HashMap>();
        HashMap<String, HashMap> files = readObvData(brMap);
//        compressData(file);
        ArrayList<HashMap> obvData;
        HashMap obv;
        HashMap expData;

        for (String exname : files.keySet()) {
            obvData = (ArrayList) files.get(exname).get(obvDataKey);
            for (HashMap obvSub : obvData) {
                expData = new HashMap();
                obv = new HashMap();
                copyItem(expData, files.get(exname), "exname");
                copyItem(expData, files.get(exname), "crid");
                copyItem(expData, files.get(exname), "local_name");
                expData.put(jsonKey, obv);
                obv.put(obvFileKey, obvSub.get(obvDataKey));
                expArr.add(expData);
            }
        }

        // remove index variables
        ArrayList idNames = new ArrayList();
        idNames.add("trno_t");
        removeIndex(expArr, idNames);
        ret.put("experiments", expArr);

        return ret;
    }
1059157
def load(self, filename):
        """"""
        LOGGER.info("Loading result from '%s'.", filename)
        if filename.endswith(".gz"):
            with gzip.open(filename, "rb") as file_handle:
                result = MemoteResult(
                    json.loads(file_handle.read().decode("utf-8"))
                )
        else:
            with open(filename, "r", encoding="utf-8") as file_handle:
                result = MemoteResult(json.load(file_handle))
        # TODO (Moritz Beber): Validate the read-in JSON maybe? Trade-off
        #  between extra time taken and correctness. Maybe we re-visit this
        #  issue when there was a new JSON format version needed.
        return result
458052
def get_mzmlfile_map(self):
        """"""
        cursor = self.get_cursor()
        cursor.execute('SELECT mzmlfile_id, mzmlfilename FROM mzmlfiles')
        return {fn: fnid for fnid, fn in cursor.fetchall()}
641965
def load_map_info(self, map_file):
        
        if self.ensemble_name.upper() == "SSEF":
            proj_dict, grid_dict = read_arps_map_file(map_file)
            self.dx = int(grid_dict["dx"])
            mapping_data = make_proj_grids(proj_dict, grid_dict)
            for m, v in mapping_data.items():
                setattr(self, m, v)
            self.i, self.j = np.indices(self.lon.shape)
            self.proj = get_proj_obj(proj_dict)
        elif self.ensemble_name.upper() in ["NCAR", "NCARSTORM", "HRRR", "VSE", "HREFV2"]:
            proj_dict, grid_dict = read_ncar_map_file(map_file)
            if self.member_name[0:7] == "1km_pbl": # Don't just look at the first 3 characters. You have to differentiate '1km_pbl1' and '1km_on_3km_pbl1'
                grid_dict["dx"] = 1000
                grid_dict["dy"] = 1000
                grid_dict["sw_lon"] = 258.697
                grid_dict["sw_lat"] = 23.999
                grid_dict["ne_lon"] = 282.868269206236
                grid_dict["ne_lat"] = 36.4822338520542 

            self.dx = int(grid_dict["dx"])
            mapping_data = make_proj_grids(proj_dict, grid_dict)
            for m, v in mapping_data.items():
                setattr(self, m, v)
            self.i, self.j = np.indices(self.lon.shape)
            self.proj = get_proj_obj(proj_dict)
938423
def parse_mapping_file(file):
        
        id_map = {}
        if os.path.exists(os.path.join(os.path.dirname(__file__), file)):
            with open(os.path.join(os.path.dirname(__file__), file)) as tsvfile:
                reader = csv.reader(tsvfile, delimiter="\t")
                for row in reader:
                    key = row[0]
                    value = row[1]
                    id_map[key] = value

        return id_map
1128558
def map(self, fn, *seq):
        " "
        "block until done."
        results = Queue()
        args = zip(*seq)
        for seq in args:
            j = SimpleJob(results, fn, seq)
            self.put(j)

        # Aggregate results
        r = []
        for i in range(len(list(args))):
            r.append(results.get())

        return r
1146083
def data(self, run_config):
    """"""
    try:
      return run_config.map_data(self.path)
    except (IOError, OSError) as e:  # Catch both for python 2/3 compatibility.
      if self.download and hasattr(e, "filename"):
        logging.error("Error reading map '%s' from: %s", self.name, e.filename)
        logging.error("Download the map from: %s", self.download)
      raise
1066730
protected void processMap(final FileInfo fi) {
        this.map = fi.uri;
        currentFile = job.tempDirURI.resolve(map);
        ditavalFile = Optional.of(new File(job.tempDir, FILE_NAME_MERGED_DITAVAL))
                .filter(File::exists)
                .map(File::toURI)
                .orElse(null);

        logger.info("Processing " + currentFile);
        final Document doc;
        try {
            logger.debug("Reading " + currentFile);
            doc = builder.parse(new InputSource(currentFile.toString()));
        } catch (final SAXException | IOException e) {
            logger.error("Failed to parse " + currentFile, e);
            return;
        }

        logger.debug("Split branches and generate copy-to");
        splitBranches(doc.getDocumentElement(), Branch.EMPTY);
        logger.debug("Filter map");
        filterBranches(doc.getDocumentElement());
        logger.debug("Rewrite duplicate topic references");
        rewriteDuplicates(doc.getDocumentElement());

        logger.debug("Writing " + currentFile);
        Result result = null;
        try {
            Transformer serializer = TransformerFactory.newInstance().newTransformer();
            result = new StreamResult(currentFile.toString());
            serializer.transform(new DOMSource(doc), result);
        } catch (final TransformerConfigurationException | TransformerFactoryConfigurationError e) {
            throw new RuntimeException(e);
        } catch (final TransformerException e) {
            logger.error("Failed to serialize " + map.toString() + ": " + e.getMessage(), e);
        } finally {
            try {
                close(result);
            } catch (final IOException e) {
                logger.error("Failed to close result stream for " + map.toString() + ": " + e.getMessage(), e);
            }
        }
    }
106338
private Map<String, String> readAsMap(String data) {
        Map<String, String> params = new HashMap<>();

        Arrays.stream(data.split("&")).forEach(arg -> {
            if (StringUtils.isEmpty(arg)) {
                return;
            }
            String[] args = arg.split("=");
            if (args.length == 1) {
                params.put(args[0], null);
            } else {
                params.put(args[0], args[1]);
            }
        });
        return params;
    }