
    Je                     j    d Z ddlZddlmZmZ ddlmZmZmZm	Z	m
Z
 ddlmZ ddlmZ  G d de      Zy)	z.
Language Server Protocol configuration tabs.
    N)QtSlot)QGridLayoutQLabelQMessageBoxQVBoxLayoutQWidget)SpyderPreferencesTab)_c                   \     e Zd ZdZ ed      Z fdZ ee      d        Z	ddZ
d Z xZS )DocstringConfigTabz"Docstring style configuration tab.zDocstring stylec           	      P   t         |   |       d}d}t        d      }t        t        d      j	                  |||            }|j                  d       |j                  d       | j                  t        d      d      | _        | j                  t        d      d	d
      }| j                  t        d      dt        j                  dt        d            | _        | j                  t        d      dt        j                  dt        d            | _        | j                  t        d      dt        j                  dt        d            | _        | j                  t        d      dt        j                  dt        d            | _        |j"                  j$                  j'                  | j(                         |j"                  j+                         }| j)                  |       t-               }|j/                  |j0                  dd       |j/                  |j"                  dd       |j/                  | j                  j0                  dd       |j/                  | j                  j2                  dd       |j/                  | j                  j0                  dd       |j/                  | j                  j2                  dd       |j/                  | j                  j0                  dd       |j/                  | j                  j2                  dd       |j/                  | j                   j0                  dd       |j/                  | j                   j2                  dd       t5               }	|	j7                  |       |	j9                  | j;                  d             | j                  j<                  j'                  |	j8                         t?               }
|
j/                  |       |
j/                  | j                         |
j/                  |	       | j7                  |
       y )NzI<a href='https://numpydoc.readthedocs.io/en/latest/format.html'>Numpy</a>z?<a href='https://www.python.org/dev/peps/pep-0257/'>PEP 257</a>zG<a href='http://www.pydocstyle.org/en/stable/error_codes.html'>page</a>zHere you can decide if you want to perform style analysis on your docstrings according to the {} or {} conventions. You can also decide if you want to show or ignore specific errors, according to the codes found on this {}.TzEnable docstring style linting
pydocstylez/Choose the convention used to lint docstrings: ))Numpynumpy)zPEP 257pep257)Customcustomzpydocstyle/conventionShow the following errors:zpydocstyle/selectFzExample codes: D413, D414)	alignment	word_wrapplaceholderIgnore the following errors:zpydocstyle/ignorezExample codes: D107, D402z-Only check filenames matching these patterns:zpydocstyle/matchz Skip test files: (?!test_).*\.pyz2Only check in directories matching these patterns:zpydocstyle/match_dirzSkip dot directories: [^\.].*   r               ) super__init__r   r   formatsetOpenExternalLinkssetWordWrapcreate_checkboxdocstring_style_checkcreate_comboboxcreate_lineeditr   
Horizontaldocstring_style_selectdocstring_style_ignoredocstring_style_matchdocstring_style_match_dircomboboxcurrentTextChangedconnect setup_docstring_style_conventioncurrentTextr   	addWidgetlabeltextboxr	   	setLayout
setEnabled
get_optiontoggledr   )selfparent	numpy_url
pep257_urldocstring_style_codesdocstring_style_labeldocstring_style_conventioncurrent_conventiondocstring_style_g_layoutdocstring_style_g_widgetdocstring_style_layout	__class__s              g/usr/lib/python3/dist-packages/spyder/plugins/completion/providers/languageserver/conftabs/docstring.pyr    zDocstringConfigTab.__init__   s    , 	 N 	 !*!+ !' 9 : ;A&Z)>;@	!A 	2248))$/ &*%9%9./&"
 &*%9%9?@# $&%" '+&:&:*+2==E56 '; '8# '+&:&:,-2==E56 '; '8# &*%9%9=>"--5=> &: &@" *.)=)=BC"bmmu:; *> *=& 	#++>>FF55	77@@LLN--.@A $/=  **&,,a	4 **&//A	7 **''--q!	5 **''//A	7 **''--q!	5 **''//A	7 **&&,,a	4 **&&..1	6 ****00!Q	8 ****22Aq	: $+9  **+CD ++DOOL,IJ""**22$//	1 "-(()>?(()C)CD(()AB-.    c                    |dk(  r]| j                   j                  j                  t        d             | j                  j                  j                  t        d             y| j                   j                  j                  t        d             | j                  j                  j                  t        d             y)zHandle convention changes.r   r   r   zBShow the following errors in addition to the specified convention:zDIgnore the following errors in addition to the specified convention:N)r)   r3   setTextr   r*   )r9   texts     rE   r0   z3DocstringConfigTab.setup_docstring_style_conventionz   s     8''--55./1''--55013 ''--55 1 23 ''--55 1 23rF   c                 t    t        d      }|rt        d      }t        j                  | t        d      |       y)ze
        Report that matching files/directories should be valid regular
        expressions.
        zJDirectory patterns listed for matching should be valid regular expressionszEFile patterns listed for matching should be valid regular expressionsErrorN)r   r   critical)r9   filesmsgs      rE   report_invalid_regexz'DocstringConfigTab.report_invalid_regex   s=    
  & ' * +C 	T1W:s3rF   c                    	 | j                   j                  j                         }t        j                  |       	 | j                  j                  j                         }t        j                  |       y# t        j
                  $ r | j                          Y yw xY w# t        j
                  $ r | j                  d       Y yw xY w)NF)rM   T)r+   r4   rI   recompileerrorrO   r,   )r9   r+   r,   s      rE   is_validzDocstringConfigTab.is_valid   s    	**22779 "JJ,-
	..66;;= &JJ01  xx 	%%'	 xx 	%%E%2	s"   9A6 9B 6#BB%CC)T)__name__
__module____qualname____doc__r   TITLEr    r   strr0   rO   rT   __classcell__)rD   s   @rE   r   r      s:    , E[/z 
#Y3 34rF   r   )rX   rQ   qtpy.QtCorer   r   qtpy.QtWidgetsr   r   r   r   r	   spyder.api.preferencesr
   spyder.config.baser   r    rF   rE   <module>ra      s5   
 
 !% % 8  P- PrF   