§ x<ˆjiãór—dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZmZmZmZmZddlmZmZd„ZGd „d ¦«ZGd „d ¦«ZGd „d¦«ZGd„de¦«ZGd„de¦«ZGd„de¦«ZGd„de¦«ZGd„de¦«ZdS)z) Tests for L{pyflakes.scripts.pyflakes}. éN)ÚPYPY)Ú UnusedImport)ÚReporter)ÚmainÚcheckÚ checkPathÚcheckRecursiveÚiterSourceCode)ÚTestCaseÚskipIfcó€—tj|c}t_ ||i|¤Ž|t_S#|t_wxYw)z? Call C{f} with C{sys.stderr} redirected to C{stderr}. )ÚsysÚstderr)rÚfÚargsÚkwargsÚouters úh/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/pyflakes/test/test_api.pyÚ withStderrTorsG€õœ: vЀU�CŒJð؈q�$Ð!˜&Ð!Ð!à�Œ ˆ ø�U�Œ ÐÐÐÐs›/¯=có—eZdZdZdd„ZdS)ÚNodez Mock an AST node. rcó"—||_||_dS©N)ÚlinenoÚ col_offset)Úselfrrs rÚ__init__z Node.__init__)s€ØˆŒ Ø$ˆŒˆˆóN)r)Ú__name__Ú __module__Ú __qualname__Ú__doc__r©rrrr%s2€€€€€ððð%ð%ð%ð%ð%ð%rrcó$—eZdZdZd„Zd„Zd„ZdS)ÚSysStreamCapturingzContext manager capturing sys.stdin, sys.stdout and sys.stderr. The file handles are replaced with a StringIO object. cóT—tj|pdtj¬¦«|_dS)NÚ©Únewline)ÚioÚStringIOÚosÚlinesepÚ_stdin)rÚstdins rrzSysStreamCapturing.__init__4s"€Ý”k % +¨2µr´zÐBÑBÔBˆŒ ˆ ˆ rcóN—tj|_tj|_tj|_|jt_tj tj ¬¦«xt_|_ tj tj ¬¦«xt_|_ |S)Nr()rr/Ú _orig_stdinÚstdoutÚ _orig_stdoutrÚ _orig_stderrr.r*r+r,r-Ú_stdout_stringioÚ_stderr_stringio©rs rÚ __enter__zSysStreamCapturing.__enter__7sj€Ýœ9ˆÔÝœJˆÔÝœJˆÔà”K�Œ Ý-/¬[ÅÄÐ-LÑ-LÔ-LÐL�Œ �TÔ*Ý-/¬[ÅÄÐ-LÑ-LÔ-LÐL�Œ �TÔ*àˆ rcóä—|j ¦«|_|j ¦«|_|jt _|jt _ |j t _ dSr) r5ÚgetvalueÚoutputr6Úerrorr1rr/r3r2r4r)rrs rÚ__exit__zSysStreamCapturing.__exit__BsP€ØÔ+×4Ò4Ñ6Ô6ˆŒ ØÔ*×3Ò3Ñ5Ô5ˆŒ àÔ$�Œ ØÔ&�Œ ØÔ&�Œ ˆ ˆ rN)rr r!r"rr8r=r#rrr%r%.sN€€€€€ððð CðCðCð ð ð ð'ð'ð'ð'ð'rr%có*—eZdZdZd„Zd„Zd„Zd„ZdS)ÚLoggingReporterzK Implementation of Reporter that just appends any error to a list. có—||_dS)zh Construct a C{LoggingReporter}. @param log: A list to append log messages to. N)Úlog)rrAs rrzLoggingReporter.__init__Ps€ð ˆŒˆˆrcóX—|j dt|¦«f¦«dS)NÚflake)rAÚappendÚstr)rÚmessages rrCzLoggingReporter.flakeXs'€Ø Œ�Š˜¥# g¡,¤,Ð/Ñ0Ô0Ð0Ð0Ð0rcó@—|j d||f¦«dS)NÚunexpectedError©rArD)rÚfilenamerFs rrHzLoggingReporter.unexpectedError[s$€Ø Œ�ŠÐ*¨H°gÐ>Ñ?Ô?Ð?Ð?Ð?rcóF—|j d|||||f¦«dS)NÚ syntaxErrorrI)rrJÚmsgrÚoffsetÚlines rrLzLoggingReporter.syntaxError^s)€Ø Œ�Š˜¨°#°v¸vÀtÐLÑMÔMÐMÐMÐMrN)rr r!r"rrCrHrLr#rrr?r?Ksb€€€€€ðððððð1ð1ð1ð@ð@ð@ðNðNðNðNðNrr?cóN—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d S) ÚTestIterSourceCodez& Tests for L{iterSourceCode}. có6—tj¦«|_dSr)ÚtempfileÚmkdtempÚtempdirr7s rÚsetUpzTestIterSourceCode.setUpgs€ÝÔ'Ñ)Ô)ˆŒ ˆ ˆ rcó8—tj|j¦«dSr©ÚshutilÚrmtreerUr7s rÚtearDownzTestIterSourceCode.tearDownjó€ÝŒ �d”lÑ#Ô#Ð#Ð#Ð#rcóŠ—|sJ‚tjj|jg|¢RŽ}t |d¦« ¦«|S)NÚa)r,ÚpathÚjoinrUÚopenÚclose)rÚpartsÚfpaths rÚ makeEmptyFilez TestIterSourceCode.makeEmptyFilemsG€Øˆ ˆ ˆuÝ”” ˜Tœ\Ð2¨EÐ2Ð2Ð2ˆÝ ˆU�CÑÔ×ÒÑ Ô Ð Øˆ rcór—| tt|jg¦«¦«g¦«dS)zB There are no Python files in an empty directory. N)Ú assertEqualÚlistr rUr7s rÚtest_emptyDirectoryz&TestIterSourceCode.test_emptyDirectoryss4€ð ×Ò��n¨d¬l¨^Ñ<Ô<Ñ=Ô=¸rÑBÔBÐBÐBÐBrcóž—| d¦«}| tt|jg¦«¦«|g¦«dS)zd If the directory contains one Python file, C{iterSourceCode} will find it. úfoo.pyN©rergrhr rU)rÚ childpaths rÚtest_singleFilez"TestIterSourceCode.test_singleFileysI€ð ×&Ò& xÑ0Ô0ˆ Ø ×Ò��n¨d¬l¨^Ñ<Ô<Ñ=Ô=À ¸{ÑKÔKÐKÐKÐKrcóœ—| d¦«| tt|jg¦«¦«g¦«dS)zJ Files that are not Python source files are not included. zfoo.pycNrlr7s rÚtest_onlyPythonSourcez(TestIterSourceCode.test_onlyPythonSource�sH€ð ×Ò˜9Ñ%Ô%Ð%Ø ×Ò��n¨d¬l¨^Ñ<Ô<Ñ=Ô=¸rÑBÔBÐBÐBÐBrcó—tjtj |jd¦«¦«| dd¦«}| dd¦«tjtj |jd¦«¦«| dd¦«}| d¦«}| tt|jg¦«¦«t|||g¦«¦«dS)zk If the Python files are hidden deep down in child directories, we will find them. Úfooúa.pyza.py~Úbarúb.pyzc.pyN) r,Úmkdirr_r`rUrergÚsortedr )rÚapathÚbpathÚcpaths rÚ test_recursesz TestIterSourceCode.test_recursesˆsæ€õ Œ•”—’˜dœl¨EÑ2Ô2Ñ3Ô3Ð3Ø×"Ò" 5¨&Ñ1Ô1ˆØ ×Ò˜5 'Ñ*Ô*Ð*Ý Œ•”—’˜dœl¨EÑ2Ô2Ñ3Ô3Ð3Ø×"Ò" 5¨&Ñ1Ô1ˆØ×"Ò" 6Ñ*Ô*ˆØ ×ÒÝ •> 4¤< .Ñ1Ô1Ñ 2Ô 2Ý �E˜5 %Ð(Ñ )Ô )ñ +ô +ð +ð +ð +rc óÞ—tj |jd¦«}t |d¦«5}| d¦«ddd¦«n #1swxYwY| d¦«t tj |jd¦«d¦«5}| d¦«ddd¦«n #1swxYwYtj |jd¦«}t |d¦«5}| d ¦«ddd¦«n #1swxYwYtj |jd ¦«}t |d¦«5}| d ¦«ddd¦«n #1swxYwYtj |jd ¦«}t |d¦«5}| d ¦«ddd¦«n #1swxYwYtj |jd¦«}t |d¦«5}| d¦«ddd¦«n #1swxYwYtj |jd¦«}t |d¦«5}| d¦«ddd¦«n #1swxYwYtj |jd¦«}t |d¦«5}| d¦«ddd¦«n #1swxYwY| tt|jg¦«¦«t||||||g¦«¦«dS)zd Find Python files that don't end with `.py`, but contain a Python shebang. r^Úwz#!/usr/bin/env python NÚbÚcz hello world Úez#!/usr/bin/env python3 rz#!/usr/bin/env pythonw Úgz#!/usr/bin/python3 -u Úiz#!/usr/local/bin/python3d Újz#! /usr/bin/env python3.8m Úlz#!/bin/sh #!/usr/bin/python ) r,r_r`rUraÚwriterergrwr ) rÚpythonÚfdÚpython3ÚpythonwÚ python3argsÚpython3dÚ python38mÚnotfirsts rÚ test_shebangzTestIterSourceCode.test_shebang—sÜ€õ ”—’˜dœl¨CÑ0Ô0ˆÝ �&˜#Ñ Ô ð 0 "Ø �HŠHÐ.Ñ /Ô /Ð /ð 0ð 0ð 0ñ 0ô 0ð 0ð 0ð 0ð 0ð 0ð 0øøøð 0ð 0ð 0ð 0ð ×Ò˜3ÑÔÐå •"”'—,’,˜tœ|¨SÑ1Ô1°3Ñ 7Ô 7ð '¸2Ø �HŠHÐ%Ñ &Ô &Ð &ð 'ð 'ð 'ñ 'ô 'ð 'ð 'ð 'ð 'ð 'ð 'øøøð 'ð 'ð 'ð 'õ”'—,’,˜tœ|¨SÑ1Ô1ˆÝ �'˜3Ñ Ô ð 1 2Ø �HŠHÐ/Ñ 0Ô 0Ð 0ð 1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1õ”'—,’,˜tœ|¨SÑ1Ô1ˆÝ �'˜3Ñ Ô ð 1 2Ø �HŠHÐ/Ñ 0Ô 0Ð 0ð 1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1õ”g—l’l 4¤<°Ñ5Ô5ˆ Ý �+˜sÑ #Ô #ð 0 rØ �HŠHÐ.Ñ /Ô /Ð /ð 0ð 0ð 0ñ 0ô 0ð 0ð 0ð 0ð 0ð 0ð 0øøøð 0ð 0ð 0ð 0õ”7—<’< ¤ ¨cÑ2Ô2ˆÝ �(˜CÑ Ô ð 4 BØ �HŠHÐ2Ñ 3Ô 3Ð 3ð 4ð 4ð 4ñ 4ô 4ð 4ð 4ð 4ð 4ð 4ð 4øøøð 4ð 4ð 4ð 4õ”G—L’L ¤¨sÑ3Ô3ˆ Ý �)˜SÑ !Ô !ð 5 RØ �HŠHÐ3Ñ 4Ô 4Ð 4ð 5ð 5ð 5ñ 5ô 5ð 5ð 5ð 5ð 5ð 5ð 5øøøð 5ð 5ð 5ð 5õ”7—<’< ¤ ¨cÑ2Ô2ˆÝ �(˜CÑ Ô ð 7 BØ �HŠHÐ5Ñ 6Ô 6Ð 6ð 7ð 7ð 7ñ 7ô 7ð 7ð 7ð 7ð 7ð 7ð 7øøøð 7ð 7ð 7ð 7ð ×ÒÝ •> 4¤< .Ñ1Ô1Ñ 2Ô 2Ý Ø˜ ¨+°xØðñ ô ñ ô ð ð ð s�¶AÁAÁAÂ+C à CÃCÄ D/Ä/D3Ä6D3Å/FÆFÆFÇG3Ç3G7Ç:G7È3IÉIÉIÊJ7Ê7J;Ê>J;Ë7LÌLÌ LcóÄ—tj |jd¦«}tj |jd¦«}tj|¦«| dd¦«}tj|¦«| dd¦«}| tt||g¦«¦«t||g¦«¦«dS)zr L{iterSourceCode} can be given multiple directories. It will recurse into each of them. rrrtrsruN) r,r_r`rUrvrergrwr )rÚfoopathÚbarpathrxrys rÚtest_multipleDirectoriesz+TestIterSourceCode.test_multipleDirectoriesÅsÅ€õ ”'—,’,˜tœ|¨UÑ3Ô3ˆÝ”'—,’,˜tœ|¨UÑ3Ô3ˆÝ Œ�ÑÔÐØ×"Ò" 5¨&Ñ1Ô1ˆÝ Œ�ÑÔÐØ×"Ò" 5¨&Ñ1Ô1ˆØ ×ÒÝ •> 7¨GÐ"4Ñ5Ô5Ñ 6Ô 6Ý �E˜5�>Ñ "Ô "ñ $ô $ð $ð $ð $rcó”—| d¦«}| tt|g¦«¦«|g¦«dS)z‹ If one of the paths given to L{iterSourceCode} is not a directory but a file, it will include that in its output. ze.pyN)rergrhr )rÚepaths rÚtest_explicitFilesz%TestIterSourceCode.test_explicitFilesÔsR€ð ×"Ò" 6Ñ*Ô*ˆØ ×Ò��n¨e¨WÑ5Ô5Ñ6Ô6ؘñ "ô "ð "ð "ð "rN)rr r!r"rVr[rerirnrpr{rŽr’r•r#rrrQrQbs¾€€€€€ððð*ð*ð*ð$ð$ð$ðððð CðCðCð LðLðLðCðCðCð +ð +ð +ð,ð,ð,ð\ $ð $ð $ð"ð"ð"ð"ð"rrQcó6—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z dS) Ú TestReporterz Tests for L{Reporter}. cóò—tj¦«}td|¦«}| dddtjdkrdndd¦«| d | ¦«¦«dS) a  C{syntaxError} reports that there was a syntax error in the source file. It reports to the error stream and includes the filename, line number, error message, actual line of source and a caret pointing to where the error is. Nrkú a problemé©ršérœéúbad line of sourcez2foo.py:3:8: a problem bad line of source ^ )r*r+rrLrÚ version_inforgr:©rÚerrÚreporters rÚtest_syntaxErrorzTestReporter.test_syntaxErrorãs‰€õŒk‰mŒmˆÝ˜D #Ñ&Ô&ˆØ×Ò˜X {°AÝ"%Ô"2°fÒ"<Ð"<˜Q˜QÀ!Ø1ñ 3ô 3ð 3ð ×Òðð �LŠL‰NŒNñ  ô ð ð ð rcóΗtj¦«}td|¦«}| ddddd¦«| d| ¦«¦«dS)zy C{syntaxError} doesn't include a caret pointing to the error if C{offset} is passed as C{None}. Nrkr™ršržz'foo.py:3: a problem bad line of source ©r*r+rrLrgr:r s rÚtest_syntaxErrorNoOffsetz%TestReporter.test_syntaxErrorNoOffsetõss€õ Œk‰mŒmˆÝ˜D #Ñ&Ô&ˆØ×Ò˜X {°A°tØ1ñ 3ô 3ð 3à ×Òð$à �LŠL‰NŒNñ ô ð ð ð rcóΗtj¦«}td|¦«}| ddddd¦«| d| ¦«¦«dS)z¬ C{syntaxError} doesn't include text or nonsensical offsets if C{text} is C{None}. This typically happens when reporting syntax errors from stdin. Núr™rz:1:1: a problem r¥r s rÚtest_syntaxErrorNoTextz#TestReporter.test_syntaxErrorNoTexts_€õ Œk‰mŒmˆÝ˜D #Ñ&Ô&ˆØ×Ò˜Y¨ °Q¸¸4Ñ@Ô@Ð@Ø ×ÒÐ4°s·|²|±~´~ÑFÔFÐFÐFÐFrc ó†—tj¦«}ddg}td|¦«}| dddt |d¦«dzd  |¦«¦«t jd krd nd}| d |z|d zd zd|dz zzdz|  ¦«¦«dS)z¸ If there's a multi-line syntax error, then we only report the last line. The offset is adjusted so that it is relative to the start of the last line. ržzmore bad lines of sourceNrkr™ršrr�ú r›ézfoo.py:3:%d: a problem éÿÿÿÿú éú^ ) r*r+rrLÚlenr`rrŸrgr:)rr¡Úlinesr¢Úcolumns rÚtest_multiLineSyntaxErrorz&TestReporter.test_multiLineSyntaxErrorså€õ Œk‰mŒmˆà Ø &ð ˆõ˜D #Ñ&Ô&ˆØ×Ò˜X {°Aµs¸5À¼8±}´}ÀqÑ7HØ!ŸYšY uÑ-Ô-ñ /ô /ð /åÔ'¨6Ò1Ð1��°qˆØ ×ÒØ '¨&Ñ 0Ø �2ŒYñØñà �F˜Q‘JÑ ñ à"'ñ(ð �LŠL‰NŒNñ  ô ð ð ð rcóÈ—tj¦«}td|¦«}| dd¦«| d| ¦«¦«dS)zO C{unexpectedError} reports an error processing a source file. Nz source.pyz error messagezsource.py: error message )r*r+rrHrgr:r s rÚtest_unexpectedErrorz!TestReporter.test_unexpectedError#sY€õŒk‰mŒmˆÝ˜D #Ñ&Ô&ˆØ× Ò  ¨oÑ>Ô>Ð>Ø ×ÒÐ5°s·|²|±~´~ÑFÔFÐFÐFÐFrcó—tj¦«}t|d¦«}tdt d¦«d¦«}| |¦«| | ¦«|›d�¦«dS)z„ C{flake} reports a code warning from Pyflakes. It is exactly the str() of a L{pyflakes.messages.Message}. Nrké*rtr«)r*r+rrrrCrgr:)rÚoutr¢rFs rÚ test_flakezTestReporter.test_flake,sq€õ Œk‰mŒmˆÝ˜C Ñ&Ô&ˆÝ˜x­¨b©¬°5Ñ9Ô9ˆØ�Š�wÑÔÐØ ×Ò˜Ÿš™œ¨G¨¨¨Ñ8Ô8Ð8Ð8Ð8rN) rr r!r"r£r¦r©r´r¶rºr#rrr—r—Þs~€€€€€ðððððð$ ð ð ð Gð Gð Gðððð*GðGðGð 9ð 9ð 9ð 9ð 9rr—cóÚ—eZdZdZejd„¦«Zd„Zd„Zd„Z d„Z d„Z d„Z d „Z d „Zd „Zd „Zd „Zeejdkd¦«d„¦«Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZdS)Ú CheckTestszL Tests for L{check} and L{checkPath} which check a file for flakes. c#óhK—tj¦«\}} tj|d¦«5}t |d¦«s| d¦«}| |¦«ddd¦«n #1swxYwY|V—tj|¦«dS#tj|¦«wxYw)zV Make a temporary file containing C{content} and return a path to it. ÚwbÚdecodeÚasciiN)rSÚmkstempr,ÚfdopenÚhasattrÚencoder…Úremove)rÚcontentr‡Únamers rÚ makeTempFilezCheckTests.makeTempFile=sæèè€õ Ô#Ñ%Ô%‰ˆˆDð Ý”˜2˜tÑ$Ô$ð !¨Ý˜w¨Ñ1Ô1ð6Ø%Ÿnšn¨WÑ5Ô5�GØ—’˜Ñ Ô Ð ð !ð !ð !ñ !ô !ð !ð !ð !ð !ð !ð !øøøð !ð !ð !ð !ðˆJˆJˆJå ŒI�d‰OŒOˆOˆOˆOø�BŒI�d‰OŒOˆOˆOøøøs.šB¯;A6Á* BÁ6A:Á:BÁ=A:Á>BÂB1cóð—tj¦«}t|t|¦«}| || ¦«ft |¦«d |¦«f¦«dS)z² Assert that C{path} causes errors. @param path: A path to a file to check. @param errorList: A list of errors expected to be printed to stderr. r'N)r*r+rrrgr:r±r`)rr_Ú errorListr¡Úcounts rÚassertHasErrorszCheckTests.assertHasErrorsLsp€õŒk‰mŒmˆÝ˜S¥)¨TÑ2Ô2ˆØ ×ÒØ �C—L’L‘N”NÐ #¥c¨)¡n¤n°b·g²g¸iÑ6HÔ6HÐ%Iñ Kô Kð Kð Kð KrcóL—g}t|¦«}t||¦«}||fS)a‘ Get any warnings or errors reported by pyflakes for the file at C{path}. @param path: The path to a Python file on disk that pyflakes will check. @return: C{(count, log)}, where C{count} is the number of warnings or errors generated, and log is a list of those warnings, presented as structured data. See L{LoggingReporter} for more details. )r?r)rr_rAr¢rËs rÚ getErrorszCheckTests.getErrorsXs/€ðˆÝ" 3Ñ'Ô'ˆÝ˜$ Ñ)Ô)ˆØ�cˆzÐrcóR—ddlm}| |jt¦«dS)Nr)Úpyflakes)Úpyflakes.scriptsrÐÚassertIsr)rÚscript_pyflakess rÚtest_legacyScriptzCheckTests.test_legacyScriptfs1€Ø@Ð@Ð@Ð@Ð@Ð@Ø � Š �oÔ/µÑ;Ô;Ð;Ð;Ð;rcóŽ—| d¦«5}| |g¦«ddd¦«dS#1swxYwYdS)z§ Source which doesn't end with a newline shouldn't cause any exception to be raised nor an error indicator to be returned by L{check}. zdef foo(): pass N©rÈrÌ)rÚfNames rÚtest_missingTrailingNewlinez&CheckTests.test_missingTrailingNewlinejs�€ð × Ò Ð7Ñ 8Ô 8ð ,¸EØ × Ò  ¨Ñ +Ô +Ð +ð ,ð ,ð ,ñ ,ô ,ð ,ð ,ð ,ð ,ð ,ð ,ð ,øøøð ,ð ,ð ,ð ,ð ,ð ,ó –:º>Á>có�—| d¦«\}}| |d¦«| |dg¦«dS)z: L{checkPath} handles non-existing files. Úextremor¯)rHrÛzNo such file or directoryN)rÎrg)rrËÚerrorss rÚtest_checkPathNonExistingz$CheckTests.test_checkPathNonExistingss_€ðŸš yÑ1Ô1‰ ˆˆvØ ×Ò˜ Ñ"Ô"Ð"Ø ×ÒØ Ø HÐ Iñ Kô Kð Kð Kð Krc óP—d}d„} ||¦«| ¦«n_#t$rR}tsAtjdkr1| |j d¦«dk¦«Yd}~nd}~wwxYw| |¦«5}trd}ntjdkrd}nd }tstjdkrd }ntjd krd }nd }|  |d|||d|dz zfzg¦«ddd¦«dS#1swxYwYdS)zÏ Source which includes a syntax error which results in the raised L{SyntaxError.text} containing multiple lines of source are reported with only the last line of that source. zCdef foo(): ''' def bar(): pass def baz(): '''quux''' có$—t|¦«dSr)Úexec)Úsources rÚevaluatez6CheckTests.test_multilineSyntaxError..evaluate�s€Ý �‰LŒLˆLˆLˆLr©ršé r«r¯Nz=end of file (EOF) while scanning triple-quoted string literalz>unterminated triple-quoted string literal (detected at line 8)zinvalid syntaxé r›rœé z%s:8:%d: %s '''quux''' %s^ r®) ÚfailÚ SyntaxErrorrrrŸÚ assertTrueÚtextrËrÈrÌ)rrárâr€Ú sourcePathrFr³s rÚtest_multilineSyntaxErrorz$CheckTests.test_multilineSyntaxError}sµ€ð ˆð ð ð ð Ø ˆH�VÑ Ô Ð ð �IŠI‰KŒKˆKˆKøõ ð 8ð 8ð 8Ýð 8�CÔ,¨wÒ6Ð6Ø—’ ¤§ ¢ ¨TÑ 2Ô 2°QÒ 6Ñ7Ô7Ð7øøøøøøøøøð 8øøøð × Ò ˜vÑ &Ô &ð :¨*Ýð +ØY��ÝÔ! WÒ,Ð,ØZ��à*�åð •sÔ'¨7Ò2Ð2Ø��ÝÔ! VÒ+Ð+Ø��à�Ø × Ò Øðð�6˜7 C¨6°A©:Ñ$6Ð7ñ 8ð9ñ :ô :ð :ð :ð :ð :ñ :ô :ð :ð :ð :ð :ð :ð :ð :øøøð :ð :ð :ð :ð :ð :s(‡ '§ B±AA>Á>BÂA3DÄDÄ"DcóF—| d¦«5}trd}ntjdkrd}nd}tstjdkrd}nd}d|d z z}d  ||||¦«}| ||g¦«d d d ¦«d S#1swxYwYd S) ú“ The error reported for source files which end prematurely causing a syntax error reflects the cause for the syntax error. zdef foo(zparenthesis is never closedrãz'(' was never closedzunexpected EOF while parsingrœé r®r¯z{}:1:{}: {} def foo( {}^ N)rÈrrrŸÚformatrÌ)rrërMr³ÚspacesÚexpecteds rÚtest_eofSyntaxErrorzCheckTests.test_eofSyntaxError°s €ð × Ò ˜zÑ *Ô *ð 9¨jÝð 5Ø3��ÝÔ! WÒ,Ð,Ø,��à4�åð •sÔ'¨7Ò2Ð2Ø��à�à˜F Q™JÑ'ˆFØ5×<Ò<ؘF C¨ñôˆHð × Ò  ¨h¨ZÑ 8Ô 8Ð 8ð% 9ð 9ð 9ñ 9ô 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9øøøð 9ð 9ð 9ð 9ð 9ð 9s–A3BÂBÂBcó–—| d¦«5}| ||›d�g¦«ddd¦«dS#1swxYwYdS)rîzif True: foo =z$:2:7: invalid syntax foo = ^ NrÖ©rrës rÚtest_eofSyntaxErrorWithTabz%CheckTests.test_eofSyntaxErrorWithTabÉs¬€ð × Ò Ð2Ñ 3Ô 3ð °zØ × Ò Øà ððððñ ô ð ð ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð s–>¾AÁAc óœ—d}| |¦«5}trtjdkrd}nEtrd}n;tjdkrd}n(tjdkrd}ntjdkrd}nd}d |d z zd z}d |z}| |d  |||¦«g¦«ddd¦«dS#1swxYwYdS)zÎ Source which has a non-default argument following a default argument should include the line number of the syntax error. However these exceptions do not include an offset. z def foo(bar=baz, bax): pass ©ršrïérœrãér›rïr®r¯r°ú%d:zO{}:1:{} non-default argument follows default argument def foo(bar=baz, bax): {}N)rÈrrrŸrÌrð)rrárër³Ú last_lineÚ columnstrs rÚ(test_nonDefaultFollowsDefaultSyntaxErrorz3CheckTests.test_nonDefaultFollowsDefaultSyntaxError×sC€ð ˆð× Ò ˜vÑ &Ô &ð 1¨*Ýð �Ô(¨FÒ2Ð2Ø��Ýð Ø��ÝÔ! WÒ,Ð,Ø��ÝÔ! VÒ+Ð+Ø��ÝÔ! VÒ+Ð+Ø��à�ؘv¨™zÑ*¨UÑ2ˆIØ ™ˆIØ × Ò Øð÷ ‚fˆZ˜ IÑ.Ô.ð0ñ 1ô 1ð 1ð 1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1ð 1ð 1s˜BCÃCÃCc óB—d}| |¦«5}tjdkrd}ntstjdkrd}nd}d|dz zd z}d |z}d }| |d  ||||¦«g¦«d d d ¦«d S#1swxYwYd S)zÊ Source which has a non-keyword argument after a keyword argument should include the line number of the syntax error. However these exceptions do not include an offset. zfoo(bar=baz, bax) røér›éé r®r¯r°rûz,positional argument follows keyword argumentz{}:1:{} {} foo(bar=baz, bax) {}N)rÈrrŸrrÌrð)rrárër³rürýrFs rÚ&test_nonKeywordAfterKeywordSyntaxErrorz1CheckTests.test_nonKeywordAfterKeywordSyntaxError÷s€ð ˆð× Ò ˜vÑ &Ô &ð :¨*ÝÔ 6Ò)Ð)Ø��Ýð �cÔ.°&Ò8Ð8Ø��à�ؘv¨™zÑ*¨UÑ2ˆIØ ™ˆIàDˆGà × Ò Øð÷ ‚fˆZ˜ G¨YÑ7Ô7ð9ñ :ô :ð :ð :ð :ð :ñ :ô :ð :ð :ð :ð :ð :ð :ð :øøøð :ð :ð :ð :ð :ð :s˜A/BÂBÂBcó.—| d¦«5}d}trtjdkrd}ntrd}ntjdkrd}nd}dd|dz zz}d ||||fz}| ||g¦«d d d ¦«d S#1swxYwYd S) zI The invalid escape syntax raises ValueError in Python 2 z foo = '\xyz'r¯rør�érz%s^ r®zy%s:1:%d: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-%d: truncated \xXX escape foo = '\xyz' %sN)rÈrrrŸrÌ)rrëÚ position_endr³rüÚdecoding_errors rÚtest_invalidEscapezCheckTests.test_invalidEscapes€ð × Ò ˜Ñ /Ô /ð .°:؈LÝð �Ô(¨FÒ2Ð2Ø��Ýð Ø��ÝÔ! VÒ+Ð+Ø��à�à 3¨&°1©*Ñ#5Ñ6ˆIðð �V˜\¨9Ð5ñ 6ˆNð × Ò Ø˜^Ð,ñ .ô .ð .ð' .ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .ð .ð .s–A'B  BÂBÚwin32zunsupported on Windowscót—tj¦«dkr| d¦«| d¦«5}tj|d¦«| |¦«\}}| |d¦«| |d|dfg¦«ddd¦«dS#1swxYwYdS)za If the source file is not readable, this is reported on standard error. rz8root user can access all files regardless of permissionsr'r¯rHzPermission deniedN)r,ÚgetuidÚskipTestrÈÚchmodrÎrg©rrërËrÜs rÚtest_permissionDeniedz CheckTests.test_permissionDenied.s!€õ Œ9‰;Œ;˜!Ò Ð Ø �MŠMð(ñ )ô )ð )à × Ò ˜rÑ "Ô "ð H jÝ ŒH�Z Ñ #Ô #Ð #Ø ŸNšN¨:Ñ6Ô6‰MˆE�6Ø × Ò ˜U AÑ &Ô &Ð &Ø × Ò ØØ# ZÐ1DÐEÐFñ Hô Hð Hð  Hð Hð Hñ Hô Hð Hð Hð Hð Hð Hð Hð Høøøð Hð Hð Hð Hð Hð HsÁAB-Â-B1Â4B1c óB—| d¦«5}| |¦«\}}| |d¦«| |dtt |t d¦«d¦«¦«fg¦«ddd¦«dS#1swxYwYdS)zc If the source file has a pyflakes warning, this is reported as a 'flake'. z import foor¯rCrrN)rÈrÎrgrErrrs rÚtest_pyflakesWarningzCheckTests.test_pyflakesWarning?sù€ð × Ò ˜|Ñ ,Ô ,ð T° Ø ŸNšN¨:Ñ6Ô6‰MˆE�6Ø × Ò ˜U AÑ &Ô &Ð &Ø × Ò Ø˜'¥3¥|°JÅÀQÁÄÈÑ'OÔ'OÑ#PÔ#PÐQÐRñ Tô Tð Tð Tð Tð Tñ Tô Tð Tð Tð Tð Tð Tð Tð Tøøøð Tð Tð Tð Tð Tð Ts–A1BÂBÂBcóÜ—td¦«}d|z d¦«}| |¦«5}| |g¦«ddd¦«dS#1swxYwYdS)zU If source file declares the correct encoding, no error is reported. é&z# coding: utf-8 x = "%s" úutf-8N©ÚchrrÄrÈrÌ©rÚSNOWMANrárës rÚtest_encodedFileUTF8zCheckTests.test_encodedFileUTF8Js½€õ�f‘+”+ˆððñ÷Šv�g‰Œð ð× Ò ˜vÑ &Ô &ð 1¨*Ø × Ò  ¨RÑ 0Ô 0Ð 0ð 1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1ð 1ð 1s½A!Á!A%Á(A%cóŽ—| d¦«5}| |g¦«ddd¦«dS#1swxYwYdS)zW Source files with Windows CR LF line endings are parsed successfully. zx = 42 NrÖrõs rÚtest_CRLFLineEndingszCheckTests.test_CRLFLineEndingsVs�€ð× Ò ˜|Ñ ,Ô ,ð 1° Ø × Ò  ¨RÑ 0Ô 0Ð 0ð 1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1ð 1ð 1rÙcóä—td¦«}d|z d¦«}| |¦«5}| ||›d�g¦«ddd¦«dS#1swxYwYdS)ún If a source file contains bytes which cannot be decoded, this is reported on stderr. rú# coding: ascii x = "%s" rzU:1:1: 'ascii' codec can't decode byte 0xe2 in position 21: ordinal not in range(128) Nrrs rÚtest_misencodedFileUTF8z"CheckTests.test_misencodedFileUTF8]sç€õ �f‘+”+ˆððñ÷Šv�g‰Œð ð× Ò ˜vÑ &Ô &ð y¨*Ø × Ò ØØÐvÐvÐvÐwñ yô yð yð yð yð yñ yô yð yð yð yð yð yð yð yøøøð yð yð yð yð yð yó½A%Á%A)Á,A)cóä—td¦«}d|z d¦«}| |¦«5}| ||›d�g¦«ddd¦«dS#1swxYwYdS)rrrzutf-16z: problem decoding source Nrrs rÚtest_misencodedFileUTF16z#CheckTests.test_misencodedFileUTF16lsè€õ �f‘+”+ˆððñ÷Šv�hÑÔð ð× Ò ˜vÑ &Ô &ð J¨*Ø × Ò Ø  ÐGÐGÐGÐHñ Jô Jð Jð Jð Jð Jñ Jô Jð Jð Jð Jð Jð Jð Jð Jøøøð Jð Jð Jð Jð Jð Jr cóâ—tj¦«} tjtj |d¦«¦«tj |dd¦«}t |d¦«5}| d¦«ddd¦«n #1swxYwYtj |d¦«}t |d¦«5}| d¦«ddd¦«n #1swxYwYg}t|¦«}t|g|¦«}|  |d¦«|  t|¦«td tt|td ¦«d ¦«¦«fd tt|td ¦«d ¦«¦«fg¦«¦«tj|¦«dS#tj|¦«wxYw) zv L{checkRecursive} descends into each directory, finding Python files and reporting problems. rrzbar.pyr¾s import baz Nzbaz.pysimport contrabandérCr¯ÚbazÚ contraband)rSrTr,rvr_r`rar…r?r rgrwrErrrYrZ)rrUÚfile1r‡Úfile2rAr¢Úwarningss rÚtest_checkRecursivezCheckTests.test_checkRecursivezs3€õ Ô"Ñ$Ô$ˆð #Ý ŒH•R”W—\’\ '¨5Ñ1Ô1Ñ 2Ô 2Ð 2Ý”G—L’L ¨%°Ñ:Ô:ˆEÝ�e˜TÑ"Ô"ð * bØ—’˜Ñ)Ô)Ð)ð *ð *ð *ñ *ô *ð *ð *ð *ð *ð *ð *øøøð *ð *ð *ð *å”G—L’L ¨(Ñ3Ô3ˆEÝ�e˜TÑ"Ô"ð / bØ—’Ð-Ñ.Ô.Ð.ð /ð /ð /ñ /ô /ð /ð /ð /ð /ð /ð /øøøð /ð /ð /ð /àˆCÝ& sÑ+Ô+ˆHÝ% w i°Ñ:Ô:ˆHØ × Ò ˜X qÑ )Ô )Ð )Ø × Ò Ý�s‘ ” ݘ¥#¥l°5½$¸q¹'¼'À5Ñ&IÔ&IÑ"JÔ"JÐKØ Ý�\¨%µ°a±´¸,ÑGÔGÑHÔHðJðKñLôLñ Mô Mð Mõ ŒM˜'Ñ "Ô "Ð "Ð "Ð "ø�FŒM˜'Ñ "Ô "Ð "Ð "øøøsU•A#GÁ8B GÂBÂGÂ!BÂ"3GÃC7Ã+ GÃ7C;Ã;GÃ>C;Ã?CGÇG.cóÌ—d}tj¦«}t|t|d¦«}| |d¦«| ¦« d¦«dd…}tjdkrgd¢}nGtrgd ¢}n;tjd krd g}n'tjd krd g}ntjdkrdg}| ||¦«dS)z; L{check} reports syntax errors from stdin z-max(1 for i in range(10), key=lambda x: x+1) r¨r¯r«Nr­rø)ú7:1:5: Generator expression must be parenthesizedú,max(1 for i in range(10), key=lambda x: x+1)z ^)úL:1:4: Generator expression must be parenthesized if not sole argumentr-z ^r›r,)ršr�z7:1:4: Generator expression must be parenthesized)ršrr.) r*r+rrrgr:ÚsplitrrŸr)rrár¡rËÚerrlinesÚexpected_errors rÚtest_stdinReportsErrorsz"CheckTests.test_stdinReportsErrors”s€ðBˆÝŒk‰mŒmˆÝ˜S¥%¨°Ñ;Ô;ˆØ ×Ò˜ Ñ"Ô"Ð"Ø—<’<‘>”>×'Ò'¨Ñ-Ô-¨c¨r¨cÔ2ˆå Ô ˜vÒ %Ð %ðððˆNˆNõ ð ðððˆNˆNõ Ô  Ò 'Ð 'àIðˆNˆNõÔ  Ò 'Ð 'àIðˆNˆNõÔ  Ò 'Ð 'à^ðˆNð ×Ò˜ >Ñ2Ô2Ð2Ð2Ð2rN)rr r!r"Ú contextlibÚcontextmanagerrÈrÌrÎrÔrØrÝrìrórörþrrr rÚplatformrrrrrr"r*r2r#rrr¼r¼8s�€€€€€ðððÔð ð ñÔð ð Kð Kð Kð ð ð ð<ð<ð<ð,ð,ð,ðKðKðKð1:ð1:ð1:ðf9ð9ð9ð2 ð ð ð1ð1ð1ð@:ð:ð:ð8.ð.ð.ð6 €VˆCŒL˜GÒ #Ð%=Ñ>Ô>ðHðHñ?Ô>ðHð Tð Tð Tð 1ð 1ð 1ð1ð1ð1ð yð yð yð Jð Jð Jð#ð#ð#ð4#3ð#3ð#3ð#3ð#3rr¼cóJ—eZdZdZd„Zd„Zd„Zd d„Zd„Zd„Z d „Z d „Z d „Z dS) ÚIntegrationTestszF Tests of the pyflakes script that actually spawn the script. cóŠ—tj¦«|_tj |jd¦«|_dS)NÚtemp)rSrTrUr,r_r`Ú tempfilepathr7s rrVzIntegrationTests.setUp¾s2€ÝÔ'Ñ)Ô)ˆŒ ÝœGŸLšL¨¬°vÑ>Ô>ˆÔÐÐrcó8—tj|j¦«dSrrXr7s rr[zIntegrationTests.tearDownÂr\rcó–—ddl}tj |j¦«}tj |ddd¦«S)z9 Return the path to the pyflakes binary. rNz..ÚbinrÐ)rÐr,r_ÚdirnameÚ__file__r`)rrÐÚ package_dirs rÚgetPyflakesBinaryz"IntegrationTests.getPyflakesBinaryÅs=€ð ˆˆˆÝ”g—o’o hÔ&7Ñ8Ô8ˆ ÝŒw�|Š|˜K¨¨u°jÑAÔAÐArNcóÌ—ttj¦«}tj t j¦«|d<t j| ¦«g}|  |¦«|rctj ||tj tj tj ¬¦«}|  | d¦«¦«\}}nCtj ||tj tj ¬¦«}|  ¦«\}}| ¦«}| d¦«}| d¦«}|||fS)a  Launch a subprocess running C{pyflakes}. @param paths: Command-line arguments to pass to pyflakes. @param stdin: Text to use as stdin. @return: C{(returncode, stdout, stderr)} of the completed pyflakes process. Ú PYTHONPATH)Úenvr/r2rrÀ)rDr2rr)Údictr,ÚenvironÚpathsepr`rr_Ú executablerAÚextendÚ subprocessÚPopenÚPIPEÚ communicaterÄÚwaitr¿) rÚpathsr/rDÚcommandÚpr2rÚrvs rÚ runPyflakeszIntegrationTests.runPyflakesÍs#€õ•2”:ÑԈݜJŸOšO­C¬HÑ5Ô5ˆˆLÑÝ”> 4×#9Ò#9Ñ#;Ô#;Ð<ˆØ�Š�uÑÔÐØ ð /ÝÔ  ¨c½¼Ý(2¬Å ÄðQñQôQˆAà Ÿ}š}¨U¯\ª\¸'Ñ-BÔ-BÑCÔCÑ ˆV�V�VåÔ  ¨cÝ(2¬Å ÄðQñQôQˆAà Ÿ}š}™œÑ ˆV�VØ �VŠV‰XŒXˆØ—’˜wÑ'Ô'ˆØ—’˜wÑ'Ô'ˆØ˜ Ð#Ð#rcó¶—t|jd¦« ¦«| |jg¦«}| |d¦«dS)z� When a Python source file is all good, the return code is zero and no messages are printed to either stdout or stderr. r^)r'r'rN)rar:rbrSrg)rÚds rÚ test_goodFilezIntegrationTests.test_goodFileçsX€õ ˆTÔ  Ñ$Ô$×*Ò*Ñ,Ô,Ð,Ø × Ò ˜dÔ/Ð0Ñ 1Ô 1ˆØ ×Ò˜˜KÑ(Ô(Ð(Ð(Ð(rcóT—t|jd¦«5}| d¦«ddd¦«n #1swxYwY| |jg¦«}t |jt d¦«d¦«}| ||›tj›�ddf¦«dS)z… When a Python source file has warnings, the return code is non-zero and the warnings are printed to stdout. r¾simport contraband Nr¯r&r') rar:r…rSrrrgr,r-)rr‡rUròs rÚtest_fileWithFlakesz$IntegrationTests.test_fileWithFlakesðs߀õ �$Ô# TÑ *Ô *ð -¨bØ �HŠHÐ+Ñ ,Ô ,Ð ,ð -ð -ð -ñ -ô -ð -ð -ð -ð -ð -ð -øøøð -ð -ð -ð -à × Ò ˜dÔ/Ð0Ñ 1Ô 1ˆÝ Ô 1µ4¸±7´7¸LÑIÔIˆØ ×Ò˜ Ð6­"¬*Ð6Ð6¸¸AÐ>Ñ?Ô?Ð?Ð?Ð?ó –8¸<¿<có¸—| |jg¦«}d |jtj¦«}| |d|df¦«dS)úº When pyflakes finds errors with the files it's given, (if they don't exist, say), then the return code is non-zero and the errors are printed to stderr. z{}: No such file or directory{}r'r¯N)rSr:rðr,r-rg)rrUÚ error_msgs rÚtest_errors_iozIntegrationTests.test_errors_ioûsa€ð × Ò ˜dÔ/Ð0Ñ 1Ô 1ˆØ5×<Ò<¸TÔ=NÝ=?¼ZñIôIˆ à ×Ò˜˜R ¨AÐ.Ñ/Ô/Ð/Ð/Ð/rcó<—t|jd¦«5}| d¦«ddd¦«n #1swxYwY| |jg¦«}d |jt j¦«}| |d|df¦«dS)r[r¾simportNz-{0}:1:7: invalid syntax{1}import{1} ^{1}r'r¯)rar:r…rSrðr,r-rg)rr‡rUr\s rÚtest_errors_syntaxz#IntegrationTests.test_errors_syntaxsÖ€õ �$Ô# TÑ *Ô *ð ¨bØ �HŠH�YÑ Ô Ð ð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð à × Ò ˜dÔ/Ð0Ñ 1Ô 1ˆØC×JÒJØ Ô �rœzñ+ô+ˆ à ×Ò˜˜R ¨AÐ.Ñ/Ô/Ð/Ð/Ð/rYcó¾—| gd¬¦«}tdtd¦«d¦«}| ||›tj›�ddf¦«dS)zU If no arguments are passed to C{pyflakes} then it reads from stdin. zimport contraband)r/r¨r¯r&r'N)rSrrrgr,r-)rrUròs rÚtest_readFromStdinz#IntegrationTests.test_readFromStdinsd€ð × Ò ˜RÐ':Ð Ñ ;Ô ;ˆÝ  ­4°©7¬7°LÑAÔAˆØ ×Ò˜ Ð6­"¬*Ð6Ð6¸¸AÐ>Ñ?Ô?Ð?Ð?Ð?rr) rr r!r"rVr[rArSrVrXr]r_rar#rrr7r7ºsµ€€€€€ððð?ð?ð?ð$ð$ð$ðBðBðBð$ð$ð$ð$ð4)ð)ð)ð @ð @ð @ð 0ð 0ð 0ð 0ð 0ð 0ð@ð@ð@ð@ð@rr7có—eZdZdZdd„ZdS)ÚTestMainz. Tests of the pyflakes main function. NcóD— t|¦«5}t|¬¦«ddd¦«n #1swxYwYtd¦«‚#t$rM}| |jt ¦«t|j¦«}|j|j |fcYd}~Sd}~wwxYw)N)rzSystemExit not raised) r%rÚ RuntimeErrorÚ SystemExitÚassertIsInstanceÚcodeÚboolÚintr;r<)rrOr/Úcapturer€rRs rrSzTestMain.runPyflakes sï€ð 8Ý# EÑ*Ô*ð !¨gݘ%Ð Ñ Ô Ð ð !ð !ð !ñ !ô !ð !ð !ð !ð !ð !ð !øøøð !ð !ð !ð !õÐ6Ñ7Ô7Ð 7øõ ð 7ð 7ð 7Ø × !Ò ! !¤&­$Ñ /Ô /Ð /Ý�Q”V‘”ˆBØ”N G¤M°2Ð6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6øøøøð 7øøøs9‚A‘.¢ A®2²Aµ2¶AÁ BÁABÂBÂBr)rr r!r"rSr#rrrcrcs2€€€€€ððð 8ð 8ð 8ð 8ð 8ð 8rrc) r"r3r*r,rrYrJrSÚpyflakes.checkerrÚpyflakes.messagesrÚpyflakes.reporterrÚ pyflakes.apirrrr r Úpyflakes.test.harnessr r rrr%r?rQr—r¼r7rcr#rrúrqs„ððððÐÐÐØ € € € Ø € € € Ø € € € Ø € € € ØÐÐÐØ€€€à!Ð!Ð!Ð!Ð!Ð!Ø*Ð*Ð*Ð*Ð*Ð*Ø&Ð&Ð&Ð&Ð&Ð&ððððððððððððððð3Ð2Ð2Ð2Ð2Ð2Ð2Ð2ðððð%ð%ð%ð%ð%ñ%ô%ð%ð'ð'ð'ð'ð'ñ'ô'ð'ð:NðNðNðNðNñNôNðNð.y"ðy"ðy"ðy"ðy"˜ñy"ôy"ðy"ðxW9ðW9ðW9ðW9ðW9�8ñW9ôW9ðW9ðt3ð3ð3ð3ð3�ñ3ô3ð3ðD _@ð_@ð_@ð_@ð_@�xñ_@ô_@ð_@ðD 8ð 8ð 8ð 8ð 8Ðñ 8ô 8ð 8ð 8ð 8r