diff options
author | Matthew Shao <me@matshao.com> | 2017-06-24 10:18:00 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-06-24 10:18:00 +0800 |
commit | 18633262201b33fb0c36381fbc65febf21313eb7 (patch) | |
tree | 2087e959a6d4821627ff8ae530586552153a9cf3 /mitmproxy/optmanager.py | |
parent | c7ce7f84e6283fa08e87ee5ee35fd6053a2ab615 (diff) | |
download | mitmproxy-18633262201b33fb0c36381fbc65febf21313eb7.tar.gz mitmproxy-18633262201b33fb0c36381fbc65febf21313eb7.tar.bz2 mitmproxy-18633262201b33fb0c36381fbc65febf21313eb7.zip |
Minor Update for /options API of mitmweb.
Diffstat (limited to 'mitmproxy/optmanager.py')
-rw-r--r-- | mitmproxy/optmanager.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/mitmproxy/optmanager.py b/mitmproxy/optmanager.py index 4a455282..ed1310aa 100644 --- a/mitmproxy/optmanager.py +++ b/mitmproxy/optmanager.py @@ -401,18 +401,11 @@ def dump_defaults(opts): if o.choices: txt += " Valid values are %s." % ", ".join(repr(c) for c in o.choices) else: - if o.typespec in (str, int, bool): - t = o.typespec.__name__ - elif o.typespec == typing.Optional[str]: - t = "optional str" - elif o.typespec == typing.Sequence[str]: - t = "sequence of str" - else: # pragma: no cover - raise NotImplementedError + t = typecheck.typespec_to_str(o.typespec) txt += " Type %s." % t txt = "\n".join(textwrap.wrap(txt)) - s.yaml_set_comment_before_after_key(k, before = "\n" + txt) + s.yaml_set_comment_before_after_key(k, before="\n" + txt) return ruamel.yaml.round_trip_dump(s) |