Current File : //proc/2/root/usr/lib/python2.7/site-packages/kitchen/text/utf8.pyc
�
i�:Oc@s�dZddlZddlmZddlmZmZddlmZddl m
Z
mZmZm
Z
mZmZd�Zd�Zdd �Zded
d
d�Zdd
d
d
�Zd�Zd�ZdZdS(s�
-----
UTF-8
-----
Functions for operating on byte :class:`str` encoded as :term:`UTF-8`
.. note::
In many cases, it is better to convert to :class:`unicode`, operate on the
strings, then convert back to :term:`UTF-8`. :class:`unicode` type can
handle many of these functions itself. For those that it doesn't
(removing control characters from length calculations, for instance) the
code to do so with a :class:`unicode` type is often simpler.
.. warning::
All of the functions in this module are deprecated. Most of them have
been replaced with functions that operate on unicode values in
:mod:`kitchen.text.display`. :func:`kitchen.text.utf8.utf8_valid` has
been replaced with a function in :mod:`kitchen.text.misc`.
i����N(tb_(t
to_unicodetto_bytes(tbyte_string_valid_encoding(t_textual_width_letbyte_string_textual_width_filltfillt
textual_widthttextual_width_choptwrapcCs&tjtd�tdd�t|�S(s�**Deprecated** Detect if a string is valid :term:`utf-8`
Use :func:`kitchen.text.misc.byte_string_valid_encoding` instead.
sjkitchen.text.utf8.utf8_valid is deprecated. Use kitchen.text.misc.byte_string_valid_encoding(msg) insteadt
stackleveli(twarningstwarnRtDeprecationWarningR(tmsg((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pyt
utf8_valid@s
cCs&tjtd�tdd�t|�S(s�**Deprecated** Get the :term:`textual width` of a :term:`utf-8` string
Use :func:`kitchen.text.display.textual_width` instead.
s`kitchen.text.utf8.utf8_width is deprecated. Use kitchen.text.display.textual_width(msg) insteadR
i(RRRR
R(R((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pyt
utf8_widthJs
cCs|tjtd�tdd�|dkr8t|�|fSt|t�}t||�}|rlt |�}nt|�|fS(sA**Deprecated** Return a string chopped to a given :term:`textual width`
Use :func:`~kitchen.text.display.textual_width_chop` and
:func:`~kitchen.text.display.textual_width` instead::
>>> msg = 'く ku ら ra と to み mi'
>>> # Old way:
>>> utf8_width_chop(msg, 5)
(5, 'く ku')
>>> # New way
>>> from kitchen.text.converters import to_bytes
>>> from kitchen.text.display import textual_width, textual_width_chop
>>> (textual_width(msg), to_bytes(textual_width_chop(msg, 5)))
(5, 'く ku')
sekitchen.text.utf8.utf8_width_chop is deprecated. Use kitchen.text.display.textual_width_chop insteadR
iN(
RRRR
tNoneRt
isinstancetunicodeRR(Rtchoptas_bytestchopped_msg((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pytutf8_width_chopUstcCsAtjtd�tdd�t||d|d|d|d|�S(s�**Deprecated** Pad a :term:`utf-8` string to fill a specified width
Use :func:`~kitchen.text.display.byte_string_textual_width_fill` instead
sqkitchen.text.utf8.utf8_width_fill is deprecated. Use kitchen.text.display.byte_string_textual_width_fill insteadR
iRtlefttprefixtsuffix(RRRR
R(RRRRRR((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pytutf8_width_fillss
iFcCs�tjtd�tdd�t|t�}t|�}t|d|d|d|�}|r~g|D]}t|�^qc}n|S(s�**Deprecated** Similar to :func:`textwrap.wrap` but understands
:term:`utf-8` data and doesn't screw up lists/blocks/etc
Use :func:`kitchen.text.display.wrap` instead
sVkitchen.text.utf8.utf8_text_wrap is deprecated. Use kitchen.text.display.wrap insteadR
itwidthtinitial_indenttsubsequent_indent( RRRR
RRRR R(ttextRRRRtlinestm((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pytutf8_text_wraps
"cOs,tjtd�tdd�t|||�S(s�**Deprecated** Similar to :func:`textwrap.fill` but understands
:term:`utf-8` strings and doesn't screw up lists/blocks/etc.
Use :func:`kitchen.text.display.fill` instead.
sVkitchen.text.utf8.utf8_text_fill is deprecated. Use kitchen.text.display.fill insteadR
i(RRRR
R(R targstkwargs((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pytutf8_text_fill�s
cGs8tjtd�tdd�t|tdj|���S(sx**Deprecated** Convert the arguments to unicode and use
:func:`kitchen.text.display._textual_width_le` instead.
sckitchen.text.utf8._utf8_width_le is deprecated. Use kitchen.text.display._textual_width_le insteadR
iR(RRRR
RRtjoin(RR$((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pyt_utf8_width_le�s
R&R#RRRR(sutf8_text_fillsutf8_text_wraps
utf8_valids
utf8_widthsutf8_width_chopsutf8_width_fill(t__doc__RtkitchenRtkitchen.text.convertersRRtkitchen.text.miscRtkitchen.text.displayRRRRRR RRRRtTrueRR#R&R(t__all__(((s5/usr/lib/python2.7/site-packages/kitchen/text/utf8.pyt<module>2s.