
    h                     l    S r SSKrSSKJr  SSKJr  SSKJr  SSKJ	r	  S r
S rS	 rS
 r " S S5      rg)zP
Utility functions to return a formatted name and description for a given view.
    N)	force_str)escape)	mark_safe)apply_markdownc                 Z    U R                  U5      (       a  X:w  a  U S[        U5      *  $ U $ )zp
Strip trailing component `trailing` from `content` if it exists.
Used when generating names from view classes.
N)endswithlen)contenttrailings     Q/var/www/html/env/lib/python3.13/site-packages/rest_framework/utils/formatting.pyremove_trailing_stringr      s2    
 !!g&9X''N    c                     [        U 5      n U R                  5       SS  Vs/ s H  oR                  5       (       d  M  UPM     nnU(       Ga$  [        U Vs/ s H)  n[	        U5      [	        UR                  S5      5      -
  PM+     sn5      n[        U Vs/ s H)  n[	        U5      [	        UR                  S5      5      -
  PM+     sn5      nU(       aS  SSU-  -   n[
        R                  " [
        R                  " U[
        R                  5      SU 5      n U R                  5       $ U(       aC  SSU-  -   n[
        R                  " [
        R                  " U[
        R                  5      SU 5      n U R                  5       $ s  snf s  snf s  snf )z
Remove leading indent from a block of text.
Used when generating descriptions from docstrings.

Note that python's `textwrap.dedent` doesn't quite cut it,
as it fails to dedent multiline docstrings that include
unindented text on the initial line.
   N 	^ )
r   
splitlineslstripminr	   resubcompile	MULTILINEstrip)r
   linelineswhitespace_counts
tab_countswhitespace_patterns         r   dedentr"      s6     G%002126H6d++-T6EH u UutTSS1A-B!Bu UVO#d)c$++d*;&<<OP
!$.?(?!@ffRZZ(:BLLI2wWG ==? !$z(9!:ffRZZ(:BLLI2wWG==? I !VOs   FF0F0Fc                     Sn[         R                  " USU 5      R                  5       n SR                  U R	                  S5      5      R                  5       $ )za
Translate 'CamelCaseNames' to 'Camel Case Names'.
Used when generating names from view classes.
z&(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))z \1r   _)r   r   r   joinsplittitle)r
   camelcase_boundarys     r   camelcase_to_spacesr)   0   sH    
 Bff'9??AG88GMM#&'--//r   c                     [         (       a  [        U 5      n O#[        U 5      R                  SS5      n SU -   S-   n [        U 5      $ )z-
Apply HTML markup to the given description.

z<br />z<p>z</p>)r   r   replacer   )descriptions    r   markup_descriptionr.   :   sD     ~$[1[)11$Ak)F2[!!r   c                   .    \ rS rSrSrSrS rS rS rSr	g)	lazy_formatF   z
Delay formatting until it's actually needed.

Useful when the format string or one of the arguments is lazy.

Not using Django's lazy because it is too slow.
)format_stringargskwargsresultc                 6    S U l         Xl        X l        X0l        g N)r5   r2   r3   r4   )selfr2   r3   r4   s       r   __init__lazy_format.__init__P   s    *	r   c                     U R                   cJ  U R                  R                  " U R                  0 U R                  D6U l         Su  U l        U l        U l        U R                   $ )N)NNN)r5   r2   formatr3   r4   )r8   s    r   __str__lazy_format.__str__V   sN    ;;,,33TYYN$++NDK9I6D	4;{{r   c                     [        U 5      U-  $ r7   )str)r8   values     r   __mod__lazy_format.__mod__\   s    4y5  r   )r3   r2   r4   r5   N)
__name__
__module____qualname____firstlineno____doc__	__slots__r9   r=   rB   __static_attributes__ r   r   r0   r0   F   s     >I!r   r0   )rH   r   django.utils.encodingr   django.utils.htmlr   django.utils.safestringr   rest_framework.compatr   r   r"   r)   r.   r0   rK   r   r   <module>rP      s9    
 + $ - 020	"! !r   