Parses the action tileset definitions in the supplied file and puts them into a hash map,
keyed on action name.
490155
public static Map<String, TileSet> parseActionTileSets (File file)
        throws IOException, SAXException
    {
        return parseActionTileSets(new BufferedInputStream(new FileInputStream(file)));
    }
71434
def parse_action(action, parsed):
    
    if action == "list":
        list_env()

    elif action == "new":
        new_env(parsed.environment)

    elif action == "remove":
        remove_env(parsed.environment)

    elif action == "show":
        show_env(parsed.environment)

    elif action == "start":
        start_env(parsed.environment, parsed.path)
701269
private function hashFile(File $file)
    {
        $arr = [];

        foreach ($this->layouts as $layout) {
            if (strpos($layout, '_templates') === false) {
                $layout = '_templates'.DIRECTORY_SEPARATOR.$layout;
            }

            $layoutPathName = $this->sourceDirectory.DIRECTORY_SEPARATOR.$layout.'.phtml';
            if (file_exists($layoutPathName)) {
                array_push($arr, sha1_file($layoutPathName));
            }
        }

        array_push($arr, $file->getLastModified());

        return sha1(implode('.', $arr));
    }
942026
private static PropertyMap getChecksums(final File file, final java.io.File fileOnDisk) throws IOException {

		final PropertyMap propertiesWithChecksums = new PropertyMap();

		Folder parentFolder = file.getParent();
		String checksums = null;

		while (parentFolder != null && checksums == null) {

			checksums    = parentFolder.getEnabledChecksums();
			parentFolder = parentFolder.getParent();
		}

		if (checksums == null) {
			checksums = Settings.DefaultChecksums.getValue();
		}

		// New, very fast xxHash default checksum, will always be calculated
		propertiesWithChecksums.put(StructrApp.key(File.class, "checksum"), FileHelper.getChecksum(fileOnDisk));

		if (StringUtils.contains(checksums, "crc32"))	{
			propertiesWithChecksums.put(StructrApp.key(File.class, "crc32"), FileHelper.getCRC32Checksum(fileOnDisk));
		}

		if (StringUtils.contains(checksums, "md5"))	{
			propertiesWithChecksums.put(StructrApp.key(File.class, "md5"), FileHelper.getMD5Checksum(file));
		}

		if (StringUtils.contains(checksums, "sha1"))	{
			propertiesWithChecksums.put(StructrApp.key(File.class, "sha1"), FileHelper.getSHA1Checksum(file));
		}

		if (StringUtils.contains(checksums, "sha512"))	{
			propertiesWithChecksums.put(StructrApp.key(File.class, "sha512"), FileHelper.getSHA512Checksum(file));
		}

		return propertiesWithChecksums;
	}
1364837
def parse_tile_list(tile_input):
        
        if tile_input is None:
            return None
        if isinstance(tile_input, str):
            tile_list = tile_input.split(',')
        elif isinstance(tile_input, list):
            tile_list = tile_input.copy()
        else:
            raise ValueError('tile_list parameter must be a list of tile names')
        tile_list = [AwsTile.parse_tile_name(tile_name) for tile_name in tile_list]
        return tile_list
643382
function parseTemplates(options) {
  return readFileTree(options.src.templates, options.keys.templates, options);
}
42156
@Override
    public Collection<DependencyInfo> parse(File file) {
        BufferedReader br = null;
        FileReader fr = null;
        Collection<DependencyInfo> dependencyInfos = new LinkedList<>();
        try {
            File[] files = file.listFiles();
            for (File directory : files) {
                File[] packageDirectories = directory.listFiles();
                for (File packageDirectory : packageDirectories) {
                    // parse the package name from package directory
                    // get the start index of package name
                    // package Directory Name for
                    int firstHyphenIndex = packageDirectory.getName().indexOf(Constants.DASH);
                    String packageInfoString = packageDirectory.getName().substring(firstHyphenIndex + 1, packageDirectory.getName().length());
                    // change rpm pattern name to application pattern
                    int lastIndexOfHyphen = packageInfoString.lastIndexOf(Constants.DASH);
                    packageInfoString = packageInfoString.substring(0, lastIndexOfHyphen) + Constants.DOT + packageInfoString.substring(lastIndexOfHyphen + 1);
                    // create dependencyInfo object
                    DependencyInfo dependencyInfo = null;
                    String packVersion = getPackageVersion(packageInfoString);
                    if (packVersion != null) {
                        dependencyInfo = new DependencyInfo(
                                null, MessageFormat.format(RPM_PACKAGE_PATTERN, packageInfoString), packVersion);
                        dependencyInfos.add(dependencyInfo);
                    }
                }
            }
        } catch (Exception e) {
            logger.warn("Failed to parse {} : {}", file, e.getMessage());
        } finally {
            closeStream(br, fr);
        }
        return dependencyInfos;
    }
1324616
private Properties parseFile(File file) throws InvalidDeclarationFileException {
        Properties properties = new Properties();
        InputStream is = null;
        try {
            is = new FileInputStream(file);
            properties.load(is);
        } catch (Exception e) {
            throw new InvalidDeclarationFileException(String.format("Error reading declaration file %s", file.getAbsoluteFile()), e);
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                    LOG.error("IOException thrown while trying to close the declaration file.", e);
                }
            }
        }

        if (!properties.containsKey(Constants.ID)) {
            throw new InvalidDeclarationFileException(String.format("File %s is not a correct declaration, needs to contains an id property", file.getAbsoluteFile()));
        }
        return properties;
    }
1235680
def prepare_key(action, options = {})
      (
        options[:key] ||
        self.activity_key ||
        ((self.class.name.underscore.gsub('/', '_') + "." + action.to_s) if action)
      ).try(:to_s)
    end
604316
private void saveTiles(FileWriting file, int widthInTile, int step, int s) throws IOException
    {
        for (int tx = 0; tx < widthInTile; tx++)
        {
            for (int ty = 0; ty < map.getInTileHeight(); ty++)
            {
                final Tile tile = map.getTile(tx + s * step, ty);
                if (tile != null)
                {
                    saveTile(file, tile);
                }
            }
        }
    }
725173
public void parseController(File file) throws WatchingException{
        ControllerModel<T> controllerModel = new ControllerModel<>();

        //Populate the controller model by visiting the File
        try {
            JavaParser.parse(file).accept(CONTROLLER_VISITOR,controllerModel);
        } catch (ParseException |IOException e) {
            throw new WatchingException("Cannot parse "+file.getName(), e);
        }

        //Call children once the controller has been parsed
        controllerParsed(file, controllerModel);
    }
961500
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
        ResourceBundle bundle)
    {
        try {
            TileSetBundle tsb = BundleUtil.extractBundle(bundle);
            // initialize it and add it to the list
            tsb.init(bundle);
            addBundle(idmap, namemap, tsb);

        } catch (Exception e) {
            log.warning("Unable to load tileset bundle '" + BundleUtil.METADATA_PATH +
                        "' from resource bundle [rbundle=" + bundle + "].", e);
        }
    }
1095878
public Map<ChecksumType, String> calculateJavaScriptHashes(File file) throws WssHashException {
        Map<ChecksumType, String> checksums = new EnumMap<>(ChecksumType.class);
        try {
            long fileLength = file.length();
            if (fileLength >= FILE_MAX_SIZE_THRESHOLD){
                logger.debug("Ignore file {}, ({}): maximum file size  is 2GB", file.getName(), FileUtils.byteCountToDisplaySize(fileLength));
                return checksums;
            }
            checksums = calculateJavaScriptHashes(FileUtils.readFileToByteArray(file));
        } catch (Exception e) {
            throw new WssHashException("Error calculating JavaScript hash: "+ e.getMessage());
        }
        return checksums;
    }
993546
private static Map<String, String> readSyntaxMap(File syntaxMapFile) 
        throws IOException {
        
        Map<String, String> result = new HashMap<String, String>();

        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(syntaxMapFile));
            String line;
            while ((line = reader.readLine()) != null) {
                String trimmed = line.trim();
                if (trimmed.length() > 0) {
                    if (trimmed.charAt(0) != '#') {
                        String[] parts = trimmed.split(",");
                        if (parts.length != 2) {
                            throw new IOException(String.format("Failed to parse line \"%1$s\"",
                                    trimmed));
                        }
                        String partOne = parts[0].trim();
                        String partTwo = parts[1].trim();
                        if (partOne.length() == 0 || partTwo.length() == 0) {
                            throw new IOException(String.format("Failed to parse line \"%1$s\"",
                                    trimmed));
                        }
                        result.put(partOne, partTwo);
                    }
                }
            }
        } finally {
            if (reader != null) {
                reader.close();
            }
        }

        return result;
    }
144261
@Override
    public MapReadResult readMapData(Tile tile) {
        return readMapData(tile, tile, Selector.ALL);
    }
869458
def action(arguments):
    
    # Determine file format for input and output
    source_format = (arguments.source_format or
                     fileformat.from_handle(arguments.source_file))
    output_format = (arguments.output_format or
                     fileformat.from_handle(arguments.output_file))

    # Load the alignment
    with arguments.source_file:
        sequences = SeqIO.parse(
            arguments.source_file,
            source_format,
            alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))

        # Locate primers
        (forward_start, forward_end), (reverse_start, reverse_end) = locate_primers(
            sequences, arguments.forward_primer,
            arguments.reverse_primer, arguments.reverse_complement,
            arguments.max_hamming_distance)

        # Generate slice indexes
        if arguments.include_primers:
            start = forward_start
            end = reverse_end + 1
        else:
            start = forward_end + 1
            end = reverse_start

        # Rewind the input file
        arguments.source_file.seek(0)
        sequences = SeqIO.parse(
            arguments.source_file,
            source_format,
            alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))

        # Apply the transformation
        prune_action = _ACTIONS[arguments.prune_action]
        transformed_sequences = prune_action(sequences, start, end)

        with arguments.output_file:
            SeqIO.write(transformed_sequences, arguments.output_file,
                        output_format)
703458
private Object parseFile(File file, String scharset) {
        Charset charset = scharset==null || scharset.length ()==0 ? StandardCharsets.UTF_8 : Charset.forName ( scharset );

        if (file.length() > 2_000_000) {
            try (Reader reader = Files.newBufferedReader( Classpaths.path(file.toString()), charset )) {
                return parse(reader);
            } catch(IOException ioe) {
                throw new JsonException("Unable to process file: " + file.getPath(), ioe);
            }
        } else {
            try {
                return JsonFactory.create().fromJson ( Files.newBufferedReader( Classpaths.path(file.toString()), charset ) );
            } catch ( IOException e ) {
                throw new JsonException("Unable to process file: " + file.getPath(), e);
            }
        }
    }