
    uYf-                     n    d dl Z d dlZd dlmZ d dlmZmZ d dlZ G d de      Z		 d
ded   dee
   fd	Zy)    N)IntFlag)OptionalUnionc                   h    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZej                  dk  rdZdZydZdZy)CompilerFlagszPossible values of the co_flags attribute of Code object.

    Note: We do not rely on inspect values here as some of them are missing and
    furthermore would be version dependent.

                       @         i   )   	   i   i   i   i   N)__name__
__module____qualname____doc__	OPTIMIZED	NEWLOCALSVARARGSVARKEYWORDSNESTED	GENERATORNOFREE	COROUTINEITERABLE_COROUTINEASYNC_GENERATORsysversion_infoFUTURE_GENERATOR_STOPFUTURE_ANNOTATIONS     N/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/bytecode/flags.pyr   r   
   sj     IIGKFIF I ! O &  '% (&r&   r   bytecode)z_bytecode.Bytecodez_bytecode.ConcreteBytecodez_bytecode.ControlFlowGraphis_asyncc           
         t        d      }t        | t        j                  t        j                  t        j
                  f      sd}t        || z        t        | t        j
                        r| j                         n| }|D ch c]V  }t        |t        j                  t        j                  t        j                  t        j                  f      s|j                  X }}|h dz  s|t         j                  z  }|t        j                  D ch c]  }t        j                   |    c}z  s|t         j"                  z  }|| j$                  t         j&                  t         j(                  z  t         j*                  z  t         j,                  z  z  z  }|dhz  }|ddhz  }|h dz  }	|dv rT| j$                  t         j.                  z  r,|r|t         j0                  z  }nB|t         j.                  z  }n-| j$                  t         j2                  z  r#|	rd}t        |      |t         j2                  z  }n| j$                  t         j0                  z  r*|s|t         j.                  z  }n|t         j0                  z  }n|	r*|r|t         j0                  z  }n|t         j.                  z  }nz|r@|r*|r|t         j0                  z  }n`|t         j.                  z  }nL|t         j4                  z  }n8|r6|t         j.                  z  }n"|	rt        d	      |r|t         j4                  z  }|| j$                  t         j6                  z  z  }|S c c}w c c}w )
a  Infer the proper flags for a bytecode based on the instructions.

    Because the bytecode does not have enough context to guess if a function
    is asynchronous the algorithm tries to be conservative and will never turn
    a previously async code into a sync one.

    Parameters
    ----------
    bytecode : Bytecode | ConcreteBytecode | ControlFlowGraph
        Bytecode for which to infer the proper flags
    is_async : bool | None, optional
        Force the code to be marked as asynchronous if True, prevent it from
        being marked as asynchronous if False and simply infer the best
        solution based on the opcode and the existing flag if None.

    r   zIExpected a Bytecode, ConcreteBytecode or ControlFlowGraph instance not %s>   	LOAD_NAME
STORE_NAMEDELETE_NAMEYIELD_VALUE
YIELD_FROM>   	GET_AITER	GET_ANEXTEND_ASYNC_FORGET_AWAITABLEASYNC_GEN_WRAPSETUP_ASYNC_WITHBEFORE_ASYNC_WITH)NTzThe ITERABLE_COROUTINE flag is set but bytecode thatcan only be used in async functions have been detected. Please unset that flag before performing inference.ziThe is_async argument is False but bytecodes that can only be used in async functions have been detected.)r   
isinstance	_bytecodeBytecodeConcreteBytecodeControlFlowGraph
ValueError_get_instructions	SetLinenoLabelTryBeginTryEndnamer   opcodehasfreeopnamer   flagsr   r   r   r   r   r    r   r   r#   )
r(   r)   rF   msginstructionsiinstr_namessure_generatormaybe_generator
sure_asyncs
             r'   infer_flagsrN   -   s   , !E			Y779S9ST
 	 x(( h	 : :; 	""$  ##""  	
 	
K  DD((( V^^D6==+DD%%% 
X^^


	 

#
#	$ 

	 E !M?2N!]L$AAO   J <>>M333666000^^m>>>!  !o%]555E^^m;;;!000666
 !]:::E]444E %!>!>>!8!88]444E000
 !  ],,,E	X^^mAAAAELQ& Es   AMM
)N)rC   r!   enumr   typingr   r   r(   r8   r   boolrN   r%   r&   r'   <module>rR      sN     
  "  'G  'N  $	NXN tn	Nr&   