Merge pull request #867 from JackDandy/feature/UpdateBackportsABC

Update backports_abc 0.4 to 0.5.
This commit is contained in:
JackDandy 2017-02-01 03:25:08 +00:00 committed by GitHub
commit 9b497e6df2
2 changed files with 18 additions and 3 deletions

View file

@ -8,6 +8,7 @@
* Add lazyload package 3.0.0 (2e318b1)
* Change improve add show search results by comparing search term to an additional unidecoded result set
* Change webserver startup to correctly use xheaders in reverse proxy or load balance set-ups
* Update backports_abc 0.4 to 0.5
[develop changelog]

View file

@ -21,6 +21,20 @@ except ImportError:
import collections as _collections_abc
def get_mro(cls):
try:
return cls.__mro__
except AttributeError:
return old_style_mro(cls)
def old_style_mro(cls):
yield cls
for base in cls.__bases__:
for c in old_style_mro(base):
yield c
def mk_gen():
from abc import abstractmethod
@ -63,7 +77,7 @@ def mk_gen():
@classmethod
def __subclasshook__(cls, C):
if cls is Generator:
mro = C.__mro__
mro = get_mro(C)
for method in required_methods:
for base in mro:
if method in base.__dict__:
@ -88,7 +102,7 @@ def mk_awaitable():
@classmethod
def __subclasshook__(cls, C):
if cls is Awaitable:
for B in C.__mro__:
for B in get_mro(C):
if '__await__' in B.__dict__:
if B.__dict__['__await__']:
return True
@ -144,7 +158,7 @@ def mk_coroutine():
@classmethod
def __subclasshook__(cls, C):
if cls is Coroutine:
mro = C.__mro__
mro = get_mro(C)
for method in ('__await__', 'send', 'throw', 'close'):
for base in mro:
if method in base.__dict__: