sqlobject-cvs Mailing List for SQLObject (Page 15)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
| 2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
| 2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
| 2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
| 2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
| 2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
| 2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
| 2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
| 2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
| 2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
| 2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
| 2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
| 2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
| 2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
| 2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
| 2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
|
From: Oleg B. <no...@so...> - 2015-02-17 01:23:47
|
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 1d2c30814029c967ecf0727d87b3c177cbf76375 (commit)
from 894a92f5b1eda6e2aad174ac34b24971ffdd3008 (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/1d2c30814029c967ecf0727d87b3c177cbf76375
commit 1d2c30814029c967ecf0727d87b3c177cbf76375
Author: Oleg Broytman <ph...@ph...>
Date: Tue Feb 17 04:22:31 2015 +0300
Add Lukasz Dobrzanski as a contributor
diff --git a/docs/Authors.txt b/docs/Authors.txt
index b7755e9..51f7035 100644
--- a/docs/Authors.txt
+++ b/docs/Authors.txt
@@ -30,6 +30,7 @@ Contributions have been made by:
* Andrew Ziem <ahz001 at gmail.com>
* Andrew Trusty <atrusty at gatech.edu>
* Ian Cordasco <graffatcolmingov at gmail.com>
+* Lukasz Dobrzanski <lukasz.m.dobrzanski at gmail.com>
* Oleg Broytman <ph...@ph...>
.. image:: http://sflogo.sourceforge.net/sflogo.php?group_id=74338&type=10
-----------------------------------------------------------------------
Summary of changes:
docs/Authors.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-16 16:34:57
|
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 894a92f5b1eda6e2aad174ac34b24971ffdd3008 (commit)
via ff7d207b77a6d9dbab1f7076574b978564dd25c7 (commit)
via eb878a622e05d0c703d5433c2ddf18a4799cb680 (commit)
via 4414ff1f2b1d142dfb3115b2f3336e2ebe7b4aa9 (commit)
via fbd179e40cd4c293a604b7830a320aa8e1af5bf1 (commit)
via 7e955f802a8c426894790df3534130b423ef61ba (commit)
via aafa59cac20f6686859e11b85cc14eb0213b44f9 (commit)
via 056fd5398af45742abee0d419c8687d76c443569 (commit)
via c962c5ea401c74343becc23ad0842c3918ec7414 (commit)
via 85cc5fe77c7dc412b2a4ed5bc7dcda51ea37cb97 (commit)
via 4513d2e88d0527665f6b49ab66ea30a27e7c2040 (commit)
via 9e74a80a3abfa69fffae00bea644f2d5b239be00 (commit)
via 71df75e74879b273fd861afd39e030d618baeb57 (commit)
via d5612ab75b6556f7f041eb31c2541acf649ff7a4 (commit)
from fce408b71883cfbafada9c38c3c07328384357ec (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/894a92f5b1eda6e2aad174ac34b24971ffdd3008
commit 894a92f5b1eda6e2aad174ac34b24971ffdd3008
Merge: ff7d207 fbd179e
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 19:33:19 2015 +0300
Merge pull request #84 from drnlm/py3k_fixes
Py3k fixes
http://sourceforge.net/p/sqlobject/sqlobject/ci/ff7d207b77a6d9dbab1f7076574b978564dd25c7
commit ff7d207b77a6d9dbab1f7076574b978564dd25c7
Merge: fce408b eb878a6
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 19:31:18 2015 +0300
Merge pull request #83 from drnlm/fix_lookupConvertor
Change lookupConverter to handle python 3 behaviour
http://sourceforge.net/p/sqlobject/sqlobject/ci/eb878a622e05d0c703d5433c2ddf18a4799cb680
commit eb878a622e05d0c703d5433c2ddf18a4799cb680
Author: Neil <drn...@gm...>
Date: Mon Feb 16 16:47:35 2015 +0200
Expand upon clarifying comment
diff --git a/sqlobject/converters.py b/sqlobject/converters.py
index 64983fe..87879f2 100644
--- a/sqlobject/converters.py
+++ b/sqlobject/converters.py
@@ -65,7 +65,7 @@ class ConverterRegistry:
else:
def lookupConverter(self, value, default=None):
# python 3 doesn't have classic classes, so everything's
- # in self.klass
+ # in self.klass due to comparison order in registerConvertor
return self.klass.get(value.__class__, default)
converters = ConverterRegistry()
http://sourceforge.net/p/sqlobject/sqlobject/ci/4414ff1f2b1d142dfb3115b2f3336e2ebe7b4aa9
commit 4414ff1f2b1d142dfb3115b2f3336e2ebe7b4aa9
Author: Neil <drn...@gm...>
Date: Mon Feb 16 16:46:42 2015 +0200
Move version check out of lookupConvertor method
diff --git a/sqlobject/converters.py b/sqlobject/converters.py
index 045f79c..64983fe 100644
--- a/sqlobject/converters.py
+++ b/sqlobject/converters.py
@@ -56,13 +56,14 @@ class ConverterRegistry:
else:
self.basic[typ] = func
- def lookupConverter(self, value, default=None):
- if sys.version_info[0] < 3:
+ if sys.version_info[0] < 3:
+ def lookupConverter(self, value, default=None):
if type(value) is InstanceType:
# lookup on klasses dict
return self.klass.get(value.__class__, default)
return self.basic.get(type(value), default)
- else:
+ else:
+ def lookupConverter(self, value, default=None):
# python 3 doesn't have classic classes, so everything's
# in self.klass
return self.klass.get(value.__class__, default)
http://sourceforge.net/p/sqlobject/sqlobject/ci/fbd179e40cd4c293a604b7830a320aa8e1af5bf1
commit fbd179e40cd4c293a604b7830a320aa8e1af5bf1
Author: Neil <drn...@gm...>
Date: Wed Feb 11 17:47:22 2015 +0200
Use functools.reduce, for python 3 compatibility
diff --git a/sqlobject/inheritance/__init__.py b/sqlobject/inheritance/__init__.py
index 8d3cf1e..5795458 100644
--- a/sqlobject/inheritance/__init__.py
+++ b/sqlobject/inheritance/__init__.py
@@ -1,3 +1,5 @@
+from functools import reduce
+
from sqlobject import dbconnection
from sqlobject import classregistry
from sqlobject import events
http://sourceforge.net/p/sqlobject/sqlobject/ci/7e955f802a8c426894790df3534130b423ef61ba
commit 7e955f802a8c426894790df3534130b423ef61ba
Author: Neil <drn...@gm...>
Date: Wed Feb 11 17:49:19 2015 +0200
Use next builtin
diff --git a/sqlobject/tests/test_basic.py b/sqlobject/tests/test_basic.py
index 2e7c775..01878f4 100644
--- a/sqlobject/tests/test_basic.py
+++ b/sqlobject/tests/test_basic.py
@@ -237,7 +237,7 @@ def testForeignKeyDropTableCascade():
tc6b.destroySelf()
assert TestSO5.select().count() == 1
assert TestSO6.select().count() == 0
- assert iter(TestSO5.select()).next() == tc5b
+ assert next(iter(TestSO5.select())) == tc5b
tc6c = TestSO6(name='3')
tc5b.other = tc6c
assert TestSO5.select().count() == 1
http://sourceforge.net/p/sqlobject/sqlobject/ci/aafa59cac20f6686859e11b85cc14eb0213b44f9
commit aafa59cac20f6686859e11b85cc14eb0213b44f9
Author: Neil <drn...@gm...>
Date: Thu Feb 12 17:35:57 2015 +0200
Guard against comparison with None
diff --git a/sqlobject/col.py b/sqlobject/col.py
index 7c3df4e..8cbf04b 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -697,7 +697,7 @@ class SOIntCol(SOCol):
if str is None or len(str) < 1:
return None
- if self.length >= 1:
+ if self.length and self.length >= 1:
_ret = "%s(%d)" % (_ret, self.length)
if self.unsigned:
_ret = _ret + " UNSIGNED"
http://sourceforge.net/p/sqlobject/sqlobject/ci/056fd5398af45742abee0d419c8687d76c443569
commit 056fd5398af45742abee0d419c8687d76c443569
Author: Neil <drn...@gm...>
Date: Thu Feb 12 17:59:42 2015 +0200
Use args to get exception details
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index 1710143..a0c347b 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -18,7 +18,7 @@ sqlite2_Binary = None
class ErrorMessage(str):
def __new__(cls, e):
- obj = str.__new__(cls, e[0])
+ obj = str.__new__(cls, e.args[0])
obj.code = None
obj.module = e.__module__
obj.exception = e.__class__.__name__
http://sourceforge.net/p/sqlobject/sqlobject/ci/c962c5ea401c74343becc23ad0842c3918ec7414
commit c962c5ea401c74343becc23ad0842c3918ec7414
Author: Neil <drn...@gm...>
Date: Thu Feb 12 18:17:12 2015 +0200
Support python 3 iter interface
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index 19e14d7..57ca294 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -750,6 +750,9 @@ class Iteration(object):
def __iter__(self):
return self
+ def __next__(self):
+ return self.next()
+
def next(self):
result = self.cursor.fetchone()
if result is None:
http://sourceforge.net/p/sqlobject/sqlobject/ci/85cc5fe77c7dc412b2a4ed5bc7dcda51ea37cb97
commit 85cc5fe77c7dc412b2a4ed5bc7dcda51ea37cb97
Author: Neil <drn...@gm...>
Date: Thu Feb 12 18:09:57 2015 +0200
Ensure we have a list for slice tests in python 3
diff --git a/sqlobject/tests/test_slice.py b/sqlobject/tests/test_slice.py
index c612534..5e756e1 100644
--- a/sqlobject/tests/test_slice.py
+++ b/sqlobject/tests/test_slice.py
@@ -8,6 +8,11 @@ from sqlobject.tests.dbtest import *
########################################
+def listrange(*args):
+ """Always return a list, for py3k compatibility"""
+ return list(range(*args))
+
+
class Counter(SQLObject):
number = IntCol(notNull=True)
@@ -27,28 +32,28 @@ class TestSlice:
def test_slice(self):
self.counterEqual(
- Counter.select(None, orderBy='number'), range(100))
+ Counter.select(None, orderBy='number'), listrange(100))
self.counterEqual(
Counter.select(None, orderBy='number')[10:20],
- range(10, 20))
+ listrange(10, 20))
self.counterEqual(
Counter.select(None, orderBy='number')[20:30][:5],
- range(20, 25))
+ listrange(20, 25))
self.counterEqual(
Counter.select(None, orderBy='number')[20:30][1:5],
- range(21, 25))
+ listrange(21, 25))
self.counterEqual(
Counter.select(None, orderBy='number')[:-10],
- range(0, 90))
+ listrange(0, 90))
self.counterEqual(
Counter.select(None, orderBy='number', reversed=True),
- range(99, -1, -1))
+ listrange(99, -1, -1))
self.counterEqual(
Counter.select(None, orderBy='-number'),
- range(99, -1, -1))
+ listrange(99, -1, -1))
http://sourceforge.net/p/sqlobject/sqlobject/ci/4513d2e88d0527665f6b49ab66ea30a27e7c2040
commit 4513d2e88d0527665f6b49ab66ea30a27e7c2040
Author: Neil <drn...@gm...>
Date: Thu Feb 12 18:09:41 2015 +0200
drop xrange
diff --git a/sqlobject/cache.py b/sqlobject/cache.py
index 111b5a3..ba6361d 100644
--- a/sqlobject/cache.py
+++ b/sqlobject/cache.py
@@ -195,7 +195,7 @@ class CacheFactory(object):
self.expiredCache.pop(key, None)
keys = self.cache.keys()
- for i in xrange(self.cullOffset, len(keys), self.cullFraction):
+ for i in range(self.cullOffset, len(keys), self.cullFraction):
id = keys[i]
# create a weakref, then remove from the cache
obj = ref(self.cache[id])
diff --git a/sqlobject/main.py b/sqlobject/main.py
index fabd3b4..ecae515 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1426,7 +1426,7 @@ class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)):
cls.__name__, name, repr(value)))
else:
names = []
- for i in xrange(len(name)):
+ for i in range(len(name)):
names.append("%s = %s" % (name[i], repr(value[i])))
names = ', '.join(names)
raise SQLObjectNotFound(
http://sourceforge.net/p/sqlobject/sqlobject/ci/9e74a80a3abfa69fffae00bea644f2d5b239be00
commit 9e74a80a3abfa69fffae00bea644f2d5b239be00
Author: Neil <drn...@gm...>
Date: Wed Feb 11 17:46:24 2015 +0200
Use codecs.encode for rot13 encoding, to be compatible with python 3
diff --git a/sqlobject/tests/test_basic.py b/sqlobject/tests/test_basic.py
index a481708..2e7c775 100644
--- a/sqlobject/tests/test_basic.py
+++ b/sqlobject/tests/test_basic.py
@@ -1,6 +1,7 @@
import py.test
from sqlobject import *
from sqlobject.tests.dbtest import *
+import codecs
class TestSO1(SQLObject):
@@ -14,7 +15,7 @@ class TestSO1(SQLObject):
cacheValues = False
def _set_passwd(self, passwd):
- self._SO_set_passwd(passwd.encode('rot13'))
+ self._SO_set_passwd(codecs.encode(passwd, 'rot13'))
def setupGetters(cls):
@@ -28,7 +29,7 @@ def test_case1():
setupGetters(TestSO1)
bob = TestSO1.selectBy(name='bob')[0]
assert bob.name == 'bob'
- assert bob.passwd == 'god'.encode('rot13')
+ assert bob.passwd == codecs.encode('god', 'rot13')
bobs = TestSO1.selectBy(name='bob')[:10]
assert len(list(bobs)) == 1
@@ -73,14 +74,14 @@ class TestSO2(SQLObject):
passwd = StringCol(length=10)
def _set_passwd(self, passwd):
- self._SO_set_passwd(passwd.encode('rot13'))
+ self._SO_set_passwd(codecs.encode(passwd, 'rot13'))
def test_case2():
setupGetters(TestSO2)
bob = TestSO2.selectBy(name='bob')[0]
assert bob.name == 'bob'
- assert bob.passwd == 'god'.encode('rot13')
+ assert bob.passwd == codecs.encode('god', 'rot13')
class Student(SQLObject):
http://sourceforge.net/p/sqlobject/sqlobject/ci/71df75e74879b273fd861afd39e030d618baeb57
commit 71df75e74879b273fd861afd39e030d618baeb57
Author: Neil <drn...@gm...>
Date: Fri Feb 13 12:07:57 2015 +0200
python 3 keys don't have a sort method
diff --git a/sqlobject/classregistry.py b/sqlobject/classregistry.py
index 132afef..07e5abf 100644
--- a/sqlobject/classregistry.py
+++ b/sqlobject/classregistry.py
@@ -103,8 +103,7 @@ class ClassRegistry(object):
try:
return self.classes[className]
except KeyError:
- all = self.classes.keys()
- all.sort()
+ all = sorted(self.classes.keys())
raise KeyError(
"No class %s found in the registry %s (these classes "
"exist: %s)"
diff --git a/sqlobject/inheritance/tests/test_asdict.py b/sqlobject/inheritance/tests/test_asdict.py
index 6e37d03..e88ac67 100644
--- a/sqlobject/inheritance/tests/test_asdict.py
+++ b/sqlobject/inheritance/tests/test_asdict.py
@@ -28,8 +28,7 @@ def test_getColumns():
(InheritablePersonAD, ['firstName', 'lastName']),
(ManagerAD, ['department', 'firstName', 'lastName']),
(EmployeeAD, ['firstName', 'lastName', 'position'])):
- _columns = klass.sqlmeta.getColumns().keys()
- _columns.sort()
+ _columns = sorted(klass.sqlmeta.getColumns().keys())
assert _columns == columns
http://sourceforge.net/p/sqlobject/sqlobject/ci/d5612ab75b6556f7f041eb31c2541acf649ff7a4
commit d5612ab75b6556f7f041eb31c2541acf649ff7a4
Author: Neil <drn...@gm...>
Date: Thu Feb 12 17:40:01 2015 +0200
Change lookupConverter to handle python 3 behaviour
diff --git a/sqlobject/converters.py b/sqlobject/converters.py
index 35cfcdc..045f79c 100644
--- a/sqlobject/converters.py
+++ b/sqlobject/converters.py
@@ -57,10 +57,15 @@ class ConverterRegistry:
self.basic[typ] = func
def lookupConverter(self, value, default=None):
- if type(value) is InstanceType:
- # lookup on klasses dict
+ if sys.version_info[0] < 3:
+ if type(value) is InstanceType:
+ # lookup on klasses dict
+ return self.klass.get(value.__class__, default)
+ return self.basic.get(type(value), default)
+ else:
+ # python 3 doesn't have classic classes, so everything's
+ # in self.klass
return self.klass.get(value.__class__, default)
- return self.basic.get(type(value), default)
converters = ConverterRegistry()
registerConverter = converters.registerConverter
-----------------------------------------------------------------------
Summary of changes:
sqlobject/cache.py | 2 +-
sqlobject/classregistry.py | 3 +--
sqlobject/col.py | 2 +-
sqlobject/converters.py | 14 ++++++++++----
sqlobject/dbconnection.py | 3 +++
sqlobject/inheritance/__init__.py | 2 ++
sqlobject/inheritance/tests/test_asdict.py | 3 +--
sqlobject/main.py | 2 +-
sqlobject/sqlite/sqliteconnection.py | 2 +-
sqlobject/tests/test_basic.py | 11 ++++++-----
sqlobject/tests/test_slice.py | 19 ++++++++++++-------
11 files changed, 39 insertions(+), 24 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-15 22:36:43
|
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 fce408b71883cfbafada9c38c3c07328384357ec (commit)
via 7d74887a148f8d0ce180bd225fa5cc0b75fddae4 (commit)
via a5c1389a31e30ee9f0d545a694d63f3093de14ed (commit)
from fb15acc6f07eb639a4dd2be03f080ade895994da (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/fce408b71883cfbafada9c38c3c07328384357ec
commit fce408b71883cfbafada9c38c3c07328384357ec
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 01:35:47 2015 +0300
Fixed URLs
diff --git a/sqlobject/compat.py b/sqlobject/compat.py
index 261b364..8828235 100644
--- a/sqlobject/compat.py
+++ b/sqlobject/compat.py
@@ -1,5 +1,5 @@
-# Credit to six authors http://pypi.python.org/pypi/
-# License http://opensource.org/licenses/MIT
+# Credit to six authors: http://pypi.python.org/pypi/six
+# License: MIT
def with_metaclass(meta, *bases):
http://sourceforge.net/p/sqlobject/sqlobject/ci/7d74887a148f8d0ce180bd225fa5cc0b75fddae4
commit 7d74887a148f8d0ce180bd225fa5cc0b75fddae4
Merge: fb15acc a5c1389
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 01:32:25 2015 +0300
Merge pull request #80 from lukmdo/pytest_show_py3_errors
make pytest report py3 issues
http://sourceforge.net/p/sqlobject/sqlobject/ci/a5c1389a31e30ee9f0d545a694d63f3093de14ed
commit a5c1389a31e30ee9f0d545a694d63f3093de14ed
Author: Lukasz Dobrzanski <luk...@gm...>
Date: Sun Feb 15 02:05:55 2015 +0000
make pytest report py3 issues
diff --git a/sqlobject/compat.py b/sqlobject/compat.py
new file mode 100644
index 0000000..261b364
--- /dev/null
+++ b/sqlobject/compat.py
@@ -0,0 +1,14 @@
+# Credit to six authors http://pypi.python.org/pypi/
+# License http://opensource.org/licenses/MIT
+
+
+def with_metaclass(meta, *bases):
+ """Create a base class with a metaclass."""
+ # This requires a bit of explanation: the basic idea is to make a dummy
+ # metaclass for one level of class instantiation that replaces itself with
+ # the actual metaclass.
+
+ class metaclass(meta):
+ def __new__(cls, name, this_bases, d):
+ return meta(name, bases, d)
+ return type.__new__(metaclass, 'temporary_class', (), {})
diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py
index bc3485a..73373ef 100644
--- a/sqlobject/declarative.py
+++ b/sqlobject/declarative.py
@@ -34,6 +34,7 @@ or an instance method depending on where it is called.
import copy
from . import events
+from sqlobject.compat import with_metaclass
import itertools
counter = itertools.count()
@@ -90,21 +91,22 @@ class DeclarativeMeta(type):
for func in early_funcs:
func(cls)
if '__classinit__' in new_attrs:
- cls.__classinit__ = staticmethod(cls.__classinit__.im_func)
+ if hasattr(cls.__classinit__, '__func__'):
+ cls.__classinit__ = staticmethod(cls.__classinit__.__func__)
+ else:
+ cls.__classinit__ = staticmethod(cls.__classinit__)
cls.__classinit__(cls, new_attrs)
for func in post_funcs:
func(cls)
return cls
-class Declarative(object):
+class Declarative(with_metaclass(DeclarativeMeta, object)):
__unpackargs__ = ()
__mutableattributes__ = ()
- __metaclass__ = DeclarativeMeta
-
__restrict_attributes__ = None
def __classinit__(cls, new_attrs):
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 5812b29..8cdcd22 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -25,7 +25,7 @@ License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
USA.
"""
-
+import sys
import threading
import weakref
import types
@@ -41,8 +41,8 @@ from . import declarative
from . import events
from .sresults import SelectResults
from .util.threadinglocal import local
+from sqlobject.compat import with_metaclass
-import sys
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+")
@@ -50,6 +50,7 @@ if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \
if sys.version_info[0] > 2:
# alias for python 3 compatability
long = int
+ unicode = str
"""
This thread-local storage is needed for RowCreatedSignals. It gathers
@@ -180,8 +181,7 @@ class CreateNewSQLObject:
pass
-class sqlmeta(object):
-
+class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)):
"""
This object is the object we use to keep track of all sorts of
information. Subclasses are made for each SQLObject subclass
@@ -254,8 +254,6 @@ class sqlmeta(object):
# Default encoding for UnicodeCol's
dbEncoding = None
- __metaclass__ = declarative.DeclarativeMeta
-
def __classinit__(cls, new_attrs):
for attr in cls._unshared_attributes:
if attr not in new_attrs:
@@ -757,9 +755,7 @@ _postponed_local = local()
# MetaSQLObject.
-class SQLObject(object):
-
- __metaclass__ = declarative.DeclarativeMeta
+class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)):
_connection = sqlhub
@@ -902,7 +898,7 @@ class SQLObject(object):
"(while fixing up sqlmeta %r inheritance)"
% cls.sqlmeta)
values = dict(cls.sqlmeta.__dict__)
- for key in values.keys():
+ for key in list(values.keys()):
if key.startswith('__') and key.endswith('__'):
# Magic values shouldn't be passed through:
del values[key]
@@ -1355,7 +1351,8 @@ class SQLObject(object):
# These are all the column values that were supposed
# to be set, but were delayed until now:
setters = self._SO_createValues.items()
- setters.sort(key=lambda c: self.sqlmeta.columns[c[0]].creationOrder)
+ setters = sorted(
+ setters, key=lambda c: self.sqlmeta.columns[c[0]].creationOrder)
# Here's their database names:
names = [self.sqlmeta.columns[v[0]].dbName for v in setters]
values = [v[1] for v in setters]
@@ -1734,7 +1731,7 @@ class SQLObject(object):
@classmethod
def setConnection(cls, value):
- if isinstance(value, basestring):
+ if isinstance(value, (str, unicode)):
value = dbconnection.connectionForURI(value)
cls._connection = value
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 214c72d..0cabf56 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -20,6 +20,7 @@ from sqlobject import col
from sqlobject.classregistry import findClass
from sqlobject.declarative import DeclarativeMeta
from sqlobject.util import moduleloader
+from sqlobject.compat import with_metaclass
# It's not very unsafe to use tempnam like we are doing:
warnings.filterwarnings(
@@ -179,9 +180,7 @@ def standard_parser(connection=True, simulate=True,
return parser
-class Command(object):
-
- __metaclass__ = DeclarativeMeta
+class Command(with_metaclass(DeclarativeMeta, object)):
min_args = 0
min_args_error = 'You must provide at least %(min_args)s arguments'
diff --git a/sqlobject/tests/test_boundattributes.py b/sqlobject/tests/test_boundattributes.py
index 1ca9fab..a3c5f8f 100644
--- a/sqlobject/tests/test_boundattributes.py
+++ b/sqlobject/tests/test_boundattributes.py
@@ -6,9 +6,6 @@ pytestmark = py.test.mark.skipif('True')
class TestMe(object):
-
- # __metaclass__ = declarative.DeclarativeMeta
- # __classinit__ = boundattributes.bind_attributes_local
pass
diff --git a/sqlobject/tests/test_reparent_sqlmeta.py b/sqlobject/tests/test_reparent_sqlmeta.py
index 3244ad9..8b61dee 100644
--- a/sqlobject/tests/test_reparent_sqlmeta.py
+++ b/sqlobject/tests/test_reparent_sqlmeta.py
@@ -19,7 +19,7 @@ class Reparented2(SQLObject):
# Well, it's pretty hard to call the superclass method
# when it's a classmethod and it's not actually your
# *current* superclass. Sigh
- real_sqlmeta.setClass.im_func(cls, soClass)
+ real_sqlmeta.setClass.__func__(cls, soClass)
cls.worked = True
dummy = StringCol()
-----------------------------------------------------------------------
Summary of changes:
sqlobject/compat.py | 14 ++++++++++++++
sqlobject/declarative.py | 10 ++++++----
sqlobject/main.py | 21 +++++++++------------
sqlobject/manager/command.py | 5 ++---
sqlobject/tests/test_reparent_sqlmeta.py | 2 +-
5 files changed, 32 insertions(+), 20 deletions(-)
create mode 100644 sqlobject/compat.py
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-15 22:24:19
|
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 fb15acc6f07eb639a4dd2be03f080ade895994da (commit)
from 3c762203f2dfb80df26876ec06a5ddb3efa11620 (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/fb15acc6f07eb639a4dd2be03f080ade895994da
commit fb15acc6f07eb639a4dd2be03f080ade895994da
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 01:21:38 2015 +0300
Fix flake8 W503 line break before binary operator
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index 54b9ac2..19e14d7 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -618,8 +618,9 @@ class DBAPI(DBConnection):
def _SO_selectOneAlt(self, so, columnNames, condition):
if columnNames:
- columns = [isinstance(x, basestring) and sqlbuilder.SQLConstant(x)
- or x for x in columnNames]
+ columns = [isinstance(x, basestring) and
+ sqlbuilder.SQLConstant(x) or
+ x for x in columnNames]
else:
columns = None
return self.queryOne(self.sqlrepr(sqlbuilder.Select(
@@ -1040,8 +1041,8 @@ class ConnectionURIOpener(object):
def registerConnectionInstance(self, inst):
if inst.name:
- assert (inst.name not in self.instanceNames
- or self.instanceNames[inst.name] is cls # noqa
+ assert (inst.name not 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, \
diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py
index bc3485a..9d25445 100644
--- a/sqlobject/declarative.py
+++ b/sqlobject/declarative.py
@@ -197,8 +197,8 @@ class Declarative(object):
@staticmethod
def _repr_vars(dictNames):
names = [n for n in dictNames
- if not n.startswith('_')
- and n != 'declarative_count']
+ if not n.startswith('_') and
+ n != 'declarative_count']
names.sort()
return names
diff --git a/sqlobject/joins.py b/sqlobject/joins.py
index 403e4b5..17ae613 100644
--- a/sqlobject/joins.py
+++ b/sqlobject/joins.py
@@ -420,18 +420,18 @@ class SOManyToMany(object):
self.otherClass, events.CreateTableSignal)
self.clause = (
(self.otherClass.q.id ==
- sqlbuilder.Field(self.intermediateTable, self.otherColumn))
- & (sqlbuilder.Field(self.intermediateTable, self.joinColumn)
- == self.soClass.q.id))
+ sqlbuilder.Field(self.intermediateTable, self.otherColumn)) &
+ (sqlbuilder.Field(self.intermediateTable, self.joinColumn) ==
+ self.soClass.q.id))
def __get__(self, obj, type):
if obj is None:
return self
query = (
(self.otherClass.q.id ==
- sqlbuilder.Field(self.intermediateTable, self.otherColumn))
- & (sqlbuilder.Field(self.intermediateTable, self.joinColumn)
- == obj.id))
+ sqlbuilder.Field(self.intermediateTable, self.otherColumn)) &
+ (sqlbuilder.Field(self.intermediateTable, self.joinColumn) ==
+ obj.id))
select = self.otherClass.select(query)
return _ManyToManySelectWrapper(obj, self, select)
@@ -524,15 +524,15 @@ class SOOneToMany(object):
self.joinColumn = styles.getStyle(
self.soClass).tableReference(self.soClass.sqlmeta.table)
self.clause = (
- sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn)
- == self.soClass.q.id)
+ sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn) ==
+ self.soClass.q.id)
def __get__(self, obj, type):
if obj is None:
return self
query = (
- sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn)
- == obj.id)
+ sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn) ==
+ obj.id)
select = self.otherClass.select(query)
return _OneToManySelectWrapper(obj, self, select)
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 52d9363..f0174e4 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -440,8 +440,8 @@ class Command(object):
for section in p.sections():
name = section.strip().lower()
if (conf_section == name or
- (conf_section == name.split(':')[-1]
- and name.split(':')[0] in ('app', 'application'))):
+ (conf_section == name.split(':')[-1] and
+ name.split(':')[0] in ('app', 'application'))):
possible_sections.append(section)
if not possible_sections:
@@ -966,8 +966,7 @@ class CommandRecord(Command):
dbName = cls._connection.dbName
if cls._connection not in conns:
conns.append(cls._connection)
- fn = os.path.join(cls.__name__
- + '_' + dbName + '.sql')
+ fn = os.path.join(cls.__name__ + '_' + dbName + '.sql')
if sim:
continue
create, constraints = cls.createTableSQL()
@@ -1058,8 +1057,8 @@ class CommandRecord(Command):
print("Cannot edit upgrader because there is no "
"previous version")
else:
- breaker = ('-' * 20 + ' lines below this will be ignored '
- + '-' * 20)
+ breaker = ('-' * 20 + ' lines below this will be ignored ' +
+ '-' * 20)
pre_text = breaker + '\n' + '\n'.join(all_diffs)
text = self.open_editor('\n\n' + pre_text, breaker=breaker,
extension='.sql')
diff --git a/sqlobject/sresults.py b/sqlobject/sresults.py
index fd3e0dd..5660606 100644
--- a/sqlobject/sresults.py
+++ b/sqlobject/sresults.py
@@ -213,8 +213,8 @@ class SelectResults(object):
""" Counting elements of current select results """
assert not self.ops.get('start') and not self.ops.get('end'), \
"start/end/limit have no meaning with 'count'"
- assert not (self.ops.get('distinct') and (self.ops.get('start')
- or self.ops.get('end'))), \
+ assert not (self.ops.get('distinct') and
+ (self.ops.get('start') or self.ops.get('end'))), \
"distinct-counting of sliced objects is not supported"
if self.ops.get('distinct'):
# Column must be specified, so we are using unique ID column.
diff --git a/sqlobject/tests/test_auto.py b/sqlobject/tests/test_auto.py
index a00f8fb..c6d5fec 100644
--- a/sqlobject/tests/test_auto.py
+++ b/sqlobject/tests/test_auto.py
@@ -47,8 +47,8 @@ class TestPeople:
nickname = StringCol('nickname', length=10)
Person.sqlmeta.addColumn(nickname, changeSchema=True)
Person(name='robert', nickname='bob')
- assert ([p.name for p in Person.select('all')]
- == ['bob', 'jake', 'jane', 'robert', 'tim'])
+ assert ([p.name for p in Person.select('all')] ==
+ ['bob', 'jake', 'jane', 'robert', 'tim'])
Person.sqlmeta.delColumn(nickname, changeSchema=True)
def test_dynamicJoin(self):
diff --git a/sqlobject/tests/test_joins.py b/sqlobject/tests/test_joins.py
index 63fa306..c570b2f 100644
--- a/sqlobject/tests/test_joins.py
+++ b/sqlobject/tests/test_joins.py
@@ -110,8 +110,8 @@ class TestJoin2:
def test_defaultOrder(self):
p1 = PersonJoiner2.byName('bob')
- assert ([i.zip for i in p1.addressJoiner2s]
- == ['33333', '22222', '11111'])
+ assert ([i.zip for i in p1.addressJoiner2s] ==
+ ['33333', '22222', '11111'])
_personJoiner3_getters = []
diff --git a/sqlobject/tests/test_new_joins.py b/sqlobject/tests/test_new_joins.py
index 10f108d..c325eb7 100644
--- a/sqlobject/tests/test_new_joins.py
+++ b/sqlobject/tests/test_new_joins.py
@@ -116,8 +116,8 @@ class TestJoin2:
def test_defaultOrder(self):
p1 = PersonJoinerNew2.byName('bob')
- assert ([i.zip for i in p1.addressJoiner2s]
- == ['33333', '22222', '11111'])
+ assert ([i.zip for i in p1.addressJoiner2s] ==
+ ['33333', '22222', '11111'])
_personJoiner3_getters = []
diff --git a/sqlobject/tests/test_transactions.py b/sqlobject/tests/test_transactions.py
index 171d5ee..124ff8b 100644
--- a/sqlobject/tests/test_transactions.py
+++ b/sqlobject/tests/test_transactions.py
@@ -26,8 +26,8 @@ def test_transaction():
TestSOTrans(name='joe', connection=trans)
trans.rollback()
trans.begin()
- assert ([n.name for n in TestSOTrans.select(connection=trans)]
- == ['bob', 'tim'])
+ assert ([n.name for n in TestSOTrans.select(connection=trans)] ==
+ ['bob', 'tim'])
b = TestSOTrans.byName('bob', connection=trans)
b.name = 'robert'
trans.commit()
diff --git a/sqlobject/util/csvimport.py b/sqlobject/util/csvimport.py
index 79ef985..ba0fa0d 100644
--- a/sqlobject/util/csvimport.py
+++ b/sqlobject/util/csvimport.py
@@ -88,8 +88,8 @@ def create_data(data, class_getter, keyorder=None):
"""
objects = {}
classnames = data.keys()
- if (not keyorder and isinstance(class_getter, types.ModuleType)
- and hasattr(class_getter, 'soClasses')):
+ if (not keyorder and isinstance(class_getter, types.ModuleType) and
+ hasattr(class_getter, 'soClasses')):
keyorder = [c.__name__ for c in class_getter.soClasses]
if not keyorder:
classnames.sort()
@@ -117,8 +117,7 @@ def create_data(data, class_getter, keyorder=None):
raise ValueError(
"Object reference to %r does not have target"
% value.name)
- elif (isinstance(resolved, list)
- and len(resolved) > 1):
+ elif (isinstance(resolved, list) and len(resolved) > 1):
raise ValueError(
"Object reference to %r is ambiguous (got %r)"
% (value.name, resolved))
-----------------------------------------------------------------------
Summary of changes:
sqlobject/dbconnection.py | 9 +++++----
sqlobject/declarative.py | 4 ++--
sqlobject/joins.py | 20 ++++++++++----------
sqlobject/manager/command.py | 11 +++++------
sqlobject/sresults.py | 4 ++--
sqlobject/tests/test_auto.py | 4 ++--
sqlobject/tests/test_joins.py | 4 ++--
sqlobject/tests/test_new_joins.py | 4 ++--
sqlobject/tests/test_transactions.py | 4 ++--
sqlobject/util/csvimport.py | 7 +++----
10 files changed, 35 insertions(+), 36 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-15 22:10:53
|
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 3c762203f2dfb80df26876ec06a5ddb3efa11620 (commit)
from 430a2fe7344f2a4a9e9741c96abfb77fc7cfe5a3 (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/3c762203f2dfb80df26876ec06a5ddb3efa11620
commit 3c762203f2dfb80df26876ec06a5ddb3efa11620
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 01:09:41 2015 +0300
Require sources to be flake8-clean at least for py2.7
diff --git a/.travis.yml b/.travis.yml
index 6cf7e62..900ca4f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,7 +17,6 @@ matrix:
fast_finish: true
allow_failures:
- env: TOXENV=py34-sqlite
- - env: TOXENV=py27-flake8
- env: TOXENV=py34-flake8
script: tox -e ${TOXENV}
diff --git a/docs/DeveloperGuide.txt b/docs/DeveloperGuide.txt
index 0182c99..d788d50 100644
--- a/docs/DeveloperGuide.txt
+++ b/docs/DeveloperGuide.txt
@@ -39,6 +39,12 @@ Python Style Guide. Some things to take particular note of:
.. _PEP 8: http://www.python.org/peps/pep-0008.html
+* With a few exceptions sources must be `flake8`_-clean (and hence
+ pep8-clean). Please consider using pre-commit hook installed by
+ running ``flake8 --install-hook``.
+
+.. _flake8: https://gitlab.com/pycqa/flake8
+
* **No tabs**. Not anywhere. Always indent with 4 spaces.
* I don't stress too much on line length. But try to break lines up
-----------------------------------------------------------------------
Summary of changes:
.travis.yml | 1 -
docs/DeveloperGuide.txt | 6 ++++++
2 files changed, 6 insertions(+), 1 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-15 20:48:00
|
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 430a2fe7344f2a4a9e9741c96abfb77fc7cfe5a3 (commit)
via 6a745636b95344ae6978b522c5de0c6b8aadcabc (commit)
via 7a7216eb77aebaf6aac6567ac723285a90535c50 (commit)
from 46d0d0ae10564e7970afef57813b2e7a3a44b39a (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/430a2fe7344f2a4a9e9741c96abfb77fc7cfe5a3
commit 430a2fe7344f2a4a9e9741c96abfb77fc7cfe5a3
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 23:20:58 2015 +0300
Fix #33 flake8 F402 import 'name' shadowed by loop variable
diff --git a/sqlobject/versioning/__init__.py b/sqlobject/versioning/__init__.py
index eda26cb..dd7566f 100644
--- a/sqlobject/versioning/__init__.py
+++ b/sqlobject/versioning/__init__.py
@@ -1,5 +1,4 @@
from datetime import datetime
-
from sqlobject import col, events, SQLObject, AND
@@ -9,8 +8,8 @@ class Version(SQLObject):
del values['id']
del values['masterID']
del values['dateArchived']
- for col in self.extraCols:
- del values[col]
+ for _col in self.extraCols:
+ del values[_col]
self.masterClass.get(self.masterID).set(**values)
def nextVersion(self):
http://sourceforge.net/p/sqlobject/sqlobject/ci/6a745636b95344ae6978b522c5de0c6b8aadcabc
commit 6a745636b95344ae6978b522c5de0c6b8aadcabc
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 23:19:14 2015 +0300
Fix #12 flake8 E501 line too long
diff --git a/sqlobject/tests/test_sorting.py b/sqlobject/tests/test_sorting.py
index 49b6eab..10626fc 100644
--- a/sqlobject/tests/test_sorting.py
+++ b/sqlobject/tests/test_sorting.py
@@ -75,5 +75,6 @@ def test_singleUntranslatedColumnOrder():
['zoe', 'tim', 'joe', 'joe', 'aj']
assert firstList(Names.select().orderBy(Names.q.firstName).reversed()) == \
['zoe', 'tim', 'joe', 'joe', 'aj']
- assert firstList(Names.select().orderBy(DESC(Names.q.firstName)).reversed()) == \
+ assert firstList(
+ Names.select().orderBy(DESC(Names.q.firstName)).reversed()) == \
['aj', 'joe', 'joe', 'tim', 'zoe']
diff --git a/sqlobject/tests/test_sqlite.py b/sqlobject/tests/test_sqlite.py
index ea5c3f5..ac2de71 100644
--- a/sqlobject/tests/test_sqlite.py
+++ b/sqlobject/tests/test_sqlite.py
@@ -94,7 +94,8 @@ def test_sqlite_aggregate():
SQLiteFactoryTest(name='sqlobject')
SQLiteFactoryTest(name='sqlbuilder')
- assert SQLiteFactoryTest.select(orderBy="name").accumulateOne("group_concat", "name") == \
+ assert SQLiteFactoryTest.select(orderBy="name").\
+ accumulateOne("group_concat", "name") == \
"sqlbuilder, sqlobject"
http://sourceforge.net/p/sqlobject/sqlobject/ci/7a7216eb77aebaf6aac6567ac723285a90535c50
commit 7a7216eb77aebaf6aac6567ac723285a90535c50
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 23:16:40 2015 +0300
Fix flake8 E731 do not assign a lambda expression, use a def
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 7d56464..ad9160f 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -846,7 +846,8 @@ class SQLObject(object):
for i in implicitIndexes:
sqlmeta.addIndex(i)
- order_getter = lambda o: o.creationOrder
+ def order_getter(o):
+ return o.creationOrder
sqlmeta.columnList.sort(key=order_getter)
sqlmeta.indexes.sort(key=order_getter)
sqlmeta.indexDefinitions.sort(key=order_getter)
@@ -1129,9 +1130,14 @@ class SQLObject(object):
# Filter out items that don't map to column names.
# Those will be set directly on the object using
# setattr(obj, name, value).
- is_column = lambda _c: _c in self.sqlmeta._plainSetters
- f_is_column = lambda item: is_column(item[0])
- f_not_column = lambda item: not is_column(item[0])
+ def is_column(_c):
+ return _c in self.sqlmeta._plainSetters
+
+ def f_is_column(item):
+ return is_column(item[0])
+
+ def f_not_column(item):
+ return not is_column(item[0])
items = kw.items()
extra = dict(filter(f_not_column, items))
kw = dict(filter(f_is_column, items))
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index 2beadc9..de028e0 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -798,7 +798,8 @@ class Select(SQLExpression):
if self.ops['reversed']:
reverser = DESC
else:
- reverser = lambda x: x
+ def reverser(x):
+ return x
if isinstance(orderBy, (list, tuple)):
select += " ORDER BY %s" % ", ".join(
[_str_or_sqlrepr(reverser(_x), db) for _x in orderBy])
-----------------------------------------------------------------------
Summary of changes:
sqlobject/main.py | 14 ++++++++++----
sqlobject/sqlbuilder.py | 3 ++-
sqlobject/tests/test_sorting.py | 3 ++-
sqlobject/tests/test_sqlite.py | 3 ++-
sqlobject/versioning/__init__.py | 5 ++---
5 files changed, 18 insertions(+), 10 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-15 13:12:17
|
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 46d0d0ae10564e7970afef57813b2e7a3a44b39a (commit)
via 972ccbf8480472c80a9b03caf81514116ad7df6f (commit)
from 6e78d01d110fecb8502daccac51ea30e17fe86e4 (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/46d0d0ae10564e7970afef57813b2e7a3a44b39a
commit 46d0d0ae10564e7970afef57813b2e7a3a44b39a
Merge: 6e78d01 972ccbf
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 16:11:17 2015 +0300
Merge pull request #82 from lukmdo/fixE131_F403
Fix flake8 E131 (and F403 outside tests)
E131 continuation line unaligned for hanging indent.
F403 'from module import *' used; unable to detect undefined names.
http://sourceforge.net/p/sqlobject/sqlobject/ci/972ccbf8480472c80a9b03caf81514116ad7df6f
commit 972ccbf8480472c80a9b03caf81514116ad7df6f
Author: Lukasz Dobrzanski <luk...@gm...>
Date: Sun Feb 15 12:50:07 2015 +0000
fix E131 (and F403 outside tests)
diff --git a/sqlobject/index.py b/sqlobject/index.py
index ca0fd50..ad676dc 100644
--- a/sqlobject/index.py
+++ b/sqlobject/index.py
@@ -1,5 +1,4 @@
from itertools import count
-from types import *
from .converters import sqlrepr
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 7e20839..52d9363 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -238,8 +238,7 @@ class Command(object):
dependency_stack.append(cls)
raise SQLObjectCircularReferenceError(
"Found a circular reference: %s " %
- (' --> '.join([x.__name__
- for x in dependency_stack])))
+ (' --> '.join([x.__name__ for x in dependency_stack])))
dependency_stack.append(cls)
# Recursively inspect dependent classes.
depended = findReverseDependencies(cls)
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index e09f1ad..c61a38e 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -1,6 +1,6 @@
from sqlobject import col
+from sqlobject import dberrors
from sqlobject.dbconnection import DBAPI
-from sqlobject.dberrors import *
class ErrorMessage(str):
@@ -82,7 +82,7 @@ class MySQLConnection(DBAPI):
conninfo = ("; used connection string: "
"host=%(host)s, port=%(port)s, "
"db=%(db)s, user=%(user)s" % self.__dict__)
- raise OperationalError(ErrorMessage(e, conninfo))
+ raise dberrors.OperationalError(ErrorMessage(e, conninfo))
if hasattr(conn, 'autocommit'):
conn.autocommit(bool(self.autoCommit))
@@ -126,33 +126,33 @@ class MySQLConnection(DBAPI):
if e.args[0] in (self.module.constants.CR.SERVER_GONE_ERROR,
self.module.constants.CR.SERVER_LOST):
if count == 2:
- raise OperationalError(ErrorMessage(e))
+ raise dberrors.OperationalError(ErrorMessage(e))
if self.debug:
self.printDebug(conn, str(e), 'ERROR')
else:
- raise OperationalError(ErrorMessage(e))
+ raise dberrors.OperationalError(ErrorMessage(e))
except self.module.IntegrityError as e:
msg = ErrorMessage(e)
if e.args[0] == self.module.constants.ER.DUP_ENTRY:
- raise DuplicateEntryError(msg)
+ raise dberrors.DuplicateEntryError(msg)
else:
- raise IntegrityError(msg)
+ raise dberrors.IntegrityError(msg)
except self.module.InternalError as e:
- raise InternalError(ErrorMessage(e))
+ raise dberrors.InternalError(ErrorMessage(e))
except self.module.ProgrammingError as e:
- raise ProgrammingError(ErrorMessage(e))
+ raise dberrors.ProgrammingError(ErrorMessage(e))
except self.module.DataError as e:
- raise DataError(ErrorMessage(e))
+ raise dberrors.DataError(ErrorMessage(e))
except self.module.NotSupportedError as e:
- raise NotSupportedError(ErrorMessage(e))
+ raise dberrors.NotSupportedError(ErrorMessage(e))
except self.module.DatabaseError as e:
- raise DatabaseError(ErrorMessage(e))
+ raise dberrors.DatabaseError(ErrorMessage(e))
except self.module.InterfaceError as e:
- raise InterfaceError(ErrorMessage(e))
+ raise dberrors.InterfaceError(ErrorMessage(e))
except self.module.Warning as e:
raise Warning(ErrorMessage(e))
except self.module.Error as e:
- raise Error(ErrorMessage(e))
+ raise dberrors.Error(ErrorMessage(e))
def _queryInsertID(self, conn, soInstance, id, names, values):
table = soInstance.sqlmeta.table
@@ -206,7 +206,7 @@ class MySQLConnection(DBAPI):
# which is not always True (for an embedded application, e.g.)
self.query('DESCRIBE %s' % (tableName))
return True
- except ProgrammingError as e:
+ except dberrors.ProgrammingError as e:
if e[0].code == 1146: # ER_NO_SUCH_TABLE
return False
raise
diff --git a/sqlobject/postgres/pgconnection.py b/sqlobject/postgres/pgconnection.py
index c4f414d..63afa14 100644
--- a/sqlobject/postgres/pgconnection.py
+++ b/sqlobject/postgres/pgconnection.py
@@ -1,9 +1,9 @@
from sqlobject.dbconnection import DBAPI
import re
from sqlobject import col
+from sqlobject import dberrors
from sqlobject import sqlbuilder
from sqlobject.converters import registerConverter
-from sqlobject.dberrors import *
class ErrorMessage(str):
@@ -149,7 +149,7 @@ class PostgresConnection(DBAPI):
else:
conn = self.module.connect(**self.dsn_dict)
except self.module.OperationalError as e:
- raise OperationalError(
+ raise dberrors.OperationalError(
ErrorMessage(e, "used connection string %r" % self.dsn))
# For printDebug in _executeRetry
@@ -172,29 +172,29 @@ class PostgresConnection(DBAPI):
try:
return cursor.execute(query)
except self.module.OperationalError as e:
- raise OperationalError(ErrorMessage(e))
+ raise dberrors.OperationalError(ErrorMessage(e))
except self.module.IntegrityError as e:
msg = ErrorMessage(e)
if e.pgcode == '23505':
- raise DuplicateEntryError(msg)
+ raise dberrors.DuplicateEntryError(msg)
else:
- raise IntegrityError(msg)
+ raise dberrors.IntegrityError(msg)
except self.module.InternalError as e:
- raise InternalError(ErrorMessage(e))
+ raise dberrors.InternalError(ErrorMessage(e))
except self.module.ProgrammingError as e:
- raise ProgrammingError(ErrorMessage(e))
+ raise dberrors.ProgrammingError(ErrorMessage(e))
except self.module.DataError as e:
- raise DataError(ErrorMessage(e))
+ raise dberrors.DataError(ErrorMessage(e))
except self.module.NotSupportedError as e:
- raise NotSupportedError(ErrorMessage(e))
+ raise dberrors.NotSupportedError(ErrorMessage(e))
except self.module.DatabaseError as e:
- raise DatabaseError(ErrorMessage(e))
+ raise dberrors.DatabaseError(ErrorMessage(e))
except self.module.InterfaceError as e:
- raise InterfaceError(ErrorMessage(e))
+ raise dberrors.InterfaceError(ErrorMessage(e))
except self.module.Warning as e:
raise Warning(ErrorMessage(e))
except self.module.Error as e:
- raise Error(ErrorMessage(e))
+ raise dberrors.Error(ErrorMessage(e))
def _queryInsertID(self, conn, soInstance, id, names, values):
table = soInstance.sqlmeta.table
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index f245fa2..1710143 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -8,9 +8,9 @@ try:
from urllib import quote
except ImportError:
from urllib.parse import quote
-from sqlobject.dbconnection import DBAPI, Boolean
from sqlobject import col
-from sqlobject.dberrors import *
+from sqlobject import dberrors
+from sqlobject.dbconnection import DBAPI, Boolean
sqlite2_Binary = None
@@ -219,30 +219,30 @@ class SQLiteConnection(DBAPI):
try:
return cursor.execute(query)
except self.module.OperationalError as e:
- raise OperationalError(ErrorMessage(e))
+ raise dberrors.OperationalError(ErrorMessage(e))
except self.module.IntegrityError as e:
msg = ErrorMessage(e)
if msg.startswith('column') and msg.endswith('not unique') \
or msg.startswith('UNIQUE constraint failed:'):
- raise DuplicateEntryError(msg)
+ raise dberrors.DuplicateEntryError(msg)
else:
- raise IntegrityError(msg)
+ raise dberrors.IntegrityError(msg)
except self.module.InternalError as e:
- raise InternalError(ErrorMessage(e))
+ raise dberrors.InternalError(ErrorMessage(e))
except self.module.ProgrammingError as e:
- raise ProgrammingError(ErrorMessage(e))
+ raise dberrors.ProgrammingError(ErrorMessage(e))
except self.module.DataError as e:
- raise DataError(ErrorMessage(e))
+ raise dberrors.DataError(ErrorMessage(e))
except self.module.NotSupportedError as e:
- raise NotSupportedError(ErrorMessage(e))
+ raise dberrors.NotSupportedError(ErrorMessage(e))
except self.module.DatabaseError as e:
- raise DatabaseError(ErrorMessage(e))
+ raise dberrors.DatabaseError(ErrorMessage(e))
except self.module.InterfaceError as e:
- raise InterfaceError(ErrorMessage(e))
+ raise dberrors.InterfaceError(ErrorMessage(e))
except self.module.Warning as e:
raise Warning(ErrorMessage(e))
except self.module.Error as e:
- raise Error(ErrorMessage(e))
+ raise dberrors.Error(ErrorMessage(e))
def _queryInsertID(self, conn, soInstance, id, names, values):
table = soInstance.sqlmeta.table
diff --git a/sqlobject/versioning/__init__.py b/sqlobject/versioning/__init__.py
index 0770d40..eda26cb 100644
--- a/sqlobject/versioning/__init__.py
+++ b/sqlobject/versioning/__init__.py
@@ -1,6 +1,7 @@
-from sqlobject import *
from datetime import datetime
+from sqlobject import col, events, SQLObject, AND
+
class Version(SQLObject):
def restore(self):
@@ -47,7 +48,7 @@ class Version(SQLObject):
def getColumns(columns, cls):
for column, defi in cls.sqlmeta.columnDefinitions.items():
- if column.endswith("ID") and isinstance(defi, ForeignKey):
+ if column.endswith("ID") and isinstance(defi, col.ForeignKey):
column = column[:-2]
# remove incompatible constraints
@@ -74,8 +75,8 @@ class Versioning(object):
self.name = name
self.soClass = soClass
- attrs = {'dateArchived': DateTimeCol(default=datetime.now),
- 'master': ForeignKey(self.soClass.__name__),
+ attrs = {'dateArchived': col.DateTimeCol(default=datetime.now),
+ 'master': col.ForeignKey(self.soClass.__name__),
'masterClass': self.soClass,
'extraCols': self.extraCols
}
diff --git a/sqlobject/views.py b/sqlobject/views.py
index dddc3a3..1f4f8fa 100644
--- a/sqlobject/views.py
+++ b/sqlobject/views.py
@@ -1,4 +1,4 @@
-from .sqlbuilder import *
+from .sqlbuilder import * # noqa
from .main import SQLObject
-----------------------------------------------------------------------
Summary of changes:
sqlobject/index.py | 1 -
sqlobject/manager/command.py | 3 +--
sqlobject/mysql/mysqlconnection.py | 28 ++++++++++++++--------------
sqlobject/postgres/pgconnection.py | 24 ++++++++++++------------
sqlobject/sqlite/sqliteconnection.py | 24 ++++++++++++------------
sqlobject/versioning/__init__.py | 9 +++++----
sqlobject/views.py | 2 +-
7 files changed, 45 insertions(+), 46 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-15 12:31:07
|
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 6e78d01d110fecb8502daccac51ea30e17fe86e4 (commit)
from f2ea218f366844292e14017a6f68e0f8ab62f8e5 (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/6e78d01d110fecb8502daccac51ea30e17fe86e4
commit 6e78d01d110fecb8502daccac51ea30e17fe86e4
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 15:30:21 2015 +0300
Fixed flake8 F822 undefined name in __all__
diff --git a/setup.cfg b/setup.cfg
index 152719d..3736ba9 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -13,8 +13,7 @@ exclude = .git,docs/europython/*.py,ez_setup.py
; Ignore:
; E401 multiple imports on one line
; F403 'from module import *' used; unable to detect undefined names
-; F822 undefined name in __all__
-ignore = E401,F403,F822
+ignore = E401,F403
[pudge]
theme = pythonpaste.org
-----------------------------------------------------------------------
Summary of changes:
setup.cfg | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-15 12:29:05
|
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 f2ea218f366844292e14017a6f68e0f8ab62f8e5 (commit)
via 098903ad1c6489ecb3fe4207193a091d70f43ab3 (commit)
from 917dbcd7680600f9f308a9fdf8ed1bf81f8eca66 (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/f2ea218f366844292e14017a6f68e0f8ab62f8e5
commit f2ea218f366844292e14017a6f68e0f8ab62f8e5
Merge: 917dbcd 098903a
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 15:27:32 2015 +0300
Merge pull request #81 from lukmdo/fixF822
Fix #52 flake8 F822 undefined name in __all__
http://sourceforge.net/p/sqlobject/sqlobject/ci/098903ad1c6489ecb3fe4207193a091d70f43ab3
commit 098903ad1c6489ecb3fe4207193a091d70f43ab3
Author: Lukasz Dobrzanski <luk...@gm...>
Date: Sun Feb 15 12:05:01 2015 +0000
Fix flake8 F822
`bind_attributes`, `bind_attributes_local` were dropped in 9a1ab01
diff --git a/sqlobject/boundattributes.py b/sqlobject/boundattributes.py
index 221e231..cee0993 100644
--- a/sqlobject/boundattributes.py
+++ b/sqlobject/boundattributes.py
@@ -10,26 +10,13 @@ change the value in the class, it must call ``setattr(added_class,
name, new_value)``.
BoundAttribute is a class that facilitates lazy attribute creation.
-
-``bind_attributes(cls, new_attrs)`` is a function that looks for
-attributes with this special method. ``new_attrs`` is a dictionary,
-as typically passed into ``__classinit__`` with declarative (calling
-``bind_attributes`` in ``__classinit__`` would be typical).
-
-Note if you do this that attributes defined in a superclass will not
-be rebound in subclasses. If you want to rebind attributes in
-subclasses, use ``bind_attributes_local``, which adds a
-``__bound_attributes__`` variable to your class to track these active
-attributes.
"""
-
+from __future__ import absolute_import
from . import declarative
from . import events
-
-__all__ = ['BoundAttribute', 'BoundFactory', 'bind_attributes',
- 'bind_attributes_local']
+__all__ = ['BoundAttribute', 'BoundFactory']
class BoundAttribute(declarative.Declarative):
diff --git a/sqlobject/tests/test_boundattributes.py b/sqlobject/tests/test_boundattributes.py
index 1ca9fab..1651dbd 100644
--- a/sqlobject/tests/test_boundattributes.py
+++ b/sqlobject/tests/test_boundattributes.py
@@ -1,14 +1,12 @@
-from sqlobject import declarative
-from sqlobject import boundattributes
import py.test
+from sqlobject import boundattributes
+from sqlobject import declarative
+
pytestmark = py.test.mark.skipif('True')
class TestMe(object):
-
- # __metaclass__ = declarative.DeclarativeMeta
- # __classinit__ = boundattributes.bind_attributes_local
pass
-----------------------------------------------------------------------
Summary of changes:
sqlobject/boundattributes.py | 17 ++---------------
sqlobject/tests/test_boundattributes.py | 8 +++-----
2 files changed, 5 insertions(+), 20 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-14 21:51:46
|
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 917dbcd7680600f9f308a9fdf8ed1bf81f8eca66 (commit)
via 893d240807ea9dd2093e45ed19b9ddd0c361f6af (commit)
from f89bd3cd9d20ac07d36c966b396a7ca1c8025cff (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/917dbcd7680600f9f308a9fdf8ed1bf81f8eca66
commit 917dbcd7680600f9f308a9fdf8ed1bf81f8eca66
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 00:50:16 2015 +0300
Fix flake8 E123 closing bracket does not match indentation
Closing bracket does not match indentation of opening bracket's line.
diff --git a/setup.py b/setup.py
index 650a0b9..f89bc38 100755
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@ if is_setuptools:
'sybase': ['Sybase'],
'mssql': ['adodbapi'], # or pymssql
'sapdb': ['sapdb'],
- }
+ }
setup(name="SQLObject",
version=version,
diff --git a/sqlobject/boundattributes.py b/sqlobject/boundattributes.py
index a2ba863..221e231 100644
--- a/sqlobject/boundattributes.py
+++ b/sqlobject/boundattributes.py
@@ -58,7 +58,7 @@ class BoundAttribute(declarative.Declarative):
'set_object',
'make_object',
'clone_in_subclass',
- )
+ )
_all_attrs = ()
clone_for_subclass = True
diff --git a/sqlobject/conftest.py b/sqlobject/conftest.py
index d50a6a9..1d9dc26 100644
--- a/sqlobject/conftest.py
+++ b/sqlobject/conftest.py
@@ -29,7 +29,7 @@ connectionShortcuts = {
'firebird':
'firebird://sysdba:masterkey@localhost/var/lib/firebird/data/test.gdb',
'mssql': 'mssql://sa:@127.0.0.1/test'
- }
+}
def pytest_addoption(parser):
diff --git a/sqlobject/firebird/firebirdconnection.py b/sqlobject/firebird/firebirdconnection.py
index 7b74d3d..ba59c3b 100644
--- a/sqlobject/firebird/firebirdconnection.py
+++ b/sqlobject/firebird/firebirdconnection.py
@@ -95,7 +95,7 @@ class FirebirdConnection(DBAPI):
role=self.role,
charset=self.dbEncoding,
**extra
- )
+ )
def _queryInsertID(self, conn, soInstance, id, names, values):
"""Firebird uses 'generators' to create new ids for a table.
diff --git a/sqlobject/joins.py b/sqlobject/joins.py
index c37d606..403e4b5 100644
--- a/sqlobject/joins.py
+++ b/sqlobject/joins.py
@@ -329,9 +329,9 @@ class SOSQLRelatedJoin(SORelatedJoin):
),
TableToId(self.soClass.sqlmeta.table, self.soClass.sqlmeta.idName,
inst.id),
- ), clauseTables=(self.soClass.sqlmeta.table,
- self.otherClass.sqlmeta.table,
- self.intermediateTable),
+ ), clauseTables=(self.soClass.sqlmeta.table,
+ self.otherClass.sqlmeta.table,
+ self.intermediateTable),
connection=conn)
return results.orderBy(self.orderBy)
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index aaec8bd..2beadc9 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -282,7 +282,7 @@ operatorMap = {
">": operator.gt,
"IN": operator.contains,
"IS": operator.eq,
- }
+}
class SQLOp(SQLExpression):
diff --git a/sqlobject/sresults.py b/sqlobject/sresults.py
index ae8e46c..fd3e0dd 100644
--- a/sqlobject/sresults.py
+++ b/sqlobject/sresults.py
@@ -341,7 +341,7 @@ class SelectResults(object):
colName = col.name
query = self.queryForSelect().newItems([
sqlbuilder.ColumnAS(getattr(self.sourceClass.q, colName), colName)
- ]).orderBy(None).distinct()
+ ]).orderBy(None).distinct()
query = sqlbuilder.Alias(query,
"%s_%s" % (self.sourceClass.__name__,
col.name))
diff --git a/sqlobject/tests/dbtest.py b/sqlobject/tests/dbtest.py
index 5edf3f8..d3f156a 100644
--- a/sqlobject/tests/dbtest.py
+++ b/sqlobject/tests/dbtest.py
@@ -42,7 +42,7 @@ supportsMatrix = {
'-limitSelect': 'mssql',
'+schema': 'postgres',
'+memorydb': 'sqlite',
- }
+}
def setupClass(soClasses, force=False):
http://sourceforge.net/p/sqlobject/sqlobject/ci/893d240807ea9dd2093e45ed19b9ddd0c361f6af
commit 893d240807ea9dd2093e45ed19b9ddd0c361f6af
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 15 00:45:55 2015 +0300
Fix flake8 E402 module level import not at top of file
diff --git a/setup.py b/setup.py
index a356eb5..650a0b9 100755
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ except ImportError:
versionpath = join(abspath(dirname(__file__)), "sqlobject", "__version__.py")
load_source("sqlobject_version", versionpath)
-from sqlobject_version import version
+from sqlobject_version import version # noqa: ignore flake8 E402
subpackages = ['firebird', 'include',
'inheritance', 'inheritance.tests',
diff --git a/sqlobject/boundattributes.py b/sqlobject/boundattributes.py
index 9b04b2e..a2ba863 100644
--- a/sqlobject/boundattributes.py
+++ b/sqlobject/boundattributes.py
@@ -23,13 +23,15 @@ subclasses, use ``bind_attributes_local``, which adds a
attributes.
"""
-__all__ = ['BoundAttribute', 'BoundFactory', 'bind_attributes',
- 'bind_attributes_local']
from . import declarative
from . import events
+__all__ = ['BoundAttribute', 'BoundFactory', 'bind_attributes',
+ 'bind_attributes_local']
+
+
class BoundAttribute(declarative.Declarative):
"""
diff --git a/sqlobject/col.py b/sqlobject/col.py
index 3cdf9a1..7c3df4e 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -19,13 +19,16 @@ are what gets used.
"""
from array import array
+from decimal import Decimal
from itertools import count
+import sys
import time
try:
import cPickle as pickle
except ImportError:
import pickle
import weakref
+
from formencode import compound, validators
from .classregistry import findClass
# Sadly the name "constraints" conflicts with many of the function
@@ -34,8 +37,6 @@ from . import constraints as constrs
from . import sqlbuilder
from .styles import capword
-NoDefault = sqlbuilder.NoDefault
-
import datetime
datetime_available = True
@@ -64,19 +65,19 @@ if mxdatetime_available:
DateTimeType = type(DateTime.DateTime())
TimeType = type(DateTime.DateTime.Time(DateTime.DateTime()))
-default_datetime_implementation = DATETIME_IMPLEMENTATION
-
__all__ = ["datetime_available", "mxdatetime_available",
"default_datetime_implementation", "DATETIME_IMPLEMENTATION"]
if mxdatetime_available:
__all__.append("MXDATETIME_IMPLEMENTATION")
-import sys
+default_datetime_implementation = DATETIME_IMPLEMENTATION
+
if sys.version_info[0] > 2:
# alias for python 3 compatability
long = int
+NoDefault = sqlbuilder.NoDefault
creationOrder = count()
@@ -1503,9 +1504,6 @@ class TimedeltaCol(Col):
baseClass = SOTimedeltaCol
-from decimal import Decimal
-
-
class DecimalValidator(SOValidator):
def to_python(self, value, state):
if value is None:
diff --git a/sqlobject/conftest.py b/sqlobject/conftest.py
index fa29e1c..d50a6a9 100644
--- a/sqlobject/conftest.py
+++ b/sqlobject/conftest.py
@@ -3,10 +3,6 @@ This module is used by py.test to configure testing for this
application.
"""
-# Override some options (doesn't override command line):
-verbose = 0
-exitfirst = True
-
import py
import sqlobject
@@ -17,6 +13,10 @@ except ImportError: # Python 2.2
else:
pkg_resources.require('SQLObject')
+# Override some options (doesn't override command line):
+verbose = 0
+exitfirst = True
+
connectionShortcuts = {
'mysql': 'mysql://test@localhost/test',
'dbm': 'dbm:///data',
diff --git a/sqlobject/include/hashcol.py b/sqlobject/include/hashcol.py
index 950fdd1..81e5c7a 100644
--- a/sqlobject/include/hashcol.py
+++ b/sqlobject/include/hashcol.py
@@ -1,7 +1,7 @@
-__all__ = ['HashCol']
+import sqlobject.col
-import sqlobject.col
+__all__ = ['HashCol']
class DbHash:
diff --git a/sqlobject/joins.py b/sqlobject/joins.py
index 63c8ec1..c37d606 100644
--- a/sqlobject/joins.py
+++ b/sqlobject/joins.py
@@ -1,4 +1,5 @@
from itertools import count
+from . import boundattributes
from . import classregistry
from . import events
from . import styles
@@ -371,9 +372,6 @@ class SingleJoin(Join):
baseClass = SOSingleJoin
-from . import boundattributes
-
-
class SOManyToMany(object):
def __init__(self, soClass, name, join,
diff --git a/sqlobject/tests/test_auto.py b/sqlobject/tests/test_auto.py
index 3b9c8ac..a00f8fb 100644
--- a/sqlobject/tests/test_auto.py
+++ b/sqlobject/tests/test_auto.py
@@ -1,10 +1,9 @@
from datetime import datetime
-now = datetime.now
+from py.test import raises
from sqlobject import *
from sqlobject.tests.dbtest import *
from sqlobject import classregistry
-from py.test import raises
########################################
@@ -12,6 +11,9 @@ from py.test import raises
########################################
+now = datetime.now
+
+
class Person(SQLObject):
class sqlmeta:
diff --git a/sqlobject/tests/test_datetime.py b/sqlobject/tests/test_datetime.py
index b4354e5..af93fed 100644
--- a/sqlobject/tests/test_datetime.py
+++ b/sqlobject/tests/test_datetime.py
@@ -1,5 +1,8 @@
+from datetime import datetime, date, time
import py.test
+
from sqlobject import *
+from sqlobject import col
from sqlobject.tests.dbtest import *
@@ -8,9 +11,7 @@ from sqlobject.tests.dbtest import *
########################################
-from sqlobject import col
col.default_datetime_implementation = DATETIME_IMPLEMENTATION
-from datetime import datetime, date, time
class DateTime1(SQLObject):
-----------------------------------------------------------------------
Summary of changes:
setup.py | 4 ++--
sqlobject/boundattributes.py | 8 +++++---
sqlobject/col.py | 14 ++++++--------
sqlobject/conftest.py | 10 +++++-----
sqlobject/firebird/firebirdconnection.py | 2 +-
sqlobject/include/hashcol.py | 4 ++--
sqlobject/joins.py | 10 ++++------
sqlobject/sqlbuilder.py | 2 +-
sqlobject/sresults.py | 2 +-
sqlobject/tests/dbtest.py | 2 +-
sqlobject/tests/test_auto.py | 6 ++++--
sqlobject/tests/test_datetime.py | 5 +++--
12 files changed, 35 insertions(+), 34 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-14 21:03:28
|
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 f89bd3cd9d20ac07d36c966b396a7ca1c8025cff (commit)
via 92c9ee59fc92b747004a4cbd1be568430249faaa (commit)
from 2f5512c24a7aa83ccff9c43ff890d1ee16d1bf11 (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/f89bd3cd9d20ac07d36c966b396a7ca1c8025cff
commit f89bd3cd9d20ac07d36c966b396a7ca1c8025cff
Author: Oleg Broytman <ph...@ph...>
Date: Sat Feb 14 23:59:01 2015 +0300
Fix flake8 E226 missing whitespace around arithmetic operator
diff --git a/sqlobject/col.py b/sqlobject/col.py
index d974f41..3cdf9a1 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -1187,7 +1187,7 @@ class DateTimeValidator(validators.DateValidator):
microseconds = _value[-1]
_l = len(microseconds)
if _l < 6:
- _value[-1] = microseconds + '0'*(6 - _l)
+ _value[-1] = microseconds + '0' * (6 - _l)
elif _l > 6:
_value[-1] = microseconds[:6]
if _l != 6:
@@ -1238,7 +1238,7 @@ if mxdatetime_available:
microseconds = _value[-1]
_l = len(microseconds)
if _l < 6:
- _value[-1] = microseconds + '0'*(6 - _l)
+ _value[-1] = microseconds + '0' * (6 - _l)
elif _l > 6:
_value[-1] = microseconds[:6]
if _l != 6:
@@ -1704,11 +1704,11 @@ class SOBLOBCol(SOStringCol):
def _mysqlType(self):
length = self.length
varchar = self.varchar
- if length >= 2**24:
+ if length >= 2 ** 24:
return varchar and "LONGTEXT" or "LONGBLOB"
- if length >= 2**16:
+ if length >= 2 ** 16:
return varchar and "MEDIUMTEXT" or "MEDIUMBLOB"
- if length >= 2**8:
+ if length >= 2 ** 8:
return varchar and "TEXT" or "BLOB"
return varchar and "TINYTEXT" or "TINYBLOB"
@@ -1768,9 +1768,9 @@ class SOPickleCol(SOBLOBCol):
def _mysqlType(self):
length = self.length
- if length >= 2**24:
+ if length >= 2 ** 24:
return "LONGBLOB"
- if length >= 2**16:
+ if length >= 2 ** 16:
return "MEDIUMBLOB"
return "BLOB"
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index 4dc9c8f..54b9ac2 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -415,10 +415,10 @@ class DBAPI(DBConnection):
sep = '->'
s = repr(s)
n = self._connectionNumbers[id(conn)]
- spaces = ' '*(8-len(name))
+ spaces = ' ' * (8 - len(name))
if self.debugThreading:
threadName = threading.currentThread().getName()
- threadName = (':' + threadName + ' '*(8-len(threadName)))
+ threadName = (':' + threadName + ' ' * (8 - len(threadName)))
else:
threadName = ''
msg = '%(n)2i%(threadName)s/%(name)s%(spaces)s%(sep)s %(s)s' % locals()
diff --git a/sqlobject/events.py b/sqlobject/events.py
index 1b2b5f5..6f66cb9 100644
--- a/sqlobject/events.py
+++ b/sqlobject/events.py
@@ -236,7 +236,7 @@ def summarize_events_by_sender(sender=None, output=None, indent=0):
print(leader + header, file=output)
print(leader + ('=' * len(header)), file=output)
summarize_events_by_sender(real_sender, output=output,
- indent=indent+2)
+ indent=indent + 2)
else:
for signal, receivers in \
sorted_items(dispatcher.connections.get(id(sender), [])):
diff --git a/sqlobject/firebird/firebirdconnection.py b/sqlobject/firebird/firebirdconnection.py
index 284330c..7b74d3d 100644
--- a/sqlobject/firebird/firebirdconnection.py
+++ b/sqlobject/firebird/firebirdconnection.py
@@ -127,7 +127,7 @@ class FirebirdConnection(DBAPI):
if not end:
limit_str = "SELECT SKIP %i" % start
else:
- limit_str = "SELECT FIRST %i SKIP %i" % (end-start, start)
+ limit_str = "SELECT FIRST %i SKIP %i" % (end - start, start)
match = cls.limit_re.match(query)
if match and len(match.groups()) == 2:
diff --git a/sqlobject/index.py b/sqlobject/index.py
index c1ec148..ca0fd50 100644
--- a/sqlobject/index.py
+++ b/sqlobject/index.py
@@ -34,7 +34,7 @@ class SODatabaseIndex(object):
raise TypeError(
"get() takes exactly %d argument and an optional "
"named argument 'connection' (%d given)" % (
- len(columns), len(args)+len(kw)))
+ len(columns), len(args) + len(kw)))
if args:
kw = {}
for i in range(len(args)):
diff --git a/sqlobject/inheritance/iteration.py b/sqlobject/inheritance/iteration.py
index 25f97a9..fd7b78f 100644
--- a/sqlobject/inheritance/iteration.py
+++ b/sqlobject/inheritance/iteration.py
@@ -60,7 +60,7 @@ class InheritableIteration(Iteration):
childIdsNames = {}
childNameIdx = self._childNameIdx
for result in self._results:
- childName = result[childNameIdx+1]
+ childName = result[childNameIdx + 1]
if childName:
ids = childIdsNames.get(childName)
if ids is None:
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 5812b29..7d56464 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -489,8 +489,8 @@ class sqlmeta(object):
if isinstance(column, str):
if column in sqlmeta.columns:
column = sqlmeta.columns[column]
- elif column+'ID' in sqlmeta.columns:
- column = sqlmeta.columns[column+'ID']
+ elif column + 'ID' in sqlmeta.columns:
+ column = sqlmeta.columns[column + 'ID']
else:
raise ValueError('Unknown column ' + column)
if isinstance(column, col.Col):
@@ -554,7 +554,7 @@ class sqlmeta(object):
meth = join.joinMethodName
sqlmeta.joins.append(join)
- index = len(sqlmeta.joins)-1
+ index = len(sqlmeta.joins) - 1
if joinDef not in sqlmeta.joinDefinitions:
sqlmeta.joinDefinitions.append(joinDef)
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 214c72d..7e20839 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -286,7 +286,7 @@ class Command(object):
self.parser.usage = "%%prog [options]\n%s" % self.summary
if self.help:
help = textwrap.fill(
- self.help, int(os.environ.get('COLUMNS', 80))-4)
+ self.help, int(os.environ.get('COLUMNS', 80)) - 4)
self.parser.usage += '\n' + help
self.parser.prog = '%s %s' % (
os.path.basename(self.invoked_as),
@@ -561,7 +561,7 @@ class Command(object):
directory (if it can). For display purposes.
"""
if fn.startswith(os.getcwd() + '/'):
- fn = fn[len(os.getcwd())+1:]
+ fn = fn[len(os.getcwd()) + 1:]
return fn
def open_editor(self, pretext, breaker=None, extension='.txt'):
@@ -830,11 +830,11 @@ class CommandHelp(Command):
max_len = max([len(cn) for cn, c in items])
for command_name, command in items:
print('%s:%s %s' % (command_name,
- ' '*(max_len-len(command_name)),
+ ' ' * (max_len - len(command_name)),
command.summary))
if command.aliases:
print('%s (Aliases: %s)' % (
- ' '*max_len, ', '.join(command.aliases)))
+ ' ' * max_len, ', '.join(command.aliases)))
class CommandExecute(Command):
@@ -1059,8 +1059,8 @@ class CommandRecord(Command):
print("Cannot edit upgrader because there is no "
"previous version")
else:
- breaker = ('-'*20 + ' lines below this will be ignored '
- + '-'*20)
+ breaker = ('-' * 20 + ' lines below this will be ignored '
+ + '-' * 20)
pre_text = breaker + '\n' + '\n'.join(all_diffs)
text = self.open_editor('\n\n' + pre_text, breaker=breaker,
extension='.sql')
@@ -1124,7 +1124,7 @@ class CommandRecord(Command):
if not extra:
extra = 'a'
else:
- extra = chr(ord(extra)+1)
+ extra = chr(ord(extra) + 1)
def find_last_version(self):
names = []
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index ea83c56..e09f1ad 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -180,7 +180,7 @@ class MySQLConnection(DBAPI):
return "%s LIMIT %i" % (query, end)
if not end:
return "%s LIMIT %i, -1" % (query, start)
- return "%s LIMIT %i, %i" % (query, start, end-start)
+ return "%s LIMIT %i, %i" % (query, start, end - start)
def createReferenceConstraint(self, soClass, col):
return col.mysqlCreateReferenceConstraint()
@@ -292,21 +292,21 @@ class MySQLConnection(DBAPI):
elif t.startswith('bool'):
return col.BoolCol, {}
elif t.startswith('tinyblob'):
- return col.BLOBCol, {"length": 2**8-1}
+ return col.BLOBCol, {"length": 2 ** 8 - 1}
elif t.startswith('tinytext'):
- return col.StringCol, {"length": 2**8-1, "varchar": True}
+ return col.StringCol, {"length": 2 ** 8 - 1, "varchar": True}
elif t.startswith('blob'):
- return col.BLOBCol, {"length": 2**16-1}
+ return col.BLOBCol, {"length": 2 ** 16 - 1}
elif t.startswith('text'):
- return col.StringCol, {"length": 2**16-1, "varchar": True}
+ return col.StringCol, {"length": 2 ** 16 - 1, "varchar": True}
elif t.startswith('mediumblob'):
- return col.BLOBCol, {"length": 2**24-1}
+ return col.BLOBCol, {"length": 2 ** 24 - 1}
elif t.startswith('mediumtext'):
- return col.StringCol, {"length": 2**24-1, "varchar": True}
+ return col.StringCol, {"length": 2 ** 24 - 1, "varchar": True}
elif t.startswith('longblob'):
- return col.BLOBCol, {"length": 2**32}
+ return col.BLOBCol, {"length": 2 ** 32}
elif t.startswith('longtext'):
- return col.StringCol, {"length": 2**32, "varchar": True}
+ return col.StringCol, {"length": 2 ** 32, "varchar": True}
else:
return col.Col, {}
diff --git a/sqlobject/postgres/pgconnection.py b/sqlobject/postgres/pgconnection.py
index d7fe8cb..c4f414d 100644
--- a/sqlobject/postgres/pgconnection.py
+++ b/sqlobject/postgres/pgconnection.py
@@ -224,7 +224,7 @@ class PostgresConnection(DBAPI):
return "%s LIMIT %i" % (query, end)
if not end:
return "%s OFFSET %i" % (query, start)
- return "%s LIMIT %i OFFSET %i" % (query, end-start, start)
+ return "%s LIMIT %i OFFSET %i" % (query, end - start, start)
def createColumn(self, soClass, col):
return col.postgresCreateSQL()
@@ -379,11 +379,11 @@ class PostgresConnection(DBAPI):
return col.IntCol, {}
elif t.count('varying') or t.count('varchar'):
if '(' in t:
- return col.StringCol, {'length': int(t[t.index('(')+1:-1])}
+ return col.StringCol, {'length': int(t[t.index('(') + 1:-1])}
else: # varchar without length in Postgres means any length
return col.StringCol, {}
elif t.startswith('character('):
- return col.StringCol, {'length': int(t[t.index('(')+1:-1]),
+ return col.StringCol, {'length': int(t[t.index('(') + 1:-1]),
'varchar': False}
elif t.count('float') or t.count('real') or t.count('double'):
return col.FloatCol, {}
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index 44b33ab..aaec8bd 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -493,7 +493,7 @@ class SQLObjectTable(Table):
elif attr in self.soClass.sqlmeta.columns:
column = self.soClass.sqlmeta.columns[attr]
return self._getattrFromColumn(column, attr)
- elif attr+'ID' in \
+ elif attr + 'ID' in \
[k for (k, v) in self.soClass.sqlmeta.columns.items()
if v.foreignKey]:
attr += 'ID'
@@ -516,10 +516,10 @@ class SQLObjectTable(Table):
class SQLObjectTableWithJoins(SQLObjectTable):
def __getattr__(self, attr):
- if attr+'ID' in \
+ if attr + 'ID' in \
[k for (k, v) in self.soClass.sqlmeta.columns.items()
if v.foreignKey]:
- column = self.soClass.sqlmeta.columns[attr+'ID']
+ column = self.soClass.sqlmeta.columns[attr + 'ID']
return self._getattrFromForeignKey(column, attr)
elif attr in [x.joinMethodName for x in self.soClass.sqlmeta.joins]:
join = [x for x in self.soClass.sqlmeta.joins
@@ -530,7 +530,7 @@ class SQLObjectTableWithJoins(SQLObjectTable):
def _getattrFromForeignKey(self, column, attr):
ret = getattr(self, column.name) == \
- getattr(self.soClass, '_SO_class_'+column.foreignKey).q.id
+ getattr(self.soClass, '_SO_class_' + column.foreignKey).q.id
return ret
def _getattrFromJoin(self, join, attr):
@@ -1082,8 +1082,8 @@ def _quote_like_special(s, db):
else:
escape = '\\'
s = s.replace('\\', r'\\').\
- replace('%', escape+'%').\
- replace('_', escape+'_')
+ replace('%', escape + '%').\
+ replace('_', escape + '_')
return s
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index 78d200e..f245fa2 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -277,7 +277,7 @@ class SQLiteConnection(DBAPI):
return "%s LIMIT %i" % (query, end)
if not end:
return "%s LIMIT 0 OFFSET %i" % (query, start)
- return "%s LIMIT %i OFFSET %i" % (query, end-start, start)
+ return "%s LIMIT %i OFFSET %i" % (query, end - start, start)
def createColumn(self, soClass, col):
return col.sqliteCreateSQL()
@@ -370,7 +370,7 @@ class SQLiteConnection(DBAPI):
end = colData.find(')', start)
if end == -1:
break
- colData = colData[:start] + colData[end+1:]
+ colData = colData[:start] + colData[end + 1:]
results = []
for colDesc in colData.split(','):
parts = colDesc.strip().split(' ', 2)
@@ -407,9 +407,9 @@ class SQLiteConnection(DBAPI):
if t.find('INT') >= 0:
return col.IntCol, {}
elif t.find('TEXT') >= 0 or t.find('CHAR') >= 0 or t.find('CLOB') >= 0:
- return col.StringCol, {'length': 2**32-1}
+ return col.StringCol, {'length': 2 ** 32 - 1}
elif t.find('BLOB') >= 0:
- return col.BLOBCol, {"length": 2**32-1}
+ return col.BLOBCol, {"length": 2 ** 32 - 1}
elif t.find('REAL') >= 0 or t.find('FLOAT') >= 0:
return col.FloatCol, {}
elif t.find('DECIMAL') >= 0:
diff --git a/sqlobject/sresults.py b/sqlobject/sresults.py
index ce02f93..ae8e46c 100644
--- a/sqlobject/sresults.py
+++ b/sqlobject/sresults.py
@@ -179,7 +179,7 @@ class SelectResults(object):
return list(iter(self))[value]
else:
start = self.ops.get('start', 0) + value
- return list(self.clone(start=start, end=start+1))[0]
+ return list(self.clone(start=start, end=start + 1))[0]
def __iter__(self):
# @@: This could be optimized, using a simpler algorithm
@@ -312,7 +312,7 @@ class SelectResults(object):
orderBy = sqlbuilder.NoDefault
ref = self.sourceClass.sqlmeta.columns.get(
- attr.endswith('ID') and attr or attr+'ID', None)
+ attr.endswith('ID') and attr or attr + 'ID', None)
if ref and ref.foreignKey:
otherClass, clause = self._throughToFK(ref)
else:
@@ -337,7 +337,7 @@ class SelectResults(object):
connection=self._getConnection())
def _throughToFK(self, col):
- otherClass = getattr(self.sourceClass, "_SO_class_"+col.foreignKey)
+ otherClass = getattr(self.sourceClass, "_SO_class_" + col.foreignKey)
colName = col.name
query = self.queryForSelect().newItems([
sqlbuilder.ColumnAS(getattr(self.sourceClass.q, colName), colName)
diff --git a/sqlobject/tests/test_aggregates.py b/sqlobject/tests/test_aggregates.py
index 925ea1d..d940aa6 100644
--- a/sqlobject/tests/test_aggregates.py
+++ b/sqlobject/tests/test_aggregates.py
@@ -31,7 +31,7 @@ def test_integer():
def floatcmp(f1, f2):
- if abs(f1-f2) < 0.1:
+ if abs(f1 - f2) < 0.1:
return 0
if f1 < f2:
return 1
diff --git a/sqlobject/tests/test_auto.py b/sqlobject/tests/test_auto.py
index 9d6ff63..3b9c8ac 100644
--- a/sqlobject/tests/test_auto.py
+++ b/sqlobject/tests/test_auto.py
@@ -202,17 +202,17 @@ class TestAuto:
age=10,
created=now(),
wannahavefun=False,
- longField='x'*1000)
+ longField='x' * 1000)
jane = AutoTest(firstName='jane',
lastName='doe',
happy='N',
created=now(),
wannahavefun=True,
- longField='x'*1000)
+ longField='x' * 1000)
assert not john.wannahavefun
assert jane.wannahavefun
- assert john.longField == 'x'*1000
- assert jane.longField == 'x'*1000
+ assert john.longField == 'x' * 1000
+ assert jane.longField == 'x' * 1000
del classregistry.registry(
AutoTest.sqlmeta.registry).classes['AutoTest']
diff --git a/sqlobject/tests/test_converters.py b/sqlobject/tests/test_converters.py
index 0146d70..ba6011c 100644
--- a/sqlobject/tests/test_converters.py
+++ b/sqlobject/tests/test_converters.py
@@ -243,7 +243,7 @@ def test_sets():
def test_timedelta():
- assert sqlrepr(timedelta(seconds=30*60)) == \
+ assert sqlrepr(timedelta(seconds=30 * 60)) == \
"INTERVAL '0 days 1800 seconds'"
diff --git a/sqlobject/tests/test_distinct.py b/sqlobject/tests/test_distinct.py
index 31d09be..aeeefd8 100644
--- a/sqlobject/tests/test_distinct.py
+++ b/sqlobject/tests/test_distinct.py
@@ -18,7 +18,7 @@ class Distinct2(SQLObject):
def count(select):
result = {}
for ob in select:
- result[int(ob.n)] = result.get(int(ob.n), 0)+1
+ result[int(ob.n)] = result.get(int(ob.n), 0) + 1
return result
diff --git a/sqlobject/tests/test_select.py b/sqlobject/tests/test_select.py
index f47d9fe..74a04ba 100644
--- a/sqlobject/tests/test_select.py
+++ b/sqlobject/tests/test_select.py
@@ -67,7 +67,7 @@ def test_04_indexed_ended_by_exception():
try:
while 1:
all[count]
- count = count+1
+ count = count + 1
# Stop the test if it's gone on too long
if count > len(names):
break
diff --git a/sqlobject/tests/test_sqlbuilder_importproxy.py b/sqlobject/tests/test_sqlbuilder_importproxy.py
index 4ce4497..4a9bcff 100644
--- a/sqlobject/tests/test_sqlbuilder_importproxy.py
+++ b/sqlobject/tests/test_sqlbuilder_importproxy.py
@@ -19,7 +19,7 @@ def testSimple():
def testAddition():
nyi = ImportProxy('NotYetImported2')
- x = nyi.q.name+nyi.q.name
+ x = nyi.q.name + nyi.q.name
class NotYetImported2(SQLObject):
name = StringCol(dbName='a_name')
diff --git a/sqlobject/tests/test_style.py b/sqlobject/tests/test_style.py
index aa2d86e..804e213 100644
--- a/sqlobject/tests/test_style.py
+++ b/sqlobject/tests/test_style.py
@@ -6,7 +6,7 @@ from sqlobject import styles
class AnotherStyle(styles.MixedCaseUnderscoreStyle):
def pythonAttrToDBColumn(self, attr):
if attr.lower().endswith('id'):
- return 'id'+styles.MixedCaseUnderscoreStyle.\
+ return 'id' + styles.MixedCaseUnderscoreStyle.\
pythonAttrToDBColumn(self, attr[:-2])
else:
return styles.MixedCaseUnderscoreStyle.\
... 134 lines suppressed ...
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-14 12:39:13
|
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 2f5512c24a7aa83ccff9c43ff890d1ee16d1bf11 (commit)
via e5e281a23bc3818fd45bf2e02d31ac9bf919ef12 (commit)
from 747da169fd122facf9b1b46af5f420867bd4e8d7 (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/2f5512c24a7aa83ccff9c43ff890d1ee16d1bf11
commit 2f5512c24a7aa83ccff9c43ff890d1ee16d1bf11
Author: Oleg Broytman <ph...@ph...>
Date: Sat Feb 14 15:38:05 2015 +0300
Fix #50 flake8 E401 multiple imports on one line
diff --git a/docs/test.py b/docs/test.py
index a6e475e..bf43dfa 100644
--- a/docs/test.py
+++ b/docs/test.py
@@ -1,5 +1,6 @@
-import sys, os
import doctest
+import os
+import sys
sys.path.insert(
0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
diff --git a/setup.cfg b/setup.cfg
index 152719d..10ad420 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -11,10 +11,9 @@ tag_svn_revision = 0
exclude = .git,docs/europython/*.py,ez_setup.py
; Ignore:
-; E401 multiple imports on one line
; F403 'from module import *' used; unable to detect undefined names
; F822 undefined name in __all__
-ignore = E401,F403,F822
+ignore = F403,F822
[pudge]
theme = pythonpaste.org
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index 512e36e..ea83c56 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -19,7 +19,7 @@ class MySQLConnection(DBAPI):
schemes = [dbName]
def __init__(self, db, user, password='', host='localhost', port=0, **kw):
- import MySQLdb, MySQLdb.constants.CR, MySQLdb.constants.ER
+ import MySQLdb, MySQLdb.constants.CR, MySQLdb.constants.ER # noqa
self.module = MySQLdb
self.host = host
self.port = port
http://sourceforge.net/p/sqlobject/sqlobject/ci/e5e281a23bc3818fd45bf2e02d31ac9bf919ef12
commit e5e281a23bc3818fd45bf2e02d31ac9bf919ef12
Author: Oleg Broytman <ph...@ph...>
Date: Sat Feb 14 15:34:23 2015 +0300
Fixed in #3: W603 '<>' is deprecated, use '!='
Also already fixed:
E123 closing bracket does not match indentation
E226 missing whitespace around arithmetic operator
diff --git a/setup.cfg b/setup.cfg
index dc56a50..152719d 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -11,13 +11,10 @@ tag_svn_revision = 0
exclude = .git,docs/europython/*.py,ez_setup.py
; Ignore:
-; E123 closing bracket does not match indentation of opening bracket's line
-; E226 missing whitespace around arithmetic operator
; E401 multiple imports on one line
; F403 'from module import *' used; unable to detect undefined names
; F822 undefined name in __all__
-; W603 '<>' is deprecated, use '!='
-ignore = E123,E226,E401,F403,F822,W603
+ignore = E401,F403,F822
[pudge]
theme = pythonpaste.org
-----------------------------------------------------------------------
Summary of changes:
docs/test.py | 3 ++-
setup.cfg | 6 +-----
sqlobject/mysql/mysqlconnection.py | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-13 19:03:14
|
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 747da169fd122facf9b1b46af5f420867bd4e8d7 (commit)
via 98a255b89bdbb051260c7eb8e3c21fe65aa177df (commit)
from 80b163b8db1c629ea0b7323dd50b95dbc9e0f204 (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/747da169fd122facf9b1b46af5f420867bd4e8d7
commit 747da169fd122facf9b1b46af5f420867bd4e8d7
Author: Oleg Broytman <ph...@ph...>
Date: Fri Feb 13 22:01:40 2015 +0300
Fix #36 flake8 W391 blank line at end of file
diff --git a/setup.cfg b/setup.cfg
index baeb80b..dc56a50 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,9 +16,8 @@ exclude = .git,docs/europython/*.py,ez_setup.py
; E401 multiple imports on one line
; F403 'from module import *' used; unable to detect undefined names
; F822 undefined name in __all__
-; W391 blank line at end of file
; W603 '<>' is deprecated, use '!='
-ignore = E123,E226,E401,F403,F822,W391,W603
+ignore = E123,E226,E401,F403,F822,W603
[pudge]
theme = pythonpaste.org
diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py
index 33d2db5..bc3485a 100644
--- a/sqlobject/declarative.py
+++ b/sqlobject/declarative.py
@@ -207,4 +207,3 @@ def setup_attributes(cls, new_attrs):
for name, value in new_attrs.items():
if hasattr(value, '__addtoclass__'):
value.__addtoclass__(cls, name)
-
diff --git a/sqlobject/tests/test_csvexport.py b/sqlobject/tests/test_csvexport.py
index bd56a14..7f97f2d 100644
--- a/sqlobject/tests/test_csvexport.py
+++ b/sqlobject/tests/test_csvexport.py
@@ -99,4 +99,3 @@ def test_zip():
assert isinstance(s, str) and s
s = export_csv_zip([SimpleCSV.selectBy(name='Bob'),
(ComplexCSV, list(ComplexCSV.selectBy(fname='John')))])
-
diff --git a/sqlobject/tests/test_inheritance.py b/sqlobject/tests/test_inheritance.py
index 62a0f63..becdfce 100644
--- a/sqlobject/tests/test_inheritance.py
+++ b/sqlobject/tests/test_inheritance.py
@@ -33,4 +33,3 @@ def test_sub():
Sub(name='two', name2='2') # s2
s3 = Sub.get(s1.id)
assert s1 == s3
-
diff --git a/sqlobject/tests/test_sqlobject_admin.py b/sqlobject/tests/test_sqlobject_admin.py
index 7debce3..d16b44d 100644
--- a/sqlobject/tests/test_sqlobject_admin.py
+++ b/sqlobject/tests/test_sqlobject_admin.py
@@ -36,4 +36,3 @@ class Test5(SQLObject):
class sqlmeta:
createSQL = {'mysql': 'CREATE SEQUENCE db_test5_seq;'}
test5 = StringCol()
-
diff --git a/sqlobject/versioning/__init__.py b/sqlobject/versioning/__init__.py
index 512aa8c..956c5d6 100644
--- a/sqlobject/versioning/__init__.py
+++ b/sqlobject/versioning/__init__.py
@@ -118,4 +118,3 @@ class Versioning(object):
return self
return self.versionClass.select(
self.versionClass.q.masterID == obj.id, connection=obj._connection)
-
http://sourceforge.net/p/sqlobject/sqlobject/ci/98a255b89bdbb051260c7eb8e3c21fe65aa177df
commit 98a255b89bdbb051260c7eb8e3c21fe65aa177df
Author: Oleg Broytman <ph...@ph...>
Date: Fri Feb 13 21:56:34 2015 +0300
Fix #43 flake8 E712 comparison to bool should be 'if cond is' or 'if cond'
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 1ed8bf8..5812b29 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1640,7 +1640,7 @@ class SQLObject(object):
query = []
delete = setnull = restrict = False
for _col in cols:
- if _col.cascade == False:
+ if _col.cascade is False:
# Found a restriction
restrict = True
query.append(getattr(k.q, _col.name) == self.id)
diff --git a/sqlobject/tests/test_basic.py b/sqlobject/tests/test_basic.py
index ffa67d6..a481708 100644
--- a/sqlobject/tests/test_basic.py
+++ b/sqlobject/tests/test_basic.py
@@ -90,9 +90,9 @@ class Student(SQLObject):
def test_boolCol():
setupClass(Student)
student = Student(is_smart=False)
- assert student.is_smart == False
+ assert not student.is_smart
student2 = Student(is_smart=1)
- assert student2.is_smart == True
+ assert student2.is_smart
class TestSO3(SQLObject):
diff --git a/sqlobject/tests/test_sqlbuilder.py b/sqlobject/tests/test_sqlbuilder.py
index 7a3eec7..fea08ae 100644
--- a/sqlobject/tests/test_sqlbuilder.py
+++ b/sqlobject/tests/test_sqlbuilder.py
@@ -34,7 +34,7 @@ def test_Select():
def test_empty_AND():
assert AND() is None
- assert AND(True) == True
+ assert AND(True) is True
# sqlrepr() is needed because AND() returns an SQLExpression that overrides
# comparison. The following
diff --git a/sqlobject/tests/test_sqlbuilder_dbspecific.py b/sqlobject/tests/test_sqlbuilder_dbspecific.py
index 029b72b..7e423c0 100644
--- a/sqlobject/tests/test_sqlbuilder_dbspecific.py
+++ b/sqlobject/tests/test_sqlbuilder_dbspecific.py
@@ -17,7 +17,8 @@ class SBButton(SQLObject):
def makeClause():
- return SBButton.q.activated == True
+ # It's not a comparison, it's an SQLExpression
+ return SBButton.q.activated == True # noqa
def makeSelect():
-----------------------------------------------------------------------
Summary of changes:
setup.cfg | 3 +--
sqlobject/declarative.py | 1 -
sqlobject/main.py | 2 +-
sqlobject/tests/test_basic.py | 4 ++--
sqlobject/tests/test_csvexport.py | 1 -
sqlobject/tests/test_inheritance.py | 1 -
sqlobject/tests/test_sqlbuilder.py | 2 +-
sqlobject/tests/test_sqlbuilder_dbspecific.py | 3 ++-
sqlobject/tests/test_sqlobject_admin.py | 1 -
sqlobject/versioning/__init__.py | 1 -
10 files changed, 7 insertions(+), 12 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-12 23:11:10
|
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 80b163b8db1c629ea0b7323dd50b95dbc9e0f204 (commit)
from 12fb5061fe1940fe654a14e19cdd2878296d8dc7 (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/80b163b8db1c629ea0b7323dd50b95dbc9e0f204
commit 80b163b8db1c629ea0b7323dd50b95dbc9e0f204
Author: Oleg Broytman <ph...@ph...>
Date: Fri Feb 13 02:10:12 2015 +0300
Fix #49: rename loop variables instead of del
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 35ca648..1ed8bf8 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1404,9 +1404,8 @@ class SQLObject(object):
v = from_python(
v, sqlbuilder.SQLObjectState(cls, connection=connection))
new_value.append(v)
- del v
condition = sqlbuilder.AND(
- *[getattr(cls.q, n) == v for n, v in zip(name, new_value)])
+ *[getattr(cls.q, _n) == _v for _n, _v in zip(name, new_value)])
return (connection or cls._connection)._SO_selectOneAlt(
cls,
[cls.sqlmeta.idName] +
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 8ae591e..214c72d 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -257,9 +257,8 @@ class Command(object):
for cls in classes:
level = calculateDependencyLevel(cls)
sorter.append((level, cls))
- del level
sorter.sort()
- ordered_classes = [cls for level, cls in sorter]
+ ordered_classes = [cls for _, cls in sorter]
except SQLObjectCircularReferenceError as msg:
# Failsafe: return the classes as-is if a circular reference
# prevented the dependency levels to be calculated.
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index de93e68..44b33ab 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -754,7 +754,6 @@ class Select(SQLExpression):
if isinstance(x, SQLExpression):
x = sqlrepr(x, db)
tables.add(x)
- del x
things = list(self.ops['items']) + join
if self.ops['clause'] is not NoDefault:
things.append(self.ops['clause'])
@@ -802,7 +801,7 @@ class Select(SQLExpression):
reverser = lambda x: x
if isinstance(orderBy, (list, tuple)):
select += " ORDER BY %s" % ", ".join(
- [_str_or_sqlrepr(reverser(x), db) for x in orderBy])
+ [_str_or_sqlrepr(reverser(_x), db) for _x in orderBy])
else:
select += " ORDER BY %s" % _str_or_sqlrepr(
reverser(orderBy), db)
-----------------------------------------------------------------------
Summary of changes:
sqlobject/main.py | 3 +--
sqlobject/manager/command.py | 3 +--
sqlobject/sqlbuilder.py | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-12 22:45:34
|
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 12fb5061fe1940fe654a14e19cdd2878296d8dc7 (commit)
from 60394d446cc48e95812c6755c4786f50e7a98205 (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/12fb5061fe1940fe654a14e19cdd2878296d8dc7
commit 12fb5061fe1940fe654a14e19cdd2878296d8dc7
Author: Oleg Broytman <ph...@ph...>
Date: Fri Feb 13 01:43:21 2015 +0300
Fix #49 flake8 F812 list comprehension redefines 'name'
Del unused loop variables from the namespace.
diff --git a/setup.cfg b/setup.cfg
index 2c8a0d8..baeb80b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -15,11 +15,10 @@ exclude = .git,docs/europython/*.py,ez_setup.py
; E226 missing whitespace around arithmetic operator
; E401 multiple imports on one line
; F403 'from module import *' used; unable to detect undefined names
-; F812 list comprehension redefines 'name' from line 1402
; F822 undefined name in __all__
; W391 blank line at end of file
; W603 '<>' is deprecated, use '!='
-ignore = E123,E226,E401,F403,F812,F822,W391,W603
+ignore = E123,E226,E401,F403,F822,W391,W603
[pudge]
theme = pythonpaste.org
diff --git a/sqlobject/main.py b/sqlobject/main.py
index d0f5283..35ca648 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1404,6 +1404,7 @@ class SQLObject(object):
v = from_python(
v, sqlbuilder.SQLObjectState(cls, connection=connection))
new_value.append(v)
+ del v
condition = sqlbuilder.AND(
*[getattr(cls.q, n) == v for n, v in zip(name, new_value)])
return (connection or cls._connection)._SO_selectOneAlt(
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index f54a587..8ae591e 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -257,6 +257,7 @@ class Command(object):
for cls in classes:
level = calculateDependencyLevel(cls)
sorter.append((level, cls))
+ del level
sorter.sort()
ordered_classes = [cls for level, cls in sorter]
except SQLObjectCircularReferenceError as msg:
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index d59e41f..de93e68 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -754,6 +754,7 @@ class Select(SQLExpression):
if isinstance(x, SQLExpression):
x = sqlrepr(x, db)
tables.add(x)
+ del x
things = list(self.ops['items']) + join
if self.ops['clause'] is not NoDefault:
things.append(self.ops['clause'])
-----------------------------------------------------------------------
Summary of changes:
setup.cfg | 3 +--
sqlobject/main.py | 1 +
sqlobject/manager/command.py | 1 +
sqlobject/sqlbuilder.py | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-12 14:54:37
|
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 60394d446cc48e95812c6755c4786f50e7a98205 (commit)
from a101ddfff42bc451120529e5bb3d796423abd972 (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/60394d446cc48e95812c6755c4786f50e7a98205
commit 60394d446cc48e95812c6755c4786f50e7a98205
Author: Oleg Broytman <ph...@ph...>
Date: Thu Feb 12 17:51:33 2015 +0300
Fix #37 flake8 E122 continuation line missing indentation
diff --git a/sqlobject/inheritance/__init__.py b/sqlobject/inheritance/__init__.py
index 80cf52f..8d3cf1e 100644
--- a/sqlobject/inheritance/__init__.py
+++ b/sqlobject/inheritance/__init__.py
@@ -73,7 +73,7 @@ class InheritableSelectResults(SelectResults):
parentClause = []
for (currentClass, minParentClass) in tableRegistry.items():
while (currentClass != minParentClass) \
- and currentClass.sqlmeta.parentClass:
+ and currentClass.sqlmeta.parentClass:
parentClass = currentClass.sqlmeta.parentClass
parentClause.append(currentClass.q.id == parentClass.q.id)
currentClass = parentClass
@@ -283,7 +283,7 @@ class InheritableSQLObject(SQLObject):
sqlmeta.parentClass = None
for superclass in cls.__bases__:
if getattr(superclass, '_inheritable', False) \
- and (superclass.__name__ != 'InheritableSQLObject'):
+ and (superclass.__name__ != 'InheritableSQLObject'):
if sqlmeta.parentClass:
# already have a parent class;
# cannot inherit from more than one
@@ -453,7 +453,9 @@ class InheritableSQLObject(SQLObject):
addClause = parentClass.q.childName == cls.sqlmeta.childName
# if the clause was one of TRUE varians, replace it
if (clause is None) or (clause is sqlbuilder.SQLTrueClause) \
- or (isinstance(clause, basestring) and (clause == 'all')):
+ or (
+ isinstance(clause, basestring) and
+ (clause == 'all')):
clause = addClause
else:
# patch WHERE condition:
@@ -470,7 +472,7 @@ class InheritableSQLObject(SQLObject):
elif not isinstance(clause, sqlbuilder.Field):
return None
elif (clause.tableName == clsID.tableName) \
- and (clause.fieldName == clsID.fieldName):
+ and (clause.fieldName == clsID.fieldName):
return parentID
else:
return None
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 2e308ea..d0f5283 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -43,8 +43,8 @@ from .sresults import SelectResults
from .util.threadinglocal import local
import sys
-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))):
+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:
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index d301fb8..78d200e 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -223,7 +223,7 @@ class SQLiteConnection(DBAPI):
except self.module.IntegrityError as e:
msg = ErrorMessage(e)
if msg.startswith('column') and msg.endswith('not unique') \
- or msg.startswith('UNIQUE constraint failed:'):
+ or msg.startswith('UNIQUE constraint failed:'):
raise DuplicateEntryError(msg)
else:
raise IntegrityError(msg)
-----------------------------------------------------------------------
Summary of changes:
sqlobject/inheritance/__init__.py | 10 ++++++----
sqlobject/main.py | 4 ++--
sqlobject/sqlite/sqliteconnection.py | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-12 13:05:33
|
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 a101ddfff42bc451120529e5bb3d796423abd972 (commit)
via 5f20c1c411eeb6d736dce50f4aacf7f2003d27bc (commit)
from 926024dfa8c83f198432288100dcda18530dd657 (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/a101ddfff42bc451120529e5bb3d796423abd972
commit a101ddfff42bc451120529e5bb3d796423abd972
Merge: 926024d 5f20c1c
Author: Oleg Broytman <ph...@ph...>
Date: Thu Feb 12 16:04:20 2015 +0300
Merge pull request #79 from drnlm/fix_flake8_E241
Fix flake8 E241 - multiple spaces after ','
http://sourceforge.net/p/sqlobject/sqlobject/ci/5f20c1c411eeb6d736dce50f4aacf7f2003d27bc
commit 5f20c1c411eeb6d736dce50f4aacf7f2003d27bc
Author: Neil <drn...@gm...>
Date: Thu Feb 12 14:26:21 2015 +0200
Fix flake8 E241 - multiple spaces after ','
diff --git a/sqlobject/tests/test_parse_uri.py b/sqlobject/tests/test_parse_uri.py
index 83c7009..bcb0671 100644
--- a/sqlobject/tests/test_parse_uri.py
+++ b/sqlobject/tests/test_parse_uri.py
@@ -105,33 +105,33 @@ def test_uri():
connection = DBConnection()
connection.close = lambda: None
- connection.dbName, connection.host, connection.port, \
- connection.user, connection.password, connection.db = \
+ connection.dbName, connection.host, connection.port, \
+ connection.user, connection.password, connection.db = \
'mysql', 'host', None, None, None, 'database'
assert connection.uri() == "mysql://host/database"
- connection.dbName, connection.host, connection.port, \
- connection.user, connection.password, connection.db = \
+ connection.dbName, connection.host, connection.port, \
+ connection.user, connection.password, connection.db = \
'mysql', 'host', None, 'user', 'pass word', 'database'
assert connection.uri() == "mysql://user:pass%20word@host/database"
- connection.dbName, connection.host, connection.port, \
- connection.user, connection.password, connection.db = \
+ connection.dbName, connection.host, connection.port, \
+ connection.user, connection.password, connection.db = \
'postgres', 'host', None, 'user', None, 'database'
assert connection.uri() == "postgres://user@host/database"
- connection.dbName, connection.host, connection.port, \
- connection.user, connection.password, connection.db = \
+ connection.dbName, connection.host, connection.port, \
+ connection.user, connection.password, connection.db = \
'postgres', 'host', 5432, None, None, 'database'
assert connection.uri() == "postgres://host:5432/database"
- connection.dbName, connection.host, connection.port, \
- connection.user, connection.password, connection.db = \
+ connection.dbName, connection.host, connection.port, \
+ connection.user, connection.password, connection.db = \
'postgres', None, None, None, None, '/full/path/to/socket/database'
assert connection.uri() == "postgres:///full/path/to/socket/database"
- connection.dbName, connection.host, connection.port, \
- connection.user, connection.password, connection.db = \
+ connection.dbName, connection.host, connection.port, \
+ connection.user, connection.password, connection.db = \
'postgres', 'host', None, 'us:er', 'p@ssword', 'database'
assert connection.uri() == "postgres://us%3Aer:p%40ssword@host/database"
-----------------------------------------------------------------------
Summary of changes:
sqlobject/tests/test_parse_uri.py | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-12 10:08: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 926024dfa8c83f198432288100dcda18530dd657 (commit)
via 95d589ad2c853b60f1727e5d5fdf9642c6ea6b52 (commit)
from 82df1caa6d872e8df1ce5bf2965f174fe6714a4d (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/926024dfa8c83f198432288100dcda18530dd657
commit 926024dfa8c83f198432288100dcda18530dd657
Merge: 82df1ca 95d589a
Author: Oleg Broytman <ph...@ph...>
Date: Thu Feb 12 13:05:21 2015 +0300
Merge pull request #78 from drnlm/issue_40_E713
Fix #40: E713 - test for membership should be 'not in'
http://sourceforge.net/p/sqlobject/sqlobject/ci/95d589ad2c853b60f1727e5d5fdf9642c6ea6b52
commit 95d589ad2c853b60f1727e5d5fdf9642c6ea6b52
Author: Neil <drn...@gm...>
Date: Thu Feb 12 11:46:34 2015 +0200
Fix #40: E713 - test for membership should be 'not in'
diff --git a/sqlobject/col.py b/sqlobject/col.py
index 7174fcc..d974f41 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -1780,7 +1780,7 @@ class PickleCol(BLOBCol):
def pushKey(kw, name, value):
- if not name in kw:
+ if name not in kw:
kw[name] = value
all = []
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index 6fb6586..4dc9c8f 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -825,7 +825,7 @@ class Transaction(object):
def _SO_delete(self, inst):
cls = inst.__class__.__name__
- if not cls in self._deletedCache:
+ if cls not in self._deletedCache:
self._deletedCache[cls] = []
self._deletedCache[cls].append(inst.id)
if sys.version_info[0] < 3:
@@ -1032,7 +1032,7 @@ class ConnectionURIOpener(object):
def registerConnection(self, schemes, builder):
for uriScheme in schemes:
- assert not uriScheme in self.schemeBuilders \
+ assert uriScheme not in self.schemeBuilders \
or self.schemeBuilders[uriScheme] is builder, \
"A driver has already been registered " \
"for the URI scheme %s" % uriScheme
@@ -1040,7 +1040,7 @@ class ConnectionURIOpener(object):
def registerConnectionInstance(self, inst):
if inst.name:
- assert (not inst.name in self.instanceNames
+ assert (inst.name not in self.instanceNames
or self.instanceNames[inst.name] is cls # noqa
), ("A instance has already been registered "
"with the name %s" % inst.name)
diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py
index d568fc4..33d2db5 100644
--- a/sqlobject/declarative.py
+++ b/sqlobject/declarative.py
@@ -64,7 +64,7 @@ class _methodwrapper(object):
self.type = type
def __call__(self, *args, **kw):
- assert not 'self' in kw and not 'cls' in kw, (
+ assert 'self' not in kw and 'cls' not in kw, (
"You cannot use 'self' or 'cls' arguments to a "
"classinstancemethod")
return self.func(*((self.obj, self.type) + args), **kw)
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 1100769..2e308ea 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -130,7 +130,7 @@ def unmakeProperties(obj):
for var, value in d.items():
if isinstance(value, property):
for prop in [value.fget, value.fset, value.fdel]:
- if prop and not prop.__name__ in d:
+ if prop and prop.__name__ not in d:
delFunc(obj, var)
break
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index badf41d..f54a587 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -995,7 +995,7 @@ class CommandRecord(Command):
for fn in os.listdir(last_version_dir):
if not fn.endswith('.sql'):
continue
- if not fn in files_copy:
+ if fn not in files_copy:
if v > 1:
print("Missing file %s" % fn)
break
-----------------------------------------------------------------------
Summary of changes:
sqlobject/col.py | 2 +-
sqlobject/dbconnection.py | 6 +++---
sqlobject/declarative.py | 2 +-
sqlobject/main.py | 2 +-
sqlobject/manager/command.py | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-11 20:24:19
|
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 82df1caa6d872e8df1ce5bf2965f174fe6714a4d (commit)
via 29c489240f337bc3d55ee452f0cb21d97a86995f (commit)
via 9564667f87c5fe86dd4f9a0bf1076687eae9cca2 (commit)
via 5d40100f43be3926f47060501f7754a1670971f0 (commit)
via ef1b9c65417683526cf6d6c38b23be0d83591079 (commit)
via df9ec6c26dff78a00a13a27783a704368eb462bc (commit)
via 6f725c371b29aee1e77437d6c8ffc0c3d804323f (commit)
via abe460e629471cee275989de348878b69941753c (commit)
via 4ad16e0759cb3c8cc46d6f749ee3b8e48cb6c122 (commit)
via f06bfc89cd5bffca6bf8a5be4afbf3b1cb784d9e (commit)
via f3e919b0ce7cbee1079b402a54b40110750a44c9 (commit)
from e2045eab8a1620ea3896b46a0011f7a1b81a7d96 (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/82df1caa6d872e8df1ce5bf2965f174fe6714a4d
commit 82df1caa6d872e8df1ce5bf2965f174fe6714a4d
Author: Oleg Broytman <ph...@ph...>
Date: Wed Feb 11 23:09:44 2015 +0300
Fix #42 flake8 E124 closing bracket does not match visual indentation
diff --git a/setup.cfg b/setup.cfg
index 8ccf93b..2c8a0d8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -12,7 +12,6 @@ exclude = .git,docs/europython/*.py,ez_setup.py
; Ignore:
; E123 closing bracket does not match indentation of opening bracket's line
-; E124 closing bracket does not match visual indentation
; E226 missing whitespace around arithmetic operator
; E401 multiple imports on one line
; F403 'from module import *' used; unable to detect undefined names
@@ -20,7 +19,7 @@ exclude = .git,docs/europython/*.py,ez_setup.py
; F822 undefined name in __all__
; W391 blank line at end of file
; W603 '<>' is deprecated, use '!='
-ignore = E123,E124,E226,E401,F403,F812,F822,W391,W603
+ignore = E123,E226,E401,F403,F812,F822,W391,W603
[pudge]
theme = pythonpaste.org
diff --git a/setup.py b/setup.py
index 9045300..a356eb5 100755
--- a/setup.py
+++ b/setup.py
@@ -107,7 +107,7 @@ and `GitHub <https://github.com/sqlobject>`_.
"../docs/html/sqlobject/versioning/*.html",
],
"sqlobject.maxdb": ["readme.txt"],
- },
+ },
**kw
)
diff --git a/sqlobject/inheritance/__init__.py b/sqlobject/inheritance/__init__.py
index 32b609e..80cf52f 100644
--- a/sqlobject/inheritance/__init__.py
+++ b/sqlobject/inheritance/__init__.py
@@ -503,7 +503,7 @@ class InheritableSQLObject(SQLObject):
[(column.foreignName, name)
for (name, column) in currentClass.sqlmeta.columns.items()
if column.foreignKey
- ]))
+ ]))
currentClass = currentClass.sqlmeta.parentClass
for name, value in kw.items():
if name in foreignColumns:
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 4aa2f71..1100769 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1849,7 +1849,7 @@ def getObject(obj, klass):
else:
return obj
-__all__ = ['NoDefault', 'SQLObject',
- 'SQLObjectIntegrityError', 'SQLObjectNotFound',
- 'getID', 'getObject', 'sqlhub', 'sqlmeta',
- ]
+__all__ = [
+ 'NoDefault', 'SQLObject', 'SQLObjectIntegrityError', 'SQLObjectNotFound',
+ 'getID', 'getObject', 'sqlhub', 'sqlmeta',
+]
diff --git a/sqlobject/tests/dbtest.py b/sqlobject/tests/dbtest.py
index 1102c80..5edf3f8 100644
--- a/sqlobject/tests/dbtest.py
+++ b/sqlobject/tests/dbtest.py
@@ -322,4 +322,4 @@ def setupLogging():
__all__ = ['Dummy', 'deprecated_module', 'getConnection', 'getConnectionURI',
'inserts', 'raises', 'setupClass', 'setupLogging', 'setup_module',
'supports', 'teardown_module',
- ]
+ ]
diff --git a/sqlobject/tests/test_default_style.py b/sqlobject/tests/test_default_style.py
index 41162cf..1ce0f85 100644
--- a/sqlobject/tests/test_default_style.py
+++ b/sqlobject/tests/test_default_style.py
@@ -8,19 +8,21 @@ from sqlobject.styles import Style, MixedCaseUnderscoreStyle, MixedCaseStyle
# Hash of styles versus the database names resulting from 'columns' below.
columns = ["ABCUpper", "abc_lower", "ABCamelCaseColumn"]
-styles = {Style: columns,
- MixedCaseUnderscoreStyle: ["abc_upper", "abc_lower",
- "ab_camel_case_column"],
- MixedCaseStyle: ["ABCUpper", "Abc_lower", "ABCamelCaseColumn"],
- }
+styles = {
+ Style: columns,
+ MixedCaseUnderscoreStyle: ["abc_upper", "abc_lower",
+ "ab_camel_case_column"],
+ MixedCaseStyle: ["ABCUpper", "Abc_lower", "ABCamelCaseColumn"],
+}
# Hash of styles versus the database names
# resulting from a foreign key named 'FKey'.
fkey = ForeignKey("DefaultStyleTest", name="FKey")
-fkeys = {Style: "FKeyID",
- MixedCaseUnderscoreStyle: "f_key_id",
- MixedCaseStyle: "FKeyID",
- }
+fkeys = {
+ Style: "FKeyID",
+ MixedCaseUnderscoreStyle: "f_key_id",
+ MixedCaseStyle: "FKeyID",
+}
def make_columns():
diff --git a/sqlobject/tests/test_sqlobject_admin.py b/sqlobject/tests/test_sqlobject_admin.py
index be22e13..7debce3 100644
--- a/sqlobject/tests/test_sqlobject_admin.py
+++ b/sqlobject/tests/test_sqlobject_admin.py
@@ -13,8 +13,7 @@ class Test1(SQLObject):
class Test2(SQLObject):
class sqlmeta:
createSQL = ["CREATE SEQUENCE db_test2_seq;",
- "ALTER TABLE test2 ADD CHECK(test2 != '');"
- ]
+ "ALTER TABLE test2 ADD CHECK(test2 != '');"]
test2 = StringCol()
@@ -28,8 +27,7 @@ class Test3(SQLObject):
class Test4(SQLObject):
class sqlmeta:
createSQL = {'postgres': ['CREATE SEQUENCE db_test4_seq;',
- "ALTER TABLE test4 ADD CHECK(test4 != '');"
- ],
+ "ALTER TABLE test4 ADD CHECK(test4 != '');"],
'mysql': 'CREATE SEQUENCE db_test4_seq;'}
test4 = StringCol()
http://sourceforge.net/p/sqlobject/sqlobject/ci/29c489240f337bc3d55ee452f0cb21d97a86995f
commit 29c489240f337bc3d55ee452f0cb21d97a86995f
Merge: 5d40100 9564667
Author: Oleg Broytman <ph...@ph...>
Date: Tue Feb 10 20:22:31 2015 +0300
Merge pull request #76 from drnlm/fix_binary_call
sqlite3.Binary expects a bytes object on py3
http://sourceforge.net/p/sqlobject/sqlobject/ci/9564667f87c5fe86dd4f9a0bf1076687eae9cca2
commit 9564667f87c5fe86dd4f9a0bf1076687eae9cca2
Author: Neil <drn...@gm...>
Date: Tue Feb 10 12:00:15 2015 +0200
sqlite3.Binary expects to be called with a bytes object on python 3
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index df5a28e..6fb6586 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -339,7 +339,7 @@ class DBAPI(DBConnection):
self._pool = []
self._poolLock = threading.Lock()
DBConnection.__init__(self, **kw)
- self._binaryType = type(self.module.Binary(''))
+ self._binaryType = type(self.module.Binary(b''))
def _runWithConnection(self, meth, *args):
conn = self.getConnection()
http://sourceforge.net/p/sqlobject/sqlobject/ci/5d40100f43be3926f47060501f7754a1670971f0
commit 5d40100f43be3926f47060501f7754a1670971f0
Merge: ef1b9c6 6f725c3
Author: Oleg Broytman <ph...@ph...>
Date: Tue Feb 10 19:16:30 2015 +0300
Merge pull request #75 from drnlm/issue_45_E228
Fix #45 flake8 E228 missing whitespace around %-operator
http://sourceforge.net/p/sqlobject/sqlobject/ci/ef1b9c65417683526cf6d6c38b23be0d83591079
commit ef1b9c65417683526cf6d6c38b23be0d83591079
Merge: df9ec6c 4ad16e0
Author: Oleg Broytman <ph...@ph...>
Date: Tue Feb 10 19:15:05 2015 +0300
Merge pull request #74 from drnlm/further_import_fixes
Issue 3: Further import fixes
http://sourceforge.net/p/sqlobject/sqlobject/ci/df9ec6c26dff78a00a13a27783a704368eb462bc
commit df9ec6c26dff78a00a13a27783a704368eb462bc
Merge: e2045ea abe460e
Author: Oleg Broytman <ph...@ph...>
Date: Tue Feb 10 19:14:24 2015 +0300
Merge pull request #73 from drnlm/drop_new
Drop module new
http://sourceforge.net/p/sqlobject/sqlobject/ci/6f725c371b29aee1e77437d6c8ffc0c3d804323f
commit 6f725c371b29aee1e77437d6c8ffc0c3d804323f
Author: Neil <drn...@gm...>
Date: Tue Feb 10 16:37:46 2015 +0200
Fix E228 missing whitespace around modulo operator
diff --git a/sqlobject/views.py b/sqlobject/views.py
index 6193b77..4331b75 100644
--- a/sqlobject/views.py
+++ b/sqlobject/views.py
@@ -97,7 +97,7 @@ class ViewSQLObject(SQLObject):
last_id = "id"
last = Alias(select, last_alias)
columns = [
- ColumnAS(SQLConstant("%s.%s"%(last_alias, x.expr2)),
+ ColumnAS(SQLConstant("%s.%s" % (last_alias, x.expr2)),
x.expr2) for x in columns]
for i, agg in enumerate(aggregates):
@@ -108,7 +108,7 @@ class ViewSQLObject(SQLObject):
restriction = AND(clause, restriction)
agg = agg[1:]
agg_alias = "%s_%s" % (alias, i)
- agg_id = '%s_id'%agg_alias
+ agg_id = '%s_id' % agg_alias
if not last.q.alias.endswith('base'):
last = None
new_alias = Alias(Select(
@@ -126,7 +126,7 @@ class ViewSQLObject(SQLObject):
for col in agg:
columns.append(
ColumnAS(SQLConstant(
- "%s.%s"%(agg_alias, col.expr2)),
+ "%s.%s" % (agg_alias, col.expr2)),
col.expr2))
last = new_alias
http://sourceforge.net/p/sqlobject/sqlobject/ci/abe460e629471cee275989de348878b69941753c
commit abe460e629471cee275989de348878b69941753c
Author: Neil <drn...@gm...>
Date: Tue Feb 10 11:12:05 2015 +0200
Support python 3 MethodType signature
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index 4189368..df5a28e 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -828,8 +828,11 @@ class Transaction(object):
if not cls in self._deletedCache:
self._deletedCache[cls] = []
self._deletedCache[cls].append(inst.id)
- meth = types.MethodType(self._dbConnection._SO_delete.im_func,
- self, self.__class__)
+ if sys.version_info[0] < 3:
+ meth = types.MethodType(self._dbConnection._SO_delete.im_func,
+ self, self.__class__)
+ else:
+ meth = types.MethodType(self._dbConnection._SO_delete.im_func)
return meth(inst)
def commit(self, close=False):
@@ -882,7 +885,10 @@ class Transaction(object):
else:
return attr
else:
- meth = types.MethodType(func, self, self.__class__)
+ if sys.version_info[0] < 3:
+ meth = types.MethodType(func, self, self.__class__)
+ else:
+ meth = types.MethodType(func, self)
return meth
def _makeObsolete(self):
http://sourceforge.net/p/sqlobject/sqlobject/ci/4ad16e0759cb3c8cc46d6f749ee3b8e48cb6c122
commit 4ad16e0759cb3c8cc46d6f749ee3b8e48cb6c122
Author: Neil <drn...@gm...>
Date: Mon Feb 9 22:49:30 2015 +0200
Import StringIO from io in python 3
diff --git a/sqlobject/tests/test_csvexport.py b/sqlobject/tests/test_csvexport.py
index d0f3392..bd56a14 100644
--- a/sqlobject/tests/test_csvexport.py
+++ b/sqlobject/tests/test_csvexport.py
@@ -2,7 +2,10 @@ from __future__ import print_function
from sqlobject import *
from .dbtest import *
-from StringIO import StringIO
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
from sqlobject.util.csvexport import export_csv, export_csv_zip
diff --git a/sqlobject/util/csvexport.py b/sqlobject/util/csvexport.py
index 0bdbf92..58afbb9 100644
--- a/sqlobject/util/csvexport.py
+++ b/sqlobject/util/csvexport.py
@@ -6,7 +6,10 @@ import csv
try:
from cStringIO import StringIO
except ImportError:
- from StringIO import StringIO
+ try:
+ from StringIO import StringIO
+ except ImportError:
+ from io import StringIO
import sqlobject
__all__ = ['export_csv', 'export_csv_zip']
http://sourceforge.net/p/sqlobject/sqlobject/ci/f06bfc89cd5bffca6bf8a5be4afbf3b1cb784d9e
commit f06bfc89cd5bffca6bf8a5be4afbf3b1cb784d9e
Author: Neil <drn...@gm...>
Date: Mon Feb 9 22:44:14 2015 +0200
Fix more import statements
diff --git a/sqlobject/tests/test_delete.py b/sqlobject/tests/test_delete.py
index 63e3d4b..37bd3fd 100644
--- a/sqlobject/tests/test_delete.py
+++ b/sqlobject/tests/test_delete.py
@@ -1,6 +1,6 @@
from sqlobject import *
from sqlobject.tests.dbtest import *
-from test_basic import TestSO1, setupGetters
+from .test_basic import TestSO1, setupGetters
########################################
diff --git a/sqlobject/tests/test_sqlite.py b/sqlobject/tests/test_sqlite.py
index 3a4166e..ea5c3f5 100644
--- a/sqlobject/tests/test_sqlite.py
+++ b/sqlobject/tests/test_sqlite.py
@@ -3,7 +3,7 @@ import py.test
from sqlobject import *
from sqlobject.tests.dbtest import *
from sqlobject.tests.dbtest import setSQLiteConnectionFactory
-from test_basic import TestSO1
+from .test_basic import TestSO1
class SQLiteFactoryTest(SQLObject):
diff --git a/sqlobject/views.py b/sqlobject/views.py
index 6193b77..0ede35a 100644
--- a/sqlobject/views.py
+++ b/sqlobject/views.py
@@ -1,5 +1,5 @@
-from sqlbuilder import *
-from main import SQLObject
+from .sqlbuilder import *
+from .main import SQLObject
class ViewSQLObjectField(SQLObjectField):
http://sourceforge.net/p/sqlobject/sqlobject/ci/f3e919b0ce7cbee1079b402a54b40110750a44c9
commit f3e919b0ce7cbee1079b402a54b40110750a44c9
Author: Neil <drn...@gm...>
Date: Mon Feb 9 21:08:03 2015 +0200
Replace new with types module
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index c51e226..4189368 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -1,10 +1,6 @@
import atexit
import inspect
import sys
-if sys.version_info[0] < 3:
- # Temporary workaround - will need more attention to fix
- # usage of new in the code
- import new
import os
import threading
import types
@@ -832,8 +828,8 @@ class Transaction(object):
if not cls in self._deletedCache:
self._deletedCache[cls] = []
self._deletedCache[cls].append(inst.id)
- meth = new.instancemethod(self._dbConnection._SO_delete.im_func,
- self, self.__class__)
+ meth = types.MethodType(self._dbConnection._SO_delete.im_func,
+ self, self.__class__)
return meth(inst)
def commit(self, close=False):
@@ -886,7 +882,7 @@ class Transaction(object):
else:
return attr
else:
- meth = new.instancemethod(func, self, self.__class__)
+ meth = types.MethodType(func, self, self.__class__)
return meth
def _makeObsolete(self):
-----------------------------------------------------------------------
Summary of changes:
setup.cfg | 3 +--
setup.py | 2 +-
sqlobject/dbconnection.py | 18 ++++++++++--------
sqlobject/inheritance/__init__.py | 2 +-
sqlobject/main.py | 8 ++++----
sqlobject/tests/dbtest.py | 2 +-
sqlobject/tests/test_csvexport.py | 5 ++++-
sqlobject/tests/test_default_style.py | 20 +++++++++++---------
sqlobject/tests/test_delete.py | 2 +-
sqlobject/tests/test_sqlite.py | 2 +-
sqlobject/tests/test_sqlobject_admin.py | 6 ++----
sqlobject/util/csvexport.py | 5 ++++-
sqlobject/views.py | 10 +++++-----
13 files changed, 46 insertions(+), 39 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-09 18:41:12
|
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 e2045eab8a1620ea3896b46a0011f7a1b81a7d96 (commit)
from 8645913850e76d4ce31774ad0f871fd1a1e169e9 (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/e2045eab8a1620ea3896b46a0011f7a1b81a7d96
commit e2045eab8a1620ea3896b46a0011f7a1b81a7d96
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 9 21:36:01 2015 +0300
Fix #33 flake8 F402 import 'name' shadowed by loop variable
diff --git a/setup.cfg b/setup.cfg
index 4bae483..8ccf93b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -15,13 +15,12 @@ exclude = .git,docs/europython/*.py,ez_setup.py
; E124 closing bracket does not match visual indentation
; E226 missing whitespace around arithmetic operator
; E401 multiple imports on one line
-; 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
; F822 undefined name in __all__
; W391 blank line at end of file
; W603 '<>' is deprecated, use '!='
-ignore = E123,E124,E226,E401,F402,F403,F812,F822,W391,W603
+ignore = E123,E124,E226,E401,F403,F812,F822,W391,W603
[pudge]
theme = pythonpaste.org
diff --git a/sqlobject/main.py b/sqlobject/main.py
index f09aff0..4aa2f71 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -151,9 +151,9 @@ def findDependencies(name, registry=None):
def findDependantColumns(name, klass):
depends = []
- for col in klass.sqlmeta.columnList:
- if col.foreignKey == name and col.cascade is not None:
- depends.append(col)
+ for _col in klass.sqlmeta.columnList:
+ if _col.foreignKey == name and _col.cascade is not None:
+ depends.append(_col)
return depends
@@ -1221,10 +1221,10 @@ class SQLObject(object):
func(self)
def _SO_selectInit(self, row):
- for col, colValue in zip(self.sqlmeta.columnList, row):
- if col.to_python:
- colValue = col.to_python(colValue, self._SO_validatorState)
- setattr(self, instanceName(col.name), colValue)
+ for _col, colValue in zip(self.sqlmeta.columnList, row):
+ if _col.to_python:
+ colValue = _col.to_python(colValue, self._SO_validatorState)
+ setattr(self, instanceName(_col.name), colValue)
def _SO_getValue(self, name):
# Retrieves a single value from the database. Simple.
@@ -1550,19 +1550,19 @@ class SQLObject(object):
@classmethod
def createIndexes(cls, ifNotExists=False, connection=None):
conn = connection or cls._connection
- for index in cls.sqlmeta.indexes:
- if not index:
+ for _index in cls.sqlmeta.indexes:
+ if not _index:
continue
- conn._SO_createIndex(cls, index)
+ conn._SO_createIndex(cls, _index)
@classmethod
def createIndexesSQL(cls, connection=None):
conn = connection or cls._connection
sql = []
- for index in cls.sqlmeta.indexes:
- if not index:
+ for _index in cls.sqlmeta.indexes:
+ if not _index:
continue
- sql.append(conn.createIndexSQL(cls, index))
+ sql.append(conn.createIndexSQL(cls, _index))
return ';\n'.join(sql)
@classmethod
@@ -1639,14 +1639,14 @@ class SQLObject(object):
query = []
delete = setnull = restrict = False
- for col in cols:
- if col.cascade == False:
+ for _col in cols:
+ if _col.cascade == False:
# Found a restriction
restrict = True
- query.append(getattr(k.q, col.name) == self.id)
- if col.cascade == 'null':
- setnull = col.name
- elif col.cascade:
+ query.append(getattr(k.q, _col.name) == self.id)
+ if _col.cascade == 'null':
+ setnull = _col.name
+ elif _col.cascade:
delete = True
assert delete or setnull or restrict, (
"Class %s depends on %s accoriding to "
@@ -1724,12 +1724,12 @@ class SQLObject(object):
def _reprItems(self):
items = []
- for col in self.sqlmeta.columnList:
- value = getattr(self, col.name)
+ for _col in self.sqlmeta.columnList:
+ value = getattr(self, _col.name)
r = repr(value)
if len(r) > 20:
value = r[:17] + "..." + r[-1]
- items.append((col.name, value))
+ items.append((_col.name, value))
return items
@classmethod
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 9cc1af6..badf41d 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -64,20 +64,19 @@ def db_differences(soClass, conn):
pass
else:
existing = {}
- for col in columns:
- col = col.withClass(soClass)
- existing[col.dbName] = col
+ for _col in columns:
+ _col = _col.withClass(soClass)
+ existing[_col.dbName] = _col
missing = {}
- for col in soClass.sqlmeta.columnList:
- if col.dbName in existing:
- del existing[col.dbName]
+ for _col in soClass.sqlmeta.columnList:
+ if _col.dbName in existing:
+ del existing[_col.dbName]
else:
- missing[col.dbName] = col
- for col in existing.values():
- diffs.append('Database has extra column: %s'
- % col.dbName)
- for col in missing.values():
- diffs.append('Database missing column: %s' % col.dbName)
+ missing[_col.dbName] = _col
+ for _col in existing.values():
+ diffs.append('Database has extra column: %s' % _col.dbName)
+ for _col in missing.values():
+ diffs.append('Database missing column: %s' % _col.dbName)
return diffs
@@ -215,10 +214,10 @@ class Command(object):
"depends on" here mean "has a foreign key pointing to".
"""
depended = []
- for col in cls.sqlmeta.columnList:
- if col.foreignKey:
- other = findClass(col.foreignKey,
- col.soClass.sqlmeta.registry)
+ for _col in cls.sqlmeta.columnList:
+ if _col.foreignKey:
+ other = findClass(_col.foreignKey,
+ _col.soClass.sqlmeta.registry)
if (other is not cls) and (other not in depended):
depended.append(other)
return depended
@@ -783,23 +782,23 @@ class CommandStatus(Command):
soClass.sqlmeta.table, e))
continue
existing = {}
- for col in columns:
- col = col.withClass(soClass)
- existing[col.dbName] = col
+ for _col in columns:
+ _col = _col.withClass(soClass)
+ existing[_col.dbName] = _col
missing = {}
- for col in soClass.sqlmeta.columnList:
- if col.dbName in existing:
- del existing[col.dbName]
+ for _col in soClass.sqlmeta.columnList:
+ if _col.dbName in existing:
+ del existing[_col.dbName]
else:
- missing[col.dbName] = col
+ missing[_col.dbName] = _col
if existing:
self.print_class(soClass)
- for col in existing.values():
- print(' Database has extra column: %s' % col.dbName)
+ for _col in existing.values():
+ print(' Database has extra column: %s' % _col.dbName)
if missing:
self.print_class(soClass)
- for col in missing.values():
- print(' Database missing column: %s' % col.dbName)
+ for _col in missing.values():
+ print(' Database missing column: %s' % _col.dbName)
if existing or missing:
bad += 1
else:
@@ -891,8 +890,8 @@ class CommandExecute(Command):
sys.stdout.write("%s\t" % name)
sys.stdout.write("\n")
for row in rows:
- for col in row:
- sys.stdout.write("%r\t" % col)
+ for _col in row:
+ sys.stdout.write("%r\t" % _col)
sys.stdout.write("\n")
print()
diff --git a/sqlobject/maxdb/maxdbconnection.py b/sqlobject/maxdb/maxdbconnection.py
index b388b1c..c46c3ea 100644
--- a/sqlobject/maxdb/maxdbconnection.py
+++ b/sqlobject/maxdb/maxdbconnection.py
@@ -251,8 +251,8 @@ class MaxdbConnection(DBAPI):
keymap = {}
pkmap = {}
fkData = self.queryAll(self.GET_PK_AND_FK % tableName)
- for col, cons_type, refcol, reftable in fkData:
- col_name = col.lower()
+ for _col, cons_type, refcol, reftable in fkData:
+ col_name = _col.lower()
pkmap[col_name] = False
if cons_type == 'R':
keymap[col_name] = reftable.lower()
-----------------------------------------------------------------------
Summary of changes:
setup.cfg | 3 +-
sqlobject/main.py | 44 ++++++++++++++--------------
sqlobject/manager/command.py | 57 +++++++++++++++++------------------
sqlobject/maxdb/maxdbconnection.py | 4 +-
4 files changed, 53 insertions(+), 55 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-09 15:54:32
|
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 8645913850e76d4ce31774ad0f871fd1a1e169e9 (commit)
via 4ccc069f95fddcd0b977213ed6cc3834db45679e (commit)
from 272211a770b325c20197b187478a4781d61955fc (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/8645913850e76d4ce31774ad0f871fd1a1e169e9
commit 8645913850e76d4ce31774ad0f871fd1a1e169e9
Merge: 272211a 4ccc069
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 9 18:53:36 2015 +0300
Merge pull request #72 from drnlm/rework_itertools_count
Replace count.next() with next(count) to be compatible with python 3
http://sourceforge.net/p/sqlobject/sqlobject/ci/4ccc069f95fddcd0b977213ed6cc3834db45679e
commit 4ccc069f95fddcd0b977213ed6cc3834db45679e
Author: Neil <drn...@gm...>
Date: Mon Feb 9 16:10:18 2015 +0200
Replace count.next() with next(count) to be compatible with python 3
diff --git a/sqlobject/col.py b/sqlobject/col.py
index cc8558c..7174fcc 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -421,7 +421,7 @@ class Col(object):
super(Col, self).__init__()
self.__dict__['_name'] = name
self.__dict__['_kw'] = kw
- self.__dict__['creationOrder'] = creationOrder.next()
+ self.__dict__['creationOrder'] = next(creationOrder)
self.__dict__['_extra_vars'] = {}
def _set_name(self, value):
diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py
index e825cfa..d568fc4 100644
--- a/sqlobject/declarative.py
+++ b/sqlobject/declarative.py
@@ -108,7 +108,7 @@ class Declarative(object):
__restrict_attributes__ = None
def __classinit__(cls, new_attrs):
- cls.declarative_count = counter.next()
+ cls.declarative_count = next(counter)
for name in cls.__mutableattributes__:
if name not in new_attrs:
setattr(cls, copy.copy(getattr(cls, name)))
@@ -123,7 +123,7 @@ class Declarative(object):
for name, value in new_attrs.items():
setattr(self, name, value)
if 'declarative_count' not in new_attrs:
- self.declarative_count = counter.next()
+ self.declarative_count = next(counter)
def __init__(self, *args, **kw):
if self.__unpackargs__ and self.__unpackargs__[0] == '*':
diff --git a/sqlobject/index.py b/sqlobject/index.py
index fca8824..c1ec148 100644
--- a/sqlobject/index.py
+++ b/sqlobject/index.py
@@ -161,7 +161,7 @@ class DatabaseIndex(object):
def __init__(self, *columns, **kw):
kw['columns'] = columns
self.kw = kw
- self.creationOrder = creationOrder.next()
+ self.creationOrder = next(creationOrder)
def setName(self, value):
assert self.kw.get('name') is None, \
diff --git a/sqlobject/joins.py b/sqlobject/joins.py
index ee2ef16..63c8ec1 100644
--- a/sqlobject/joins.py
+++ b/sqlobject/joins.py
@@ -25,7 +25,7 @@ class Join(object):
kw['otherClass'] = otherClass
self.kw = kw
self._joinMethodName = self.kw.pop('joinMethodName', None)
- self.creationOrder = creationOrder.next()
+ self.creationOrder = next(creationOrder)
def _set_joinMethodName(self, value):
assert self._joinMethodName == value or self._joinMethodName is None, \
-----------------------------------------------------------------------
Summary of changes:
sqlobject/col.py | 2 +-
sqlobject/declarative.py | 4 ++--
sqlobject/index.py | 2 +-
sqlobject/joins.py | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-09 14:07:46
|
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 272211a770b325c20197b187478a4781d61955fc (commit)
from 41f1d8dcd07fd73386aa4fa1f44aae9f1ff9b1e5 (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/272211a770b325c20197b187478a4781d61955fc
commit 272211a770b325c20197b187478a4781d61955fc
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 9 17:06:39 2015 +0300
Fix #25 flake8 E502 backslash is redundant between brackets
diff --git a/setup.cfg b/setup.cfg
index 48c67ee..4bae483 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -15,14 +15,13 @@ exclude = .git,docs/europython/*.py,ez_setup.py
; E124 closing bracket does not match visual indentation
; E226 missing whitespace around arithmetic operator
; E401 multiple imports on one line
-; E502 the backslash is redundant between brackets
; 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
; F822 undefined name in __all__
; W391 blank line at end of file
; W603 '<>' is deprecated, use '!='
-ignore = E123,E124,E226,E401,E502,F402,F403,F812,F822,W391,W603
+ignore = E123,E124,E226,E401,F402,F403,F812,F822,W391,W603
[pudge]
theme = pythonpaste.org
diff --git a/setup.py b/setup.py
index f1f8ee9..9045300 100755
--- a/setup.py
+++ b/setup.py
@@ -84,7 +84,7 @@ and `GitHub <https://github.com/sqlobject>`_.
download_url="https://pypi.python.org/pypi/SQLObject/"
"%sdev-2014" % version,
license="LGPL",
- packages=["sqlobject"] + \
+ packages=["sqlobject"] +
['sqlobject.%s' % package for package in subpackages],
scripts=["scripts/sqlobject-admin", "scripts/sqlobject-convertOldURI"],
package_data={"sqlobject":
diff --git a/sqlobject/converters.py b/sqlobject/converters.py
index efae0c5..35cfcdc 100644
--- a/sqlobject/converters.py
+++ b/sqlobject/converters.py
@@ -208,7 +208,7 @@ def sqlrepr(obj, db=None):
except AttributeError:
converter = lookupConverter(obj)
if converter is None:
- raise ValueError("Unknown SQL builtin type: %s for %s" % \
+ raise ValueError("Unknown SQL builtin type: %s for %s" %
(type(obj), repr(obj)))
return converter(obj, db)
else:
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index ded823f..c51e226 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -542,11 +542,10 @@ class DBAPI(DBConnection):
return constraints
def createReferenceConstraints(self, soClass):
- refConstraints = [self.createReferenceConstraint(soClass, column) \
- for column in soClass.sqlmeta.columnList \
+ refConstraints = [self.createReferenceConstraint(soClass, column)
+ for column in soClass.sqlmeta.columnList
if isinstance(column, col.SOForeignKey)]
- refConstraintDefs = [constraint \
- for constraint in refConstraints \
+ refConstraintDefs = [constraint for constraint in refConstraints
if constraint]
return refConstraintDefs
diff --git a/sqlobject/firebird/firebirdconnection.py b/sqlobject/firebird/firebirdconnection.py
index 74ca35a..284330c 100644
--- a/sqlobject/firebird/firebirdconnection.py
+++ b/sqlobject/firebird/firebirdconnection.py
@@ -136,7 +136,7 @@ class FirebirdConnection(DBAPI):
return query
def createTable(self, soClass):
- self.query('CREATE TABLE %s (\n%s\n)' % \
+ self.query('CREATE TABLE %s (\n%s\n)' %
(soClass.sqlmeta.table, self.createColumns(soClass)))
self.query("CREATE GENERATOR GEN_%s" % soClass.sqlmeta.table)
return []
@@ -183,7 +183,7 @@ class FirebirdConnection(DBAPI):
# Get out if encoding is known allready (can by None as well).
if self.defaultDbEncoding == "":
self.defaultDbEncoding = str(self.queryOne(
- "SELECT rdb$character_set_name FROM rdb$database")[0].\
+ "SELECT rdb$character_set_name FROM rdb$database")[0].
strip().lower()) # encoding defined during db creation
if self.defaultDbEncoding == "none":
self.defaultDbEncoding = None
@@ -433,8 +433,9 @@ class FirebirdConnection(DBAPI):
return col.Col, {}
def createEmptyDatabase(self):
- self.module.create_database("CREATE DATABASE '%s' user '%s' password '%s'" % \
- (self.db, self.user, self.password))
+ self.module.create_database(
+ "CREATE DATABASE '%s' user '%s' password '%s'" %
+ (self.db, self.user, self.password))
def dropDatabase(self):
self.module.drop_database()
diff --git a/sqlobject/joins.py b/sqlobject/joins.py
index 3303aff..ee2ef16 100644
--- a/sqlobject/joins.py
+++ b/sqlobject/joins.py
@@ -359,7 +359,7 @@ class SOSingleJoin(SOMultipleJoin):
if not self.makeDefault:
return None
else:
- kw = {self.soClass.sqlmeta.style.\
+ kw = {self.soClass.sqlmeta.style.
instanceIDAttrToAttr(pythonColumn): inst}
# instanciating the otherClass with all
return self.otherClass(**kw)
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 9ca364c..f09aff0 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1229,7 +1229,7 @@ class SQLObject(object):
def _SO_getValue(self, name):
# Retrieves a single value from the database. Simple.
assert not self.sqlmeta._obsolete, (
- "%s with id %s has become obsolete" \
+ "%s with id %s has become obsolete"
% (self.__class__.__name__, self.id))
# @@: do we really need this lock?
# self._SO_writeLock.acquire()
diff --git a/sqlobject/maxdb/maxdbconnection.py b/sqlobject/maxdb/maxdbconnection.py
index 7b59943..b388b1c 100644
--- a/sqlobject/maxdb/maxdbconnection.py
+++ b/sqlobject/maxdb/maxdbconnection.py
@@ -173,7 +173,7 @@ class MaxdbConnection(DBAPI):
# self.createSequenceName(soClass.sqlmeta.table))
# t.commit()
# so use transaction when the problem will be solved
- self.query('CREATE TABLE %s (\n%s\n)' % \
+ self.query('CREATE TABLE %s (\n%s\n)' %
(soClass.sqlmeta.table, self.createColumns(soClass)))
self.query("CREATE SEQUENCE %s"
% self.createSequenceName(soClass.sqlmeta.table))
diff --git a/sqlobject/tests/test_sqlbuilder_joins_instances.py b/sqlobject/tests/test_sqlbuilder_joins_instances.py
index 1747f66..e1c56f2 100644
--- a/sqlobject/tests/test_sqlbuilder_joins_instances.py
+++ b/sqlobject/tests/test_sqlbuilder_joins_instances.py
@@ -79,7 +79,7 @@ def testJoin2():
list(SBAddress.select(
AND(SBPerson.q.id == SBAddress.q.personID,
SBPerson.q.name == 'Julia')).orderBy(SBAddress.q.city)) == \
- list(SBPerson.selectBy(name='Julia').throughTo.\
+ list(SBPerson.selectBy(name='Julia').throughTo.
addresses.orderBy(SBAddress.q.city))
-----------------------------------------------------------------------
Summary of changes:
setup.cfg | 3 +--
setup.py | 2 +-
sqlobject/converters.py | 2 +-
sqlobject/dbconnection.py | 7 +++----
sqlobject/firebird/firebirdconnection.py | 9 +++++----
sqlobject/joins.py | 2 +-
sqlobject/main.py | 2 +-
sqlobject/maxdb/maxdbconnection.py | 2 +-
sqlobject/tests/test_sqlbuilder_joins_instances.py | 2 +-
9 files changed, 15 insertions(+), 16 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-09 13:29:20
|
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 41f1d8dcd07fd73386aa4fa1f44aae9f1ff9b1e5 (commit)
via 7098443b63eca23003a5d1c0e18b8bf782559a8e (commit)
from 18c14963a7a79ff81d1637dbf916a00aab893fba (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/41f1d8dcd07fd73386aa4fa1f44aae9f1ff9b1e5
commit 41f1d8dcd07fd73386aa4fa1f44aae9f1ff9b1e5
Merge: 18c1496 7098443
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 9 16:28:13 2015 +0300
Merge pull request #71 from drnlm/fix_urllib_import
Update urllib usage in sqliteconnection
http://sourceforge.net/p/sqlobject/sqlobject/ci/7098443b63eca23003a5d1c0e18b8bf782559a8e
commit 7098443b63eca23003a5d1c0e18b8bf782559a8e
Author: Neil <ne...@di...>
Date: Mon Feb 9 13:22:00 2015 +0200
Update urllib usage in sqliteconnection
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index b3f009f..d301fb8 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -4,7 +4,10 @@ try:
from _thread import get_ident
except ImportError:
from thread import get_ident
-import urllib
+try:
+ from urllib import quote
+except ImportError:
+ from urllib.parse import quote
from sqlobject.dbconnection import DBAPI, Boolean
from sqlobject import col
from sqlobject.dberrors import *
@@ -130,7 +133,7 @@ class SQLiteConnection(DBAPI):
path = "//" + path
else:
path = "///" + path
- path = urllib.quote(path)
+ path = quote(path)
return 'sqlite:%s' % path
def getConnection(self):
-----------------------------------------------------------------------
Summary of changes:
sqlobject/sqlite/sqliteconnection.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-08 21:26:02
|
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 18c14963a7a79ff81d1637dbf916a00aab893fba (commit)
via d12ab4b5e63904f3e45a2cb362cc37ba7a5edd43 (commit)
via d7b80b7237d79f94c3be05283dfa6b3f33e156d9 (commit)
from ff296ca1f8996fd5a38074a440ac9c1436c7fb0e (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/18c14963a7a79ff81d1637dbf916a00aab893fba
commit 18c14963a7a79ff81d1637dbf916a00aab893fba
Merge: ff296ca d12ab4b
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 9 00:20:21 2015 +0300
Merge branch 'flake8-fixes'
diff --cc sqlobject/sqlite/sqliteconnection.py
index a62a9d8,57bedef..b3f009f
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@@ -142,9 -139,8 +142,8 @@@ class SQLiteConnection(DBAPI)
self._connectionNumbers[id(conn)] = self._connectionCount
self._connectionCount += 1
return conn
- threadid = thread.get_ident()
+ threadid = get_ident()
- if (self._pool is not None
- and threadid in self._threadPool):
+ if (self._pool is not None and threadid in self._threadPool):
conn = self._threadPool[threadid]
del self._threadPool[threadid]
if conn in self._pool:
http://sourceforge.net/p/sqlobject/sqlobject/ci/d12ab4b5e63904f3e45a2cb362cc37ba7a5edd43
commit d12ab4b5e63904f3e45a2cb362cc37ba7a5edd43
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 9 00:10:39 2015 +0300
Fix #18 flake8 E261 at least two spaces before inline comment
diff --git a/sqlobject/inheritance/tests/test_foreignKey.py b/sqlobject/inheritance/tests/test_foreignKey.py
index ce71846..357a5a3 100644
--- a/sqlobject/inheritance/tests/test_foreignKey.py
+++ b/sqlobject/inheritance/tests/test_foreignKey.py
@@ -51,7 +51,9 @@ def test_foreignKey():
persons = PersonWithNotes.selectBy(noteID=person.note.id)
assert persons.count() == 1
- employee = EmployeeWithNotes.select(PersonWithNotes.q.noteID <> None)
+ # comparison to None needed to build the right SQL expression
+ employee = EmployeeWithNotes.select(
+ PersonWithNotes.q.noteID != None) # noqa
assert employee.count() == 1
persons = PersonWithNotes.selectBy(noteID=person.note.id)
diff --git a/sqlobject/inheritance/tests/test_inheritance.py b/sqlobject/inheritance/tests/test_inheritance.py
index 83ec676..93d04cf 100644
--- a/sqlobject/inheritance/tests/test_inheritance.py
+++ b/sqlobject/inheritance/tests/test_inheritance.py
@@ -50,19 +50,23 @@ def test_inheritance():
def test_inheritance_select():
setup()
- persons = InheritablePerson.select(InheritablePerson.q.firstName <> None)
+ # comparison to None needed to build the right SQL expression
+ persons = InheritablePerson.select(
+ InheritablePerson.q.firstName != None) # noqa
assert persons.count() == 2
persons = InheritablePerson.select(InheritablePerson.q.firstName == "phd")
assert persons.count() == 0
- employees = Employee.select(Employee.q.firstName <> None)
+ # comparison to None needed to build the right SQL expression
+ employees = Employee.select(Employee.q.firstName != None) # noqa
assert employees.count() == 1
employees = Employee.select(Employee.q.firstName == "phd")
assert employees.count() == 0
- employees = Employee.select(Employee.q.position <> None)
+ # comparison to None needed to build the right SQL expression
+ employees = Employee.select(Employee.q.position != None) # noqa
assert employees.count() == 1
persons = InheritablePerson.selectBy(firstName="Project")
http://sourceforge.net/p/sqlobject/sqlobject/ci/d7b80b7237d79f94c3be05283dfa6b3f33e156d9
commit d7b80b7237d79f94c3be05283dfa6b3f33e156d9
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 8 21:31:09 2015 +0300
Fix #31 flake8 E129
visually indented line with same indent as next logical line
diff --git a/sqlobject/conftest.py b/sqlobject/conftest.py
index 7d71dff..fa29e1c 100644
--- a/sqlobject/conftest.py
+++ b/sqlobject/conftest.py
@@ -67,8 +67,8 @@ def pytest_configure(config):
class SQLObjectClass(py.test.collect.Class):
def run(self):
- if (isinstance(self.obj, type)
- and issubclass(self.obj, sqlobject.SQLObject)):
+ if (isinstance(self.obj, type) and
+ issubclass(self.obj, sqlobject.SQLObject)):
return []
return super(SQLObjectClass, self).run()
diff --git a/sqlobject/main.py b/sqlobject/main.py
index e1ff1fa..b783a42 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -821,8 +821,7 @@ class SQLObject(object):
# class. If so, then we need to remove that column from
# _columns.
for key in sqlmeta.columnDefinitions.keys():
- if (key in new_attrs
- and new_attrs[key] is None):
+ if (key in new_attrs and new_attrs[key] is None):
del sqlmeta.columnDefinitions[key]
for column in sqlmeta.columnDefinitions.values():
@@ -876,8 +875,7 @@ class SQLObject(object):
inheritance. Lastly it calls sqlmeta.setClass, which handles
much of the setup.
"""
- if ('sqlmeta' not in new_attrs
- and not is_base):
+ if ('sqlmeta' not in new_attrs and not is_base):
# We have to create our own subclass, usually.
# type(className, bases_tuple, attr_dict) creates a new subclass.
cls.sqlmeta = type('sqlmeta', (cls.sqlmeta,), {})
@@ -1533,7 +1531,7 @@ class SQLObject(object):
conn = connection or cls._connection
for join in cls._getJoinsToCreate():
if (ifNotExists and
- conn.tableExists(join.intermediateTable)):
+ conn.tableExists(join.intermediateTable)):
continue
conn._SO_createJoinTable(join)
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index c310af7..1b66e81 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -295,8 +295,8 @@ class Command(object):
if self.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):
+ if (getattr(self.options, 'simulate', False) and
+ not self.options.verbose):
self.options.verbose = 1
if self.min_args is not None and len(self.args) < self.min_args:
self.runner.invalid(
@@ -389,9 +389,9 @@ class Command(object):
else:
for name in dir(module):
value = getattr(module, name)
- if (isinstance(value, type)
- and issubclass(value, sqlobject.SQLObject)
- and value.__module__ == module.__name__):
+ if (isinstance(value, type) and
+ issubclass(value, sqlobject.SQLObject) and
+ value.__module__ == module.__name__):
all.append(value)
return all
@@ -412,8 +412,8 @@ class Command(object):
return None
config_file = self.options.config_file
if appconfig:
- if (not config_file.startswith('egg:')
- and not config_file.startswith('config:')):
+ if (not config_file.startswith('egg:') and
+ not config_file.startswith('config:')):
config_file = 'config:' + config_file
return appconfig(config_file,
relative_to=os.getcwd())
@@ -508,9 +508,8 @@ class Command(object):
def load_options_from_egg(self, egg_spec):
dist, conf = self.config_from_egg(egg_spec)
- if (hasattr(self.options, 'output_dir')
- and not self.options.output_dir
- and conf.get('history_dir')):
+ if (hasattr(self.options, 'output_dir') and
+ not self.options.output_dir and conf.get('history_dir')):
dir = conf['history_dir']
dir = dir.replace('$base', dist.location)
self.options.output_dir = dir
@@ -648,8 +647,8 @@ class CommandCreate(Command):
dbs_created = []
constraints = {}
for soClass in self.classes(require_some=True):
- if (self.options.create_db
- and soClass._connection not in dbs_created):
+ if (self.options.create_db and
+ soClass._connection not in dbs_created):
if not self.options.simulate:
try:
soClass._connection.createEmptyDatabase()
@@ -673,8 +672,7 @@ class CommandCreate(Command):
if v >= 2:
sql, extra = soClass.createTableSQL()
print(sql)
- if (not self.options.simulate
- and not exists):
+ if (not self.options.simulate and not exists):
if self.options.interactive:
if self.ask('Create %s' % soClass.__name__):
created += 1
@@ -723,8 +721,7 @@ class CommandDrop(Command):
else:
not_existing += 1
print('%s does not exist.' % soClass.__name__)
- if (not self.options.simulate
- and exists):
+ if (not self.options.simulate and exists):
if self.options.interactive:
if self.ask('Drop %s' % soClass.__name__):
dropped += 1
@@ -1006,8 +1003,8 @@ class CommandRecord(Command):
f = open(os.path.join(last_version_dir, fn), 'r')
content = f.read()
f.close()
- if (self.strip_comments(files_copy[fn])
- != self.strip_comments(content)):
+ if (self.strip_comments(files_copy[fn]) !=
+ self.strip_comments(content)):
if v > 1:
print("Content does not match: %s" % fn)
break
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index 2f398c1..57bedef 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -140,8 +140,7 @@ class SQLiteConnection(DBAPI):
self._connectionCount += 1
return conn
threadid = thread.get_ident()
- if (self._pool is not None
- and threadid in self._threadPool):
+ if (self._pool is not None and threadid in self._threadPool):
conn = self._threadPool[threadid]
del self._threadPool[threadid]
if conn in self._pool:
@@ -165,8 +164,8 @@ class SQLiteConnection(DBAPI):
return
threadid = self._threadOrigination.get(id(conn))
DBAPI.releaseConnection(self, conn, explicit=explicit)
- if (self._pool is not None and threadid
- and threadid not in self._threadPool):
+ if (self._pool is not None and threadid and
+ threadid not in self._threadPool):
self._threadPool[threadid] = conn
else:
if self._pool and conn in self._pool:
diff --git a/sqlobject/tests/test_declarative.py b/sqlobject/tests/test_declarative.py
index a97ba52..60f6e15 100644
--- a/sqlobject/tests/test_declarative.py
+++ b/sqlobject/tests/test_declarative.py
@@ -41,9 +41,8 @@ class B1(Declarative):
def add_attrs(old_attrs, new_attrs):
old_attrs = old_attrs[:]
for name in new_attrs.keys():
- if (name in old_attrs
- or name.startswith('_')
- or name in ('add_attrs', 'declarative_count', 'attrs')):
+ if (name in old_attrs or name.startswith('_') or
+ name in ('add_attrs', 'declarative_count', 'attrs')):
continue
old_attrs.append(name)
old_attrs.sort()
diff --git a/sqlobject/util/csvimport.py b/sqlobject/util/csvimport.py
index 247a9f2..fc91825 100644
--- a/sqlobject/util/csvimport.py
+++ b/sqlobject/util/csvimport.py
@@ -89,7 +89,7 @@ def create_data(data, class_getter, keyorder=None):
objects = {}
classnames = data.keys()
if (not keyorder and isinstance(class_getter, types.ModuleType)
- and hasattr(class_getter, 'soClasses')):
+ and hasattr(class_getter, 'soClasses')):
keyorder = [c.__name__ for c in class_getter.soClasses]
if not keyorder:
classnames.sort()
-----------------------------------------------------------------------
Summary of changes:
sqlobject/conftest.py | 4 +-
sqlobject/inheritance/tests/test_foreignKey.py | 3 +-
sqlobject/inheritance/tests/test_inheritance.py | 7 +++--
sqlobject/main.py | 8 ++---
sqlobject/manager/command.py | 33 ++++++++++------------
sqlobject/sqlite/sqliteconnection.py | 7 ++---
sqlobject/tests/test_declarative.py | 5 +--
sqlobject/util/csvimport.py | 2 +-
8 files changed, 32 insertions(+), 37 deletions(-)
hooks/post-receive
--
SQLObject development repository
|
|
From: Oleg B. <no...@so...> - 2015-02-08 19:54:29
|
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 ff296ca1f8996fd5a38074a440ac9c1436c7fb0e (commit)
via a0ef0cfaa4d0495bfe58d5652c0e3f008b454bc5 (commit)
via a4cb726354a95d40de803610d2120108dc4dbdc0 (commit)
from 3a880112a5e4219a8bfcee684f2e90a1082c41f0 (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/ff296ca1f8996fd5a38074a440ac9c1436c7fb0e
commit ff296ca1f8996fd5a38074a440ac9c1436c7fb0e
Merge: 3a88011 a0ef0cf
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 8 22:53:11 2015 +0300
Merge pull request #70 from drnlm/isse_44_flake8_E711
Issue 44: flake8 e711 - comparison to None
http://sourceforge.net/p/sqlobject/sqlobject/ci/a0ef0cfaa4d0495bfe58d5652c0e3f008b454bc5
commit a0ef0cfaa4d0495bfe58d5652c0e3f008b454bc5
Author: Neil <ne...@di...>
Date: Sun Feb 8 21:44:49 2015 +0200
Fix typo in comments
diff --git a/sqlobject/inheritance/tests/test_foreignKey.py b/sqlobject/inheritance/tests/test_foreignKey.py
index 74dbb97..ae582bf 100644
--- a/sqlobject/inheritance/tests/test_foreignKey.py
+++ b/sqlobject/inheritance/tests/test_foreignKey.py
@@ -44,14 +44,14 @@ def test_foreignKey():
assert employee.note.text == "employee"
save_employee = employee
- # comparison to Non needed to build the right SQL expression
+ # comparison to None needed to build the right SQL expression
persons = PersonWithNotes.select(PersonWithNotes.q.noteID != None) # noqa
assert persons.count() == 2
persons = PersonWithNotes.selectBy(noteID=person.note.id)
assert persons.count() == 1
- # comparison to Non needed to build the right SQL expression
+ # comparison to None needed to build the right SQL expression
employee = EmployeeWithNotes.select(PersonWithNotes.q.noteID != None) # noqa
assert employee.count() == 1
diff --git a/sqlobject/inheritance/tests/test_inheritance.py b/sqlobject/inheritance/tests/test_inheritance.py
index 155c892..a699cd7 100644
--- a/sqlobject/inheritance/tests/test_inheritance.py
+++ b/sqlobject/inheritance/tests/test_inheritance.py
@@ -50,21 +50,21 @@ def test_inheritance():
def test_inheritance_select():
setup()
- # comparison to Non needed to build the right SQL expression
+ # comparison to None needed to build the right SQL expression
persons = InheritablePerson.select(InheritablePerson.q.firstName != None) # noqa
assert persons.count() == 2
persons = InheritablePerson.select(InheritablePerson.q.firstName == "phd")
assert persons.count() == 0
- # comparison to Non needed to build the right SQL expression
+ # comparison to None needed to build the right SQL expression
employees = Employee.select(Employee.q.firstName != None) # noqa
assert employees.count() == 1
employees = Employee.select(Employee.q.firstName == "phd")
assert employees.count() == 0
- # comparison to Non needed to build the right SQL expression
+ # comparison to None needed to build the right SQL expression
employees = Employee.select(Employee.q.position != None) # noqa
assert employees.count() == 1
http://sourceforge.net/p/sqlobject/sqlobject/ci/a4cb726354a95d40de803610d2120108dc4dbdc0
commit a4cb726354a95d40de803610d2120108dc4dbdc0
Author: Neil <ne...@di...>
Date: Sun Feb 8 21:42:45 2015 +0200
Fix flake8 E711 - comparison to None should be 'if cond is (not) None:'
diff --git a/sqlobject/inheritance/tests/test_foreignKey.py b/sqlobject/inheritance/tests/test_foreignKey.py
index 92104f7..74dbb97 100644
--- a/sqlobject/inheritance/tests/test_foreignKey.py
+++ b/sqlobject/inheritance/tests/test_foreignKey.py
@@ -44,13 +44,15 @@ def test_foreignKey():
assert employee.note.text == "employee"
save_employee = employee
- persons = PersonWithNotes.select(PersonWithNotes.q.noteID != None)
+ # comparison to Non needed to build the right SQL expression
+ persons = PersonWithNotes.select(PersonWithNotes.q.noteID != None) # noqa
assert persons.count() == 2
persons = PersonWithNotes.selectBy(noteID=person.note.id)
assert persons.count() == 1
- employee = EmployeeWithNotes.select(PersonWithNotes.q.noteID != None)
+ # comparison to Non needed to build the right SQL expression
+ employee = EmployeeWithNotes.select(PersonWithNotes.q.noteID != None) # noqa
assert employee.count() == 1
persons = PersonWithNotes.selectBy(noteID=person.note.id)
diff --git a/sqlobject/inheritance/tests/test_inheritance.py b/sqlobject/inheritance/tests/test_inheritance.py
index a504d9f..155c892 100644
--- a/sqlobject/inheritance/tests/test_inheritance.py
+++ b/sqlobject/inheritance/tests/test_inheritance.py
@@ -50,19 +50,22 @@ def test_inheritance():
def test_inheritance_select():
setup()
- persons = InheritablePerson.select(InheritablePerson.q.firstName != None)
+ # comparison to Non needed to build the right SQL expression
+ persons = InheritablePerson.select(InheritablePerson.q.firstName != None) # noqa
assert persons.count() == 2
persons = InheritablePerson.select(InheritablePerson.q.firstName == "phd")
assert persons.count() == 0
- employees = Employee.select(Employee.q.firstName != None)
+ # comparison to Non needed to build the right SQL expression
+ employees = Employee.select(Employee.q.firstName != None) # noqa
assert employees.count() == 1
employees = Employee.select(Employee.q.firstName == "phd")
assert employees.count() == 0
- employees = Employee.select(Employee.q.position != None)
+ # comparison to Non needed to build the right SQL expression
+ employees = Employee.select(Employee.q.position != None) # noqa
assert employees.count() == 1
persons = InheritablePerson.selectBy(firstName="Project")
diff --git a/sqlobject/main.py b/sqlobject/main.py
index e206b33..7c05a56 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1238,7 +1238,7 @@ class SQLObject(object):
column = self.sqlmeta.columns[name]
results = self._connection._SO_selectOne(self, [column.dbName])
# self._SO_writeLock.release()
- assert results != None, "%s with id %s is not in the database" % (
+ assert results is not None, "%s with id %s is not in the database" % (
self.__class__.__name__, self.id)
value = results[0]
if column.to_python:
diff --git a/sqlobject/tests/test_cache.py b/sqlobject/tests/test_cache.py
index c256da3..b3a7dea 100644
--- a/sqlobject/tests/test_cache.py
+++ b/sqlobject/tests/test_cache.py
@@ -18,10 +18,10 @@ def test_purge1():
assert j == y
x.expire(1, y.__class__)
j = x.get(1, y.__class__)
- assert j == None
+ assert j is None
x.finishPut(y.__class__)
j = x.get(1, y.__class__)
- assert j == None
+ assert j is None
x.finishPut(y.__class__)
diff --git a/sqlobject/tests/test_enum.py b/sqlobject/tests/test_enum.py
index aa89ae1..432d464 100644
--- a/sqlobject/tests/test_enum.py
+++ b/sqlobject/tests/test_enum.py
@@ -45,7 +45,7 @@ def testDefaultNone():
setupClass(EnumWithDefaultNone)
e = EnumWithDefaultNone()
- assert e.l == None
+ assert e.l is None
class EnumWithDefaultOther(SQLObject):
diff --git a/sqlobject/tests/test_sqlbuilder.py b/sqlobject/tests/test_sqlbuilder.py
index 1bc1628..7a3eec7 100644
--- a/sqlobject/tests/test_sqlbuilder.py
+++ b/sqlobject/tests/test_sqlbuilder.py
@@ -33,7 +33,7 @@ def test_Select():
def test_empty_AND():
- assert AND() == None
+ assert AND() is None
assert AND(True) == True
# sqlrepr() is needed because AND() returns an SQLExpression that overrides
-----------------------------------------------------------------------
Summary of changes:
sqlobject/inheritance/tests/test_foreignKey.py | 6 ++++--
sqlobject/inheritance/tests/test_inheritance.py | 9 ++++++---
sqlobject/main.py | 2 +-
sqlobject/tests/test_cache.py | 4 ++--
sqlobject/tests/test_enum.py | 2 +-
sqlobject/tests/test_sqlbuilder.py | 2 +-
6 files changed, 15 insertions(+), 10 deletions(-)
hooks/post-receive
--
SQLObject development repository
|