<commit_before>import os
import subprocess
import tempfile

import time

_path_to_commandline_utils = os.path.join(os.path.dirname(__file__), 'command_line_utils')


class Garmin:
    def __init__(self, output_directory, pbf_path, map_description):
        os.makedirs(output_directory, exist_ok=True)

        self.output_directory = output_directory
        self.pbf_path = pbf_path
        self.map_description = map_description
        self.timestamped_outfile_base_name = '{}-{}'.format(
            time.strftime("%Y-%m-%d_%H%M%S"),
            'garmin',
        )

    def create_garmin_export(self):
        self._to_garmin()

    def _to_garmin(self):
        with tempfile.TemporaryDirectory() as tmp_dir:
            tmp_out_dir = os.path.join(tmp_dir, 'garmin')
            config_file_path = self._split(tmp_dir)
            self._produce_garmin(config_file_path, tmp_dir, tmp_out_dir)
            resulting_zip_file_path = self._zip_and_move(tmp_out_dir)

        return resulting_zip_file_path

    def _split(self, workdir):
        _splitter_path = os.path.abspath(os.path.join(_path_to_commandline_utils, 'splitter', 'splitter.jar'))
        subprocess.check_call([
            'java',  # '-Xms32m', '-Xmx4096m',
            '-jar', _splitter_path,
            '--output-dir={0}'.format(workdir),
            '--description={0}'.format(self.map_description),
            self.pbf_path,
        ])
        config_file_path = os.path.join(workdir, 'template.args')<commit_msg>remove now unneeded JVM options<commit_after>import os
import subprocess
import tempfile

import time

_path_to_commandline_utils = os.path.join(os.path.dirname(__file__), 'command_line_utils')


class Garmin:
    def __init__(self, output_directory, pbf_path, map_description):
        os.makedirs(output_directory, exist_ok=True)

        self.output_directory = output_directory
        self.pbf_path = pbf_path
        self.map_description = map_description
        self.timestamped_outfile_base_name = '{}-{}'.format(
            time.strftime("%Y-%m-%d_%H%M%S"),
            'garmin',
        )

    def create_garmin_export(self):
        self._to_garmin()

    def _to_garmin(self):
        with tempfile.TemporaryDirectory() as tmp_dir:
            tmp_out_dir = os.path.join(tmp_dir, 'garmin')
            config_file_path = self._split(tmp_dir)
            self._produce_garmin(config_file_path, tmp_dir, tmp_out_dir)
            resulting_zip_file_path = self._zip_and_move(tmp_out_dir)

        return resulting_zip_file_path

    def _split(self, workdir):
        _splitter_path = os.path.abspath(os.path.join(_path_to_commandline_utils, 'splitter', 'splitter.jar'))
        subprocess.check_call([
            'java',
            '-jar', _splitter_path,
            '--output-dir={0}'.format(workdir),
            '--description={0}'.format(self.map_description),
            self.pbf_path,
        ])
        config_file_path = os.path.join(workdir, 'template.args')
{'fraction_non_alphanumeric': 0.11327731092436975, 'fraction_numerical': 0.0033613445378151263, 'mean_word_length': 2.859922178988327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5998127', 'n_tokens_mistral': 990, 'n_tokens_neox': 971, 'n_words': 141}