o
    ˳i                     @   s@   d e dedB de dB fddZd ededB dedB fddZdS )valuetrunc_lengthNreturnc              	   C   s   | d | }|| kr?g |}t dt| d dD ]#}zt|| }t|d }|||< d|W   S  ty<   Y qw d S |S )N    )rangelenordchrjoin
ValueError)r   r   resultcharsito_inc_next r   L/home/ubuntu/.local/lib/python3.10/site-packages/pyiceberg/utils/truncate.py truncate_upper_bound_text_string   s   r   c                 C   st   | d | }|| kr8g |}t dt| d dD ]}|| dk r5||  d7  < ddd |D   S qd S |S )Nr   r          c                 S   s   g | ]	}|j d ddqS )r   little)	byteorder)to_bytes).0r   r   r   r   
<listcomp>,   s    z6truncate_upper_bound_binary_string.<locals>.<listcomp>)r   r   r   )r   r   r   _bytesr   r   r   r   "truncate_upper_bound_binary_string%   s   r   )strintr   bytesr   r   r   r   r   <module>   s   "