ML if UddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ejdk\rddlZnddlZddlmZmZmZddlmZmZmZmZmZddlmZmZdd lmZdd lm Z m!Z!ee"e#e$e%e&e"e"fe'e"e(e$e$ffZ)d e*d <eege)fZ+d e*d <GddejXZ-dSdZ.dTdUdZ/dVdZ0dWdZ1dXdZ2dYdZ3dZdZ4d[dZ5d\dZ6d\dZ7d]dZ8ide.de"de2ddd e5d!e2d"e2d#e7d$e6d%e#d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4e2e2e#d5e/e/d6Z9d7e*d8<e9juZ;d7e*d9<e;jyide.dd:d d;d#d<d$d=d&e/d(e/d*e/d,d>d.e/d0d?d2d@dAe/dBe3dCe/dDe/ d^ d_dEZ= d^ d`dFZ> da dbdGZ?dcdHZ@dddIZAdedJZBejf dfdKZDdgdLZEdhdMZFdidNZG djdOZHdkdPZIGdQdReJZKy)l) annotationsN)StringIO) error_codes) )MappingMutableMappingSequence)AnyCallableFinalTextIOUnion)Never TypeAlias)defaults)PER_MODULE_OPTIONSOptionsr_CONFIG_VALUE_TYPES_INI_PARSER_CALLABLEc$eZdZdZdfd ZxZS)VersionTypeErrorz>Provide a fallback value if the Python version is unsupported.c,||_t||yN)fallbacksuper__init__)selfrargs __class__s X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypy/config_parser.pyrzVersionTypeError.__init__"s   $)rr rtuple[int, int]returnNone)__name__ __module__ __qualname____doc__r __classcell__)r s@r!rrsH  r"rctjdt|}|stjd|dt |j dt |j d}}|dk(r |dk(r ||fS|dk(rk|tjdkrQdj|gtj}t|tr|d z }t|tj ||fStjd |d ) Nz\A(\d)\.(\d+)\ZzInvalid python version 'z' (expected format: 'x.y')rz6Python 3.{} is not supported (must be {}.{} or higher)z7. You may need to put quotes around your Python version)rzPython major version 'z' out of range (must be 3)) rematchstrargparseArgumentTypeErrorintgrouprPYTHON3_VERSION_MINformat isinstancefloatr)vmmajorminormsgs r! parse_versionr?'s  #SV,A ((+CA3F`)abbqwwqz?C O5E zeqj  %< ! 8//2 2QJQQ 44C!U#PP"31M1MN N %<(($UG+E F  r"c~ddd}t|trNtj||Dcgc]}|j }}|r|ddk(r|j d|St|t r8|Dcgc],}t|tr|j n ||d.c}S||ycc}wcc}w) zSplit and trim a str or sequence (eg: list) of str into a list of str. If an element of the input is not str, a type error will be raised.cdtjd|dt|jd|)Nz.complainCs<((J1#[Y]^_Y`YiYiXjjkl{k| }  r"z (As an element of the list.))rFN)rA)rEobjectrFr1r$r)r8r1r/splitstrippopr )r: split_regexrGpitemss r! try_splitrP?s !S$&HH[!$<=q== U2Y"_ IIbM Ax   a% a1PQR    >  s B581B:ct|ttjz }|r0tjddj t ||S)NzInvalid error code(s): , )setrkeysr2r3joinsorted)codes invalid_codess r!validate_codesrYZsTJ[%5%5%7!88M((%dii}0E&F%G H   Lr"c|D]C}d|}d|vrtj|dd|vsd|vs-tj|d|S)NzInvalid allow list entry: *z5 (entries are already prefixes so must not contain *)\/zA (entries must be packages like foo.bar not directories or files))r2r3) allow_listrNr>s r!validate_package_allow_listr_csw  *1#. !8,,%LM  19q,,%XY   r"cztjjtjj|S)ziExpand the user home directory and any environment variables contained within the provided path. )ospath expandvars expanduser)rbs r! expand_pathreqs( 77  bgg006 77r"ct|tr#|jr|jgSgS|Dcgc]#}|js|j%c}Scc}wr)r8r1rK)r:rNs r!str_or_array_as_listrgysI!Sggi {/R/ .!AGGIAGGI .. .s A#A#cg}|D]W}t|j}tj|d}|r|j |G|j |Y|S)zTake a list of files/directories (with support for globbing through the glob library). Where a path/glob matches no file, we still include the raw path in the resulting list. Returns a list of file paths T) recursive)rerKfileglobglobextendappend)pathsexpanded_pathsrb globbed_filess r!split_and_match_files_listrqs_N(4::<( dd;   ! !- 0  ! !$ ' ( r"c*tt|S)zTake a string representing a list of files/directories (with support for globbing through the glob library). Where a path/glob matches no file, we still include the raw path in the resulting list. Returns a list of file paths )rq split_commas)rns r!split_and_match_filesrts &l5&9 ::r"c gd}||vr;tjdj|djd|D|S)N)normalsilentskiperror$invalid choice '{}' (choose from {})rRc3(K|] }d|d yw'N.0rEs r! z'check_follow_imports..!.rrrrs r!check_junit_formatrsP$G W(( 2 9 9 !rs*BHHVQlSTo2V17792V#W2VrcZt|Dcgc]}|jc}Scc}wrrrs r!rrrrc$|jgSrrKrs r!rrs!'')r") package_root cache_dirpython_executablestrictexcludepackagesmodulesz&Final[dict[str, _INI_PARSER_CALLABLE]]ini_config_typestoml_config_typescRt|dDcgc] }t|c}Scc}wr)rPrers r!rrs !V8LM1 AMMs$c*tt|Sr)rqrPrs r!rrs5ilCr"c*tt|Sr)rr1rs r!rrs"4SV"<r"c*tt|Sr)rr1rs r!rrs$8Q$@r"c*tt|Sr)r_rPrs r!rrs+FyQR|+Tr"c*tt|SrrYrPrs r!rrsy|(Dr"c*tt|Srrrs r!rrs~il'Cr"rrrrc|tjj|sy t|rZt |d5}t j |}dddjdi}d|vryd|di}t|}t}n+tj}|j|t}tjj%|t&j(vrd|vry|||fS#1swYxYw#t jtjt f$r}t#|d||Yd}~yd}~wwxYw)Nrbtoolmypy: file)rarbexistsis_tomlopentomllibloadgetdestructure_overridesr configparserRawConfigParserreadrTOMLDecodeErrorErrorConfigTOMLValueErrorprintbasenamerSHARED_CONFIG_NAMES) config_filestderrf toml_dataparser config_typeserrs r!_parse_individual_filers  77>>+ & ; k4( ,A#LLO  ," fb1IY&6!23I*95F,L!113F KK $+L  ww $(D(DDW]I] < ,,+ , ,  # #\%7%79M N  Ru%F3s5C7C+C7.AC7+C40C77(D;D66D;ctjjtj tj tj zD]Q}tjjtjj|}t||}|O|cStfddDrn(tjj}|k(rn|tjD]}t||}||cSy)Nc3K|]A}tjjtjj|Cywr)rarbrrU)rcvs_root current_dirs r!rz$_find_config_file..'s2 DLBGGNN277<< X> ? sAA )z.gitz.hg) rarbabspathgetcwdr CONFIG_NAMESrrelpathrUranydirnameUSER_CONFIG_FILES)rnamerret parent_dirrs @r!_find_config_filers''//"))+.K ))H,H,HH D''//"'',,{D*IJK(f=C{J    P_   WW__[1  $   " 11 $[&9 ;   r"c (|xstj}|xstj}| t||n t |}|y|\}}}||_t jjt jj|t jd<d|vrB|s/t jj|tjvrnt|d|n]|d} |d} t| ||| ||\} } | j!D]\} }t#|| ||j$j'| |j!D]\}} |j)dst+||} t| ||| ||\} } | r.ls!MA!i-!Msz=Per-module sections should only specify per-module flags ({})rrCc3&K|]}|v ywrr~)rcrks r!rz$parse_config_file..s1QqDy1z?[]!c32K|]}d|vxr|dk7yw)r[Nr~rs r!rz$parse_config_file..s%9./C1H)c)9sziPatterns must be fully-qualified module names, optionally with '*' in some components (e.g spam.*.eggs.*))!sysstdoutrrrrrarbrrenvironrrrr parse_sectionrOsetattr report_dirsupdate startswith get_prefixr7rUrVrSrrJreplacesepaltseprper_module_options)optionsset_strict_flagsfilenamerrrrr file_readsectionprefixupdatesrkr:rglobsrks @r!parse_config_filer9s !szzF  !szzF   x0 v &  {&)#FL)#G)+9S)TBJJ%& V rww'' 2(:V:VV YKAB P.;j), G-w f MMO #DAq GQ " #"";/)? g ??7 # 40F#0!17L&$ G[IPP !M 9L!MM 7|00SZZ &W8J)J"KL -4MMOWDAqqDV?V1a4WWHE C( ?||BFFC099<< 37D1&11S937::c?96J# 8?G..t4! ?3)?,Xs 3LLczt|r'ddj|jdddz}n|}|d|dS)Nz module = "%s"-r,z: [z]:)rrUrJ)rrmodule_name_strs r!rrsEy)CHHTZZ_QR5H,II[O,B //r"c@|jjdS)Nz.toml)lowerendswith)rs r!rrs >>  $ $W --r"c d|dvr|St|ddts td|j}|ddD]}d|vr tdt|dtr|dg}n$t|dtr|d}n td|D]h}|j}|d=d|}||vr|||<%|j D]1\}}|||vr||||k7rtd|d |d ||||<3j|dd=|S) aFTake the new [[tool.mypy.overrides]] section array in the pyproject.toml file, and convert it back to a flatter structure that the existing config_parser can handle. E.g. the following pyproject.toml file: [[tool.mypy.overrides]] module = [ "a.b", "b.*" ] disallow_untyped_defs = true [[tool.mypy.overrides]] module = 'c' disallow_untyped_defs = false Would map to the following config dict that it would have gotten from parsing an equivalent ini file: { "mypy-a.b": { disallow_untyped_defs = true, }, "mypy-b.*": { disallow_untyped_defs = true, }, "mypy-c": { disallow_untyped_defs: false, }, } overridesrz~tool.mypy.overrides sections must be an array. Please make sure you are using double brackets like so: [[tool.mypy.overrides]]modulezetoml config file contains a [[tool.mypy.overrides]] section, but no module to override was specified.zytoml config file contains a [[tool.mypy.overrides]] section with a module value that is not a string or a list of stringsrz\toml config file contains [[tool.mypy.overrides]] sections with conflicting values. Module 'z ' has two different values for 'r})r8listrcopyr1rO) rresultoverriderrmodule_overridesold_config_namenew_key new_values r!rrs@)F++ i' 4d ;" R  ^^ F6N;/#A 8 #&D  hx(# .)*G *D 1x(G&   AF'}}  * %fX.Of,*:'*:*@*@*B A&GY6/#::"?3G< I2//5h6VW^V__`b 8AF?+G4 A A%#AJ v{# Mr"c i}i}ddd}|D]G} d} | } | |vr|| } n| |vr t|d| d|| d|| d| 7t|| d } | E| jd rL| d d jd d}|tj vrt || ||<nt|d| | | jdrn| jdrt|| dd r| dd } d} n| jdrt|d| zrd| z} d} nt| jdrt|| dd r| dd } d} nL| jdrt|d| dd zr d| dd z} d} n| dk(rnt|d| d|| | | rt|| d } nt| } d } | turBt|trt|j| }n|j| }| rS| }nOt!| r/| rt|d| |  | |j| }nt|d| d| 3| dk(r |r|C||| <Jd|vrg|d<d|vrg|d<||fS#t"$r*}t|| d|| |j$}Yd }~\d }~wt&j($r}t|| d|| Yd }~d }~wwxYw#t*$r}t|| d|| Yd }~d }~wwxYw)z|Parse one section of a config file. Returns a dict of option values encountered, and a dict of report directories. rr)enabled_error_codesdisabled_error_codesFzUnrecognized option: z = z (did you mean z?)rNri_rzUnrecognized report type: x_no_rTallowdisdisallowshow_hide_rrzCan not invert non-boolean key rzDon't know what type z should have)rgetattrrr rREPORTER_NAMESr1rhasattrrDboolr8dictconvert_to_booleanr getbooleancallablerrr2r3 ValueError)rtemplaterrrrresultsrinvalid_optionskeyinvert options_keyctdv report_typer: err_versionrs r!rrs"$G"$K 3 4O L! , c"B O # (/uC ~!/#"6!7r;  3-Bz<< *"%cr("2"23">$'^^E*wxQR/I"%ab'K!F^^G,53;1O"'#+K!F^^J/GHc!"g4N"%ab'K!F^^G,7SQRQSWCT1U")CG"3K!FH_VH$9#c'#,PW]^ ;=BbB Tzgt,*7;;s+;.sB1779Bsr,rr+True)rPrJr )liner<r entriesrNentryrrs r!mypy_comments_to_config_maprXs~G%d+OGV  e DEBekk#q.ABKD%||C% =E   F?r"c g}ggd}|D]\}tj}t||\}}d|vr|jdf|d=||d<|j fd|Dt }ddfd } t d|| |dt| \} } |j fd |jjjd D| r|jd fr|jd fd| vrQt| dx} tr.s8avqk8rFc dy)NTr~) strict_foundsr!rz-parse_mypy_comments..set_strict_flagssLr"rA)rc3,K|] }|s|f ywrr~r\s r!rz&parse_mypy_comments..sVaTUvqkVs  z-Reports not supported in inline configurationzSetting "strict" not supported in inline configuration: specify it in a configuration file instead, or set individual inline flags (see "mypy -h" for the list of flags enabled in strict mode)rr)r$r%)rrrXrmrlrrrgetvaluerKrJr8r rrVrSr)rr<rNsectionsrUrr  parse_errorsrr new_sectionsreportsneeceecndecdecr]r_s @@r!parse_mypy_commentsrks%'F8:RT"UH4& --/ ;D( K w & MM6#YZ [()!w 8<88  !. *F7O=MV\!  g  V6??+<+B+B+D+J+J4+PVV  MM6#RS T  MMS  < /<0C#DD4dK(,,/BB"GG3N06s4#:0GL, - L 0<0D#EE4tL(,,/CR"HH3$O17D3J1HL- . %i4&j V r"c|r|syt|sdjd|DSddjt|zS)NrArRc3(K|] }d|d yw)z[mypy-]Nr~)rrs r!rz*get_config_module_names..sB6&+Brzmodule = ['%s']z', ')rrUrV)rrs r!get_config_module_namesros? 7 8 yyB'BBB  F7O < ==r"c eZdZy)rN)r&r'r(r~r"r!rrsr"r)r:z str | floatr$r#)r)r:zstr | Sequence[str] | objectrMr1r$ list[str])rWrqr$rq)r^rqr$rq)rbr1r$r1)r:zstr | Sequence[str]r$rq)rnz Sequence[str]r$rq)rnr1r$rq)rr1r$r1)rr1r$rqr)rr1r TextIO | Noner$Ltuple[MutableMapping[str, Any], dict[str, _INI_PARSER_CALLABLE], str] | None)rrrr$rs)NN) r rrCallable[[], None]r str | Nonerrrrrrr$r%)rr1rr1r$r1)rr1r$r6)rdict[str, Any]r$rv)rr1r<rrrtrzMapping[str, Any]rrvrrr$z(tuple[dict[str, object], dict[str, str]])rz Any | Noner$r6)rr1r$ztuple[list[str], list[str]])rUr1r<rr$z tuple[dict[str, str], list[str]])rzlist[tuple[int, str]]r<rr$z/tuple[dict[str, object], list[tuple[int, str]]])rrurrqr$r1)L __future__rr2rrkrjrar/riormypy.errorcodesr version_infortomlicollections.abcrr r typingr r r rrtyping_extensionsrrrr mypy.optionsrrr1r6r4r9r7r tupler__annotations__rr3rr?rPrYr_rergrqrtrrrsrr!rrrrrrrrrrr8rPrXrkror;rr~r"r!rs " 'w==66.4!&sE4S>49eCHoE"Y#+C52E+E"FiF x11 06 8/ ( ;<m<C<;<P <  " < { <<&<*<<=<A<B<<" !O#<$X%<&W'<(C$$5<8<=M : r"