Source code for memote.suite.cli.config

# -*- coding: utf-8 -*-

# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Define and make parseable the memote configuration file."""

from __future__ import absolute_import

import click
from click_configfile import ConfigFileReader, Param, SectionSchema, matches_section


[docs]class ConfigSectionSchema(object): """Describes all sections of the memote configuration file.""" @matches_section("memote")
[docs] class Memote(SectionSchema): """ Describes the memote configuration keys and values. Memote configuration should be carried out either in 'setup.cfg' or a dedicated 'memote.ini' file. """
[docs] collect = Param(type=bool, default=True)
[docs] git = Param(type=bool, default=True)
[docs] addargs = Param(type=str, default="")
[docs] model = Param(type=click.Path(exists=False, dir_okay=False))
[docs] deployment = Param(type=str, default="gh-pages")
[docs] location = Param(type=str)
[docs] github_repository = Param(type=str)
[docs] github_username = Param(type=str)
[docs] exclusive = Param(type=str, multiple=True)
[docs] skip = Param(type=str, multiple=True)
[docs] solver = Param( type=click.Choice(["cplex", "glpk", "gurobi", "glpk_exact"]), default="glpk"
)
[docs] solver_timeout = Param(type=int, default=None)
[docs] experimental = Param( type=click.Path(exists=False, dir_okay=False), default=None
)
[docs]class ConfigFileProcessor(ConfigFileReader): """Determine which files to look for and what sections."""
[docs] config_files = ["memote.ini", "setup.cfg"]
[docs] config_section_schemas = [ConfigSectionSchema.Memote]