|
|
@ -27,6 +27,21 @@ import typing |
|
|
|
import attr |
|
|
|
|
|
|
|
|
|
|
|
# We use type annotations, and attrs implements the helper type keyword |
|
|
|
# for compatibility with python 3.5 in version 17.3.0. |
|
|
|
# We need to monkey patch things. |
|
|
|
if tuple(int(i) for i in attr.__version__.split('.')) < (17, 3, 0): |
|
|
|
if getattr(attr, 'original_ib', None) is None: |
|
|
|
attr.original_ib = attr.ib |
|
|
|
def our_attrib(type=None, *args, **kwargs): |
|
|
|
# factory is also new in 18.1.0 |
|
|
|
factory = kwargs.pop('factory', None) |
|
|
|
if factory is not None: |
|
|
|
kwargs['default']=attr.Factory(factory) |
|
|
|
return attr.original_ib(*args, **kwargs) |
|
|
|
attr.ib = our_attrib |
|
|
|
|
|
|
|
|
|
|
|
def _list_helper( |
|
|
|
config, section: str, item: str, separator: str = "," |
|
|
|
) -> typing.Iterable[str]: |
|
|
|