def __init__(self, *args, **kwargs):
from MySQLdb.constants import CLIENT, FIELD_TYPE<EOL>from MySQLdb.converters import conversions, _bytes_or_str<EOL>from weakref import proxy<EOL>kwargs2 = kwargs.copy()<EOL>if '<STR_LIT>' in kwargs2:<EOL><INDENT>kwargs2['<STR_LIT>'] = kwargs2.pop('<STR_LIT>')<EOL><DEDENT>if '<STR_LIT:password>' in kwargs2:<EOL><INDENT>kwargs2['<STR_LIT>'] = kwargs2.pop('<STR_LIT:password>')<EOL><DEDENT>if '<STR_LIT>' in kwargs:<EOL><INDENT>conv = kwargs['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>conv = conversions<EOL><DEDENT>conv2 = {}<EOL>for k, v in conv.items():<EOL><INDENT>if isinstance(k, int) and isinstance(v, list):<EOL><INDENT>conv2[k] = v[:]<EOL><DEDENT>else:<EOL><INDENT>conv2[k] = v<EOL><DEDENT><DEDENT>kwargs2['<STR_LIT>'] = conv2<EOL>cursorclass = kwargs2.pop('<STR_LIT>', self.default_cursor)<EOL>charset = kwargs2.pop('<STR_LIT>', '<STR_LIT>')<EOL>if charset or not PY2:<EOL><INDENT>use_unicode = True<EOL><DEDENT>else:<EOL><INDENT>use_unicode = False<EOL><DEDENT>use_unicode = kwargs2.pop('<STR_LIT>', use_unicode)<EOL>sql_mode = kwargs2.pop('<STR_LIT>', '<STR_LIT>')<EOL>self._binary_prefix = kwargs2.pop('<STR_LIT>', False)<EOL>client_flag = kwargs.get('<STR_LIT>', <NUM_LIT:0>)<EOL>client_version = tuple([ numeric_part(n) for n in _mysql.get_client_info().split('<STR_LIT:.>')[:<NUM_LIT:2>] ])<EOL>if client_version >= (<NUM_LIT:4>, <NUM_LIT:1>):<EOL><INDENT>client_flag |= CLIENT.MULTI_STATEMENTS<EOL><DEDENT>if client_version >= (<NUM_LIT:5>, <NUM_LIT:0>):<EOL><INDENT>client_flag |= CLIENT.MULTI_RESULTS<EOL><DEDENT>kwargs2['<STR_LIT>'] = client_flag<EOL>autocommit = kwargs2.pop('<STR_LIT>', False)<EOL>super(Connection, self).__init__(*args, **kwargs2)<EOL>self.cursorclass = cursorclass<EOL>self.encoders = dict([ (k, v) for k, v in conv.items()<EOL>if type(k) is not int ])<EOL>self.encoders[bytes] = bytes<EOL>self._server_version = tuple([ numeric_part(n) for n in self.get_server_info().split('<STR_LIT:.>')[:<NUM_LIT:2>] ])<EOL>self.encoding = '<STR_LIT:ascii>'  <EOL>db = proxy(self)<EOL>def unicode_literal(u, dummy=None):<EOL><INDENT>return db.string_literal(u.encode(db.encoding))<EOL><DEDENT>if not charset:<EOL><INDENT>charset = self.character_set_name()<EOL><DEDENT>self.set_character_set(charset)<EOL>if sql_mode:<EOL><INDENT>self.set_sql_mode(sql_mode)<EOL><DEDENT>if use_unicode:<EOL><INDENT>for t in (FIELD_TYPE.STRING, FIELD_TYPE.VAR_STRING, FIELD_TYPE.VARCHAR, FIELD_TYPE.TINY_BLOB,<EOL>FIELD_TYPE.MEDIUM_BLOB, FIELD_TYPE.LONG_BLOB, FIELD_TYPE.BLOB):<EOL><INDENT>self.converter[t] = _bytes_or_str<EOL><DEDENT>self.converter[FIELD_TYPE.JSON] = unicode<EOL><DEDENT>self.encoders[unicode] = unicode_literal<EOL>self._transactional = self.server_capabilities & CLIENT.TRANSACTIONS<EOL>if self._transactional:<EOL><INDENT>if autocommit is not None:<EOL><INDENT>self.autocommit(autocommit)<EOL><DEDENT><DEDENT>self.messages = []<EOL>
Create a connection to the database. It is strongly recommended
that you only use keyword parameters. Consult the MySQL C API
documentation for more information.

:param str host:        host to connect
:param str user:        user to connect as
:param str password:    password to use
:param str passwd:      alias of password, for backward compatibility
:param str database:    database to use
:param str db:          alias of database, for backward compatibility
:param int port:        TCP/IP port to connect to
:param str unix_socket: location of unix_socket to use
:param dict conv:       conversion dictionary, see MySQLdb.converters
:param int connect_timeout:
    number of seconds to wait before the connection attempt fails.

:param bool compress:   if set, compression is enabled
:param str named_pipe:  if set, a named pipe is used to connect (Windows only)
:param str init_command:
    command which is run once the connection is created

:param str read_default_file:
    file from which default client values are read

:param str read_default_group:
    configuration group to use from the default file

:param type cursorclass:
    class object, used to create cursors (keyword only)

:param bool use_unicode:
    If True, text-like columns are returned as unicode objects
    using the connection's character set. Otherwise, text-like
    columns are returned as bytes. Unicode objects will always
    be encoded to the connection's character set regardless of
    this setting.
    Default to False on Python 2 and True on Python 3
    so that you can always get python `str` object by default.

:param str charset:
    If supplied, the connection character set will be changed
    to this character set.
    On Python 2, this option changes default value of `use_unicode`
    option from False to True.

:param str sql_mode:
    If supplied, the session SQL mode will be changed to this
    setting.
    For more details and legal values, see the MySQL documentation.

:param int client_flag:
    flags to use or 0 (see MySQL docs or constants/CLIENTS.py)

:param dict ssl:
    dictionary or mapping contains SSL connection parameters;
    see the MySQL documentation for more details
    (mysql_ssl_set()).  If this is set, and the client does not
    support SSL, NotSupportedError will be raised.

:param bool local_infile:
    enables LOAD LOCAL INFILE; zero disables

:param bool autocommit:
    If False (default), autocommit is disabled.
    If True, autocommit is enabled.
    If None, autocommit isn't set and server default is used.

:param bool binary_prefix:
    If set, the '_binary' prefix will be used for raw byte query
    arguments (e.g. Binary). This is disabled by default.

There are a number of undocumented, non-standard methods. See the
documentation for the MySQL C API for some hints on what they do.