Python fire.Fire() Examples

The following are 30 code examples of fire.Fire(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module fire , or try the search function .
Example #1
Source File: launch_eval.py    From training with Apache License 2.0 6 votes vote down vote up
def same_run_eval(black_num=0, white_num=0, completions=4):
    """Shorthand to spawn a job matching up two models from the same run,
    identified by their model number """
    if black_num <= 0 or white_num <= 0:
        print("Need real model numbers")
        return

    b = fsdb.get_model(black_num)
    w = fsdb.get_model(white_num)

    b_model_path = os.path.join(fsdb.models_dir(), b)
    w_model_path = os.path.join(fsdb.models_dir(), w)
    flags_path = fsdb.eval_flags_path()

    obj = launch_eval_job(b_model_path + ".pb",
                           w_model_path + ".pb",
                           "{:d}-{:d}".format(black_num, white_num),
                           bucket_name=flags.FLAGS.bucket_name,
                           flags_path=flags_path,
                           completions=completions)

    # Fire spams the retval to stdout, so...
    return "{} job launched ok".format(obj[1].metadata.name) 
Example #2
Source File: cli.py    From aitextgen with MIT License 5 votes vote down vote up
def aitextgen_cli(**kwargs):
    """Entrypoint for the CLI"""
    fire.Fire({"encode": encode_cli, "train": train_cli, "generate": generate_cli}) 
Example #3
Source File: __main__.py    From pyattck with MIT License 5 votes vote down vote up
def main(args=None):
    attck = Attck()
    fire.Fire(attck) 
Example #4
Source File: __main__.py    From pyrwr with MIT License 5 votes vote down vote up
def main():
    fire.Fire(process_query) 
Example #5
Source File: cli.py    From professional-services with Apache License 2.0 5 votes vote down vote up
def main():
  fire.Fire(dict(
      gen_csv_from_images=dataset.gen_csv_from_images,
      gen_csv_from_annotations=dataset.gen_csv_from_annotations,
  )) 
Example #6
Source File: greengo.py    From greengo with MIT License 5 votes vote down vote up
def main():
    fire.Fire(GroupCommands)

# Run main() 
Example #7
Source File: main.py    From text2art with MIT License 5 votes vote down vote up
def main():
    init(autoreset=True)
    fire.Fire() 
Example #8
Source File: launcher.py    From pipelines with Apache License 2.0 5 votes vote down vote up
def launch(file_or_module, args):
    """Launches a python file or module as a command entrypoint.

    Args:
        file_or_module: it is either a file path to python file
            a module path.
        args: the args passed to the entrypoint function.

    Returns:
        The return value from the launched function.
    """
    try:
        module = importlib.import_module(file_or_module)
    except Exception:
        try:
            if sys.version_info.major > 2:
                spec = importlib.util.spec_from_file_location('module', file_or_module)
                module = importlib.util.module_from_spec(spec)
                spec.loader.exec_module(module)
            else:
                import imp
                module = imp.load_source('module', file_or_module)
        except Exception:
            logging.error('Failed to find the module or file: {}'.format(file_or_module))
            sys.exit(1)
    return fire.Fire(module, command=args, name=module.__name__) 
Example #9
Source File: sample_test_launcher.py    From pipelines with Apache License 2.0 5 votes vote down vote up
def main():
  """Launches either KFP sample test or component test as a command entrypoint.

  Usage:
  python sample_test_launcher.py sample_test run_test arg1 arg2 to launch sample test, and
  python sample_test_launcher.py component_test run_test arg1 arg2 to launch component
  test.
  """
  fire.Fire({
      'sample_test': SampleTest,
      'component_test': ComponentTest
  }) 
Example #10
Source File: program.py    From ops_sdk with GNU General Public License v3.0 5 votes vote down vote up
def run(cls_inst):
        if issubclass(cls_inst, MainProgram):
            fire.Fire(cls_inst)
        else:
            raise Exception('') 
Example #11
Source File: test_cli.py    From chepy with GNU General Public License v3.0 5 votes vote down vote up
def test_fire3():
    fire_obj = fire.Fire(Chepy, command=["abc", "-", "hmac_hash", "--digest", "md5"])
    assert type(fire_obj) == Chepy 
Example #12
Source File: test_cli.py    From chepy with GNU General Public License v3.0 5 votes vote down vote up
def test_fire2():
    assert (
        fire.Fire(Chepy, command=["abc", "-", "hmac_hash", "--digest", "md5"]).o
        == "dd2701993d29fdd0b032c233cec63403"
    ) 
Example #13
Source File: test_cli.py    From chepy with GNU General Public License v3.0 5 votes vote down vote up
def test_fire1():
    assert fire.Fire(Chepy, command=["A", "-", "to_hex", "o"]) == b"41" 
Example #14
Source File: cli.py    From pytorch-fast-elmo with MIT License 5 votes vote down vote up
def main():  # type: ignore
    fire.Fire(Main) 
Example #15
Source File: calculate_account_contests.py    From clist with Apache License 2.0 5 votes vote down vote up
def run(*args):
    fire.Fire(main, args) 
Example #16
Source File: init_account_writers.py    From clist with Apache License 2.0 5 votes vote down vote up
def run(*args):
    fire.Fire(main, args) 
Example #17
Source File: apsconnect.py    From apsconnect-cli with Apache License 2.0 5 votes vote down vote up
def main():
    version = get_version()
    if version:
        print("APSConnect-cli v{}".format(get_version()))

    try:
        log_entry = ("=============================\n{}\n".format(" ".join(sys.argv)))
        Logger(LOG_FILE).log(log_entry)
        fire.Fire(APSConnectUtil, name='apsconnect')
    except Exception as e:
        print("Error: {}".format(e))
        sys.exit(1) 
Example #18
Source File: __main__.py    From pydata2019-nlp-system with Apache License 2.0 5 votes vote down vote up
def main():
    fire.Fire(StreamConsumer) 
Example #19
Source File: publisher.py    From pydata2019-nlp-system with Apache License 2.0 5 votes vote down vote up
def main():
    fire.Fire(TelegramPublisher) 
Example #20
Source File: __main__.py    From pydata2019-nlp-system with Apache License 2.0 5 votes vote down vote up
def main():
    fire.Fire(MessageProcessor) 
Example #21
Source File: publisher.py    From pydata2019-nlp-system with Apache License 2.0 5 votes vote down vote up
def main():
    fire.Fire(TelegramPublisher) 
Example #22
Source File: stylecloud.py    From stylecloud with MIT License 5 votes vote down vote up
def stylecloud_cli(**kwargs):
    """Entrypoint for the stylecloud CLI."""
    fire.Fire(gen_stylecloud) 
Example #23
Source File: ramile-cli.py    From ramile with MIT License 5 votes vote down vote up
def main():
    fire.Fire(ramile_cli(), name='ramile') 
Example #24
Source File: __init__.py    From LKI with MIT License 5 votes vote down vote up
def entry():
    fire.Fire(LKI) 
Example #25
Source File: argfile_runner.py    From lottery-ticket-hypothesis with Apache License 2.0 5 votes vote down vote up
def main(unused_argv):
  fire.Fire(run) 
Example #26
Source File: train.py    From lottery-ticket-hypothesis with Apache License 2.0 5 votes vote down vote up
def main(_=None):
  fire.Fire(train.train) 
Example #27
Source File: lottery_experiment.py    From lottery-ticket-hypothesis with Apache License 2.0 5 votes vote down vote up
def main(_=None):
  fire.Fire(lottery_experiment.train) 
Example #28
Source File: reinitialize.py    From lottery-ticket-hypothesis with Apache License 2.0 5 votes vote down vote up
def main(_=None):
  fire.Fire(reinitialize.train) 
Example #29
Source File: download_data.py    From lottery-ticket-hypothesis with Apache License 2.0 5 votes vote down vote up
def main(unused_argv):
  fire.Fire(download) 
Example #30
Source File: cli.py    From stagesepx with MIT License 5 votes vote down vote up
def main():
    fire.Fire(TerminalCli)