
    yIf                     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  G d de          ZdS )    )messages)FunctionScope
ClassScopeModuleScopeArgumentFunctionDefinition
Assignment)TestCasec                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )TestCodeSegmentsz(
    Tests for segments of a module
    c                 x    |                      dd           |                      dt          j        d           d S )NzH
        def foo():
            def bar():
                pass
        T
is_segmentzI
        def foo():
            def bar():
                x = 0
        flakesmUnusedVariableselfs    S/var/www/piapp/venv/lib/python3.11/site-packages/pyflakes/test/test_code_segment.pytest_function_segmentz&TestCodeSegments.test_function_segment   ]      	 	 	 	 	 	  $	 	 	0 	0 	0 	0 	0    c                 x    |                      dd           |                      dt          j        d           d S )NzH
        class Foo:
            class Bar:
                pass
        Tr   zI
        class Foo:
            def bar():
                x = 0
        r   r   s    r   test_class_segmentz#TestCodeSegments.test_class_segment   r   r   c                 |   |                      dd          }|j        }d |D             }d |D             }d |D             }|                     t          |          d           |                     t          |          d           |                     t          |          d           |d         }|d         }|                     |t
                     |                     |t                     |                     d	|           |                     d
|           |                     d|           |                     d|           |                     d|           |                     d|           |                     |d
         t                     |                     |d	         t                     |                     |d         t                     |                     |d         t                     |                     |d         t                     |                     |d         t                     d S )Nzi
        class Foo:
            x = 0
            def bar(a, b=1, *d, **e):
                pass
        Tr   c                 .    g | ]}|j         t          u |S  	__class__r   .0scopes     r   
<listcomp>z5TestCodeSegments.test_scope_class.<locals>.<listcomp>/   .     I I IK)G)GE)G)G)Gr   c                 .    g | ]}|j         t          u |S r   )r    r   r!   s     r   r$   z5TestCodeSegments.test_scope_class.<locals>.<listcomp>1   s.     H H HJ)F)FE)F)F)Fr   c                 .    g | ]}|j         t          u |S r   r    r   r!   s     r   r$   z5TestCodeSegments.test_scope_class.<locals>.<listcomp>3   .     K K KM)I)IE)I)I)Ir   r      xbarabde)r   
deadScopesassertEquallenassertIsInstancer   r   assertInr   r	   r   )r   checkerscopesmodule_scopesclass_scopesfunction_scopesclass_scopefunction_scopes           r   test_scope_classz!TestCodeSegments.test_scope_class&   sS   ++ 
     #I I%I I IH H%H H HK K%K K K
 	]++Q///\**A..._--q111"1o(+k:666nm<<<c;'''e[)))c>***c>***c>***c>***k%02DEEEk#.
;;;nS18<<<nS18<<<nS18<<<nS18<<<<<r   c                 h   |                      dd          }|j        }d |D             }d |D             }|                     t          |          d           |                     t          |          d           |d         }|d         }|                     |t
                     |                     |t
                     |                     d	|           |                     d
|           |                     d|           |                     d|           |                     d|           |                     d|           |                     d|           |                     d|           |                     d|           |                     |d         t                     |                     |d	         t                     |                     |d
         t                     |                     |d         t                     |                     |d         t                     |                     |d         t                     |                     |d         t                     |                     |d         t                     |                     |d         t                     d S )Nzf
        def foo(a, b=1, *d, **e):
            def bar(f, g=1, *h, **i):
                pass
        Tr   c                 .    g | ]}|j         t          u |S r   r   r!   s     r   r$   z8TestCodeSegments.test_scope_function.<locals>.<listcomp>Z   r%   r   c                 .    g | ]}|j         t          u |S r   r(   r!   s     r   r$   z8TestCodeSegments.test_scope_function.<locals>.<listcomp>\   r)   r   r      r*   r-   r.   r/   r0   r,   fghi)	r   r1   r2   r3   r4   r   r5   r   r   )r   r6   r7   r8   r:   function_scope_foofunction_scope_bars          r   test_scope_functionz$TestCodeSegments.test_scope_functionR   s   ++  	    #I I%I I IK K%K K K
 	]++Q///_--q111,Q/,Q/0-@@@0-@@@c-...c-...c-...c-...e/000c-...c-...c-...c-...079KLLL05x@@@05x@@@05x@@@05x@@@05x@@@05x@@@05x@@@05x@@@@@r   c                 4    |                      dd           d S )Nzasync def foo(): passTr   )r   r   s    r   test_scope_async_functionz*TestCodeSegments.test_scope_async_function   s    +=====r   N)	__name__
__module____qualname____doc__r   r   r=   rH   rJ   r   r   r   r   r      sn         0 0 00 0 0*= *= *=X,A ,A ,A\> > > > >r   r   N)pyflakesr   r   pyflakes.checkerr   r   r   r   r   r	   pyflakes.test.harnessr
   r   r   r   r   <module>rR      s    " " " " " "H H H H H H H H H H H H H H H H * * * * * *z> z> z> z> z>x z> z> z> z> z>r   