<s> import sys <EOL> import os <EOL> import zipfile <EOL> from botocore . compat import six <EOL> advance_iterator = six . advance_iterator <EOL> PY3 = six . PY3 <EOL> queue = six . moves . queue <EOL> shlex_quote = six . moves . shlex_quote <EOL> StringIO = six . StringIO <EOL> urlopen = six . moves . urllib . request . urlopen <EOL> try : <EOL> import zlib <EOL> ZIP_COMPRESSION_MODE = zipfile . ZIP_DEFLATED <EOL> except ImportError : <EOL> ZIP_COMPRESSION_MODE = zipfile . ZIP_STORED <EOL> class BinaryStdout ( object ) : <EOL> def __enter__ ( self ) : <EOL> if sys . platform == "<STR_LIT:win32>" : <EOL> import msvcrt <EOL> self . previous_mode = msvcrt . setmode ( sys . stdout . fileno ( ) , <EOL> os . O_BINARY ) <EOL> return sys . stdout <EOL> def __exit__ ( self , type , value , traceback ) : <EOL> if sys . platform == "<STR_LIT:win32>" : <EOL> import msvcrt <EOL> msvcrt . setmode ( sys . stdout . fileno ( ) , self . previous_mode ) <EOL> if six . PY3 : <EOL> import locale <EOL> import urllib . parse as urlparse <EOL> from urllib . error import URLError <EOL> raw_input = input <EOL> def get_stdout_text_writer ( ) : <EOL> return sys . stdout <EOL> def compat_open ( filename , mode = '<STR_LIT:r>' , encoding = None ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT:b>' not in mode : <EOL> encoding = locale . getpreferredencoding ( ) <EOL> return open ( filename , mode , encoding = encoding ) <EOL> else : <EOL> import codecs <EOL> import locale <EOL> import io <EOL> import urlparse <EOL> from urllib2 import URLError <EOL> raw_input = raw_input <EOL> def get_stdout_text_writer ( ) : <EOL> return codecs . getwriter ( locale . getpreferredencoding ( ) ) ( sys . stdout ) <EOL> def compat_open ( filename , mode = '<STR_LIT:r>' , encoding = None ) : <EOL> if '<STR_LIT:b>' not in mode : <EOL> encoding = locale . getpreferredencoding ( ) <EOL> return io . open ( filename , mode , encoding = encoding ) </s>
