d3c5ba6fa3edaddd4814d3d5b66a18022a35afe4,src/rastervision/rv_config.py,RVConfig,set_tempdir,#Any#,18

Before Change



        // find explicitly set tempdir
        explicit_temp_dir = next(
            iter([
                os.environ.get(k) for k in ["TMPDIR", "TEMP", "TMP"]
                if k in os.environ
            ] + [path, tempfile.tempdir]))
        try:
            // try to create directory
            if not os.path.exists(explicit_temp_dir):
                os.makedirs(explicit_temp_dir, exist_ok=True)
            // can we interact with directory?
            explicit_temp_dir_valid = (
                os.path.isdir(explicit_temp_dir) and Path.touch(
                    Path(os.path.join(explicit_temp_dir, ".can_touch"))))
        except Exception:
            print(
                "Root temporary directory cannot be used: {}. Using root: {}".
                format(explicit_temp_dir, RV_TEMP_DIR))

After Change


        DEFAULT_DIR = "/opt/data/tmp/"

        // Check the various possibilities in order of priority.
        path_array = [path]
        env_array = [
            os.environ.get(k) for k in ["TMPDIR", "TEMP", "TMP"]
            if k in os.environ
        ]
        current_array = [tempfile.tempdir]
        it = iter(path_array + env_array + current_array)
        explicit_temp_dir = next(filter(lambda p: p is not None, it))

        try:
            // Try to create directory
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: azavea/raster-vision
Commit Name: d3c5ba6fa3edaddd4814d3d5b66a18022a35afe4
Time: 2018-10-03
Author: jmcclain@azavea.com
File Name: src/rastervision/rv_config.py
Class Name: RVConfig
Method Name: set_tempdir


Project Name: pantsbuild/pants
Commit Name: 831b005905d3f3dd36269cccf9186d1ee1110858
Time: 2015-07-24
Author: john.sirois@gmail.com
File Name: src/python/pants/backend/python/interpreter_cache.py
Class Name: PythonInterpreterCache
Method Name: _resolve_and_link


Project Name: tensorflow/agents
Commit Name: eff70fcc79aee2af0f4528ef16499c5dce3662e0
Time: 2020-10-02
Author: summeryue@google.com
File Name: tf_agents/experimental/examples/ppo/ppo_learner.py
Class Name: PPOLearner
Method Name: _update_normalizers