diff options
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/pysqlcipher.py')
-rw-r--r-- | lib/sqlalchemy/dialects/sqlite/pysqlcipher.py | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py index 09f2b8009..fca425127 100644 --- a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py +++ b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py @@ -82,9 +82,9 @@ from ... import pool class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite): - driver = 'pysqlcipher' + driver = "pysqlcipher" - pragmas = ('kdf_iter', 'cipher', 'cipher_page_size', 'cipher_use_hmac') + pragmas = ("kdf_iter", "cipher", "cipher_page_size", "cipher_use_hmac") @classmethod def dbapi(cls): @@ -102,15 +102,13 @@ class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite): return pool.SingletonThreadPool def connect(self, *cargs, **cparams): - passphrase = cparams.pop('passphrase', '') + passphrase = cparams.pop("passphrase", "") - pragmas = dict( - (key, cparams.pop(key, None)) for key in - self.pragmas - ) + pragmas = dict((key, cparams.pop(key, None)) for key in self.pragmas) - conn = super(SQLiteDialect_pysqlcipher, self).\ - connect(*cargs, **cparams) + conn = super(SQLiteDialect_pysqlcipher, self).connect( + *cargs, **cparams + ) conn.execute('pragma key="%s"' % passphrase) for prag, value in pragmas.items(): if value is not None: @@ -120,11 +118,17 @@ class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite): def create_connect_args(self, url): super_url = _url.URL( - url.drivername, username=url.username, - host=url.host, database=url.database, query=url.query) - c_args, opts = super(SQLiteDialect_pysqlcipher, self).\ - create_connect_args(super_url) - opts['passphrase'] = url.password + url.drivername, + username=url.username, + host=url.host, + database=url.database, + query=url.query, + ) + c_args, opts = super( + SQLiteDialect_pysqlcipher, self + ).create_connect_args(super_url) + opts["passphrase"] = url.password return c_args, opts + dialect = SQLiteDialect_pysqlcipher |