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
|
Sep
|
Oct
|
Nov
|
Dec
|
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 |
From: Oleg B. <no...@so...> - 2015-02-08 14:38:50
|
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 3a880112a5e4219a8bfcee684f2e90a1082c41f0 (commit) via 76751416320130b67ee6a3dddf53141830706910 (commit) via 1de380e5ddbe17b6c25edabd2561d40fc0436eb7 (commit) via 325d0da1f45b6bd8a98c7472e207f6bda627ec01 (commit) from 748b6d60cc57aa07baa48dbb4ac17e930a61715a (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/3a880112a5e4219a8bfcee684f2e90a1082c41f0 commit 3a880112a5e4219a8bfcee684f2e90a1082c41f0 Merge: 748b6d6 7675141 Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 8 17:37:19 2015 +0300 Merge pull request #69 from drnlm/rewrite_parse_uri Rewrite parse uri to use urlparse http://sourceforge.net/p/sqlobject/sqlobject/ci/76751416320130b67ee6a3dddf53141830706910 commit 76751416320130b67ee6a3dddf53141830706910 Author: Neil <ne...@di...> Date: Sun Feb 8 10:41:36 2015 +0200 Add workaround for python 2.6 urlparse behaviour diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 277d5d9..ded823f 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -213,6 +213,12 @@ class DBConnection: @staticmethod def _parseURI(uri): parsed = urlparse(uri) + if sys.version_info[0] == 2 and sys.version_info[1] < 7: + # In python 2.6, urlparse only parses the uri completely + # for certain schemes, so we force the scheme to + # something that will be parsed correctly + scheme = parsed.scheme + parsed = urlparse(uri.replace(scheme, 'http', 1)) host, path = parsed.hostname, parsed.path user, password, port = None, None, None if parsed.username: http://sourceforge.net/p/sqlobject/sqlobject/ci/1de380e5ddbe17b6c25edabd2561d40fc0436eb7 commit 1de380e5ddbe17b6c25edabd2561d40fc0436eb7 Author: Neil <ne...@di...> Date: Fri Feb 6 11:45:09 2015 +0200 Update urllib and urlparse code to support python 3 diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 1ea7731..277d5d9 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -8,8 +8,12 @@ if sys.version_info[0] < 3: import os import threading import types -import urlparse -import urllib +try: + from urlparse import urlparse, parse_qsl + from urllib import unquote, quote, urlencode +except ImportError: + from urllib.parse import urlparse, parse_qsl, unquote, quote, urlencode + import warnings import weakref @@ -126,9 +130,9 @@ class DBConnection: def uri(self): auth = getattr(self, 'user', '') or '' if auth: - auth = urllib.quote(auth) + auth = quote(auth) if self.password: - auth = auth + ':' + urllib.quote(self.password) + auth = auth + ':' + quote(self.password) auth = auth + '@' else: assert not getattr(self, 'password', None), ( @@ -142,7 +146,7 @@ class DBConnection: db = self.db if db.startswith('/'): db = db[1:] - return uri + urllib.quote(db) + return uri + quote(db) @classmethod def connectionFromOldURI(cls, uri): @@ -202,23 +206,23 @@ class DBConnection: arglist = arglist.split('&') for single in arglist: argname, argvalue = single.split('=', 1) - argvalue = urllib.unquote(argvalue) + argvalue = unquote(argvalue) args[argname] = argvalue return user, password, host, port, path, args @staticmethod def _parseURI(uri): - parsed = urlparse.urlparse(uri) + parsed = urlparse(uri) host, path = parsed.hostname, parsed.path user, password, port = None, None, None if parsed.username: - user = urllib.unquote(parsed.username) + user = unquote(parsed.username) if parsed.password: - password = urllib.unquote(parsed.password) + password = unquote(parsed.password) if parsed.port: port = int(parsed.port) - path = urllib.unquote(path) + path = unquote(path) if (os.name == 'nt') and (len(path) > 2): # Preserve backward compatibility with URIs like /C|/path; # replace '|' by ':' @@ -233,7 +237,7 @@ class DBConnection: args = {} if query: - for name, value in urlparse.parse_qsl(query): + for name, value in parse_qsl(query): args[name] = value return user, password, host, port, path, args @@ -1041,9 +1045,9 @@ class ConnectionURIOpener(object): def connectionForURI(self, uri, oldUri=False, **args): if args: if '?' not in uri: - uri += '?' + urllib.urlencode(args) + uri += '?' + urlencode(args) else: - uri += '&' + urllib.urlencode(args) + uri += '&' + urlencode(args) if uri in self.cachedURIs: return self.cachedURIs[uri] if uri.find(':') != -1: http://sourceforge.net/p/sqlobject/sqlobject/ci/325d0da1f45b6bd8a98c7472e207f6bda627ec01 commit 325d0da1f45b6bd8a98c7472e207f6bda627ec01 Author: Neil <ne...@di...> Date: Fri Feb 6 11:44:33 2015 +0200 Rewrite _parseURI to use urlparse diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 6bcfb43..1ea7731 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -1,5 +1,4 @@ import atexit -from cgi import parse_qsl import inspect import sys if sys.version_info[0] < 3: @@ -9,6 +8,7 @@ if sys.version_info[0] < 3: import os import threading import types +import urlparse import urllib import warnings import weakref @@ -208,28 +208,15 @@ class DBConnection: @staticmethod def _parseURI(uri): - protocol, request = urllib.splittype(uri) + parsed = urlparse.urlparse(uri) + host, path = parsed.hostname, parsed.path user, password, port = None, None, None - host, path = urllib.splithost(request) - - if host: - # Python < 2.7 have a problem - - # splituser() calls unquote() too early - # user, host = urllib.splituser(host) - if '@' in host: - user, host = host.split('@', 1) - if user: - user, password = [x and urllib.unquote(x) or None - for x in urllib.splitpasswd(user)] - host, port = urllib.splitport(host) - if port: - port = int(port) - elif host == '': - host = None - - # hash-tag is splitted but ignored - path, tag = urllib.splittag(path) - path, query = urllib.splitquery(path) + if parsed.username: + user = urllib.unquote(parsed.username) + if parsed.password: + password = urllib.unquote(parsed.password) + if parsed.port: + port = int(parsed.port) path = urllib.unquote(path) if (os.name == 'nt') and (len(path) > 2): @@ -241,9 +228,12 @@ class DBConnection: if (path[0] == '/') and (path[2] == ':'): path = path[1:] + query = parsed.query + # hash-tag / fragment is ignored + args = {} if query: - for name, value in parse_qsl(query): + for name, value in urlparse.parse_qsl(query): args[name] = value return user, password, host, port, path, args ----------------------------------------------------------------------- Summary of changes: sqlobject/dbconnection.py | 62 ++++++++++++++++++++++---------------------- 1 files changed, 31 insertions(+), 31 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-07 23:13:35
|
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 748b6d60cc57aa07baa48dbb4ac17e930a61715a (commit) via 01fc573a97e58b590519dbdc4d6e6bd0d0eb72a6 (commit) via 7de150113a1b50d6b8ee66a6cde33237c1b953ec (commit) via bec0c4adec80590ad097d6c2b3bc726e955da903 (commit) via a991d3d66d4a021eb88ad1ff982686f3b930d468 (commit) via 3824b689bc7d35d35d40ef2c52ec47998a34b387 (commit) from aef770354252bc575c7972ac1a3bf1d199376069 (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/748b6d60cc57aa07baa48dbb4ac17e930a61715a commit 748b6d60cc57aa07baa48dbb4ac17e930a61715a Merge: aef7703 01fc573 Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 8 02:12:25 2015 +0300 Merge branch 'flake8-fixes' http://sourceforge.net/p/sqlobject/sqlobject/ci/01fc573a97e58b590519dbdc4d6e6bd0d0eb72a6 commit 01fc573a97e58b590519dbdc4d6e6bd0d0eb72a6 Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 8 02:05:39 2015 +0300 Fix #16 flake8 E128 continuation line under-indented for visual indent diff --git a/sqlobject/tests/test_auto.py b/sqlobject/tests/test_auto.py index 840f83b..9d6ff63 100644 --- a/sqlobject/tests/test_auto.py +++ b/sqlobject/tests/test_auto.py @@ -71,13 +71,13 @@ class TestPeople: def test_collidingName(self): raises(AssertionError, Person.sqlmeta.addColumn, - StringCol(name="name")) + StringCol(name="name")) raises(AssertionError, Person.sqlmeta.addColumn, - StringCol(name="_init")) + StringCol(name="_init")) raises(AssertionError, Person.sqlmeta.addColumn, - StringCol(name="expire")) + StringCol(name="expire")) raises(AssertionError, Person.sqlmeta.addColumn, - StringCol(name="set")) + StringCol(name="set")) raises(AssertionError, self._test_collidingName) http://sourceforge.net/p/sqlobject/sqlobject/ci/7de150113a1b50d6b8ee66a6cde33237c1b953ec commit 7de150113a1b50d6b8ee66a6cde33237c1b953ec Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 8 02:03:41 2015 +0300 Fix #22 flake8 E127 continuation line over-indented for visual indent diff --git a/sqlobject/maxdb/maxdbconnection.py b/sqlobject/maxdb/maxdbconnection.py index 226fe2e..2b6f4c5 100644 --- a/sqlobject/maxdb/maxdbconnection.py +++ b/sqlobject/maxdb/maxdbconnection.py @@ -66,9 +66,9 @@ class MaxdbConnection(DBAPI): dbName = 'maxdb' schemes = [dbName] - def __init__ (self, host='', port=None, user=None, password=None, - database=None, autoCommit=1, sqlmode='internal', - isolation=None, timeout=None, **kw): + def __init__(self, host='', port=None, user=None, password=None, + database=None, autoCommit=1, sqlmode='internal', + isolation=None, timeout=None, **kw): from sapdb import dbapi self.module = dbapi self.host = host http://sourceforge.net/p/sqlobject/sqlobject/ci/bec0c4adec80590ad097d6c2b3bc726e955da903 commit bec0c4adec80590ad097d6c2b3bc726e955da903 Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 7 21:31:34 2015 +0300 Fix #39 flake8 W291 trailing whitespace diff --git a/setup.cfg b/setup.cfg index 370092e..48c67ee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,10 +20,9 @@ exclude = .git,docs/europython/*.py,ez_setup.py ; F403 'from module import *' used; unable to detect undefined names ; F812 list comprehension redefines 'name' from line 1402 ; F822 undefined name in __all__ -; W291 trailing whitespace ; W391 blank line at end of file ; W603 '<>' is deprecated, use '!=' -ignore = E123,E124,E226,E401,E502,F402,F403,F812,F822,W291,W391,W603 +ignore = E123,E124,E226,E401,E502,F402,F403,F812,F822,W391,W603 [pudge] theme = pythonpaste.org diff --git a/setup.py b/setup.py index 86dfe5a..f1f8ee9 100755 --- a/setup.py +++ b/setup.py @@ -163,4 +163,4 @@ http://sqlobject.org/docs/News.html -- Ian Bicking / ia...@co... / http://blog.ianbicking.org -""" +""" # noqa: preserve space after two dashes diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py index 2531dd0..88e3445 100644 --- a/sqlobject/mssql/mssqlconnection.py +++ b/sqlobject/mssql/mssqlconnection.py @@ -49,7 +49,7 @@ class MSSQLConnection(DBAPI): conn_str += "Data Source=%s;Initial Catalog=%s;" - # MSDE does not allow SQL server login + # MSDE does not allow SQL server login if kw.get("sspi"): conn_str += \ "Integrated Security=SSPI;Persist Security Info=False" @@ -219,8 +219,8 @@ class MSSQLConnection(DBAPI): self.query('ALTER TABLE %s DROP COLUMN %s' % (sqlmeta.table, column.dbName)) - # precision and scale is gotten from column table so that we can create - # decimal columns if needed + # Precision and scale is gotten from column table + # so that we can create decimal columns if needed. SHOW_COLUMNS = """ select name, diff --git a/sqlobject/tests/test_cyclic_reference.py b/sqlobject/tests/test_cyclic_reference.py index 4dfd6f7..55f8712 100644 --- a/sqlobject/tests/test_cyclic_reference.py +++ b/sqlobject/tests/test_cyclic_reference.py @@ -24,7 +24,7 @@ class TestCyclicReferenceB(SQLObject): time = DateTimeCol() short = StringCol(length=10) blobcol = BLOBCol() - fkeya = ForeignKey('TestCyclicReferenceA') + fkeya = ForeignKey('TestCyclicReferenceA') def test_cyclic_reference(): diff --git a/sqlobject/versioning/test/test_version.py b/sqlobject/versioning/test/test_version.py index 56f8766..ca64ce5 100644 --- a/sqlobject/versioning/test/test_version.py +++ b/sqlobject/versioning/test/test_version.py @@ -174,11 +174,11 @@ def test_extra(): setup() extra = Extra(name='title') extra.name = 'new' - assert extra.versions[0].extra == 'read all about it' + assert extra.versions[0].extra == 'read all about it' assert sorted(extra.versions[0].getChangedFields()) == ['Name'] def test_altid(): setup() - extra = HasAltId(name="fleem", altid=5) + extra = HasAltId(name="fleem", altid=5) extra.name = "morx" http://sourceforge.net/p/sqlobject/sqlobject/ci/a991d3d66d4a021eb88ad1ff982686f3b930d468 commit a991d3d66d4a021eb88ad1ff982686f3b930d468 Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 7 21:26:21 2015 +0300 Fix flake8 E302 expected 2 blank lines, found 1 diff --git a/sqlobject/dberrors.py b/sqlobject/dberrors.py index bd60bd8..2feedbc 100644 --- a/sqlobject/dberrors.py +++ b/sqlobject/dberrors.py @@ -9,6 +9,7 @@ import sys if sys.version_info[0] >= 3: StandardError = Exception + class Error(StandardError): pass http://sourceforge.net/p/sqlobject/sqlobject/ci/3824b689bc7d35d35d40ef2c52ec47998a34b387 commit 3824b689bc7d35d35d40ef2c52ec47998a34b387 Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 7 18:22:39 2015 +0300 Fix #30 flake8 W293 blank line contains whitespace diff --git a/setup.cfg b/setup.cfg index 863e0a5..370092e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,10 +21,9 @@ exclude = .git,docs/europython/*.py,ez_setup.py ; F812 list comprehension redefines 'name' from line 1402 ; F822 undefined name in __all__ ; W291 trailing whitespace -; W293 blank line contains whitespace ; W391 blank line at end of file ; W603 '<>' is deprecated, use '!=' -ignore = E123,E124,E226,E401,E502,F402,F403,F812,F822,W291,W293,W391,W603 +ignore = E123,E124,E226,E401,E502,F402,F403,F812,F822,W291,W391,W603 [pudge] theme = pythonpaste.org diff --git a/sqlobject/cache.py b/sqlobject/cache.py index 690b137..111b5a3 100644 --- a/sqlobject/cache.py +++ b/sqlobject/cache.py @@ -374,4 +374,3 @@ class CacheSet(object): return self.caches[cls.__name__].getAll() else: return [] - diff --git a/sqlobject/dberrors.py b/sqlobject/dberrors.py index 986c80d..bd60bd8 100644 --- a/sqlobject/dberrors.py +++ b/sqlobject/dberrors.py @@ -1,7 +1,7 @@ """dberrors: database exception classes for SQLObject. These classes are dictated by the DB API v2.0: - + http://www.python.org/topics/database/DatabaseAPI-2.0.html """ diff --git a/sqlobject/tests/dbtest.py b/sqlobject/tests/dbtest.py index 14b2fea..a093f77 100644 --- a/sqlobject/tests/dbtest.py +++ b/sqlobject/tests/dbtest.py @@ -268,7 +268,7 @@ def supports(feature): "The supportMatrix does not list this feature: %r" % feature) - + # To avoid name clashes: _inserts = inserts diff --git a/sqlobject/tests/test_combining_joins.py b/sqlobject/tests/test_combining_joins.py index 3423ec2..690570e 100644 --- a/sqlobject/tests/test_combining_joins.py +++ b/sqlobject/tests/test_combining_joins.py @@ -38,10 +38,10 @@ def test_join_sqlrepr(): u2.complexes.add(c2) u2.complexes.add(c3) assert list(Complex.selectBy(name='c1')) == [c1] - + assert list(cg1.unit_models) == [u1] assert list(cg2.unit_models) == [u1, u2, u2] assert list(cg2.unit_models.distinct()) == [u1, u2] - + assert list( cg2.unit_models.filter(UnitModel.q.name == 'u1')) == [u1] diff --git a/sqlobject/tests/test_paste.py b/sqlobject/tests/test_paste.py index 8c52dee..98e4ac5 100644 --- a/sqlobject/tests/test_paste.py +++ b/sqlobject/tests/test_paste.py @@ -90,4 +90,3 @@ def test_other(): setup() assert runapp(use_transaction=True) assert names() == ['app1', 'app2'] - diff --git a/sqlobject/tests/test_sqlbuilder_dbspecific.py b/sqlobject/tests/test_sqlbuilder_dbspecific.py index 08768cf..029b72b 100644 --- a/sqlobject/tests/test_sqlbuilder_dbspecific.py +++ b/sqlobject/tests/test_sqlbuilder_dbspecific.py @@ -41,14 +41,14 @@ def testMiscOps(): setupClass(SBButton) yield checkCount, AND(makeClause(), makeClause()), 2 yield checkCount, AND(makeClause(), EXISTS(makeSelect())), 2 - - + + def testAliased(): setupClass(SBButton) b = Alias(makeSelect(), 'b') yield checkCount, b, 1 yield checkCount, Select(b.q.id), 1 - + # Table1 & Table2 are treated individually in joins yield checkCount, JOIN(None, b), 1 yield checkCount, JOIN(b, SBButton), 1 @@ -56,10 +56,9 @@ def testAliased(): yield checkCount, LEFTJOINOn(None, b, SBButton.q.id == b.q.id), 1 yield checkCount, LEFTJOINOn(b, SBButton, SBButton.q.id == b.q.id), 1 yield checkCount, LEFTJOINOn(SBButton, b, SBButton.q.id == b.q.id), 1 - - + + def testTablesUsedSResults(): setupClass(SBButton) - + yield checkCount, SBButton.select(makeClause()).queryForSelect(), 1 - diff --git a/sqlobject/util/csvimport.py b/sqlobject/util/csvimport.py index fe7b2cb..247a9f2 100644 --- a/sqlobject/util/csvimport.py +++ b/sqlobject/util/csvimport.py @@ -10,7 +10,7 @@ Supported types: A python expression, run through ``eval()``. This can be a security risk, pass in ``allow_python=False`` if you don't want to allow it. - + ``:int``: Integer @@ -137,7 +137,7 @@ def create_data(data, class_getter, keyorder=None): else: objects[name] = inst return objects - + def load_csv_from_directory(directory, allow_python=True, default_type=DEFAULT_TYPE, @@ -175,7 +175,7 @@ def load_csv(csvreader, allow_python=True, default_type=DEFAULT_TYPE, current_class = default_class current_headers = None results = {} - + for row in csvreader: if not [cell for cell in row if cell.strip()]: # empty row @@ -336,7 +336,7 @@ def parse_datetime(v): else: parsed = time.strptime(v, fmts[-1]) return datetime.fromtimestamp(time.mktime(parsed)) - + register_coercer('datetime', parse_datetime) diff --git a/sqlobject/views.py b/sqlobject/views.py index 862b8dd..6193b77 100644 --- a/sqlobject/views.py +++ b/sqlobject/views.py @@ -44,7 +44,7 @@ class ViewSQLObject(SQLObject): See test_views.py for simple examples. """ - + def __classinit__(cls, new_attrs): SQLObject.__classinit__(cls, new_attrs) # like is_base diff --git a/sqlobject/wsgi_middleware.py b/sqlobject/wsgi_middleware.py index 5a605aa..b1395ae 100644 --- a/sqlobject/wsgi_middleware.py +++ b/sqlobject/wsgi_middleware.py @@ -18,11 +18,11 @@ def make_middleware(app, global_conf, database=None, use_transaction=False, ``sqlobject.get_connection()``: Returns the connection object - + ``sqlobject.abort()``: Aborts the transaction. Does not raise an error, but at the *end* of the request there will be a rollback. - + ``sqlobject.begin()``: Starts a transaction. First commits (or rolls back if aborted) if this is run in a transaction. @@ -102,4 +102,3 @@ class SQLObjectMiddleware(object): environ['sqlobject.in_transaction'] = in_transaction return catch_errors(self.app, environ, start_response, error_callback=error, ok_callback=ok) - ----------------------------------------------------------------------- Summary of changes: setup.cfg | 5 ++--- setup.py | 2 +- sqlobject/cache.py | 1 - sqlobject/dberrors.py | 3 ++- sqlobject/maxdb/maxdbconnection.py | 4 ++-- sqlobject/mssql/mssqlconnection.py | 6 +++--- sqlobject/tests/dbtest.py | 2 +- sqlobject/tests/test_auto.py | 8 ++++---- sqlobject/tests/test_combining_joins.py | 4 ++-- sqlobject/tests/test_cyclic_reference.py | 2 +- sqlobject/tests/test_paste.py | 1 - sqlobject/tests/test_sqlbuilder_dbspecific.py | 13 ++++++------- sqlobject/util/csvimport.py | 8 ++++---- sqlobject/versioning/test/test_version.py | 4 ++-- sqlobject/views.py | 2 +- sqlobject/wsgi_middleware.py | 5 ++--- 16 files changed, 33 insertions(+), 37 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-07 12:02:36
|
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 aef770354252bc575c7972ac1a3bf1d199376069 (commit) via de8725ee3c5dcb879e5c1bee632dc0d8a3ba09be (commit) via 08779bbf61cd9153f4c8b619a6dd415ce6098f7c (commit) via aac5b4e900aaf10eb8544a158cafce9ebfa77ca3 (commit) from 57d02341d725820da1574fbdcc58c5b173cbf3c9 (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/aef770354252bc575c7972ac1a3bf1d199376069 commit aef770354252bc575c7972ac1a3bf1d199376069 Merge: de8725e 08779bb Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 7 14:59:10 2015 +0300 Merge pull request #68 from drnlm/issue_34_flake8_E303 Issue #34: Fix flake8 E303 - Too many blank lines http://sourceforge.net/p/sqlobject/sqlobject/ci/de8725ee3c5dcb879e5c1bee632dc0d8a3ba09be commit de8725ee3c5dcb879e5c1bee632dc0d8a3ba09be Merge: 57d0234 aac5b4e Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 7 14:56:48 2015 +0300 Merge pull request #67 from drnlm/fix_test_md5 Tweak test_md5 to be compatible with python 3 http://sourceforge.net/p/sqlobject/sqlobject/ci/08779bbf61cd9153f4c8b619a6dd415ce6098f7c commit 08779bbf61cd9153f4c8b619a6dd415ce6098f7c Author: Neil <ne...@di...> Date: Sat Feb 7 08:56:39 2015 +0200 Fix flake8 E303 - Too many blank lines diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 1295691..6bcfb43 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -621,7 +621,6 @@ class DBAPI(DBConnection): def _SO_selectOne(self, so, columnNames): return self._SO_selectOneAlt(so, columnNames, so.q.id == so.id) - def _SO_selectOneAlt(self, so, columnNames, condition): if columnNames: columns = [isinstance(x, basestring) and sqlbuilder.SQLConstant(x) diff --git a/sqlobject/inheritance/tests/test_foreignKey.py b/sqlobject/inheritance/tests/test_foreignKey.py index 49f19cd..92104f7 100644 --- a/sqlobject/inheritance/tests/test_foreignKey.py +++ b/sqlobject/inheritance/tests/test_foreignKey.py @@ -34,7 +34,6 @@ def test_foreignKey(): EmployeeWithNotes(firstName='Senior', lastName='Clerk', paper=paper) PersonWithNotes(firstName='Some', lastName='Person') - person = PersonWithNotes.get(1) assert isinstance(person, PersonWithNotes) and \ not isinstance(person, EmployeeWithNotes) diff --git a/sqlobject/joins.py b/sqlobject/joins.py index 02280a0..3303aff 100644 --- a/sqlobject/joins.py +++ b/sqlobject/joins.py @@ -227,7 +227,6 @@ class SORelatedJoin(SOMultipleJoin): self.otherColumn = self.soClass.sqlmeta.style.tableReference( otherClass.sqlmeta.table) - def hasIntermediateTable(self): return True @@ -372,7 +371,6 @@ class SingleJoin(Join): baseClass = SOSingleJoin - from . import boundattributes diff --git a/sqlobject/main.py b/sqlobject/main.py index 6dbde14..e206b33 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -1743,7 +1743,6 @@ class SQLObject(object): def tablesUsedImmediate(self): return [self.__class__.q] - # Comparison def __eq__(self, other): @@ -1767,7 +1766,6 @@ class SQLObject(object): def __ge__(self, other): return NotImplemented - # (De)serialization (pickle, etc.) def __getstate__(self): diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index c310af7..27b57fe 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -1229,7 +1229,6 @@ class CommandUpgrade(CommandRecord): self.update_db(next_version, conn) print('Done.') - def current_version(self): conn = self.connection() if not conn.tableExists(SQLObjectVersionTable.sqlmeta.table): diff --git a/sqlobject/sresults.py b/sqlobject/sresults.py index 924c7e5..ce02f93 100644 --- a/sqlobject/sresults.py +++ b/sqlobject/sresults.py @@ -151,7 +151,6 @@ class SelectResults(object): return list(self)[value.start:] return list(self)[:value.stop] - if value.start: assert value.start >= 0 start = self.ops.get('start', 0) + value.start diff --git a/sqlobject/tests/test_sqlbuilder_joins_instances.py b/sqlobject/tests/test_sqlbuilder_joins_instances.py index d96ae5b..1747f66 100644 --- a/sqlobject/tests/test_sqlbuilder_joins_instances.py +++ b/sqlobject/tests/test_sqlbuilder_joins_instances.py @@ -39,7 +39,6 @@ def testJoin(): SBAddress.q.city == 'London'))) == \ list(SBAddress.selectBy(city='London').throughTo.person) - assert list(SBAddress.select( AND(SBPerson.q.id == SBAddress.q.personID, SBPerson.q.name == 'Julia')).orderBy(SBAddress.q.city)) == \ diff --git a/sqlobject/versioning/test/test_version.py b/sqlobject/versioning/test/test_version.py index c8a7d60..0ab1ec2 100644 --- a/sqlobject/versioning/test/test_version.py +++ b/sqlobject/versioning/test/test_version.py @@ -97,7 +97,6 @@ def test_inheritable_versioning(): child.set(name='teenager', toy='guitar') assert len(list(child.versions)) == 0 - # child versioned, base unversioned government = Government(name='canada') assert not hasattr(government, 'versions') http://sourceforge.net/p/sqlobject/sqlobject/ci/aac5b4e900aaf10eb8544a158cafce9ebfa77ca3 commit aac5b4e900aaf10eb8544a158cafce9ebfa77ca3 Author: Neil <ne...@di...> Date: Fri Feb 6 11:46:02 2015 +0200 Tweak test_md5 to be compatible with python 3 diff --git a/sqlobject/tests/test_md5.py b/sqlobject/tests/test_md5.py index 128fc6b..ca01368 100644 --- a/sqlobject/tests/test_md5.py +++ b/sqlobject/tests/test_md5.py @@ -7,7 +7,7 @@ from hashlib import md5 def test_md5(): - assert md5('').hexdigest() == 'd41d8cd98f00b204e9800998ecf8427e' - assert md5('\n').hexdigest() == '68b329da9893e34099c7d8ad5cb9c940' - assert md5('123').hexdigest() == '202cb962ac59075b964b07152d234b70' - assert md5('123\n').hexdigest() == 'ba1f2511fc30423bdbb183fe33f3dd0f' + assert md5(b'').hexdigest() == 'd41d8cd98f00b204e9800998ecf8427e' + assert md5(b'\n').hexdigest() == '68b329da9893e34099c7d8ad5cb9c940' + assert md5(b'123').hexdigest() == '202cb962ac59075b964b07152d234b70' + assert md5(b'123\n').hexdigest() == 'ba1f2511fc30423bdbb183fe33f3dd0f' ----------------------------------------------------------------------- Summary of changes: sqlobject/dbconnection.py | 1 - sqlobject/inheritance/tests/test_foreignKey.py | 1 - sqlobject/joins.py | 2 -- sqlobject/main.py | 2 -- sqlobject/manager/command.py | 1 - sqlobject/sresults.py | 1 - sqlobject/tests/test_md5.py | 8 ++++---- sqlobject/tests/test_sqlbuilder_joins_instances.py | 1 - sqlobject/versioning/test/test_version.py | 1 - 9 files changed, 4 insertions(+), 14 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-06 20:45:58
|
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 57d02341d725820da1574fbdcc58c5b173cbf3c9 (commit) via 85d3f0a07baf0885d41ce6cc00e414f1b5cb5f9b (commit) from bb333927311676fc023ec54938be81a2ee7e0d03 (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/57d02341d725820da1574fbdcc58c5b173cbf3c9 commit 57d02341d725820da1574fbdcc58c5b173cbf3c9 Merge: bb33392 85d3f0a Author: Oleg Broytman <ph...@ph...> Date: Fri Feb 6 23:44:28 2015 +0300 Merge pull request #66 from drnlm/issue_48_flak8_E121 Issue 48: Fix E121 - continuation line under-indented for hanging indent http://sourceforge.net/p/sqlobject/sqlobject/ci/85d3f0a07baf0885d41ce6cc00e414f1b5cb5f9b commit 85d3f0a07baf0885d41ce6cc00e414f1b5cb5f9b Author: Neil <ne...@di...> Date: Fri Feb 6 22:06:50 2015 +0200 Fix E121 - continuation line under-indented for hanging indent diff --git a/sqlobject/inheritance/__init__.py b/sqlobject/inheritance/__init__.py index b570310..32b609e 100644 --- a/sqlobject/inheritance/__init__.py +++ b/sqlobject/inheritance/__init__.py @@ -4,7 +4,7 @@ from sqlobject import events from sqlobject import sqlbuilder from sqlobject.col import StringCol, ForeignKey from sqlobject.main import sqlmeta, SQLObject, SelectResults, \ - makeProperties, unmakeProperties, getterName, setterName + makeProperties, unmakeProperties, getterName, setterName from . import iteration diff --git a/sqlobject/sresults.py b/sqlobject/sresults.py index b740996..924c7e5 100644 --- a/sqlobject/sresults.py +++ b/sqlobject/sresults.py @@ -29,7 +29,7 @@ class SelectResults(object): del ops['connection'] if ops.get('limit', None): assert not ops.get('start', None) and not ops.get('end', None), \ - "'limit' cannot be used with 'start' or 'end'" + "'limit' cannot be used with 'start' or 'end'" ops["start"] = 0 ops["end"] = ops.pop("limit") ----------------------------------------------------------------------- Summary of changes: sqlobject/inheritance/__init__.py | 2 +- sqlobject/sresults.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-06 17:05: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 bb333927311676fc023ec54938be81a2ee7e0d03 (commit) via dbbdc86fb22854682d8e1a94ae0154e558903028 (commit) via 753903081500d91fe246e0286089758ef3de0c31 (commit) via 49b63d9d3ad7cb82d7b31e86257e2af49dbce240 (commit) from 0b9ad6e9a3927353359f32ab50181217a2f0a4d8 (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/bb333927311676fc023ec54938be81a2ee7e0d03 commit bb333927311676fc023ec54938be81a2ee7e0d03 Merge: 7539030 dbbdc86 Author: Oleg Broytman <ph...@ph...> Date: Fri Feb 6 20:03:54 2015 +0300 Merge pull request #65 from drnlm/issue_47_flak8_E211 Issue 47: Fix E211 - whitespace before ( http://sourceforge.net/p/sqlobject/sqlobject/ci/dbbdc86fb22854682d8e1a94ae0154e558903028 commit dbbdc86fb22854682d8e1a94ae0154e558903028 Author: Neil <ne...@di...> Date: Fri Feb 6 18:59:34 2015 +0200 Fix E211 - whitespace before ( diff --git a/sqlobject/firebird/firebirdconnection.py b/sqlobject/firebird/firebirdconnection.py index b8961f9..74ca35a 100644 --- a/sqlobject/firebird/firebirdconnection.py +++ b/sqlobject/firebird/firebirdconnection.py @@ -330,8 +330,8 @@ class FirebirdConnection(DBAPI): # can look like: "DEFAULT 0", "DEFAULT 'default text'", None if defaultSource: defaultSource = defaultSource.split(' ')[1] - if defaultSource.startswith ("'") and \ - defaultSource.endswith ("'"): + if defaultSource.startswith("'") and \ + defaultSource.endswith("'"): defaultSource = str(defaultSource[1:-1]) elif fieldType in ("integer", "smallint", "bigint"): defaultSource = int(defaultSource) diff --git a/sqlobject/maxdb/maxdbconnection.py b/sqlobject/maxdb/maxdbconnection.py index 16aa43a..4ebe143 100644 --- a/sqlobject/maxdb/maxdbconnection.py +++ b/sqlobject/maxdb/maxdbconnection.py @@ -66,7 +66,7 @@ class MaxdbConnection(DBAPI): dbName = 'maxdb' schemes = [dbName] - def __init__ (self, host='', port=None, user=None, password=None, + def __init__(self, host='', port=None, user=None, password=None, database=None, autoCommit=1, sqlmode='internal', isolation=None, timeout=None, **kw): from sapdb import dbapi diff --git a/sqlobject/versioning/__init__.py b/sqlobject/versioning/__init__.py index 2e937d3..512aa8c 100644 --- a/sqlobject/versioning/__init__.py +++ b/sqlobject/versioning/__init__.py @@ -80,7 +80,7 @@ class Versioning(object): 'extraCols': self.extraCols } - getColumns (attrs, self.soClass) + getColumns(attrs, self.soClass) attrs.update(self.extraCols) http://sourceforge.net/p/sqlobject/sqlobject/ci/753903081500d91fe246e0286089758ef3de0c31 commit 753903081500d91fe246e0286089758ef3de0c31 Merge: 0b9ad6e 49b63d9 Author: Oleg Broytman <ph...@ph...> Date: Fri Feb 6 18:03:17 2015 +0300 Merge pull request #64 from drnlm/issue_51_flake8_E222 Issue #51: Fix flake8 E222 - multiple spaces after operator http://sourceforge.net/p/sqlobject/sqlobject/ci/49b63d9d3ad7cb82d7b31e86257e2af49dbce240 commit 49b63d9d3ad7cb82d7b31e86257e2af49dbce240 Author: Neil <ne...@di...> Date: Fri Feb 6 12:13:49 2015 +0200 Fix flake8 E222 - multiple spaces after operator diff --git a/sqlobject/firebird/firebirdconnection.py b/sqlobject/firebird/firebirdconnection.py index ecf0c54..b8961f9 100644 --- a/sqlobject/firebird/firebirdconnection.py +++ b/sqlobject/firebird/firebirdconnection.py @@ -123,7 +123,7 @@ class FirebirdConnection(DBAPI): """Firebird slaps the limit and offset (actually 'first' and 'skip', respectively) statement right after the select.""" if not start: - limit_str = "SELECT FIRST %i" % end + limit_str = "SELECT FIRST %i" % end if not end: limit_str = "SELECT SKIP %i" % start else: @@ -182,7 +182,7 @@ class FirebirdConnection(DBAPI): def readDefaultEncodingFromDB(self): # Get out if encoding is known allready (can by None as well). if self.defaultDbEncoding == "": - self.defaultDbEncoding = str(self.queryOne( + self.defaultDbEncoding = str(self.queryOne( "SELECT rdb$character_set_name FROM rdb$database")[0].\ strip().lower()) # encoding defined during db creation if self.defaultDbEncoding == "none": diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py index 7e3b1b8..d59e41f 100644 --- a/sqlobject/sqlbuilder.py +++ b/sqlobject/sqlbuilder.py @@ -529,7 +529,7 @@ class SQLObjectTableWithJoins(SQLObjectTable): return SQLObjectTable.__getattr__(self, attr) def _getattrFromForeignKey(self, column, attr): - ret = getattr(self, column.name) == \ + ret = getattr(self, column.name) == \ getattr(self.soClass, '_SO_class_'+column.foreignKey).q.id return ret ----------------------------------------------------------------------- Summary of changes: sqlobject/firebird/firebirdconnection.py | 8 ++++---- sqlobject/maxdb/maxdbconnection.py | 2 +- sqlobject/sqlbuilder.py | 2 +- sqlobject/versioning/__init__.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) hooks/post-receive -- SQLObject development repository |