<s> from collections import Mapping <EOL> from UserDict import UserDict <EOL> from UserString import UserString <EOL> from types import ClassType , NoneType <EOL> try : <EOL> from java . lang import String <EOL> except ImportError : <EOL> String = ( ) <EOL> from . platform import RERAISED_EXCEPTIONS <EOL> def is_integer ( item ) : <EOL> return isinstance ( item , ( int , long ) ) <EOL> def is_number ( item ) : <EOL> return isinstance ( item , ( int , long , float ) ) <EOL> def is_bytes ( item ) : <EOL> return isinstance ( item , ( bytes , bytearray ) ) <EOL> def is_string ( item ) : <EOL> return isinstance ( item , basestring ) <EOL> def is_unicode ( item ) : <EOL> return isinstance ( item , unicode ) <EOL> def is_list_like ( item ) : <EOL> if isinstance ( item , ( basestring , bytes , bytearray , UserString , String , <EOL> file ) ) : <EOL> return False <EOL> try : <EOL> iter ( item ) <EOL> except RERAISED_EXCEPTIONS : <EOL> raise <EOL> except : <EOL> return False <EOL> else : <EOL> return True <EOL> def is_dict_like ( item ) : <EOL> return isinstance ( item , ( Mapping , UserDict ) ) <EOL> def type_name ( item ) : <EOL> cls = item . __class__ if hasattr ( item , '<STR_LIT>' ) else type ( item ) <EOL> named_types = { str : '<STR_LIT:string>' , unicode : '<STR_LIT:string>' , bool : '<STR_LIT>' , <EOL> int : '<STR_LIT>' , long : '<STR_LIT>' , NoneType : '<STR_LIT:None>' , <EOL> dict : '<STR_LIT>' , type : '<STR_LIT:class>' , ClassType : '<STR_LIT:class>' } <EOL> return named_types . get ( cls , cls . __name__ ) </s>
