
    BVhh                         d Z ddlmZmZ  ed      ZdZdedefdZdZd	 Zdee	   fd
Z
eZe
ZdZdedefdZdZdedefdZdZdedefdZeZdZdedefdZdZdedefdZy)z!Documentation control decorators.    )OptionalTypeVarT_tf_docs_deprecatedobjreturnc                 (    t        | t        d       | S )z=Explicitly tag an object as deprecated for the doc generator.N)setattr_DEPRECATEDr   s    R/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/tools/docs/doc_controls.pyset_deprecatedr      s    	#{D!	*    _tf_docs_inheritable_headerc                       fd}|S )Nc                 *    t        | t               | S N)r
   _INHERITABLE_HEADER)clstexts    r   _wrappedz$inheritable_header.<locals>._wrapped$   s    C$d+Jr    )r   r   s   ` r   inheritable_headerr   "   s     
/r   c                 $    t        | t        d       S r   )getattrr   r   s    r   get_inheritable_headerr   +   s    	)4	00r   _tf_docs_do_not_documentc                 (    t        | t        d       | S )a  A decorator: Do not generate docs for this object.

  For example the following classes:

  ```
  class Parent(object):
    def method1(self):
      pass
    def method2(self):
      pass

  class Child(Parent):
    def method1(self):
      pass
    def method2(self):
      pass
  ```

  Produce the following api_docs:

  ```
  /Parent.md
    # method1
    # method2
  /Child.md
    # method1
    # method2
  ```

  This decorator allows you to skip classes or methods:

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

  class Child(Parent):
    @do_not_generate_docs
    def method1(self):
      pass
    def method2(self):
      pass
  ```

  This will only produce the following docs:

  ```
  /Child.md
    # method2
  ```

  Note: This is implemented by adding a hidden attribute on the object, so it
  cannot be used on objects which do not allow new attributes to be added. So
  this decorator must go *below* `@property`, `@classmethod`,
  or `@staticmethod`:

  ```
  class Example(object):
    @property
    @do_not_generate_docs
    def x(self):
      return self._x
  ```

  Args:
    obj: The object to hide from the generated docs.

  Returns:
    obj
  N)r
   _DO_NOT_DOCr   s    r   do_not_generate_docsr    5   s    T 
#{D!	*r   _tf_docs_do_not_doc_inheritablec                 (    t        | t        d       | S )a  A decorator: Do not generate docs for this method.

  This version of the decorator is "inherited" by subclasses. No docs will be
  generated for the decorated method in any subclass. Even if the sub-class
  overrides the method.

  For example, to ensure that `method1` is **never documented** use this
  decorator on the base-class:

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

  class Child(Parent):
    def method1(self):
      pass
    def method2(self):
      pass
  ```
  This will produce the following docs:

  ```
  /Parent.md
    # method2
  /Child.md
    # method2
  ```

  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 class in the `__mro__`.

  Note: This is implemented by adding a hidden attribute on the object, so it
  cannot be used on objects which do not allow new attributes to be added. So
  this decorator must go *below* `@property`, `@classmethod`,
  or `@staticmethod`:

  ```
  class Example(object):
    @property
    @do_not_doc_inheritable
    def x(self):
      return self._x
  ```

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

  Returns:
    obj
  N)r
   _DO_NOT_DOC_INHERITABLEr   s    r   do_not_doc_inheritabler$      s    p 
#&-	*r   (_tf_docs_tools_for_subclass_implementersc                 (    t        | t        d       | S )a6  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
  ```

  Note: This is implemented by adding a hidden attribute on the object, so it
  cannot be used on objects which do not allow new attributes to be added. So
  this decorator must go *below* `@property`, `@classmethod`,
  or `@staticmethod`:

  ```
  class Example(object):
    @property
    @for_subclass_implementers
    def x(self):
      return self._x
  ```

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

  Returns:
    obj
  N)r
   _FOR_SUBCLASS_IMPLEMENTERSr   s    r   for_subclass_implementersr(      s    N 
#)40	*r   _tf_docs_doc_privatec                 (    t        | t        d       | S )a  A decorator: Generates docs for private methods/functions.

  For example:

  ```
  class Try:

    @doc_controls.doc_private
    def _private(self):
      ...
  ```

  As a rule of thumb, private(beginning with `_`) methods/functions are
  not documented.

  This decorator allows to force document a private method/function.

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

  Returns:
    obj
  N)r
   _DOC_PRIVATEr   s    r   doc_privater,     s    2 
#|T"	*r   &_tf_docs_doc_in_current_and_subclassesc                 (    t        | t        d       | S )a  Overrides `do_not_doc_in_subclasses` decorator.

  If this decorator is set on a child class's method whose parent's method
  contains `do_not_doc_in_subclasses`, then that will be overriden and the
  child method will get documented. All classes inherting from the child will
  also document that method.

  For example:

  ```
  class Parent:
    @do_not_doc_in_subclasses
    def method1(self):
      pass
    def method2(self):
      pass

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

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

  class Child11(Child1):
    pass
  ```

  This will produce the following docs:

  ```
  /Parent.md
    # method1
    # method2
  /Child1.md
    # method1
    # method2
  /Child2.md
    # method2
  /Child11.md
    # method1
    # method2
  ```

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

  Returns:
    obj
  N)r
   _DOC_IN_CURRENT_AND_SUBCLASSESr   s    r   doc_in_current_and_subclassesr0   5  s    t 
#-t4	*r   N)__doc__typingr   r   r   r   r   r   r   strr   header
get_headerr   r    r#   r$   r'   r(   do_not_doc_in_subclassesr+   r,   r/   r0   r   r   r   <module>r7      s    ( $CL $ a  4 18C= 1 
#
(Ka KA K\ < 9 9a 9x H H1 H HV 5 %Q 1 : "J ;q ;Q ;r   