summaryrefslogtreecommitdiff
path: root/urwid/util.py
diff options
context:
space:
mode:
authorMarien Zwart <marien.zwart@gmail.com>2010-03-07 18:26:05 -0500
committerMarien Zwart <marien.zwart@gmail.com>2010-03-07 18:26:05 -0500
commita57c3129a1486d6d1c3887b761593cd31bb1a720 (patch)
tree8907a3f90a0a77027da0d5381314d5d83437239d /urwid/util.py
parentd760975b7bfb5dd71044196519288f5668b1c2b0 (diff)
downloadurwid-a57c3129a1486d6d1c3887b761593cd31bb1a720.tar.gz
Stop calling type() on literals.
Diffstat (limited to 'urwid/util.py')
-rw-r--r--urwid/util.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/urwid/util.py b/urwid/util.py
index 60b1a73..8fe9149 100644
--- a/urwid/util.py
+++ b/urwid/util.py
@@ -104,7 +104,7 @@ def apply_target_encoding( s ):
"""
Return (encoded byte string, character set rle).
"""
- if _use_dec_special and type(s) == type(u""):
+ if _use_dec_special and type(s) == unicode:
# first convert drawing characters
try:
s = s.translate( escape.DEC_SPECIAL_CHARMAP )
@@ -114,7 +114,7 @@ def apply_target_encoding( s ):
escape.ALT_DEC_SPECIAL_CHARS):
s = s.replace( c, escape.SO+alt+escape.SI )
- if type(s) == type(u""):
+ if type(s) == unicode:
s = s.replace( escape.SI+escape.SO, u"" ) # remove redundant shifts
s = s.encode( _target_encoding )
@@ -261,7 +261,7 @@ def rle_len( rle ):
run = 0
for v in rle:
- assert type(v) == type(()), repr(rle)
+ assert type(v) == tuple, repr(rle)
a, r = v
run += r
return run
@@ -386,7 +386,7 @@ def _tagmarkup_recurse( tm, attr ):
ral += al
return rtl, ral
- if type(tm) == type(()):
+ if type(tm) == tuple:
# tuples mark a new attribute boundary
if len(tm) != 2:
raise TagMarkupException, "Tuples must be in the form (attribute, tagmarkup): %r" % (tm,)
@@ -403,7 +403,7 @@ def _tagmarkup_recurse( tm, attr ):
def is_mouse_event( ev ):
- return type(ev) == type(()) and len(ev)==4 and ev[0].find("mouse")>=0
+ return type(ev) == tuple and len(ev)==4 and ev[0].find("mouse")>=0
def is_mouse_press( ev ):
return ev.find("press")>=0