diff --git a/tensorflow/tools/common/public_api.py b/tensorflow/tools/common/public_api.py index a7ac8cb22ad..4c1ccebd616 100644 --- a/tensorflow/tools/common/public_api.py +++ b/tensorflow/tools/common/public_api.py @@ -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.""" diff --git a/tensorflow/tools/docs/generate.py b/tensorflow/tools/docs/generate.py index 4189deaec9c..73109d9dd85 100644 --- a/tensorflow/tools/docs/generate.py +++ b/tensorflow/tools/docs/generate.py @@ -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', diff --git a/tensorflow/tools/docs/parser.py b/tensorflow/tools/docs/parser.py index 1dde384fb59..f4451a6e258 100644 --- a/tensorflow/tools/docs/parser.py +++ b/tensorflow/tools/docs/parser.py @@ -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: