in tools/tensorflow_docs/api_generator/public_api.py [0:0]
def _is_private(self, path, parent, name, obj):
"""Returns whether a name is private or not."""
# Skip objects blocked by doc_controls.
if doc_controls.should_skip(obj):
return True
if isinstance(parent, type):
if doc_controls.should_skip_class_attr(parent, name):
return True
if doc_controls.should_doc_private(obj):
return False
if inspect.ismodule(obj):
mod_base_dirs = get_module_base_dirs(obj)
# This check only handles normal packages/modules. Namespace-package
# contents will get filtered when the submodules are checked.
if len(mod_base_dirs) == 1:
mod_base_dir = mod_base_dirs[0]
# Check that module is in one of the `self._base_dir`s
if not any(base in mod_base_dir.parents for base in self._base_dir):
return True
# Skip objects blocked by the private_map
if name in self._private_map.get('.'.join(path), []):
return True
# Skip "_" hidden attributes
if name.startswith('_') and name not in ALLOWED_DUNDER_METHODS:
return True
return False