Best Python code snippet using localstack_python
search_organisms.py
Source:search_organisms.py  
...549    parameters_path = RESULT_BASE_PATH_DIR + "parameters.txt"550    print_ln("-" * 50, parameters_path)551    print_ln(" " * 20 + "PARAMETERS", parameters_path)552    print_ln("-" * 50, parameters_path)553    print_config_json(config["main"], "Main Config", parameters_path)554    print_config_json(configOrganism, "Organism Config", parameters_path)555    print_config_json(556        configOrganismFactory, "Organism Factory Config", parameters_path557    )558    print_config_json(configConnector, "Connector Config", parameters_path)559    print_config_json(configPssm, "PSSM Config", parameters_path)560    print_ln("-" * 50, parameters_path)561def read_fasta_file(filename: str) -> list:562    """Reads a fasta file and returns an array of DNA sequences (strings)563    TODO: probably it can be useful to create our own Sequence object that564    creates the string and stores some properties from fasta format. Also565    we can adapt the current program to use Biopythons's Seq object.566    Args:567        filename: Name of the file that contains FASTA format sequences to read568    Returns:569        The set of sequences in string format570    """571    dataset = []572    fasta_sequences = SeqIO.parse(open(filename), "fasta")573    for fasta in fasta_sequences:574        dataset.append(str(fasta.seq).lower())575    return dataset576def read_json_file(filename: str) -> dict:577    """Reads a JSON file and returns a dictionary with the content578    Args:579        filename: Name of the json file to read580    Returns:581        Dictionary with the json file info582    """583    with open(filename) as json_content:584        return json.load(json_content)585def print_config_json(config: dict, name: str, path: str) -> None:586    """Print the config file on std out and send it to a file.587    It is useful so we can know which was the configuration on every run588    Args:589        config: Configuration file to print590        name: Title for the configuration file591        path: File to export the configuration info592    """593    print_ln("{}:".format(name), path)594    for key in config.keys():595        print_ln("{}: {}".format(key, config[key]), path)596    print_ln("\n", path)597def print_ln(string: str, name_file: str) -> None:598    """Shows the string on stdout and write it to a file599    (like the python's logging modules does)...opts.py
Source:opts.py  
1"""Command line options."""2import argparse3import sys4import toml5import json6import os7default_config_toml = ""8with open(os.path.join(os.path.dirname(__file__), 'config.toml'), 'r') as f:9    default_config_toml = f.read()10class Opts:11    """Parse command line options."""12    def __init__(self):13        """Parse and initialize the options."""14        parser = argparse.ArgumentParser(description='Management tool for '15                                         'DragonMint/Innosilicon miners.',16                                         formatter_class=argparse.17                                         ArgumentDefaultsHelpFormatter)18        parser.add_argument('-c', '--config', type=str,19                            help='Path to config file in either TOML or JSON format.',20                            default="config.toml")21        parser.add_argument('--print-config-toml', action='store_true',22                            help="Print default config in TOML and exit")23        parser.add_argument('--print-config-json', action='store_true',24                            help="Print default config in JSON and exit")25        self.args = parser.parse_args()26        if self.args.print_config_toml:27            print(default_config_toml)28            sys.exit(0)29        if self.args.print_config_json:30            print(json.dumps(toml.loads(default_config_toml),31                             sort_keys=True, indent=2))...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
