Use __attrs_post_init__ to validate ArgInfo

This makes qutebrowser compatible with attrs < 17.1.0, such as attrs 16.3.0
coming with Debian Stretch.
This commit is contained in:
Florian Bruhin 2017-09-20 17:25:17 +02:00
parent 31bd4d7ffe
commit 9d360f80cf

View File

@ -45,9 +45,7 @@ class ArgInfo:
completion = attr.ib(None)
choices = attr.ib(None)
@win_id.validator
@count.validator
def _validate_exclusive(self, _attr, _value):
def __attrs_post_init__(self):
if self.win_id and self.count:
raise TypeError("Argument marked as both count/win_id!")