U ʗReP@s^ddlZddlmZmZmZmZddlmZddlm Z erHddl m Z Gdddej Z dS) N)IO TYPE_CHECKINGAnyList) AnsiDecoder)Text)Consolec@sjeZdZdZdeeddddZeeeddd Zee d d d Z ee d ddZ ddddZ dS) FileProxyzAWraps a file (e.g. sys.stdout) and redirects writes to a console.r N)consolefilereturncCs||_||_g|_t|_dSN)_FileProxy__console_FileProxy__file_FileProxy__bufferr_FileProxy__ansi_decoder)selfr r r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/rich/file_proxy.py__init__szFileProxy.__init__)r cCs|jS)zGet proxied file.)rrrrrrich_proxied_fileszFileProxy.rich_proxied_file)namer cCs t|j|Sr)getattrr)rrrrr __getattr__szFileProxy.__getattr__)textr c st|tstdt|jj}g}|rn|d\}}}|r`|d|||dd=q(||qnq(|rj }|,t dfdd|D}| |W5QRXt |S)Nz"write() argument must be str, not  c3s|]}j|VqdSr)r decode_line).0linerrr ,sz"FileProxy.write..) isinstancestr TypeErrortype__name__r partitionappendjoinrrprintlen)rrbufferlinesr!new_liner outputrrrwrites&   zFileProxy.writecCs,d|j}|r|j||jdd=dS)Nr)r*rrr+)rr0rrrflush2s  zFileProxy.flush)r' __module__ __qualname____doc__rr$rpropertyrrrintr1r2rrrrr sr )iotypingrrrransirrrr r TextIOBaser rrrrs