db2a9d3a62e36db12066c980d180377fffb31fcc,deploy/rule_generator/rule_generator.py,,run,#,38

Before Change


  
  project_configs, global_config = load_all_project_configs(config_path)

  for generator in SCANNER_RULE_GENERATORS:
    rules = generator.generate_rules(project_configs, global_config)
    write_yaml_config(rules, output_dir, generator.config_file_name())


def read_yaml_config(path):
  Reads a YAML file and return a dictionary of its contents.
  with open(path) as input_file:
    data = input_file.read()

After Change


    ValueError: If no output_path given AND no forseti config in the
      deployment_config.
  
  if not output_path:
    output_path = deployment_config.get(
        "overall").get("generated_fields").get("forseti_server_bucket")
    if not output_path:
      raise ValueError(
          ("Must provide an output path or set the "forseti_server_bucket" "
           "field in the overall generated_fields"))

  if output_path.startswith("gs://"):
    // output path is a GCS bucket
    with tempfile.TemporaryDirectory() as tmp_dir:
      _write_rules(deployment_config, tmp_dir)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: GoogleCloudPlatform/healthcare
Commit Name: db2a9d3a62e36db12066c980d180377fffb31fcc
Time: 2018-11-29
Author: noreply@google.com
File Name: deploy/rule_generator/rule_generator.py
Class Name:
Method Name: run


Project Name: scikit-optimize/scikit-optimize
Commit Name: 544875dd8a7fea49a86e5623d37274159b4ba7b5
Time: 2017-01-10
Author: betatim@gmail.com
File Name: skopt/optimizer/base.py
Class Name:
Method Name: base_minimize


Project Name: scikit-optimize/scikit-optimize
Commit Name: 4af750bec058da0cf5d4a3245a443549b9d7fd33
Time: 2016-04-05
Author: manojkumarsivaraj334@gmail.com
File Name: skopt/dummy_opt.py
Class Name:
Method Name: dummy_minimize