summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/sybase/pysybase.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:14:26 -0500
committermike bayer <mike_mp@zzzcomputing.com>2019-01-06 17:34:50 +0000
commit1e1a38e7801f410f244e4bbb44ec795ae152e04e (patch)
tree28e725c5c8188bd0cfd133d1e268dbca9b524978 /lib/sqlalchemy/dialects/sybase/pysybase.py
parent404e69426b05a82d905cbb3ad33adafccddb00dd (diff)
downloadsqlalchemy-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/sybase/pysybase.py')
-rw-r--r--lib/sqlalchemy/dialects/sybase/pysybase.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/lib/sqlalchemy/dialects/sybase/pysybase.py b/lib/sqlalchemy/dialects/sybase/pysybase.py
index 2168d5572..09d2cf380 100644
--- a/lib/sqlalchemy/dialects/sybase/pysybase.py
+++ b/lib/sqlalchemy/dialects/sybase/pysybase.py
@@ -22,8 +22,11 @@ kind at this time.
"""
from sqlalchemy import types as sqltypes, processors
-from sqlalchemy.dialects.sybase.base import SybaseDialect, \
- SybaseExecutionContext, SybaseSQLCompiler
+from sqlalchemy.dialects.sybase.base import (
+ SybaseDialect,
+ SybaseExecutionContext,
+ SybaseSQLCompiler,
+)
class _SybNumeric(sqltypes.Numeric):
@@ -35,7 +38,6 @@ class _SybNumeric(sqltypes.Numeric):
class SybaseExecutionContext_pysybase(SybaseExecutionContext):
-
def set_ddl_autocommit(self, dbapi_connection, value):
if value:
# call commit() on the Sybase connection directly,
@@ -58,24 +60,22 @@ class SybaseSQLCompiler_pysybase(SybaseSQLCompiler):
class SybaseDialect_pysybase(SybaseDialect):
- driver = 'pysybase'
+ driver = "pysybase"
execution_ctx_cls = SybaseExecutionContext_pysybase
statement_compiler = SybaseSQLCompiler_pysybase
- colspecs = {
- sqltypes.Numeric: _SybNumeric,
- sqltypes.Float: sqltypes.Float
- }
+ colspecs = {sqltypes.Numeric: _SybNumeric, sqltypes.Float: sqltypes.Float}
@classmethod
def dbapi(cls):
import Sybase
+
return Sybase
def create_connect_args(self, url):
- opts = url.translate_connect_args(username='user', password='passwd')
+ opts = url.translate_connect_args(username="user", password="passwd")
- return ([opts.pop('host')], opts)
+ return ([opts.pop("host")], opts)
def do_executemany(self, cursor, statement, parameters, context=None):
# calling python-sybase executemany yields:
@@ -90,13 +90,17 @@ class SybaseDialect_pysybase(SybaseDialect):
return (vers / 1000, vers % 1000 / 100, vers % 100 / 10, vers % 10)
def is_disconnect(self, e, connection, cursor):
- if isinstance(e, (self.dbapi.OperationalError,
- self.dbapi.ProgrammingError)):
+ if isinstance(
+ e, (self.dbapi.OperationalError, self.dbapi.ProgrammingError)
+ ):
msg = str(e)
- return ('Unable to complete network request to host' in msg or
- 'Invalid connection state' in msg or
- 'Invalid cursor state' in msg)
+ return (
+ "Unable to complete network request to host" in msg
+ or "Invalid connection state" in msg
+ or "Invalid cursor state" in msg
+ )
else:
return False
+
dialect = SybaseDialect_pysybase