
    Je                     j    d Z ddlZddlmZ ddlmZ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)	QGroupBoxQGridLayoutQLabelQMessageBoxQVBoxLayoutQWidget)SpyderPreferencesTab)_c                   @     e Zd ZdZ ed      Z fdZddZd Z xZ	S )FormattingStyleConfigTabzCode style and formatting tab.zCode style and formattingc                 
   t         |   |       | j                  }d}t        d      }t	        t        d      j                  ||            }|j                  d       |j                  d       | j                  t        d      d      | _        | j                  t        d      dt        j                  d	t        d
            | _        | j                  t        d      dt        j                  d	t        d            | _        | j                  t        d      j                  |      dt        j                  d	t        d            }| j                  t        d      dt        j                  d	t        d            }| j                  t        d      d ddddt        d            | _         |t        d      dd      }t!               }	|	j#                  | j                  j$                  dd        |	j#                  | j                  j&                  dd       |	j#                  | j                  j$                  d!d        |	j#                  | j                  j&                  d!d       |	j#                  |j$                  d"d        |	j#                  |j&                  d"d       |	j#                  |j$                  d#d        |	j#                  |j&                  d#d       t)               }
|
j+                  |	       |
j-                  | j/                  d             | j                  j0                  j3                  |
j,                         t5        t        d$            }t7               }|j#                  |       |j#                  | j                         |j#                  |
       |j+                  |       t5        t        d%            }t7               }|j#                  | j                         |j#                  |       |j+                  |       d&}d'}d(}t	        t        d)      j                  |||            }|j                  d       |j                  d       | j9                  t        d*      d+d,      } |t        d-      d.t        d/      0      }t5        t        d1            }t7               }|j#                  |       |j#                  |       |j#                  |       |j+                  |       t7               }|j#                  |       |j#                  |       |j#                  |       | j+                  |       y )2Nz<<a href="https://www.python.org/dev/peps/pep-0008">PEP 8</a>zc<a href='http://pycodestyle.pycqa.org/en/stable/intro.html#error-codes'>pycodestyle error codes</a>zSpyder can use pycodestyle to analyze your code for conformance to the {} convention. You can also manually show or hide specific warnings by their {}.TzEnable code style lintingpycodestylez-Only check filenames matching these patterns:zpycodestyle/filenameFzCheck Python files: *.py)	alignment	word_wrapplaceholderz5Exclude files or directories matching these patterns:zpycodestyle/excludez'Exclude all test files: (?!test_).*\.pyz&Show the following errors or warnings:zpycodestyle/selectzExample codes: E113, W391z(Ignore the following errors or warnings:zpycodestyle/ignorezExample codes: E201, E303zMaximum allowed line length:zpycodestyle/max_line_length
   i     zDefault is 79)min_max_steptipz!Show vertical line at that length	edge_lineeditor)sectionr            z
Code stylezLine lengthz9<a href='https://github.com/hhatto/autopep8'>Autopep8</a>z1<a href='https://github.com/google/yapf'>Yapf</a>z:<a href='https://black.readthedocs.io/en/stable'>Black</a>zTSpyder can use {0} or {1} to format your code for conformance to the {2} convention.z%Choose the code formatting provider: ))autopep8r   )blackr    
formattingzAutoformat files on saveformat_on_savez=If enabled, autoformatting will take place when saving a file)r   zCode formatting)super__init__create_checkboxr   r   formatsetOpenExternalLinkssetWordWrapcode_style_checkcreate_lineeditr   
Horizontalcode_style_filenames_matchcode_style_excludecreate_spinboxcode_style_max_line_lengthr   	addWidgetlabeltextboxr	   	setLayout
setEnabled
get_optiontoggledconnectr   r   create_combobox)selfparentnewcbpep_urlcode_style_codes_urlcode_style_labelcode_style_selectcode_style_ignorevertical_line_boxcode_style_g_layoutcode_style_g_widgetcode_style_groupcode_style_layoutline_length_groupline_length_layoutautopep8_urlyapf_url	black_urlcode_fmt_labelcode_fmt_providerformat_on_save_boxcode_fmt_groupcode_fmt_layoutcode_style_fmt_layout	__class__s                           h/usr/lib/python3/dist-packages/spyder/plugins/completion/providers/languageserver/conftabs/formatting.pyr$   z!FormattingStyleConfigTab.__init__   s    $$ K 	 C D "   VG%9:	<
 	--d3$$T* !% 4 4)*!
 +/*>*>=>"bmmu45 +? +7' #'"6"6EF!R]]eDE #7 #G !0067>>$& BMMU56	 1 8
 !0089 BMMU56 1 8 +/*=*=,-t)1/" +> +$'
 "12K
 *m%%++111a	9%%++33Q	;%%d&=&=&C&CQJ%%d&=&=&E&Eq!L%%&7&=&=q!D%%&7&?&?AF%%&7&=&=q!D%%&7&?&?AF &i%%&9:&&t}'EF%%--.A.L.LM %Q|_5'M##$45##D$9$9:##$78""#45 &a&67(]$$T%D%DE$$%67##$67 H 	 @ 	 I 	   3 44:F	7545 	++D1""4( !0056!	 #() " #$ #1%6#78%-!!.1!!"34!!"45  1 +''(89''7''(9:,-    c                 t    t        d      }|rt        d      }t        j                  | t        d      |       y)ze
        Report that excluded files/directories should be valid regular
        expressions.
        zKDirectory patterns listed for exclusion should be valid regular expressionszFFile patterns listed for exclusion should be valid regular expressionsErrorN)r   r   critical)r9   filesmsgs      rR   report_invalid_regexz-FormattingStyleConfigTab.report_invalid_regex   s=    
  & ' * +C 	T1W:s3rS   c                 (   	 | j                   j                  j                         j                  d      }|D ]%  }t	        j
                  |j                                ' 	 	 | j                  j                  j                         j                  d      }|D ]%  }t	        j
                  |j                                ' 	 y# t        j                  $ r | j                          Y yw xY w# t        j                  $ r | j                  d       Y yw xY w)N,F)rW   T)
r,   r2   textsplitrecompilestriperrorrY   r-   )r9   code_style_filenames_matchesmatchcode_style_excludess       rR   is_validz!FormattingStyleConfigTab.is_valid   s    	//77<<>DDSI )5 *

5;;=)*	''//446<<SA  , *

5;;=)*
  xx 	%%'	 xx 	%%E%2	s%   AC  !AC)  #C&%C&)%DD)T)
__name__
__module____qualname____doc__r   TITLEr$   rY   re   __classcell__)rQ   s   @rR   r   r      s"    ()*E~.@4rS   r   )ri   r^   qtpy.QtCorer   qtpy.QtWidgetsr   r   r   r   r   r	   spyder.api.preferencesr
   spyder.config.baser   r    rS   rR   <module>rq      s5   
 
 2 2 8  e3 erS   