� K�g[��t�dZgd�ZddlZejdd���Zd�Zd�Zd�Zd �Zd �Z d �Z d �Z d �Z d�Z [dS)zb Methods for serialized objects (or source code) stored in temporary files and file-like objects. ) � dump_source�dump� dumpIO_source�dumpIO� load_source�load� loadIO_source�loadIO�capture�N�stdoutc#��K�ddl}ddlm}t||��}t |||���� t||��V�t |||��dS#t |||��wxYw)z�builds a context that temporarily replaces the given stream name >>> with capture('stdout') as out: ... print ("foo!") ... >>> print (out.getvalue()) foo! r N)�StringIO)�sys�ior�getattr�setattr)�streamrr�origs �Y/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/dill/temp.pyr r s������J�J�J������� �3�� � �D� �C������$�$�$�#��c�6�"�"�"�"�"���V�T�"�"�"�"�"����V�T�"�"�"�"���s �A�A/c�@�ddl}|�|��dS)Nr )�codecs�latin_1_encode)�xrs r�br+s$���M�M�M� � � �� #� #�A� &�&�c � �|�dd��}|�dd��}t|d|��}t|fd|i|�����}|s~|������d���}|ddkr,|���d}td |z���|d}i}t||��td |z|��} | S) aCload an object that was stored with dill.temp.dump_source file: filehandle alias: string name of stored object mode: mode to open the file, one of: {'r', 'rb'} >>> f = lambda x: x**2 >>> pyfile = dill.temp.dump_source(f, alias='_f') >>> _f = dill.temp.load_source(pyfile) >>> _f(4) 16 �aliasN�mode�r�name�����r �#NAME:�unknown name for code: %s�%s) �popr�open�read�strip� splitlines�split�IOError�exec�eval) �file�kwdsrr�fname�source�tag�stub�local�_s rrr/s�� �H�H�W�d� #� #�E� �8�8�F�C� � �D� �D�&�$� '� '�E� �%� +� +�d� +�d� +� +� 0� 0� 2� 2�F� ���l�l�n�n�'�'�)�)�"�-�3�3�5�5�� �q�6�X� � ��$�$�&�&�q�)�D��5��<�=�=� =��B��� �E������� �T�E�\�5�!�!�A� �Hrc ��ddlm}m}ddl}|�dd��|�dd��|�d d��}t |��p ||��}d |z}|jd dd i|��}|�td� |||� ��|g������|� ��|S)aMwrite object source to a NamedTemporaryFile (instead of dill.dump) Loads with "import" or "dill.temp.load_source". Returns the filehandle. >>> f = lambda x: x**2 >>> pyfile = dill.temp.dump_source(f, alias='_f') >>> _f = dill.temp.load_source(pyfile) >>> _f(4) 16 >>> f = lambda x: x**2 >>> pyfile = dill.temp.dump_source(f, dir='.') >>> modulename = os.path.basename(pyfile.name).split('.py')[0] >>> exec('from %s import f as _f' % modulename) >>> _f(4) 16 Optional kwds: If 'alias' is specified, the object will be renamed to the given string. If 'prefix' is specified, the file name will begin with that prefix, otherwise a default prefix is used. If 'dir' is specified, the file will be created in that directory, otherwise a default directory is used. If 'text' is specified and true, the file is opened in text mode. Else (the default) the file is opened in binary mode. On some operating systems, this makes no difference. NOTE: Keep the return value for as long as you want your file to exist ! ��� importable�getnamer N�deleteT�suffix�r� #NAME: %s z.py�r�) r1r9r:�tempfile� setdefaultr%�str�NamedTemporaryFile�writer�join�flush)�objectr/r9r:rArr r.s rrrKs���@,�+�+�+�+�+�+�+��O�O�O��O�O�H�d�#�#�#��H�H�X�r���� �H�H�W�b� !� !�E� �u�:�:� (������D� �T� !�D� &�8� &� <� <�e� <�t� <� <�D��J�J�q����*�*�V�5�9�9�9�$�?�@�@�A�A�B�B�B��J�J�L�L�L� �Krc ��ddl}|�dd��}t|d|��}|�t |fd|i|����S)z�load an object that was stored with dill.temp.dump file: filehandle mode: mode to open the file, one of: {'r', 'rb'} >>> dumpfile = dill.temp.dump([1, 2, 3, 4, 5]) >>> dill.temp.load(dumpfile) [1, 2, 3, 4, 5] r Nr�rbr )�dillr%rrr&)r.r/�picklerr s rrrxs[������ �8�8�F�D� !� !�D� �4��� &� &�D� �;�;�t�D�4�4�t�4�t�4�4� 5� 5�5rc ��ddl}ddl}|�dd��|jdi|��}|�||��|���|S)aEdill.dump of object to a NamedTemporaryFile. Loads with "dill.temp.load". Returns the filehandle. >>> dumpfile = dill.temp.dump([1, 2, 3, 4, 5]) >>> dill.temp.load(dumpfile) [1, 2, 3, 4, 5] Optional kwds: If 'suffix' is specified, the file name will end with that suffix, otherwise there will be no suffix. If 'prefix' is specified, the file name will begin with that prefix, otherwise a default prefix is used. If 'dir' is specified, the file will be created in that directory, otherwise a default directory is used. If 'text' is specified and true, the file is opened in text mode. Else (the default) the file is opened in binary mode. On some operating systems, this makes no difference. NOTE: Keep the return value for as long as you want your file to exist ! r Nr;Tr@)rKrArBrDrrG)rHr/rLrAr.s rrr�sk��0�����O�O�O��O�O�H�d�#�#�#� &�8� &� .� .�� .� .�D� �K�K�������J�J�L�L�L� �Krc ��ddl}ddlm}t|d|��}||kr |��}|�||����S)z�load an object that was stored with dill.temp.dumpIO buffer: buffer object >>> dumpfile = dill.temp.dumpIO([1, 2, 3, 4, 5]) >>> dill.temp.loadIO(dumpfile) [1, 2, 3, 4, 5] r N��BytesIO�getvalue)rKrrPrr)�bufferr/rLr�values rr r �s`������&�&�&�&�&�&� �F�J�� /� /�E� ��������� �;�;�x�x���� '� '�'rc ��ddl}ddlm}|��}|�||��|���|S)z�dill.dump of object to a buffer. Loads with "dill.temp.loadIO". Returns the buffer object. >>> dumpfile = dill.temp.dumpIO([1, 2, 3, 4, 5]) >>> dill.temp.loadIO(dumpfile) [1, 2, 3, 4, 5] r NrO)rKrrPrrG)rHr/rLrr.s rrr�sS������&�&�&�&�&�&� �8�:�:�D� �K�K�������J�J�L�L�L� �Krc ���|�dd��}t|d|��}||kr |��}|���}|s~|������d���}|ddkr,|���d}t d|z���|d}i}t||��td|z|��}|S) aload an object that was stored with dill.temp.dumpIO_source buffer: buffer object alias: string name of stored object >>> f = lambda x:x**2 >>> pyfile = dill.temp.dumpIO_source(f, alias='_f') >>> _f = dill.temp.loadIO_source(pyfile) >>> _f(4) 16 rNrQr!r r"r#r$) r%r�decoder(r)r*r+r,r-)rRr/rr1r2r3r4r5s rrr�s��� �H�H�W�d� #� #�E� �V�Z�� 0� 0�F� ����&�&�(�(�� �]�]�_�_�F� ���l�l�n�n�'�'�)�)�"�-�3�3�5�5�� �q�6�X� � ��$�$�&�&�q�)�D��5��<�=�=� =��B��� �E������� �T�E�\�5�!�!�A� �Hrc �L�ddlm}m}ddlm}|�dd��}t |��p ||��}d|z}|��}|�td� |||���|g������|� ��|S) apwrite object source to a buffer (instead of dill.dump) Loads by with dill.temp.loadIO_source. Returns the buffer object. >>> f = lambda x:x**2 >>> pyfile = dill.temp.dumpIO_source(f, alias='_f') >>> _f = dill.temp.loadIO_source(pyfile) >>> _f(4) 16 Optional kwds: If 'alias' is specified, the object will be renamed to the given string. r7r8r rOrr=r>r?) r1r9r:rrPr%rCrErrFrG)rHr/r9r:rrr r.s rrr�s���,�+�+�+�+�+�+�+�&�&�&�&�&�&� �H�H�W�b� !� !�E� �u�:�:� (������D� �T� !�D� �8�:�:�D��J�J�q����*�*�V�5�9�9�9�$�?�@�@�A�A�B�B�B��J�J�L�L�L� �Kr)r )�__doc__�__all__� contextlib�contextmanagerr rrrrrr rrrr@rr�<module>r\s����� � � ������ ��#�#�#���#�('�'�'� � � �8+�+�+�Z 6� 6� 6����@ (� (� (� � � � � � �6���2�J�Jr
Memory