Additional overrides for Generic and its metaclass.

PiperOrigin-RevId: 319887689
Change-Id: I5db9d18649f69dabcc234ab0b00ad452537a828f
This commit is contained in:
Dan Moldovan 2020-07-06 17:20:13 -07:00 committed by TensorFlower Gardener
parent 331ce4d203
commit 7151e14479
2 changed files with 8 additions and 1 deletions

View File

@ -95,6 +95,13 @@ else:
return False
# Differences created by Generic typing.
_NORMALIZE_TYPE[(
'tensorflow.python.framework.ops.Tensor')] = (
"<class 'tensorflow.python.framework.ops.Tensor'>")
_NORMALIZE_TYPE['typing.Generic'] = "<class 'typing.Generic'>"
if sys.version_info.major == 3 and sys.version_info.minor >= 8:
_NORMALIZE_TYPE["<class '_collections._tuplegetter'>"] = "<type 'property'>"

View File

@ -112,7 +112,7 @@ class PublicAPIVisitor(object):
return ((path in self._private_map and name in self._private_map[path]) or
(six.ensure_str(name).startswith('_') and
not re.match('__.*__$', six.ensure_str(name)) or
name in ['__base__', '__class__']))
name in ['__base__', '__class__', '__next_in_mro__']))
def _do_not_descend(self, path, name):
"""Safely queries if a specific fully qualified name should be excluded."""