aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/common
diff options
context:
space:
mode:
authorGravatar Mark Daoust <markdaoust@google.com>2018-08-21 06:51:25 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-21 06:55:39 -0700
commitad4018ebb6b7f8ee4a38a7a0059bdbad28557732 (patch)
tree65c366376db549746cba55f52d4c70bc2dd8d918 /tensorflow/tools/common
parenteac93feb41361045c246e6c86621ec9f362d8ef3 (diff)
Fix usage of `docs_controls.should_skip`.
`docs_controls` was recently added to allow users to tag objects with `do_not_generate_docs` (it can be used as a decorator). This allows you to skip objects by _identity_, instead of path. In my initial implementation I checked for the tag in the doc generation step. This change fixes it to skip objects during the api-crawling step. This is necessary to avoid crawling the internals of all the excluded objects. To enable this, the `_is_private` method of PublicAPIVisitor needs access to the object, not just the path to it. The changes in `public_api` allow this. `generate_lib` uses the `_is_private` signature change to inspect the object. PiperOrigin-RevId: 209587765
Diffstat (limited to 'tensorflow/tools/common')
-rw-r--r--tensorflow/tools/common/public_api.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tensorflow/tools/common/public_api.py b/tensorflow/tools/common/public_api.py
index 09933d266b..82bb0713c4 100644
--- a/tensorflow/tools/common/public_api.py
+++ b/tensorflow/tools/common/public_api.py
@@ -102,9 +102,10 @@ class PublicAPIVisitor(object):
"""Override the default root name of 'tf'."""
self._root_name = root_name
- def _is_private(self, path, name):
+ def _is_private(self, path, name, obj=None):
"""Return whether a name is private."""
# TODO(wicke): Find out what names to exclude.
+ del obj # Unused.
return ((path in self._private_map and
name in self._private_map[path]) or
(name.startswith('_') and not re.match('__.*__$', name) or
@@ -129,7 +130,7 @@ class PublicAPIVisitor(object):
# Remove things that are not visible.
for name, child in list(children):
- if self._is_private(full_path, name):
+ if self._is_private(full_path, name, child):
children.remove((name, child))
self._visitor(path, parent, children)