[SQL-CVS] SQLObject development repository branch master updated. 2.1.0-125-gb5a0d7d
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <no...@so...> - 2015-02-06 13:54:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "SQLObject development repository". The branch, master has been updated via b5a0d7d34e83c613984c7aff39c12ffbaeba2e70 (commit) via bf4bd6bad47bc62f8abb45856a03187a224ec913 (commit) via d5e5bc6cf42462a6d0469fcf20a63067c2096fe9 (commit) via afd323dea72da5fe27aa993c05e5d5c99d6d7e12 (commit) via bd355a7de722929044caad5a2a537825abe5c543 (commit) via 124690114b0444be16ee015e9433306b2d82ac39 (commit) via fe1c76c1e867f969d79f22ba3e54c0e46afb19fb (commit) from 0a64735fbb27adf82156346674f3143db9fd4c0c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://sourceforge.net/p/sqlobject/sqlobject/ci/b5a0d7d34e83c613984c7aff39c12ffbaeba2e70 commit b5a0d7d34e83c613984c7aff39c12ffbaeba2e70 Merge: bf4bd6b bd355a7 Author: Oleg Broytman <ph...@ph...> Date: Fri Feb 6 16:52:24 2015 +0300 Merge pull request #61 from drnlm/issue_3_fix_long Issue 3 fix long syntax http://sourceforge.net/p/sqlobject/sqlobject/ci/bf4bd6bad47bc62f8abb45856a03187a224ec913 commit bf4bd6bad47bc62f8abb45856a03187a224ec913 Merge: d5e5bc6 afd323d Author: Oleg Broytman <ph...@ph...> Date: Fri Feb 6 16:51:09 2015 +0300 Merge pull request #60 from drnlm/issue_35_flake8_E203 Fix #35 flake8 E203 whitespace before ':' http://sourceforge.net/p/sqlobject/sqlobject/ci/d5e5bc6cf42462a6d0469fcf20a63067c2096fe9 commit d5e5bc6cf42462a6d0469fcf20a63067c2096fe9 Merge: 0a64735 fe1c76c Author: Oleg Broytman <ph...@ph...> Date: Fri Feb 6 16:49:46 2015 +0300 Merge branch 'flake8-fixes' http://sourceforge.net/p/sqlobject/sqlobject/ci/afd323dea72da5fe27aa993c05e5d5c99d6d7e12 commit afd323dea72da5fe27aa993c05e5d5c99d6d7e12 Author: Neil <ne...@di...> Date: Fri Feb 6 12:24:20 2015 +0200 Fix flake8 E203 - whitespace before ':' diff --git a/sqlobject/inheritance/__init__.py b/sqlobject/inheritance/__init__.py index db71622..b570310 100644 --- a/sqlobject/inheritance/__init__.py +++ b/sqlobject/inheritance/__init__.py @@ -121,7 +121,7 @@ class InheritableSQLMeta(sqlmeta): not getattr(self.sqlmeta, "row_update_sig_suppress", False): self.sqlmeta.send(events.RowUpdateSignal, self, - {cname : val}) + {cname: val}) setattr(self._parent, cname, val) return setfunc diff --git a/sqlobject/maxdb/maxdbconnection.py b/sqlobject/maxdb/maxdbconnection.py index 01ce60b..55bce1e 100644 --- a/sqlobject/maxdb/maxdbconnection.py +++ b/sqlobject/maxdb/maxdbconnection.py @@ -31,7 +31,7 @@ class LowerBoundOfSliceIsNotSupported(maxdbException): maxdbException.__init__(self, '') -class IncorrectIDStyleError(maxdbException) : +class IncorrectIDStyleError(maxdbException): def __init__(self, value): maxdbException.__init__( self, @@ -96,7 +96,7 @@ class MaxdbConnection(DBAPI): opt["sqlmode"] = sqlmode if self.isolation: opt["isolation"] = self.isolation - if self.timeout : + if self.timeout: opt["timeout"] = self.timeout return opt @@ -274,7 +274,7 @@ class MaxdbConnection(DBAPI): kw['name'] = field_name kw['dbName'] = field - if nullAllowed == 'Y' : + if nullAllowed == 'Y': nullAllowed = False else: nullAllowed = True diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py index 8608f04..a09f658 100644 --- a/sqlobject/mssql/mssqlconnection.py +++ b/sqlobject/mssql/mssqlconnection.py @@ -264,9 +264,9 @@ class MSSQLConnection(DBAPI): if defaultText[0] == "'": defaultText = defaultText[1:-1] else: - if t == "int" : + if t == "int": defaultText = int(defaultText) - if t == "float" : + if t == "float": defaultText = float(defaultText) if t == "numeric": defaultText = float(defaultText) diff --git a/sqlobject/tests/dbtest.py b/sqlobject/tests/dbtest.py index 14b2fea..5522a36 100644 --- a/sqlobject/tests/dbtest.py +++ b/sqlobject/tests/dbtest.py @@ -39,8 +39,8 @@ supportsMatrix = { '-blobData': 'mssql rdbhost', '-decimalColumn': 'mssql', '-emptyTable': 'mssql', - '-limitSelect' : 'mssql', - '+schema' : 'postgres', + '-limitSelect': 'mssql', + '+schema': 'postgres', '+memorydb': 'sqlite', } diff --git a/sqlobject/versioning/__init__.py b/sqlobject/versioning/__init__.py index 80a3ab6..61cffb1 100644 --- a/sqlobject/versioning/__init__.py +++ b/sqlobject/versioning/__init__.py @@ -76,8 +76,8 @@ class Versioning(object): attrs = {'dateArchived': DateTimeCol(default=datetime.now), 'master': ForeignKey(self.soClass.__name__), - 'masterClass' : self.soClass, - 'extraCols' : self.extraCols + 'masterClass': self.soClass, + 'extraCols': self.extraCols } getColumns (attrs, self.soClass) diff --git a/sqlobject/versioning/test/test_version.py b/sqlobject/versioning/test/test_version.py index 56f8766..c8a7d60 100644 --- a/sqlobject/versioning/test/test_version.py +++ b/sqlobject/versioning/test/test_version.py @@ -45,7 +45,7 @@ def _set_extra(): class Extra(SQLObject): name = StringCol() versions = Versioning( - extraCols={'extra' : StringCol(default=_set_extra())}) + extraCols={'extra': StringCol(default=_set_extra())}) class HasAltId(SQLObject): http://sourceforge.net/p/sqlobject/sqlobject/ci/bd355a7de722929044caad5a2a537825abe5c543 commit bd355a7de722929044caad5a2a537825abe5c543 Author: Neil <ne...@di...> Date: Fri Feb 6 11:21:08 2015 +0200 Change long specification syntax in tests to avoid python 3 syntax errors diff --git a/sqlobject/tests/test_constraints.py b/sqlobject/tests/test_constraints.py index 5bce16d..89a03fc 100644 --- a/sqlobject/tests/test_constraints.py +++ b/sqlobject/tests/test_constraints.py @@ -1,6 +1,11 @@ from sqlobject.constraints import * from sqlobject.tests.dbtest import * +import sys +if sys.version_info[0] > 2: + # alias for python 3 compatability + long = int + def test_constraints(): obj = 'Test object' @@ -14,9 +19,9 @@ def test_constraints(): raises(BadValue, notNull, obj, col, None) raises(BadValue, isInt, obj, col, 1.1) isInt(obj, col, 1) - isInt(obj, col, 1L) + isInt(obj, col, long(1)) isFloat(obj, col, 1) - isFloat(obj, col, 1L) + isFloat(obj, col, long(1)) isFloat(obj, col, 1.2) raises(BadValue, isFloat, obj, col, '1.0') diff --git a/sqlobject/tests/test_validation.py b/sqlobject/tests/test_validation.py index ccec89b..2618fdb 100644 --- a/sqlobject/tests/test_validation.py +++ b/sqlobject/tests/test_validation.py @@ -2,6 +2,10 @@ from sqlobject import * from sqlobject.col import validators from sqlobject.tests.dbtest import * +import sys +if sys.version_info[0] > 2: + # alias for python 3 compatability + long = int ######################################## # Validation/conversion @@ -96,7 +100,7 @@ class TestValidation: def test_wrapType(self): t = SOValidation(name3=1) raises(validators.Invalid, setattr, t, 'name3', 'x') - t.name3 = 1L + t.name3 = long(1) assert t.name3 == 1 t.name3 = 0 assert t.name3 == 0 http://sourceforge.net/p/sqlobject/sqlobject/ci/124690114b0444be16ee015e9433306b2d82ac39 commit 124690114b0444be16ee015e9433306b2d82ac39 Author: Neil <ne...@di...> Date: Fri Feb 6 11:20:39 2015 +0200 Add long alias for python diff --git a/sqlobject/col.py b/sqlobject/col.py index 690f273..ff943b8 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -72,6 +72,11 @@ __all__ = ["datetime_available", "mxdatetime_available", if mxdatetime_available: __all__.append("MXDATETIME_IMPLEMENTATION") +import sys +if sys.version_info[0] > 2: + # alias for python 3 compatability + long = int + creationOrder = count() diff --git a/sqlobject/constraints.py b/sqlobject/constraints.py index 440ae53..9a77983 100644 --- a/sqlobject/constraints.py +++ b/sqlobject/constraints.py @@ -2,6 +2,11 @@ Constraints """ +import sys +if sys.version_info[0] > 2: + # alias for python 3 compatability + long = int + class BadValue(ValueError): diff --git a/sqlobject/main.py b/sqlobject/main.py index e1ff1fa..20e1585 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -47,6 +47,10 @@ if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) \ or ((sys.version_info[0] == 3) and (sys.version_info[:3] < (3, 4, 0))): raise ImportError("SQLObject requires Python 2.6, 2.7 or 3.4+") +if sys.version_info[0] > 2: + # alias for python 3 compatability + long = int + """ This thread-local storage is needed for RowCreatedSignals. It gathers code-blocks to execute _after_ the whole hierachy of inherited SQLObjects http://sourceforge.net/p/sqlobject/sqlobject/ci/fe1c76c1e867f969d79f22ba3e54c0e46afb19fb commit fe1c76c1e867f969d79f22ba3e54c0e46afb19fb Author: Oleg Broytman <ph...@ph...> Date: Fri Feb 6 00:17:23 2015 +0300 Fix #27 flake8 F821 undefined name Some of these warning are real bugs. diff --git a/setup.cfg b/setup.cfg index 069a010..863e0a5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,13 +19,12 @@ exclude = .git,docs/europython/*.py,ez_setup.py ; F402 import 'name' shadowed by loop variable ; F403 'from module import *' used; unable to detect undefined names ; F812 list comprehension redefines 'name' from line 1402 -; F821 undefined name ; F822 undefined name in __all__ ; W291 trailing whitespace ; W293 blank line contains whitespace ; W391 blank line at end of file ; W603 '<>' is deprecated, use '!=' -ignore = E123,E124,E226,E401,E502,F402,F403,F812,F821,F822,W291,W293,W391,W603 +ignore = E123,E124,E226,E401,E502,F402,F403,F812,F822,W291,W293,W391,W603 [pudge] theme = pythonpaste.org diff --git a/sqlobject/col.py b/sqlobject/col.py index 690f273..682680a 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -375,7 +375,7 @@ class SOCol(object): if columns is None: obj.sqlmeta.loadValues() try: - return columns[name] + return columns[name] # noqa except KeyError: return obj.sqlmeta.loadColumn(self) else: diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index d13db60..1295691 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -1040,12 +1040,13 @@ class ConnectionURIOpener(object): def registerConnectionInstance(self, inst): if inst.name: - assert not inst.name in self.instanceNames \ - or self.instanceNames[inst.name] is cls, \ - "A instance has already been registered " \ - "with the name %s" % inst.name + assert (not inst.name in self.instanceNames + or self.instanceNames[inst.name] is cls # noqa + ), ("A instance has already been registered " + "with the name %s" % inst.name) assert inst.name.find(':') == -1, \ - "You cannot include ':' in your class names (%r)" % cls.name + "You cannot include ':' " \ + "in your class names (%r)" % cls.name # noqa self.instanceNames[inst.name] = inst def connectionForURI(self, uri, oldUri=False, **args): diff --git a/sqlobject/events.py b/sqlobject/events.py index cb4b971..1b2b5f5 100644 --- a/sqlobject/events.py +++ b/sqlobject/events.py @@ -272,8 +272,8 @@ def sort_name(value): _real_dispatcher_send = dispatcher.send _real_dispatcher_sendExact = dispatcher.sendExact -_real_dispatcher_disconnect = dispatcher.disconnect _real_dispatcher_connect = dispatcher.connect +_real_dispatcher_disconnect = dispatcher.disconnect _debug_enabled = False @@ -314,7 +314,7 @@ def _debug_disconnect(receiver, signal=dispatcher.Any, sender=dispatcher.Any, weak=True): print("disconnecting %s from %s signal %s" % ( nice_repr(receiver), nice_repr(signal), nice_repr(sender))) - return disconnect(receiver, signal, sender, weak) + return _real_dispatcher_disconnect(receiver, signal, sender, weak) def fmt_args(*arguments, **name): diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index e94f189..c310af7 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -293,7 +293,7 @@ class Command(object): os.path.basename(self.invoked_as), self.command_name) if self.description: - self.parser.description = description + self.parser.description = self.description self.options, self.args = self.parser.parse_args(self.raw_args) if (getattr(self.options, 'simulate', False) and not self.options.verbose): @@ -1102,7 +1102,7 @@ class CommandRecord(Command): def base_dir(self): base = self.options.output_dir if base is None: - base = CONFIG.get('sqlobject_history_dir', '.') + base = CONFIG.get('sqlobject_history_dir', '.') # noqa if not os.path.exists(base): print('Creating history directory %s' % self.shorten_filename(base)) diff --git a/sqlobject/maxdb/maxdbconnection.py b/sqlobject/maxdb/maxdbconnection.py index 01ce60b..226fe2e 100644 --- a/sqlobject/maxdb/maxdbconnection.py +++ b/sqlobject/maxdb/maxdbconnection.py @@ -13,6 +13,8 @@ connection creation sample:: host=hostname, database=dbname, user=user_name, password=user_password, autoCommit=1, debug=1) """ + +import os from sqlobject.dbconnection import DBAPI from sqlobject import col @@ -311,7 +313,7 @@ class MaxdbConnection(DBAPI): elif t in self._dateTypes: return col.DateTimeCol, {} elif t == 'FIXED': - return CurrencyCol, {'size': flength, - 'precision': fscale} + return col.CurrencyCol, {'size': flength, + 'precision': fscale} else: return col.Col, {} diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py index 8608f04..2531dd0 100644 --- a/sqlobject/mssql/mssqlconnection.py +++ b/sqlobject/mssql/mssqlconnection.py @@ -216,7 +216,7 @@ class MSSQLConnection(DBAPI): column.mssqlCreateSQL(self))) def delColumn(self, sqlmeta, column): - self.query('ALTER TABLE %s DROP COLUMN %s' % (tableName.table, + self.query('ALTER TABLE %s DROP COLUMN %s' % (sqlmeta.table, column.dbName)) # precision and scale is gotten from column table so that we can create @@ -288,7 +288,9 @@ class MSSQLConnection(DBAPI): option = "OFF" c = conn.cursor() c.execute("SET AUTOCOMMIT " + option) - conn.setconnectoption(SQL.AUTOCOMMIT, option) + # from mx.ODBC.Windows import SQL + # connection.setconnectoption( + # SQL.AUTOCOMMIT, SQL.AUTOCOMMIT_ON if auto else SQL.AUTOCOMMIT_OFF) # precision and scale is needed for decimal columns def guessClass(self, t, size, precision, scale): diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py index 60472a3..7e3b1b8 100644 --- a/sqlobject/sqlbuilder.py +++ b/sqlobject/sqlbuilder.py @@ -360,6 +360,7 @@ class SQLPrefix(SQLExpression): return [self.expr] def execute(self, executor): + prefix = self.prefix expr = execute(self.expr, executor) if prefix == "+": return expr diff --git a/sqlobject/util/csvimport.py b/sqlobject/util/csvimport.py index efce367..fe7b2cb 100644 --- a/sqlobject/util/csvimport.py +++ b/sqlobject/util/csvimport.py @@ -55,9 +55,10 @@ whatever default the class wants. ``[null]`` will use NULL. Lines that begin with ``[comment]`` are ignored. """ +import csv from datetime import datetime, date, timedelta import os -import csv +import time import types __all__ = ['load_csv_from_directory', @@ -199,7 +200,8 @@ def load_csv(csvreader, allow_python=True, default_type=DEFAULT_TYPE, "for this file (line: %r)" % row) if current_headers is None: - current_headers = _parse_headers(row, default_type) + current_headers = _parse_headers(row, default_type, + allow_python=allow_python) continue if row[0] == '[comment]': @@ -225,7 +227,7 @@ def load_csv(csvreader, allow_python=True, default_type=DEFAULT_TYPE, return results -def _parse_headers(header_row, default_type): +def _parse_headers(header_row, default_type, allow_python=True): headers = [] for name in header_row: original_name = name @@ -359,7 +361,7 @@ def parse_bool(v): elif v in ('n', 'no', 'f', 'false', 'off', '0'): return False raise ValueError( - "Value is not boolean-like: %r" % value) + "Value is not boolean-like: %r" % v) register_coercer('bool', parse_bool) register_coercer('boolean', parse_bool) diff --git a/sqlobject/util/moduleloader.py b/sqlobject/util/moduleloader.py index 5de7c19..bbb8d0c 100644 --- a/sqlobject/util/moduleloader.py +++ b/sqlobject/util/moduleloader.py @@ -1,5 +1,6 @@ -import sys import imp +import os +import sys ... 25 lines suppressed ... hooks/post-receive -- SQLObject development repository |