o
    tBhk                     @  sX   U d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 dZ
ded	< dddZdS )zShared code between dmypy.py and dmypy_server.py.

This should be pretty lightweight and not depend on other mypy code (other than ipc).
    )annotationsN)Any)Final)IPCBasez.dmypy.jsonr   DEFAULT_STATUS_FILE
connectionr   returnr   c              
   C  sn   |   }|s
tdz
t|d}W n ty% } ztd|d}~ww t|ts5tdt| d|S )zReceive JSON data from a connection until EOF.

    Raise OSError if the data received is not valid JSON or if it is
    not a dict.
    zNo data receivedutf8zData received is not valid JSONNzData received is not a dict ())	readOSErrorjsonloadsdecode	Exception
isinstancedicttype)r   bdatadatae r   f/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/mypy/dmypy_util.pyreceive   s   

r   )r   r   r   r   )__doc__
__future__r   r   typingr   typing_extensionsr   mypy.ipcr   r   __annotations__r   r   r   r   r   <module>   s    