def __init__(self, width=2): """ Class constructor. :param width: generate characters of given width. :type width: int """ self.characters = (unichr(idx) for idx in xrange(LIMIT_UCS) if wcwidth(unichr(idx)) == width and not _bisearch(idx, COMBINING) )
def _is_equal_combining(ucs): comb_py = bool(unicodedata.combining(ucs)) comb_wc = bool(_bisearch(ord(ucs), NONZERO_COMBINING)) assert comb_py == comb_wc, report_comb_msg(ucs, comb_py, comb_wc)