$ time ./yummain.py list available >/dev/null Before: real 0m16.644s user 0m15.722s sys 0m0.500s
After: real 0m12.393s user 0m11.552s sys 0m0.519s --- yum/i18n.py | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/yum/i18n.py b/yum/i18n.py index e8ab4ac..6b9eab5 100755 --- a/yum/i18n.py +++ b/yum/i18n.py @@ -82,11 +82,10 @@ def __utf8_bisearch(ucs, table): return False -def __utf8_ucp_width(ucs): - """ Get the textual width of a ucs character. """ - # sorted list of non-overlapping intervals of non-spacing characters - # generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" - combining = [ + +# sorted list of non-overlapping intervals of non-spacing characters +# generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" +__combining = ( ( 0x0300, 0x036F ), ( 0x0483, 0x0486 ), ( 0x0488, 0x0489 ), ( 0x0591, 0x05BD ), ( 0x05BF, 0x05BF ), ( 0x05C1, 0x05C2 ), ( 0x05C4, 0x05C5 ), ( 0x05C7, 0x05C7 ), ( 0x0600, 0x0603 ), @@ -134,7 +133,10 @@ def __utf8_ucp_width(ucs): ( 0x10A38, 0x10A3A ), ( 0x10A3F, 0x10A3F ), ( 0x1D167, 0x1D169 ), ( 0x1D173, 0x1D182 ), ( 0x1D185, 0x1D18B ), ( 0x1D1AA, 0x1D1AD ), ( 0x1D242, 0x1D244 ), ( 0xE0001, 0xE0001 ), ( 0xE0020, 0xE007F ), - ( 0xE0100, 0xE01EF )] + ( 0xE0100, 0xE01EF )) + +def __utf8_ucp_width(ucs): + """ Get the textual width of a ucs character. """ # test for 8-bit control characters if ucs == 0: @@ -143,7 +145,7 @@ def __utf8_ucp_width(ucs): if ucs < 32 or (ucs >= 0x7f and ucs < 0xa0): return (-1) - if __utf8_bisearch(ucs, combining): + if __utf8_bisearch(ucs, __combining): return 0 # if we arrive here, ucs is not a combining or C0/C1 control character -- 1.6.2.5 _______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel