<s> import sys <EOL> if sys . version_info [ <NUM_LIT:0> ] < <NUM_LIT:3> : <EOL> from urlparse import urlparse <EOL> from itertools import imap , izip <EOL> from string import letters as ascii_letters <EOL> from Queue import Queue <EOL> try : <EOL> from cStringIO import StringIO as BytesIO <EOL> except ImportError : <EOL> from StringIO import StringIO as BytesIO <EOL> iteritems = lambda x : x . iteritems ( ) <EOL> iterkeys = lambda x : x . iterkeys ( ) <EOL> itervalues = lambda x : x . itervalues ( ) <EOL> nativestr = lambda x : x if isinstance ( x , str ) else x . encode ( '<STR_LIT:utf-8>' , '<STR_LIT:replace>' ) <EOL> u = lambda x : x . decode ( ) <EOL> b = lambda x : x <EOL> byte_to_chr = lambda x : x <EOL> next = lambda x : x . next ( ) <EOL> unichr = unichr <EOL> xrange = xrange <EOL> basestring = basestring <EOL> unicode = unicode <EOL> bytes = str <EOL> long = long <EOL> else : <EOL> from urllib . parse import urlparse <EOL> from string import ascii_letters <EOL> from queue import Queue <EOL> from io import BytesIO <EOL> iteritems = lambda x : iter ( x . items ( ) ) <EOL> iterkeys = lambda x : iter ( x . keys ( ) ) <EOL> itervalues = lambda x : iter ( x . values ( ) ) <EOL> byte_to_chr = lambda x : chr ( x ) <EOL> nativestr = lambda x : x if isinstance ( x , str ) else x . decode ( '<STR_LIT:utf-8>' , '<STR_LIT:replace>' ) <EOL> u = lambda x : x <EOL> b = lambda x : x . encode ( '<STR_LIT>' ) if not isinstance ( x , bytes ) else x <EOL> next = next <EOL> unichr = chr <EOL> imap = map <EOL> izip = zip <EOL> xrange = range <EOL> basestring = str <EOL> unicode = str <EOL> bytes = bytes <EOL> long = int <EOL> try : <EOL> from collections import OrderedDict <EOL> except ImportError : <EOL> from ssdb . utils import SortedDict as OrderedDict <EOL> try : <EOL> from queue import LifoQueue , Empty , Full <EOL> except ImportError : <EOL> from Queue import Empty , Full <EOL> try : <EOL> from Queue import LifoQueue <EOL> except ImportError : <EOL> from Queue import Queue <EOL> class LifoQueue ( Queue ) : <EOL> "<STR_LIT>" <EOL> def _init ( self , maxsize ) : <EOL> self . maxsize = maxsize <EOL> self . queue = [ ] <EOL> def _qsize ( self , len = len ) : <EOL> return len ( self . queue ) <EOL> def _put ( self , item ) : <EOL> self . queue . append ( item ) <EOL> def _get ( self ) : <EOL> return self . queue . pop ( ) </s>
