adamv avatar adamv committed 874258e

* More minor style changes.

Comments (0)

Files changed (2)

source/sqlserver_ado/dbapi.py

 
 class InterfaceError(Error): pass
 class DatabaseError(Error): pass
+
 class InternalError(DatabaseError): pass
 class OperationalError(DatabaseError): pass
 class ProgrammingError(DatabaseError): pass
 
     def executemany(self, operation, seq_of_parameters):
         """Execute the given command against all parameter sequences or mappings given in seq_of_parameters."""
-        self.messages = []
+        self.messages = list()
         total_recordcount = 0
 
         for params in seq_of_parameters:
             self.execute(operation, params)
+
             if self.rowcount == -1:
                 total_recordcount = -1
 
         An Error (or subclass) exception is raised if the previous call to executeXXX()
         did not produce any result set or no call was issued yet.
         """
-        self.messages = []
+        self.messages = list()
         result = self._fetch(1)
         if result: # return record (not list of records)
             return result[0]
 
     def fetchmany(self, size=None):
         """Fetch the next set of rows of a query result, returning a list of tuples. An empty sequence is returned when no more rows are available."""
-        self.messages = []
+        self.messages = list()
         if size is None:
             size = self.arraysize
         return self._fetch(size)
 
     def fetchall(self):
         """Fetch all remaining rows of a query result, returning them as a sequence of sequences."""
-        self.messages = []
+        self.messages = list()
         return self._fetch()
 
     def nextset(self):
         If there are no more sets, the method returns None. Otherwise, it returns a true
         value and subsequent calls to the fetch methods will return rows from the next result set.
         """
-        self.messages = []
+        self.messages = list()
         if self.connection is None or self.rs is None:
             self._raiseCursorError(Error, None)
             return None
     return (datetime.datetime.fromordinal(day_count + _ordinal_1899_12_31) +
         datetime.timedelta(milliseconds=fraction_of_day * _milliseconds_per_day))
 
-_variantConversions = MultiMap({
+_variantConversions = MultiMap(
+    {
         adoDateTimeTypes : _cvtComDate,
         adoApproximateNumericTypes: _cvtFloat,
         (adCurrency,): _cvtCurrency,
         (adBoolean,): bool,
         adoLongTypes+adoRowIdTypes : long,
         adoIntegerTypes: int,
-        adoBinaryTypes: buffer, }
-    , lambda x: x)
-
+        adoBinaryTypes: buffer, 
+    }, 
+    lambda x: x)
 
 # Mapping Python data types to ADO type codes
 def _ado_type(data):
     decimal.Decimal: adDecimal,
     datetime.date: adDate,
     datetime.datetime: adDate,
-    datetime.time: adDate, }
+    datetime.time: adDate, 
+}

source/sqlserver_ado/operations.py

 
         if lookup_type == 'year':
             return "Convert(datetime, Convert(varchar, DATEPART(year, %s)) + '/01/01')" % quoted_field_name
+
         if lookup_type == 'month':
             return "Convert(datetime, Convert(varchar, DATEPART(year, %s)) + '/' + Convert(varchar, DATEPART(month, %s)) + '/01')" %\
                 (quoted_field_name, quoted_field_name)
+
         if lookup_type == 'day':
             return "Convert(datetime, Convert(varchar(12), %s))" % quoted_field_name
 
             qn(fk[0]), qn(fk[1])) for fk in fks])
 
         # Delete data from tables.
-        _delete = style.SQL_KEYWORD('DELETE')
-        _from = style.SQL_KEYWORD('FROM')
-        
-        sql_list.extend(['%s %s %s;' % (_delete, _from, style.SQL_FIELD(qn(t))) for t in tables])
+        sql_list.extend(['%s %s %s;' % (
+            style.SQL_KEYWORD('DELETE'), 
+            style.SQL_KEYWORD('FROM'), 
+            style.SQL_FIELD(qn(t))
+            ) for t in tables])
 
         # Reset the counters on each table.
         sql_list.extend(['%s %s (%s, %s, %s) %s %s;' % (
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.