Doc generator fixes:

- enable contrib
- show __init__
- remove core.protobuf module
- fix bug in _get_arg_spec
- hide contrib.learn.head
Change: 146265365
This commit is contained in:
Martin Wicke 2017-02-01 11:09:42 -08:00 committed by TensorFlower Gardener
parent 43af740fcb
commit 667bf9879f
3 changed files with 10 additions and 6 deletions
tensorflow/tools

View File

@ -40,7 +40,10 @@ class PublicAPIVisitor(object):
# Each entry maps a module path to a name to ignore in traversal.
_do_not_descend_map = {
# TODO(drpng): This can be removed once sealed off.
'': ['platform', 'pywrap_tensorflow', 'user_ops'],
'': ['platform', 'pywrap_tensorflow', 'user_ops', 'python'],
# Exclude protos, they leak a lot.
'core': ['protobuf'],
# Some implementations have this internal module that we shouldn't expose.
'flags': ['cpp_flags'],
@ -64,7 +67,8 @@ class PublicAPIVisitor(object):
def _isprivate(self, name):
"""Return whether a name is private."""
return name.startswith('_')
# TODO(wicke): We have to almost certainly add more exceptions than init.
return name.startswith('_') and name not in ['__init__']
def _do_not_descend(self, path, name):
"""Safely queries if a specific fully qualified name should be excluded."""

View File

@ -118,8 +118,7 @@ def extract():
# Access something in contrib so tf.contrib is properly loaded (it's hidden
# behind lazy loading)
# TODO(wicke): Enable contrib traversal once contrib is sealed.
# _ = tf.contrib.__name__
_ = tf.contrib.__name__
# Exclude some libaries in contrib from the documentation altogether.
# TODO(wicke): Shrink this list.
@ -163,6 +162,7 @@ def extract():
],
'contrib.learn': [
'datasets',
'head',
'graph_actions',
'io',
'models',

View File

@ -264,8 +264,8 @@ def _get_arg_spec(func):
argspec_defaults = list(argspec.defaults[partial_args-first_default_arg:])
first_default_arg = max(0, first_default_arg - partial_args)
for kwarg in func.keywords:
if kwarg in argspec.args:
for kwarg in (func.keywords or []):
if kwarg in (argspec.args or []):
i = argspec_args.index(kwarg)
argspec_args.pop(i)
if i >= first_default_arg: