diff options
| author | Barry Warsaw | 2016-07-28 23:10:56 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-07-28 23:10:56 -0400 |
| commit | 90e84bee5f47cbcdb9e9c367c60a877e325ef3e7 (patch) | |
| tree | bb7d2df3af049c6e84d65fd25cc0258b6af6ebb9 /src/mailman/database | |
| parent | 86b25ba2e3bac0e034235d322c7c77080d737833 (diff) | |
| download | mailman-90e84bee5f47cbcdb9e9c367c60a877e325ef3e7.tar.gz mailman-90e84bee5f47cbcdb9e9c367c60a877e325ef3e7.tar.zst mailman-90e84bee5f47cbcdb9e9c367c60a877e325ef3e7.zip | |
Rebase mailman/mailman!180 and cleanup # noqa
Diffstat (limited to 'src/mailman/database')
| -rw-r--r-- | src/mailman/database/alembic/versions/7b254d88f122_members_and_list_moderation_action.py | 2 | ||||
| -rw-r--r-- | src/mailman/database/model.py | 5 | ||||
| -rw-r--r-- | src/mailman/database/postgresql.py | 4 | ||||
| -rw-r--r-- | src/mailman/database/sqlite.py | 2 | ||||
| -rw-r--r-- | src/mailman/database/tests/test_migrations.py | 4 |
5 files changed, 9 insertions, 8 deletions
diff --git a/src/mailman/database/alembic/versions/7b254d88f122_members_and_list_moderation_action.py b/src/mailman/database/alembic/versions/7b254d88f122_members_and_list_moderation_action.py index c393528d9..6b4d7bfd1 100644 --- a/src/mailman/database/alembic/versions/7b254d88f122_members_and_list_moderation_action.py +++ b/src/mailman/database/alembic/versions/7b254d88f122_members_and_list_moderation_action.py @@ -85,7 +85,7 @@ def upgrade(): def downgrade(): connection = op.get_bind() for member in connection.execute(members_query.where( - member_table.c.moderation_action == None)).fetchall(): # noqa + member_table.c.moderation_action == None)).fetchall(): # noqa: E711 default_action = _get_default_action(connection, member) # Use the mailing list's default action connection.execute(member_table.update().where( diff --git a/src/mailman/database/model.py b/src/mailman/database/model.py index 6019b7488..c2ee90491 100644 --- a/src/mailman/database/model.py +++ b/src/mailman/database/model.py @@ -37,7 +37,7 @@ class ModelMeta: try: # Delete all the tables in reverse foreign key dependency # order. http://tinyurl.com/on8dy6f - for table in reversed(Model.metadata.sorted_tables): # noqa + for table in reversed(Model.metadata.sorted_tables): connection.execute(table.delete()) except: transaction.rollback() @@ -46,4 +46,5 @@ class ModelMeta: transaction.commit() -public(Model=declarative_base(cls=ModelMeta)) +Model = declarative_base(cls=ModelMeta) +public(Model=Model) diff --git a/src/mailman/database/postgresql.py b/src/mailman/database/postgresql.py index 5d42c59f8..b1095e45f 100644 --- a/src/mailman/database/postgresql.py +++ b/src/mailman/database/postgresql.py @@ -41,8 +41,8 @@ class PostgreSQLDatabase(SABaseDatabase): for table in tables: for column in table.primary_key: if (column.autoincrement - and isinstance(column.type, Integer) # noqa - and not column.foreign_keys): # noqa + and isinstance(column.type, Integer) # noqa: W503 + and not column.foreign_keys): # noqa: W503 store.execute("""\ SELECT setval('"{0}_{1}_seq"', coalesce(max("{1}"), 1), max("{1}") IS NOT null) diff --git a/src/mailman/database/sqlite.py b/src/mailman/database/sqlite.py index 409545d74..08700bfb2 100644 --- a/src/mailman/database/sqlite.py +++ b/src/mailman/database/sqlite.py @@ -37,7 +37,7 @@ class SQLiteDatabase(SABaseDatabase): path = os.path.normpath(parts.path) fd = os.open( path, - os.O_WRONLY | os.O_NONBLOCK | os.O_CREAT, # noqa + os.O_WRONLY | os.O_NONBLOCK | os.O_CREAT, 0o666) # Ignore errors if fd > 0: diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py index d61154ee2..88a2a30ab 100644 --- a/src/mailman/database/tests/test_migrations.py +++ b/src/mailman/database/tests/test_migrations.py @@ -130,7 +130,7 @@ class TestMigrations(unittest.TestCase): sa.sql.column('value', sa.Unicode), sa.sql.column('pended_id', sa.Integer), ) - def get_from_db(): # noqa + def get_from_db(): # noqa: E301 results = {} for i in range(1, 6): query = sa.sql.select( @@ -227,7 +227,7 @@ class TestMigrations(unittest.TestCase): self.assertTrue(os.path.exists(bee.data_path)) def test_7b254d88f122_moderation_action(self): - mailinglist_table = sa.sql.table( # noqa + sa.sql.table( 'mailinglist', sa.sql.column('id', sa.Integer), sa.sql.column('list_id', sa.Unicode), |
