How to use the pyhocon.HOCONConverter function in pyhocon

To help you get started, we’ve selected a few pyhocon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bcbio / bcbio-nextgen / bcbio / cwl / hpc.py View on Github external
def _load_custom_config(run_config):
    """Load custom configuration input HOCON file for cromwell.
    """
    from pyhocon import ConfigFactory, HOCONConverter, ConfigTree
    conf = ConfigFactory.parse_file(run_config)
    out = {}
    if "database" in conf:
        out["database"] = HOCONConverter.to_hocon(ConfigTree({"database": conf.get_config("database")}))
    return out
github stanfordnlp / wge / gtd / log.py View on Github external
def to_str(self, fmt='hocon'):
        return HOCONConverter.convert(self._config_tree, fmt)
github stanfordnlp / wge / gtd / utils.py View on Github external
def to_str(self):
        return HOCONConverter.convert(self._config_tree, 'hocon')
github allegroai / trains-agent / trains_agent / session.py View on Github external
recursive_remove_secrets(config, secret_keys=remove_secret_keys)
        # remove logging.loggers.urllib3.level from the print
        try:
            config['logging']['loggers']['urllib3'].pop('level', None)
        except (KeyError, TypeError, AttributeError):
            pass
        try:
            config['logging'].pop('version', None)
        except (KeyError, TypeError, AttributeError):
            pass
        config = ConfigFactory.from_dict(config)
        self.log.debug("Run by interpreter: %s", sys.executable)
        print(
            "Current configuration (trains_agent v{}, location: {}):\n"
            "----------------------\n{}\n".format(
                self.version, self._config_file, HOCONConverter.convert(config, "properties")
            )
github mandarjoshi90 / coref / util.py View on Github external
def initialize_from_env(eval_test=False):
  if "GPU" in os.environ:
    set_gpus(int(os.environ["GPU"]))

  name = sys.argv[1]
  print("Running experiment: {}".format(name))

  if eval_test:
    config = pyhocon.ConfigFactory.parse_file("test.experiments.conf")[name]
  else:
    config = pyhocon.ConfigFactory.parse_file("experiments.conf")[name]
  config["log_dir"] = mkdirs(os.path.join(config["log_root"], name))

  print(pyhocon.HOCONConverter.convert(config, "hocon"))
  return config
github kentonl / e2e-coref / util.py View on Github external
def initialize_from_env():
  if "GPU" in os.environ:
    set_gpus(int(os.environ["GPU"]))
  else:
    set_gpus()

  name = sys.argv[1]
  print("Running experiment: {}".format(name))

  config = pyhocon.ConfigFactory.parse_file("experiments.conf")[name]
  config["log_dir"] = mkdirs(os.path.join(config["log_root"], name))

  print(pyhocon.HOCONConverter.convert(config, "hocon"))
  return config
github mandarjoshi90 / pair2vec / embeddings / util.py View on Github external
def print_config(config):
    print (pyhocon.HOCONConverter.convert(config, "hocon"))
github stanfordnlp / wge / gtd / utils.py View on Github external
def to_json(self):
        return json.loads(HOCONConverter.convert(self._config_tree, 'json'))