diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-06 01:14:26 -0500 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2019-01-06 17:34:50 +0000 |
commit | 1e1a38e7801f410f244e4bbb44ec795ae152e04e (patch) | |
tree | 28e725c5c8188bd0cfd133d1e268dbca9b524978 /lib/sqlalchemy/dialects/sqlite/pysqlite.py | |
parent | 404e69426b05a82d905cbb3ad33adafccddb00dd (diff) | |
download | sqlalchemy-1e1a38e7801f410f244e4bbb44ec795ae152e04e.tar.gz |
Run black -l 79 against all source files
This is a straight reformat run using black as is, with no edits
applied at all.
The black run will format code consistently, however in
some cases that are prevalent in SQLAlchemy code it produces
too-long lines. The too-long lines will be resolved in the
following commit that will resolve all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.
Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/pysqlite.py')
-rw-r--r-- | lib/sqlalchemy/dialects/sqlite/pysqlite.py | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/pysqlite.py b/lib/sqlalchemy/dialects/sqlite/pysqlite.py index 8809962df..e78d76ae6 100644 --- a/lib/sqlalchemy/dialects/sqlite/pysqlite.py +++ b/lib/sqlalchemy/dialects/sqlite/pysqlite.py @@ -301,20 +301,20 @@ class _SQLite_pysqliteDate(DATE): class SQLiteDialect_pysqlite(SQLiteDialect): - default_paramstyle = 'qmark' + default_paramstyle = "qmark" colspecs = util.update_copy( SQLiteDialect.colspecs, { sqltypes.Date: _SQLite_pysqliteDate, sqltypes.TIMESTAMP: _SQLite_pysqliteTimeStamp, - } + }, ) if not util.py2k: description_encoding = None - driver = 'pysqlite' + driver = "pysqlite" def __init__(self, **kwargs): SQLiteDialect.__init__(self, **kwargs) @@ -323,10 +323,13 @@ class SQLiteDialect_pysqlite(SQLiteDialect): sqlite_ver = self.dbapi.version_info if sqlite_ver < (2, 1, 3): util.warn( - ("The installed version of pysqlite2 (%s) is out-dated " - "and will cause errors in some cases. Version 2.1.3 " - "or greater is recommended.") % - '.'.join([str(subver) for subver in sqlite_ver])) + ( + "The installed version of pysqlite2 (%s) is out-dated " + "and will cause errors in some cases. Version 2.1.3 " + "or greater is recommended." + ) + % ".".join([str(subver) for subver in sqlite_ver]) + ) @classmethod def dbapi(cls): @@ -341,7 +344,7 @@ class SQLiteDialect_pysqlite(SQLiteDialect): @classmethod def get_pool_class(cls, url): - if url.database and url.database != ':memory:': + if url.database and url.database != ":memory:": return pool.NullPool else: return pool.SingletonThreadPool @@ -356,22 +359,25 @@ class SQLiteDialect_pysqlite(SQLiteDialect): "Valid SQLite URL forms are:\n" " sqlite:///:memory: (or, sqlite://)\n" " sqlite:///relative/path/to/file.db\n" - " sqlite:////absolute/path/to/file.db" % (url,)) - filename = url.database or ':memory:' - if filename != ':memory:': + " sqlite:////absolute/path/to/file.db" % (url,) + ) + filename = url.database or ":memory:" + if filename != ":memory:": filename = os.path.abspath(filename) opts = url.query.copy() - util.coerce_kw_type(opts, 'timeout', float) - util.coerce_kw_type(opts, 'isolation_level', str) - util.coerce_kw_type(opts, 'detect_types', int) - util.coerce_kw_type(opts, 'check_same_thread', bool) - util.coerce_kw_type(opts, 'cached_statements', int) + util.coerce_kw_type(opts, "timeout", float) + util.coerce_kw_type(opts, "isolation_level", str) + util.coerce_kw_type(opts, "detect_types", int) + util.coerce_kw_type(opts, "check_same_thread", bool) + util.coerce_kw_type(opts, "cached_statements", int) return ([filename], opts) def is_disconnect(self, e, connection, cursor): - return isinstance(e, self.dbapi.ProgrammingError) and \ - "Cannot operate on a closed database." in str(e) + return isinstance( + e, self.dbapi.ProgrammingError + ) and "Cannot operate on a closed database." in str(e) + dialect = SQLiteDialect_pysqlite |