X-Git-Url: http://git.scottworley.com/pinch/blobdiff_plain/0a4ff8dde934f9921371da9600e473dd090a7425..7f4c3ace15d9dc80a366743e5f7a38ec7b2af201:/pinch.py diff --git a/pinch.py b/pinch.py index f5fbb48..ea380a3 100644 --- a/pinch.py +++ b/pinch.py @@ -22,9 +22,11 @@ from typing import ( Dict, Iterable, List, + Mapping, NamedTuple, NewType, Tuple, + Type, Union, ) @@ -585,11 +587,12 @@ def git_revision_name(v: Verification, channel: TarrableSearchPath) -> str: def read_search_path(conf: configparser.SectionProxy) -> SearchPath: - if 'alias_of' in conf: - return AliasSearchPath(**dict(conf.items())) - if 'channel_url' in conf: - return ChannelSearchPath(**dict(conf.items())) - return GitSearchPath(**dict(conf.items())) + mapping: Mapping[str, Type[SearchPath]] = { + 'alias': AliasSearchPath, + 'channel': ChannelSearchPath, + 'git': GitSearchPath, + } + return mapping[conf['type']](**dict(conf.items())) def read_config(filename: str) -> configparser.ConfigParser: