
    >Tf	                         d dl Z d dlZd dlmZ dZ G d d          Z G d d          Z G d d	          Z G d
 d          ZdS )    N)cached_property)FieldSetInlineFieldsObjectAttributeTabbedGroupsc                       e Zd ZdZdddZdS )r   a  
    A generic grouping of fields, with an optional name. Each item will be rendered
    on its own row under the provided heading (name), if any. The following types
    may be passed as items:

      * Field name (string)
      * InlineFields instance
      * TabbedGroups instance
      * ObjectAttribute instance

    Parameters:
        items: An iterable of items to be rendered (one per row)
        name: The fieldset's name, displayed as a heading (optional)
    Nnamec                "    || _         || _        d S N)itemsr
   )selfr
   r   s      >/var/www/html/netbox-4.1.3/netbox/utilities/forms/rendering.py__init__zFieldSet.__init__   s    
			    __name__
__module____qualname____doc__r    r   r   r   r      s<          %)       r   r   c                       e Zd ZdZdddZdS )r   z
    A set of fields rendered inline (side-by-side) with a shared label.

    Parameters:
        fields: An iterable of form field names
        label: The label text to render for the row (optional)
    N)labelc                "    || _         || _        d S r   )fieldsr   )r   r   r   s      r   r   zInlineFields.__init__)   s    


r   r   r   r   r   r   r   !   s<          '+       r   r   c                   .    e Zd ZdZd Zed             ZdS )r   a  
    Two or more groups of fields (FieldSets) arranged under tabs among which the user can toggle.

    Parameters:
        fieldsets: An iterable of FieldSet instances, one per tab. Each FieldSet *must* have a
            name assigned, which will be employed as the tab's label.
    c                     |D ]}|j         st          d| d          || _        d                    d t	          d          D                       | _        d S )NzGrouped fieldset z must have a name. c              3   l   K   | ]/}t          j        t          j        t          j        z             V  0d S r   )randomchoicestringascii_lowercasedigits).0_s     r   	<genexpr>z(TabbedGroups.__init__.<locals>.<genexpr>=   sG       
 
FGFM&06=@AA
 
 
 
 
 
r      )r
   
ValueErrorgroupsjoinrangeid)r   	fieldsetsfss      r   r   zTabbedGroups.__init__6   s     	M 	MB7 M !KR!K!K!KLLLM '' 
 
KPQR88
 
 
 
 
r   c                 H      fdt           j        d          D             S )Nc                 J    g | ]\  }}j          d | |j        |j        d S )r&   )r-   titler   )r-   r
   r   )r%   igroupr   s      r   
<listcomp>z%TabbedGroups.tabs.<locals>.<listcomp>C   sS     
 
 

 !U &&1&&+ 
 
 
r      )start)	enumerater*   )r   s   `r   tabszTabbedGroups.tabsA   s?    
 
 
 

 (1===
 
 
 	
r   N)r   r   r   r   r   r   r9   r   r   r   r   r   .   sH         	
 	
 	
 
 
 _
 
 
r   r   c                       e Zd ZdZd ZdS )r   aN  
    Renders the value for a specific attribute on the form's instance. This may be used to
    display a read-only value and convey additional context to the user. If the attribute has
    a `get_absolute_url()` method, it will be rendered as a hyperlink.

    Parameters:
        name: The name of the attribute to be displayed
    c                     || _         d S r   r	   )r   r
   s     r   r   zObjectAttribute.__init__U   s    			r   Nr   r   r   r   r   r   L   s-             r   r   )	r    r"   	functoolsr   __all__r   r   r   r   r   r   r   <module>r>      s      % % % % % %       (
 
 
 
 
 
 
 

 
 
 
 
 
 
 
<
 
 
 
 
 
 
 
 
 
r   