
    \Og                       S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSK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  \
R(                  " S5      r\
R(                  " S	5      r\
R(                  " S
5      r\4     S"S jjr " S S\5      rSu  rrrrrSr\
R(                  " S5      \4\
R(                  " S5      \4\
R(                  " S5      \4\
R(                  " S5      \4\
R(                  " S5      \4/r S#S jr!    S$S jr"\RF                  4     S%S jjr$\RF                  4S&S jjr%\RL                  " SS9S'S j5       r'S(S jr(S)S jr)S*S jr          S+S jr*S'S  jr+S,S! jr,g)-zUtility methods for flake8.    )annotationsN)
NamedTuple)Pattern)Sequence)
exceptionsz[,\s]z[,\t\n\r\f\v]z[-_.]+c                    [        U [        5      (       d   U 5       eUR                  U 5      nS U 5       nU Vs/ s H  oD(       d  M  UPM     sn$ s  snf )zParse a comma-separated list.

:param value:
    String to be parsed and normalized.
:param regexp:
    Compiled regular expression used to split the value when it is a
    string.
:returns:
    List of values with whitespace stripped.
c              3  @   #    U  H  oR                  5       v   M     g 7fN)strip).0items     Q/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/flake8/utils.py	<genexpr>-parse_comma_separated_list.<locals>.<genexpr>)   s     3

s   )
isinstancestrsplit)valueregexp	separateditem_genr   s        r   parse_comma_separated_listr      sN     eS!!(5(!U#I33H%.XTDX...s   
A	Ac                  *    \ rS rSr% S\S'   S\S'   Srg)_Token-   r   tpsrc N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       r   r   r   -   s    G	Hr%   r   )codefilecoloncommawseofz[A-Z]+[0-9]*(?=$|\s|,)z[^\s:,]+z\s*:\s*z\s*,\s*z\s+c                   / nSnU[        U 5      :  a  [         He  u  p4UR                  X5      nU(       d  M  UR                  [	        XER                  5       R                  5       5      5        UR                  5       n  O   [        SX5      eU[        U 5      :  a  M  UR                  [	        [        S5      5        U$ )Nr   unreachable )
len_FILE_LIST_TOKEN_TYPESmatchappendr   groupr   endAssertionError_EOF)r   tokensitoken_re
token_namer1   s         r    _tokenize_files_to_codes_mappingr;   =   s    F	A
c%j.$: HNN5,EufZ1D1D1FGHIIK %; !99 c%j. MM&r"#Mr%   c                  ^^^ [        U [        5      (       d  SR                  U 5      mOU m/ mTR                  5       (       d  T$  " S S5      mSUU4S jjnS	U4S jjn[	        T5       GH  nUR
                  [        [        1;   a	  STl        M'  TR                  (       d~  UR
                  [        :X  a  STl	        STl        M\  TR                  (       aB  UR
                  [        :X  a.  TR                  R                  UR                  5        STl        M  U" 5       eUR
                  [        :X  a	  U" 5         M  TR                  (       aC  UR
                  [         :X  a/  TR"                  R                  UR                  5        STl        GM'  TR                  (       aJ  UR
                  [        :X  a6  U" 5         TR                  R                  UR                  5        STl        GM  U" 5       e   T$ )
zParse a files-to-codes mapping.

A files-to-codes mapping a sequence of values specified as
`filenames list:codes list ...`.  Each of the lists may be separated by
either comma or whitespace tokens.

:param value: String to be parsed and normalized.

c                  :    \ rS rSr% SrSr/ rS\S'   / rS\S'   Sr	g)	+parse_files_to_codes_mapping.<locals>.Stateb   TF	list[str]	filenamescodesr   N)
r   r    r!   r"   seen_sep
seen_colonrB   r#   rC   r$   r   r%   r   Stater?   b   s     
!	9!yr%   rF   c                    > TR                   (       a0  TR                   H   n TR                  U TR                   45        M"     STl        STl        / Tl        / Tl         g )NTF)rC   rB   r2   rD   rE   )filenamerF   rets    r   _reset,parse_files_to_codes_mapping.<locals>._reseth   sJ    ;;!OO

Hekk23 , r%   c                 |   > [         R                  " S[        R                  " T R	                  5       S5       35      $ )NzExpected `per-file-ignores` to be a mapping from file exclude patterns to ignore codes.

Configured `per-file-ignores` setting:

z    )r   ExecutionErrortextwrapindentr   )r   s   r   _unexpected_token7parse_files_to_codes_mapping.<locals>._unexpected_tokenq   s9    ((9 u{{}f568
 	
r%   TF)returnNone)rR   zexceptions.ExecutionError)r   r   joinr   r;   r   _COMMA_WSrD   rE   _COLON_FILErB   r2   r   r6   _CODErC   )value_rJ   rP   tokenrF   rI   r   s       @@@r   parse_files_to_codes_mappingr\   N   s]    fc""		&!')C;;==
  
 2%888}$!EN!!xx6!#' !%EHH$5&&uyy1!&')) xx4EHH$5""599-!&EHH$5&&uyy1!&'))5 98 Jr%   c                |    [        U [        5      (       d   U 5       eU  Vs/ s H  n[        X!5      PM     sn$ s  snf )z_Normalize a list of paths relative to a parent directory.

:returns:
    The normalized paths.
)r   listnormalize_path)pathsparentps      r   normalize_pathsrc      s9     eT"")E)"/45u!N1%u555s   9c                H   [         R                  R                  n[         R                  R                  =(       d    SnU S:X  d  X ;   d  U(       aA  X0;   a<  [         R                  R	                  [         R                  R                  X5      5      n U R                  X#-   5      $ )z=Normalize a single-path.

:returns:
    The normalized path.
r.   .)ospathsepaltsepabspathrT   rstrip)rg   ra   	separatoralternate_separators       r   r_   r_      sk     I''...B$7$?wwrww||F9:;;y677r%      )maxsizec                    [         R                  R                  R                  5       n [        R
                  " U 5      n [        R                  " UR                  5      u  p#UR                  S5        [        R                  " X5      R                  5       $ ! [        [        [        4 a    U R                  S5      s $ f = f)z'Get and cache it so plugins can use it.r   zutf-8)sysstdinbufferreadioBytesIOtokenizedetect_encodingreadlineseekTextIOWrapperLookupErrorSyntaxErrorUnicodeErrordecode)stdin_valuefdcoding_s       r   stdin_get_valuer      s     ))""'')K	K	 B+,,R[[9	

+0022l3 +!!'**+s    AB &C ?C c                 P    [        [        R                  " [        5       5      5      $ )z8Return lines of stdin split according to file splitting.)r^   ru   StringIOr   r   r%   r   stdin_get_linesr      s    O-.//r%   c                    SU ;   $ )zDetermine if we're going to read from stdin.

:param paths:
    The paths that we're going to check.
:returns:
    True if stdin (-) is in the path, otherwise False
-r   )r`   s    r   is_using_stdinr      s     %<r%   c                >   ^  U(       d  g[        U 4S jU 5       5      $ )ag  Wrap :func:`fnmatch.fnmatch` to add some functionality.

:param filename:
    Name of the file we're trying to match.
:param patterns:
    Patterns we're using to try to match the filename.
:param default:
    The default value if patterns is empty
:returns:
    True if a pattern matches the filename, False if it doesn't.
    ``True`` if patterns is empty.
Tc              3  R   >#    U  H  n[         R                  " TU5      v   M     g 7fr
   )_fnmatchfnmatch)r   patternrH   s     r   r   fnmatch.<locals>.<genexpr>   s!     K(wx'22(s   $')any)rH   patternss   ` r   r   r      s     K(KKKr%   c                8   U(       d  g[         R                  R                  U 5      nUS;  a%  [        XA5      (       a  UR	                  X$SS.5        g[         R                  R                  U 5      n[        XQ5      nUR	                  UXV(       a  SOSS.5        U$ )a$  Use fnmatch to discern if a path exists in patterns.

:param path:
    The path to the file under question
:param patterns:
    The patterns to match the path against.
:param log_message:
    The message used for logging purposes.
:returns:
    True if path matches patterns, False otherwise
F>   re   ..r.   )rg   whetherTznot )rf   rg   basenamer   debugrj   )rg   r   log_messageloggerr   absolute_pathr1   s          r   matches_filenamer      s    " ww%H{"wx'B'B["CDGGOOD)MM,E
LL2FC Lr%   c                     SR                  [        R                  " 5       [        R                  " 5       [        R                  " 5       5      $ )z~Find and format the python implementation and version.

:returns:
    Implementation name, version, and platform as a string.
z{} {} on {})formatplatformpython_implementationpython_versionsystemr   r%   r   get_python_versionr   	  s9     &&(! r%   c                J    [         R                  SU 5      R                  5       $ )z3Normalize a distribution name according to PEP 503.r   )NORMALIZE_PACKAGE_NAME_REsublower)ss    r   normalize_pypi_namer     s    $((a06688r%   )r   r   r   zPattern[str]rR   rA   )r   r   rR   zlist[_Token])rZ   zSequence[str] | strrR   zlist[tuple[str, list[str]]])r`   Sequence[str]ra   r   rR   rA   )rg   r   ra   r   rR   r   )rR   r   )rR   rA   )r`   rA   rR   bool)rH   r   r   r   rR   r   )
rg   r   r   r   r   r   r   zlogging.LoggerrR   r   )r   r   rR   r   )-__doc__
__future__r   r   r   	functoolsru   loggingrf   r   rerq   rN   rw   typingr   r   r   flake8r   compileCOMMA_SEPARATED_LIST_RELOCAL_PLUGIN_LIST_REr   r   r   rY   rX   rW   rU   rV   r6   r0   r;   r\   curdirrc   r_   	lru_cacher   r   r   r   r   r   r   r%   r   <module>r      s   ! "   	  	  	 
      **X. zz"23 JJy1  (?//$//(Z 
 %K !uffcZZ)*E2ZZe$ZZ
V$ZZ
V$ZZ "GG GV )+			6	6"%	6	6 -/II 8* Q	+  	+0
L$
  	
 
B
9r%   