import configparser import os.path from . import Vehicle ferry_config = configparser.ConfigParser() ferry_config.read(os.path.expanduser("~edward/config/brittany-ferries/config")) def vehicle_from_config(config: configparser.ConfigParser) -> Vehicle: """Generate a vehicle object from config.""" return Vehicle( type=config.get("vehicle", "type"), registration=config.get("vehicle", "registration"), height=config.getint("vehicle", "height"), length=config.getint("vehicle", "length"), )