tfdocs.doc_controls.do_not_doc_in_subclasses

A decorator: Only generate docs for this method in the defining class.

Also group this method's docs with and @abstractmethod in the class's docs.

No docs will generated for this class attribute in sub-classes.

The canonical use case for this is tf.keras.layers.Layer.call: It's a public method, essential for anyone implementing a subclass, but it should never be called directly.

Works on method, or other class-attributes.

When generating docs for a class's arributes, the __mro__ is searched and the attribute will be skipped if this decorator is detected on the attribute on any parent class in the __mro__.

For example:

class Parent(object):
  @for_subclass_implementers
  def method1(self):
    pass
  def method2(self):
    pass

class Child1(Parent):
  def method1(self):
    pass
  def method2(self):
    pass

class Child2(Parent):
  def method1(self):
    pass
  def method2(self):
    pass

This will produce the following docs:

/Parent.md
  # method1
  # method2
/Child1.md
  # method2
/Child2.md
  # method2
class Example(object):
  @property
  @for_subclass_implementers
  def x(self):
    return self._x

obj The class-attribute to hide from the generated docs.

obj