Browse Source

Merge pull request 'Reality check, monkey patch to support newer attrs features.' (#1) from develop into main

Reviewed-on: #1
main
LeePen 1 year ago
parent
commit
e77da16709
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      releasebot.py

+ 15
- 0
releasebot.py View File

@@ -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]:


Loading…
Cancel
Save