]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
kill me now, pep8 pass, so close
authorDiana Clarke <diana.joan.clarke@gmail.com>
Tue, 20 Nov 2012 05:47:31 +0000 (00:47 -0500)
committerDiana Clarke <diana.joan.clarke@gmail.com>
Tue, 20 Nov 2012 05:47:31 +0000 (00:47 -0500)
19 files changed:
lib/sqlalchemy/dialects/__init__.py
lib/sqlalchemy/dialects/firebird/__init__.py
lib/sqlalchemy/dialects/firebird/base.py
lib/sqlalchemy/dialects/firebird/fdb.py
lib/sqlalchemy/dialects/informix/__init__.py
lib/sqlalchemy/dialects/informix/base.py
lib/sqlalchemy/dialects/mssql/__init__.py
lib/sqlalchemy/dialects/mssql/adodbapi.py
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mssql/information_schema.py
lib/sqlalchemy/dialects/mssql/mxodbc.py
lib/sqlalchemy/dialects/mssql/pymssql.py
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/mysql/gaerdbms.py
lib/sqlalchemy/dialects/mysql/oursql.py
lib/sqlalchemy/dialects/mysql/pymysql.py
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/dialects/oracle/cx_oracle.py
lib/sqlalchemy/dialects/oracle/zxjdbc.py

index af0dc37eab8870b4831ddf9a154debe401614a40..61cb4e1a125133b39e22cbbdb6f7ce4173b90d58 100644 (file)
@@ -43,4 +43,4 @@ def _auto_fn(name):
     else:
         return None
 
-registry = util.PluginLoader("sqlalchemy.dialects", auto_fn=_auto_fn)
\ No newline at end of file
+registry = util.PluginLoader("sqlalchemy.dialects", auto_fn=_auto_fn)
index f79588d24d8292f148b3cef4f4046ca022143a6c..6b2c6878dde9b343f56788c609fbf33054ec73b1 100644 (file)
@@ -18,5 +18,3 @@ __all__ = (
     'TEXT', 'NUMERIC', 'FLOAT', 'TIMESTAMP', 'VARCHAR', 'CHAR', 'BLOB',
     'dialect'
 )
-
-
index d9cdf72db95c1d7d65d775f5b0c4c2cb059ec408..9a8e8044a7541450a787836862939d9f06e23b98 100644 (file)
@@ -69,7 +69,7 @@ the SQLAlchemy ``returning()`` method, such as::
 
 """
 
-import datetime, re
+import datetime
 
 from sqlalchemy import schema as sa_schema
 from sqlalchemy import exc, types as sqltypes, sql, util
index ce872d562313f52ec4469b8626fdb0ab45b8b80a..b9356b3a33bdf53f50ed95611a89d02ddd7382d1 100644 (file)
@@ -64,4 +64,4 @@ class FBDialect_fdb(FBDialect_kinterbasdb):
 
         return self._parse_version_info(version)
 
-dialect = FBDialect_fdb
\ No newline at end of file
+dialect = FBDialect_fdb
index e500bea55499cdc9ba9d955f4956fba3544ca4f8..798ae94a6c2b0a870e7b10e8b12f065a0d9f8817 100644 (file)
@@ -6,4 +6,4 @@
 
 from sqlalchemy.dialects.informix import base, informixdb
 
-base.dialect = informixdb.dialect
\ No newline at end of file
+base.dialect = informixdb.dialect
index 0b82519a6f8401ba127fe10fd6bca5f6be7e7239..c3fbccb11476f6fe81d6cef4521a3b760db437a9 100644 (file)
@@ -175,7 +175,7 @@ class InfoTime(sqltypes.Time):
         return process
 
 colspecs = {
-    sqltypes.DateTime : InfoDateTime,
+    sqltypes.DateTime: InfoDateTime,
     sqltypes.TIMESTAMP: InfoDateTime,
     sqltypes.Time: InfoTime,
 }
@@ -352,7 +352,7 @@ class InformixIdentifierPreparer(compiler.IdentifierPreparer):
 class InformixDialect(default.DefaultDialect):
     name = 'informix'
 
-    max_identifier_length = 128 # adjusts at runtime based on server version
+    max_identifier_length = 128  # adjusts at runtime based on server version
 
     type_compiler = InfoTypeCompiler
     statement_compiler = InfoSQLCompiler
@@ -445,14 +445,14 @@ class InformixDialect(default.DefaultDialect):
             if coltype not in (0, 13) and default:
                 default = default.split()[-1]
 
-            if coltype == 6: # Serial, mark as autoincrement
+            if coltype == 6:  # Serial, mark as autoincrement
                 autoincrement = True
 
-            if coltype == 0 or coltype == 13: # char, varchar
+            if coltype == 0 or coltype == 13:  # char, varchar
                 coltype = ischema_names[coltype](collength)
                 if default:
                     default = "'%s'" % default
-            elif coltype == 5: # decimal
+            elif coltype == 5:  # decimal
                 precision, scale = (collength & 0xFF00) >> 8, collength & 0xFF
                 if scale == 255:
                     scale = 0
@@ -496,11 +496,11 @@ class InformixDialect(default.DefaultDialect):
 
         def fkey_rec():
             return {
-                 'name' : None,
-                 'constrained_columns' : [],
-                 'referred_schema' : None,
-                 'referred_table' : None,
-                 'referred_columns' : []
+                 'name': None,
+                 'constrained_columns': [],
+                 'referred_schema': None,
+                 'referred_table': None,
+                 'referred_columns': []
              }
 
         fkeys = util.defaultdict(fkey_rec)
index e262d208b720821d009cc8bfe5f69097e27377da..bad9b72c802f40425ee011d7ec1dc7946a7446ad 100644 (file)
@@ -23,4 +23,4 @@ __all__ = (
     'DATETIME2', 'DATETIMEOFFSET', 'DATE', 'TIME', 'SMALLDATETIME',
     'BINARY', 'VARBINARY', 'BIT', 'REAL', 'IMAGE', 'TIMESTAMP',
     'MONEY', 'SMALLMONEY', 'UNIQUEIDENTIFIER', 'SQL_VARIANT', 'dialect'
-)
\ No newline at end of file
+)
index 294402c06d1f21e0d1d3721045598e644c7319d9..2b864db96a08550c41b478a56cf9ec6cb76419fa 100644 (file)
@@ -59,18 +59,18 @@ class MSDialect_adodbapi(MSDialect):
 
         connectors = ["Provider=SQLOLEDB"]
         if 'port' in keys:
-            connectors.append ("Data Source=%s, %s" %
+            connectors.append("Data Source=%s, %s" %
                                 (keys.get("host"), keys.get("port")))
         else:
-            connectors.append ("Data Source=%s" % keys.get("host"))
-        connectors.append ("Initial Catalog=%s" % keys.get("database"))
+            connectors.append("Data Source=%s" % keys.get("host"))
+        connectors.append("Initial Catalog=%s" % keys.get("database"))
         user = keys.get("user")
         if user:
             connectors.append("User Id=%s" % user)
             connectors.append("Password=%s" % keys.get("password", ""))
         else:
             connectors.append("Integrated Security=SSPI")
-        return [[";".join (connectors)], {}]
+        return [[";".join(connectors)], {}]
 
     def is_disconnect(self, e, connection, cursor):
         return isinstance(e, self.dbapi.adodbapi.DatabaseError) and \
index 10878c0f52d41b2bd766d0d68f25ab576bae62a1..f55ae464444f9b266c9cf67d71abf5a0df181a19 100644 (file)
@@ -245,6 +245,7 @@ class _MSDate(sqltypes.Date):
         return process
 
     _reg = re.compile(r"(\d+)-(\d+)-(\d+)")
+
     def result_processor(self, dialect, coltype):
         def process(value):
             if isinstance(value, datetime.datetime):
@@ -277,6 +278,7 @@ class TIME(sqltypes.TIME):
         return process
 
     _reg = re.compile(r"(\d+):(\d+):(\d+)(?:\.(\d{0,6}))?")
+
     def result_processor(self, dialect, coltype):
         def process(value):
             if isinstance(value, datetime.datetime):
@@ -505,30 +507,30 @@ MSUniqueIdentifier = UNIQUEIDENTIFIER
 MSVariant = SQL_VARIANT
 
 ischema_names = {
-    'int' : INTEGER,
+    'int': INTEGER,
     'bigint': BIGINT,
-    'smallint' : SMALLINT,
-    'tinyint' : TINYINT,
-    'varchar' : VARCHAR,
-    'nvarchar' : NVARCHAR,
-    'char' : CHAR,
-    'nchar' : NCHAR,
-    'text' : TEXT,
-    'ntext' : NTEXT,
-    'decimal' : DECIMAL,
-    'numeric' : NUMERIC,
-    'float' : FLOAT,
-    'datetime' : DATETIME,
-    'datetime2' : DATETIME2,
-    'datetimeoffset' : DATETIMEOFFSET,
+    'smallint': SMALLINT,
+    'tinyint': TINYINT,
+    'varchar': VARCHAR,
+    'nvarchar': NVARCHAR,
+    'char': CHAR,
+    'nchar': NCHAR,
+    'text': TEXT,
+    'ntext': NTEXT,
+    'decimal': DECIMAL,
+    'numeric': NUMERIC,
+    'float': FLOAT,
+    'datetime': DATETIME,
+    'datetime2': DATETIME2,
+    'datetimeoffset': DATETIMEOFFSET,
     'date': DATE,
     'time': TIME,
-    'smalldatetime' : SMALLDATETIME,
-    'binary' : BINARY,
-    'varbinary' : VARBINARY,
+    'smalldatetime': SMALLDATETIME,
+    'binary': BINARY,
+    'varbinary': VARBINARY,
     'bit': BIT,
-    'real' : REAL,
-    'image' : IMAGE,
+    'real': REAL,
+    'image': IMAGE,
     'timestamp': TIMESTAMP,
     'money': MONEY,
     'smallmoney': SMALLMONEY,
@@ -604,8 +606,7 @@ class MSTypeCompiler(compiler.GenericTypeCompiler):
         return self._extend("TEXT", type_)
 
     def visit_VARCHAR(self, type_):
-        return self._extend("VARCHAR", type_,
-                    length = type_.length or 'max')
+        return self._extend("VARCHAR", type_, length=type_.length or 'max')
 
     def visit_CHAR(self, type_):
         return self._extend("CHAR", type_)
@@ -614,8 +615,7 @@ class MSTypeCompiler(compiler.GenericTypeCompiler):
         return self._extend("NCHAR", type_)
 
     def visit_NVARCHAR(self, type_):
-        return self._extend("NVARCHAR", type_,
-                    length = type_.length or 'max')
+        return self._extend("NVARCHAR", type_, length=type_.length or 'max')
 
     def visit_date(self, type_):
         if self.dialect.server_version_info < MS_2008_VERSION:
@@ -1118,9 +1118,9 @@ class MSDialect(default.DefaultDialect):
     schema_name = "dbo"
 
     colspecs = {
-        sqltypes.DateTime : _MSDateTime,
-        sqltypes.Date : _MSDate,
-        sqltypes.Time : TIME,
+        sqltypes.DateTime: _MSDateTime,
+        sqltypes.Date: _MSDate,
+        sqltypes.Time: TIME,
     }
 
     ischema_names = ischema_names
@@ -1169,7 +1169,7 @@ class MSDialect(default.DefaultDialect):
                 "behaviors may not function properly.   If using ODBC "
                 "with FreeTDS, ensure server version 7.0 or 8.0, not 4.2, "
                 "is configured in the FreeTDS configuration." %
-                ".".join(str(x) for x in self.server_version_info) )
+                ".".join(str(x) for x in self.server_version_info))
         if self.server_version_info >= MS_2005_VERSION and \
                     'implicit_returning' not in self.__dict__:
             self.implicit_returning = True
@@ -1268,7 +1268,7 @@ class MSDialect(default.DefaultDialect):
                     sql.bindparam('schname', owner,
                                     sqltypes.String(convert_unicode=True))
                 ],
-                typemap = {
+                typemap={
                     'name': sqltypes.Unicode()
                 }
             )
@@ -1297,9 +1297,7 @@ class MSDialect(default.DefaultDialect):
                             sql.bindparam('schname', owner,
                                     sqltypes.String(convert_unicode=True))
                         ],
-                        typemap = {
-                            'name': sqltypes.Unicode()
-                        }
+                        typemap={'name': sqltypes.Unicode()}
                         ),
             )
         for row in rp:
@@ -1389,10 +1387,10 @@ class MSDialect(default.DefaultDialect):
 
                 coltype = coltype(**kwargs)
             cdict = {
-                'name' : name,
-                'type' : coltype,
-                'nullable' : nullable,
-                'default' : default,
+                'name': name,
+                'type': coltype,
+                'nullable': nullable,
+                'default': default,
                 'autoincrement': False,
             }
             cols.append(cdict)
@@ -1476,9 +1474,8 @@ class MSDialect(default.DefaultDialect):
                                                 RR.c.unique_constraint_name,
                                 C.c.ordinal_position == R.c.ordinal_position
                                 ),
-                       order_by= [
-                                    RR.c.constraint_name,
-                                    R.c.ordinal_position])
+                       order_by=[RR.c.constraint_name, R.c.ordinal_position]
+        )
 
         # group rows by constraint ID, to handle multi-column FKs
         fkeys = []
@@ -1515,4 +1512,3 @@ class MSDialect(default.DefaultDialect):
             remote_cols.append(rcol)
 
         return fkeys.values()
-
index bd88a67d897cf91ad2a90149f874ace59208c3ca..85d9e501dcecc04fcf7f0a361a255d2d9fc884b9 100644 (file)
@@ -94,4 +94,3 @@ views = Table("VIEWS", ischema,
     Column("CHECK_OPTION", String, key="check_option"),
     Column("IS_UPDATABLE", String, key="is_updatable"),
     schema="INFORMATION_SCHEMA")
-
index 3c8bb307debb869094c2e91bdc0d02a9f7659194..e210d97de74975f18f372acbc17cdb92da81f617 100644 (file)
@@ -98,10 +98,10 @@ class MSDialect_mxodbc(MxODBCConnector, MSDialect):
     _need_decimal_fix = True
 
     colspecs = {
-        sqltypes.Numeric : _MSNumeric_mxodbc,
-        sqltypes.DateTime : _MSDateTime,
-        sqltypes.Date : _MSDate_mxodbc,
-        sqltypes.Time : _MSTime_mxodbc,
+        sqltypes.Numeric: _MSNumeric_mxodbc,
+        sqltypes.DateTime: _MSDateTime,
+        sqltypes.Date: _MSDate_mxodbc,
+        sqltypes.Time: _MSTime_mxodbc,
     }
 
     def __init__(self, description_encoding=None, **params):
@@ -109,4 +109,3 @@ class MSDialect_mxodbc(MxODBCConnector, MSDialect):
         self.description_encoding = description_encoding
 
 dialect = MSDialect_mxodbc
-
index 71aa7c1883b4ae5f2a074a73a456c5ed477fa476..eb795200d81bde0b922d74d42de9c1669412c199 100644 (file)
@@ -48,6 +48,7 @@ class MSDialect_pymssql(MSDialect):
             sqltypes.Float: sqltypes.Float,
         }
     )
+
     @classmethod
     def dbapi(cls):
         module = __import__('pymssql')
index f8981fc9646734846414058fde88b53957f4d31f..dc2ae7515cfb50c373811db91916cdf7d2d2a4cf 100644 (file)
@@ -339,10 +339,10 @@ RESERVED_WORDS = set(
      'union', 'unique', 'unlock', 'unsigned', 'update', 'usage', 'use',
      'using', 'utc_date', 'utc_time', 'utc_timestamp', 'values', 'varbinary',
      'varchar', 'varcharacter', 'varying', 'when', 'where', 'while', 'with',
-     'write', 'x509', 'xor', 'year_month', 'zerofill', # 5.0
-     'columns', 'fields', 'privileges', 'soname', 'tables', # 4.1
+     'write', 'x509', 'xor', 'year_month', 'zerofill',  # 5.0
+     'columns', 'fields', 'privileges', 'soname', 'tables',  # 4.1
      'accessible', 'linear', 'master_ssl_verify_server_cert', 'range',
-     'read_only', 'read_write', # 5.1
+     'read_only', 'read_write',  # 5.1
      ])
 
 AUTOCOMMIT_RE = re.compile(
@@ -708,6 +708,7 @@ class TIME(sqltypes.TIME):
 
     def result_processor(self, dialect, coltype):
         time = datetime.time
+
         def process(value):
             # convert from a timedelta value
             if value is not None:
@@ -1093,6 +1094,7 @@ class ENUM(sqltypes.Enum, _StringType):
 
     def bind_processor(self, dialect):
         super_convert = super(ENUM, self).bind_processor(dialect)
+
         def process(value):
             if self.strict and value is not None and value not in self.enums:
                 raise exc.InvalidRequestError('"%s" not a valid value for '
@@ -1180,6 +1182,7 @@ class SET(_StringType):
 
     def bind_processor(self, dialect):
         super_convert = super(SET, self).bind_processor(dialect)
+
         def process(value):
             if value is None or isinstance(value, (int, long, basestring)):
                 pass
@@ -1285,9 +1288,7 @@ class MySQLCompiler(compiler.SQLCompiler):
     """Overridden from base SQLCompiler value"""
 
     extract_map = compiler.SQLCompiler.extract_map.copy()
-    extract_map.update ({
-        'milliseconds': 'millisecond',
-    })
+    extract_map.update({'milliseconds': 'millisecond'})
 
     def visit_random_func(self, fn, **kw):
         return "rand%s" % self.function_argspec(fn)
@@ -1650,7 +1651,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
         else:
             return self._extend_numeric(type_,
                             "NUMERIC(%(precision)s, %(scale)s)" %
-                            {'precision': type_.precision, 'scale' : type_.scale})
+                            {'precision': type_.precision, 'scale': type_.scale})
 
     def visit_DECIMAL(self, type_):
         if type_.precision is None:
@@ -1662,13 +1663,13 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
         else:
             return self._extend_numeric(type_,
                             "DECIMAL(%(precision)s, %(scale)s)" %
-                            {'precision': type_.precision, 'scale' : type_.scale})
+                            {'precision': type_.precision, 'scale': type_.scale})
 
     def visit_DOUBLE(self, type_):
         if type_.precision is not None and type_.scale is not None:
             return self._extend_numeric(type_, "DOUBLE(%(precision)s, %(scale)s)" %
                                 {'precision': type_.precision,
-                                 'scale' : type_.scale})
+                                 'scale': type_.scale})
         else:
             return self._extend_numeric(type_, 'DOUBLE')
 
@@ -1676,7 +1677,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
         if type_.precision is not None and type_.scale is not None:
             return self._extend_numeric(type_, "REAL(%(precision)s, %(scale)s)" %
                                 {'precision': type_.precision,
-                                 'scale' : type_.scale})
+                                 'scale': type_.scale})
         else:
             return self._extend_numeric(type_, 'REAL')
 
@@ -2150,12 +2151,12 @@ class MySQLDialect(default.DefaultDialect):
                     con_kw[opt] = spec[opt]
 
             fkey_d = {
-                'name' : spec['name'],
-                'constrained_columns' : loc_names,
-                'referred_schema' : ref_schema,
-                'referred_table' : ref_name,
-                'referred_columns' : ref_names,
-                'options' : con_kw
+                'name': spec['name'],
+                'constrained_columns': loc_names,
+                'referred_schema': ref_schema,
+                'referred_table': ref_name,
+                'referred_columns': ref_names,
+                'options': con_kw
             }
             fkeys.append(fkey_d)
         return fkeys
@@ -2818,4 +2819,3 @@ def _re_compile(regex):
     """Compile a string to regex, I and UNICODE."""
 
     return re.compile(regex, re.I | re.UNICODE)
-
index 66180e233abc8b1d24390fe83223a79d822a36f6..25201fee681015d0afeecda895683514fcc9c026 100644 (file)
@@ -52,4 +52,4 @@ class MySQLDialect_gaerdbms(MySQLDialect_mysqldb):
         if code:
             return int(code)
 
-dialect = MySQLDialect_gaerdbms
\ No newline at end of file
+dialect = MySQLDialect_gaerdbms
index 8e4fe23835ced567fde7023aae18d665165898b8..ca4986d62b58e9c91203900a79610eaf3fce730e 100644 (file)
@@ -126,63 +126,67 @@ class MySQLDialect_oursql(MySQLDialect):
     # Q: why didn't we need all these "plain_query" overrides earlier ?
     # am i on a newer/older version of OurSQL ?
     def has_table(self, connection, table_name, schema=None):
-        return MySQLDialect.has_table(self,
-                                        connection.connect().\
-                                            execution_options(_oursql_plain_query=True),
-                                        table_name, schema)
+        return MySQLDialect.has_table(
+          self,
+          connection.connect().execution_options(_oursql_plain_query=True),
+          table_name,
+          schema
+        )
 
     def get_table_options(self, connection, table_name, schema=None, **kw):
-        return MySQLDialect.get_table_options(self,
-                                            connection.connect().\
-                                                execution_options(_oursql_plain_query=True),
-                                            table_name,
-                                            schema = schema,
-                                            **kw
+        return MySQLDialect.get_table_options(
+            self,
+            connection.connect().execution_options(_oursql_plain_query=True),
+            table_name,
+            schema=schema,
+            **kw
         )
 
     def get_columns(self, connection, table_name, schema=None, **kw):
-        return MySQLDialect.get_columns(self,
-                                        connection.connect().\
-                                                    execution_options(_oursql_plain_query=True),
-                                        table_name,
-                                        schema=schema,
-                                        **kw
+        return MySQLDialect.get_columns(
+            self,
+            connection.connect().execution_options(_oursql_plain_query=True),
+            table_name,
+            schema=schema,
+            **kw
         )
 
     def get_view_names(self, connection, schema=None, **kw):
-        return MySQLDialect.get_view_names(self,
-                                            connection.connect().\
-                                                    execution_options(_oursql_plain_query=True),
-                                            schema=schema,
-                                            **kw
+        return MySQLDialect.get_view_names(
+            self,
+            connection.connect().execution_options(_oursql_plain_query=True),
+            schema=schema,
+            **kw
         )
 
     def get_table_names(self, connection, schema=None, **kw):
-        return MySQLDialect.get_table_names(self,
-                            connection.connect().\
-                                        execution_options(_oursql_plain_query=True),
-                            schema
+        return MySQLDialect.get_table_names(
+            self,
+            connection.connect().execution_options(_oursql_plain_query=True),
+            schema
         )
 
     def get_schema_names(self, connection, **kw):
-        return MySQLDialect.get_schema_names(self,
-                                    connection.connect().\
-                                                execution_options(_oursql_plain_query=True),
-                                    **kw
+        return MySQLDialect.get_schema_names(
+            self,
+            connection.connect().execution_options(_oursql_plain_query=True),
+            **kw
         )
 
     def initialize(self, connection):
         return MySQLDialect.initialize(
-                            self,
-                            connection.execution_options(_oursql_plain_query=True)
-                            )
+            self,
+            connection.execution_options(_oursql_plain_query=True)
+        )
 
     def _show_create_table(self, connection, table, charset=None,
                            full_name=None):
-        return MySQLDialect._show_create_table(self,
-                                connection.contextual_connect(close_with_result=True).
-                                execution_options(_oursql_plain_query=True),
-                                table, charset, full_name)
+        return MySQLDialect._show_create_table(
+            self,
+            connection.contextual_connect(close_with_result=True).
+            execution_options(_oursql_plain_query=True),
+            table, charset, full_name
+        )
 
     def is_disconnect(self, e, connection, cursor):
         if isinstance(e, self.dbapi.ProgrammingError):
index 818bb7e3b4e4322a98e9274840ef0b7e1f618e4b..3989d037cf514395718a91251c45933931fa0c2e 100644 (file)
@@ -28,8 +28,9 @@ class MySQLDialect_pymysql(MySQLDialect_mysqldb):
     driver = 'pymysql'
 
     description_encoding = None
+
     @classmethod
     def dbapi(cls):
         return __import__('pymysql')
 
-dialect = MySQLDialect_pymysql
\ No newline at end of file
+dialect = MySQLDialect_pymysql
index 1daea3cefb2df3906d3ddcdcfe565de8e2b45349..baea4815b1d6d07a52eb7e3a0680aed8f7c49202 100644 (file)
@@ -139,10 +139,9 @@ is not in use this flag should be left off.
 
 """
 
-import random, re
+import re
 
-from sqlalchemy import schema as sa_schema
-from sqlalchemy import util, sql, log
+from sqlalchemy import util, sql
 from sqlalchemy.engine import default, base, reflection
 from sqlalchemy.sql import compiler, visitors, expression
 from sqlalchemy.sql import operators as sql_operators, functions as sql_functions
@@ -205,6 +204,7 @@ class NUMBER(sqltypes.Numeric, sqltypes.Integer):
 
 class DOUBLE_PRECISION(sqltypes.Numeric):
     __visit_name__ = 'DOUBLE_PRECISION'
+
     def __init__(self, precision=None, scale=None, asdecimal=None):
         if asdecimal is None:
             asdecimal = False
@@ -265,27 +265,27 @@ class _OracleBoolean(sqltypes.Boolean):
         return dbapi.NUMBER
 
 colspecs = {
-    sqltypes.Boolean : _OracleBoolean,
-    sqltypes.Interval : INTERVAL,
+    sqltypes.Boolean: _OracleBoolean,
+    sqltypes.Interval: INTERVAL,
 }
 
 ischema_names = {
-    'VARCHAR2' : VARCHAR,
-    'NVARCHAR2' : NVARCHAR,
-    'CHAR' : CHAR,
-    'DATE' : DATE,
-    'NUMBER' : NUMBER,
-    'BLOB' : BLOB,
-    'BFILE' : BFILE,
-    'CLOB' : CLOB,
-    'NCLOB' : NCLOB,
-    'TIMESTAMP' : TIMESTAMP,
-    'TIMESTAMP WITH TIME ZONE' : TIMESTAMP,
-    'INTERVAL DAY TO SECOND' : INTERVAL,
-    'RAW' : RAW,
-    'FLOAT' : FLOAT,
-    'DOUBLE PRECISION' : DOUBLE_PRECISION,
-    'LONG' : LONG,
+    'VARCHAR2': VARCHAR,
+    'NVARCHAR2': NVARCHAR,
+    'CHAR': CHAR,
+    'DATE': DATE,
+    'NUMBER': NUMBER,
+    'BLOB': BLOB,
+    'BFILE': BFILE,
+    'CLOB': CLOB,
+    'NCLOB': NCLOB,
+    'TIMESTAMP': TIMESTAMP,
+    'TIMESTAMP WITH TIME ZONE': TIMESTAMP,
+    'INTERVAL DAY TO SECOND': INTERVAL,
+    'RAW': RAW,
+    'FLOAT': FLOAT,
+    'DOUBLE PRECISION': DOUBLE_PRECISION,
+    'LONG': LONG,
 }
 
 
@@ -389,7 +389,7 @@ class OracleTypeCompiler(compiler.GenericTypeCompiler):
 
     def visit_RAW(self, type_):
         if type_.length:
-            return "RAW(%(length)s)" % {'length' : type_.length}
+            return "RAW(%(length)s)" % {'length': type_.length}
         else:
             return "RAW"
 
@@ -910,7 +910,7 @@ class OracleDialect(default.DefaultDialect):
             (colname, orig_colname, coltype, length, precision, scale, nullable, default) = \
                 (self.normalize_name(row[0]), row[0], row[1], row[2], row[3], row[4], row[5] == 'Y', row[6])
 
-            if coltype == 'NUMBER' :
+            if coltype == 'NUMBER':
                 coltype = NUMBER(precision, scale)
             elif coltype in ('VARCHAR2', 'NVARCHAR2', 'CHAR'):
                 coltype = self.ischema_names.get(coltype)(length)
@@ -1066,7 +1066,7 @@ class OracleDialect(default.DefaultDialect):
 
         """
 
-        requested_schema = schema # to check later on
+        requested_schema = schema  # to check later on
         resolve_synonyms = kw.get('oracle_resolve_synonyms', False)
         dblink = kw.get('dblink', '')
         info_cache = kw.get('info_cache')
@@ -1082,11 +1082,11 @@ class OracleDialect(default.DefaultDialect):
 
         def fkey_rec():
             return {
-                'name' : None,
-                'constrained_columns' : [],
-                'referred_schema' : None,
-                'referred_table' : None,
-                'referred_columns' : []
+                'name': None,
+                'constrained_columns': [],
+                'referred_schema': None,
+                'referred_table': None,
+                'referred_columns': []
             }
 
         fkeys = util.defaultdict(fkey_rec)
index e7b182c663dd16955d7da6ec795895a8674a59b4..bee7308005ea28044d35e31dc0bed1e0b5d8adfd 100644 (file)
@@ -182,6 +182,7 @@ class _OracleNumeric(sqltypes.Numeric):
                     fstring = "%.10f"
                 else:
                     fstring = "%%.%df" % self.scale
+
                 def to_decimal(value):
                     if value is None:
                         return None
@@ -189,6 +190,7 @@ class _OracleNumeric(sqltypes.Numeric):
                         return value
                     else:
                         return decimal.Decimal(fstring % value)
+
                 return to_decimal
             else:
                 if self.precision is None and self.scale is None:
@@ -486,21 +488,24 @@ class OracleDialect_cx_oracle(OracleDialect):
 
     colspecs = colspecs = {
         sqltypes.Numeric: _OracleNumeric,
-        sqltypes.Date : _OracleDate, # generic type, assume datetime.date is desired
+        sqltypes.Date: _OracleDate,  # generic type, assume datetime.date is desired
         oracle.DATE: oracle.DATE,  # non generic type - passthru
-        sqltypes.LargeBinary : _OracleBinary,
-        sqltypes.Boolean : oracle._OracleBoolean,
-        sqltypes.Interval : _OracleInterval,
-        oracle.INTERVAL : _OracleInterval,
-        sqltypes.Text : _OracleText,
-        sqltypes.String : _OracleString,
-        sqltypes.UnicodeText : _OracleUnicodeText,
-        sqltypes.CHAR : _OracleChar,
-        sqltypes.Integer : _OracleInteger,  # this is only needed for OUT parameters.
-                                            # it would be nice if we could not use it otherwise.
+        sqltypes.LargeBinary: _OracleBinary,
+        sqltypes.Boolean: oracle._OracleBoolean,
+        sqltypes.Interval: _OracleInterval,
+        oracle.INTERVAL: _OracleInterval,
+        sqltypes.Text: _OracleText,
+        sqltypes.String: _OracleString,
+        sqltypes.UnicodeText: _OracleUnicodeText,
+        sqltypes.CHAR: _OracleChar,
+
+        # this is only needed for OUT parameters.
+        # it would be nice if we could not use it otherwise.
+        sqltypes.Integer: _OracleInteger,
+
         oracle.RAW: _OracleRaw,
         sqltypes.Unicode: _OracleNVarChar,
-        sqltypes.NVARCHAR : _OracleNVarChar,
+        sqltypes.NVARCHAR: _OracleNVarChar,
         oracle.ROWID: _OracleRowid,
     }
 
@@ -588,6 +593,7 @@ class OracleDialect_cx_oracle(OracleDialect):
                 self.dbapi.BLOB: oracle.BLOB(),
                 self.dbapi.BINARY: oracle.RAW(),
             }
+
     @classmethod
     def dbapi(cls):
         import cx_Oracle
@@ -653,6 +659,7 @@ class OracleDialect_cx_oracle(OracleDialect):
             return
 
         cx_Oracle = self.dbapi
+
         def output_type_handler(cursor, name, defaultType,
                                     size, precision, scale):
             # convert all NUMBER with precision + positive scale to Decimal
index 7c828331b108f6626c68ad69d1cf33d5e3e21fbe..94d8f821956f627e9dba2ced6f5ba4b354ca2765 100644 (file)
@@ -78,7 +78,7 @@ class OracleCompiler_zxjdbc(OracleCompiler):
             self.binds[bindparam.key] = bindparam
             binds.append(self.bindparam_string(self._truncate_bindparam(bindparam)))
 
-        return 'RETURNING ' + ', '.join(columns) +  " INTO " + ", ".join(binds)
+        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds)
 
 
 class OracleExecutionContext_zxjdbc(OracleExecutionContext):
@@ -178,7 +178,7 @@ class OracleDialect_zxjdbc(ZxJDBCConnector, OracleDialect):
     colspecs = util.update_copy(
         OracleDialect.colspecs,
         {
-            sqltypes.Date : _ZxJDBCDate,
+            sqltypes.Date: _ZxJDBCDate,
             sqltypes.Numeric: _ZxJDBCNumeric
         }
     )
@@ -189,17 +189,19 @@ class OracleDialect_zxjdbc(ZxJDBCConnector, OracleDialect):
         from java.sql import SQLException
         from com.ziclix.python.sql import zxJDBC
         from com.ziclix.python.sql.handler import OracleDataHandler
-        class OracleReturningDataHandler(OracleDataHandler):
 
+        class OracleReturningDataHandler(OracleDataHandler):
             """zxJDBC DataHandler that specially handles ReturningParam."""
 
             def setJDBCObject(self, statement, index, object, dbtype=None):
                 if type(object) is ReturningParam:
                     statement.registerReturnParameter(index, object.type)
                 elif dbtype is None:
-                    OracleDataHandler.setJDBCObject(self, statement, index, object)
+                    OracleDataHandler.setJDBCObject(
+                        self, statement, index, object)
                 else:
-                    OracleDataHandler.setJDBCObject(self, statement, index, object, dbtype)
+                    OracleDataHandler.setJDBCObject(
+                        self, statement, index, object, dbtype)
         self.DataHandler = OracleReturningDataHandler
 
     def initialize(self, connection):