Browse Source

Fix all PEP8 and errors

pull/9/head
Dashie der otter 11 months ago
parent
commit
472a6837cd
Signed by: Dashie <dashie@sigpipe.me> GPG Key ID: C2D57B325840B755
41 changed files with 81 additions and 163 deletions
  1. 3
    3
      app.py
  2. 1
    2
      controllers/extapi.py
  3. 1
    1
      controllers/main.py
  4. 1
    1
      controllers/qsos.py
  5. 1
    1
      controllers/tools.py
  6. 2
    2
      dbseed.py
  7. 1
    0
      forms.py
  8. 1
    1
      libjambon.py
  9. 1
    1
      migrations/env.py
  10. 2
    2
      migrations/script.py.mako
  11. 2
    6
      migrations/versions/001_33200cef9060.py
  12. 2
    6
      migrations/versions/002_1981d67bd949.py
  13. 2
    6
      migrations/versions/003_dba2c36b8d15.py
  14. 2
    6
      migrations/versions/004_85dc2959dc8c.py
  15. 2
    6
      migrations/versions/005_b68e04878516.py
  16. 2
    6
      migrations/versions/006_d1c8faa24092.py
  17. 2
    6
      migrations/versions/007_f4d4e3c42eb7.py
  18. 1
    1
      migrations/versions/008_488cd2ea543d.py
  19. 2
    6
      migrations/versions/009_790b9af160b5.py
  20. 1
    1
      migrations/versions/010_516077ddda8d.py
  21. 1
    1
      migrations/versions/011_8ddd19e5391a.py
  22. 1
    2
      migrations/versions/012_0222deffc1dd.py
  23. 2
    6
      migrations/versions/013_a69619a8fd47.py
  24. 2
    6
      migrations/versions/014_229e1f2ce062.py
  25. 2
    6
      migrations/versions/015_4669be672bc4.py
  26. 2
    6
      migrations/versions/016_71ebbd5fe6de.py
  27. 3
    7
      migrations/versions/017_eb1dd834c778.py
  28. 2
    6
      migrations/versions/018_1cfbdbdced17.py
  29. 2
    6
      migrations/versions/019_4b8ff69cf574.py
  30. 2
    6
      migrations/versions/020_96dd40d300ed.py
  31. 2
    6
      migrations/versions/021_b71a316c6504.py
  32. 2
    6
      migrations/versions/022_98ea6ef6fc14.py
  33. 4
    6
      migrations/versions/024_5539ae4bd72a.py
  34. 2
    6
      migrations/versions/025_df93b7d9aa63.py
  35. 1
    1
      migrations/versions/026_eb8858fd3d9c.py
  36. 2
    6
      migrations/versions/027_e072762b7964_.py
  37. 9
    9
      models.py
  38. 1
    0
      pyproject.toml
  39. 1
    1
      setup.cfg
  40. 4
    4
      tests/test_libjambon.py
  41. 2
    2
      tests/test_utils.py

+ 3
- 3
app.py View File

@@ -51,13 +51,13 @@ def create_app(cfg=None):
file_handler.setFormatter(formatter)
app.logger.addHandler(file_handler)

mail = Mail(app)
migrate = Migrate(app, db)
mail = Mail(app) # noqa: F841
migrate = Migrate(app, db) # noqa: F841

db.init_app(app)

# Setup Flask-Security
security = Security(app, user_datastore, register_form=ExtendedRegisterForm)
security = Security(app, user_datastore, register_form=ExtendedRegisterForm) # noqa: F841

git_version = ""
gitpath = os.path.join(os.getcwd(), ".git")

+ 1
- 2
controllers/extapi.py View File

@@ -1,7 +1,6 @@
from flask import Blueprint, request, Response
from xmlrpc.server import CGIXMLRPCRequestHandler, SimpleXMLRPCDispatcher
from xmlrpc.server import SimpleXMLRPCDispatcher
from adif import parse as adif_parser
from models import db, Log, Band, Mode

bp_extapi = Blueprint("bp_extapi", __name__)


+ 1
- 1
controllers/main.py View File

@@ -1,4 +1,4 @@
from flask import Blueprint, render_template, flash, abort
from flask import Blueprint, render_template, flash
from flask_security import current_user
from sqlalchemy import func


+ 1
- 1
controllers/qsos.py View File

@@ -1199,7 +1199,7 @@ def logbook_search_adv(username, logbook_slug):
filtered = True
bq = bq.filter(Log.pictures)
elif form.pictures.data == "N":
bq = bq.filter(Log.pictures == None) # the " == " seems mandatory for sqlalchemy
bq = bq.filter(Log.pictures == None) # noqa: E711, the " == " seems mandatory for sqlalchemy

if not filtered:
bq = bq.limit(20)

+ 1
- 1
controllers/tools.py View File

@@ -64,7 +64,7 @@ def adif_import_file():
duplicates += 1
continue # duplicate found, skip record

l = Log()
l = Log() # noqa: E741, FIXME: rename properly later
for key in ADIF_FIELDS:
if key not in log:
continue

+ 2
- 2
dbseed.py View File

@@ -9,7 +9,7 @@ def make_db_seed(db):
seed_config(db)
seed_users(db) # after timezones because not null relation
# also seeds roles admin/user
except:
except: # noqa: E722
db.session.rollback()
raise

@@ -56,7 +56,7 @@ def seed_config(db):
# Bug, two commit necessary


#### Only used by tests
# Only used by tests
def seed_bands(db):
db.session.add(Band(name="2222m", zone="iaru1", lower=135700, upper=137800))
db.session.add(Band(name="630m", zone="iaru1", lower=472000, upper=476000))

+ 1
- 0
forms.py View File

@@ -21,6 +21,7 @@ BaseModelForm = model_form_factory(Form)

pictures = UploadSet("pictures", IMAGES)


# monkeypatch for https://github.com/wtforms/wtforms/issues/373
def _patch_wtforms_sqlalchemy():
from wtforms.ext.sqlalchemy import fields

+ 1
- 1
libjambon.py View File

@@ -298,7 +298,7 @@ def get_dxcc_from_clublog(callsign):

try:
r = requests.get(clublog_uri)
except:
except: # noqa: E722
raise InvalidUsage("Error getting DXCC from ClubLog", status_code=500)

if r.status_code != 200:

+ 1
- 1
migrations/env.py View File

@@ -17,7 +17,7 @@ logger = logging.getLogger("alembic.env")
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
from flask import current_app
from flask import current_app # noqa: E402

config.set_main_option("sqlalchemy.url", current_app.config.get("SQLALCHEMY_DATABASE_URI"))
target_metadata = current_app.extensions["migrate"].db.metadata

+ 2
- 2
migrations/script.py.mako View File

@@ -10,8 +10,8 @@ Create Date: ${create_date}
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402
${imports if imports else ""}

def upgrade():

+ 2
- 6
migrations/versions/001_33200cef9060.py View File

@@ -10,12 +10,11 @@ Create Date: 2016-05-05 21:12:22.134639
revision = "33200cef9060"
down_revision = None

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table(
"bands",
sa.Column("id", sa.Integer(), nullable=False),
@@ -309,11 +308,9 @@ def upgrade():
sa.ForeignKeyConstraint(["role_id"], ["role.id"]),
sa.ForeignKeyConstraint(["user_id"], ["user.id"]),
)
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table("roles_users")
op.drop_table("notes")
op.drop_index(op.f("ix_log_time_on"), table_name="log")
@@ -339,4 +336,3 @@ def downgrade():
op.drop_table("config")
op.drop_table("cat")
op.drop_table("bands")
### end Alembic commands ###

+ 2
- 6
migrations/versions/002_1981d67bd949.py View File

@@ -10,12 +10,11 @@ Create Date: 2016-06-09 10:47:18.401857
revision = "1981d67bd949"
down_revision = "33200cef9060"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table(
"contact",
sa.Column("id", sa.Integer(), nullable=False),
@@ -30,10 +29,7 @@ def upgrade():
sa.ForeignKeyConstraint(["user_id"], ["user.id"]),
sa.PrimaryKeyConstraint("id"),
)
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table("contact")
### end Alembic commands ###

+ 2
- 6
migrations/versions/003_dba2c36b8d15.py View File

@@ -10,12 +10,11 @@ Create Date: 2016-06-10 12:47:09.216628
revision = "dba2c36b8d15"
down_revision = "1981d67bd949"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table(
"logbook",
sa.Column("id", sa.Integer(), nullable=False),
@@ -35,12 +34,9 @@ def upgrade():
op.alter_column("log", "logbook_id", server_default=None)
except NotImplementedError:
print("Using SQLITE3 lol no ALTER, good luck.")
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "log", type_="foreignkey")
op.drop_column("log", "logbook_id")
op.drop_table("logbook")
### end Alembic commands ###

+ 2
- 6
migrations/versions/004_85dc2959dc8c.py View File

@@ -10,12 +10,11 @@ Create Date: 2016-06-12 00:27:05.157817
revision = "85dc2959dc8c"
down_revision = "dba2c36b8d15"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table(
"picture",
sa.Column("id", sa.Integer(), nullable=False),
@@ -32,11 +31,8 @@ def upgrade():
op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
except NotImplementedError:
print("Using SQLITE3 lol no ALTER, good luck.")
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "log", type_="foreignkey")
op.drop_table("picture")
### end Alembic commands ###

+ 2
- 6
migrations/versions/005_b68e04878516.py View File

@@ -10,12 +10,11 @@ Create Date: 2016-06-12 11:55:50.658850
revision = "b68e04878516"
down_revision = "85dc2959dc8c"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table(
"dxcc_entities",
sa.Column("id", sa.Integer(), nullable=False),
@@ -68,11 +67,9 @@ def upgrade():
op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
except NotImplementedError:
print("Using SQLITE3 lol no ALTER, good luck.")
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "log", type_="foreignkey")
op.drop_index(op.f("ix_dxcc_prefixes_record"), table_name="dxcc_prefixes")
op.drop_table("dxcc_prefixes")
@@ -80,4 +77,3 @@ def downgrade():
op.drop_table("dxcc_exceptions")
op.drop_index(op.f("ix_dxcc_entities_adif"), table_name="dxcc_entities")
op.drop_table("dxcc_entities")
### end Alembic commands ###

+ 2
- 6
migrations/versions/006_d1c8faa24092.py View File

@@ -10,21 +10,18 @@ Create Date: 2016-06-12 13:43:01.516921
revision = "d1c8faa24092"
down_revision = "b68e04878516"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table("dxccexceptions")
op.drop_table("dxcc")
# WTF alembic you drunk
# op.create_foreign_key(None, 'log', 'logbook', ['logbook_id'], ['id'])
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "log", type_="foreignkey")
op.create_table(
"dxcc",
@@ -52,4 +49,3 @@ def downgrade():
sa.Column("end", sa.DATETIME(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
### end Alembic commands ###

+ 2
- 6
migrations/versions/007_f4d4e3c42eb7.py View File

@@ -10,22 +10,18 @@ Create Date: 2016-06-13 21:53:02.914770
revision = "f4d4e3c42eb7"
down_revision = "d1c8faa24092"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("bands", sa.Column("zone", sa.String(length=10), nullable=False, server_default="iaru1"))
try:
op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
except NotImplementedError:
print("Using SQLITE3 lol no ALTER, good luck.")
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "log", type_="foreignkey")
op.drop_column("bands", "zone")
### end Alembic commands ###

+ 1
- 1
migrations/versions/008_488cd2ea543d.py View File

@@ -19,7 +19,7 @@ Help:
revision = "488cd2ea543d"
down_revision = "f4d4e3c42eb7"

from models import db, Band, Log
from models import db, Band, Log # noqa: E402


def upgrade():

+ 2
- 6
migrations/versions/009_790b9af160b5.py View File

@@ -10,22 +10,18 @@ Create Date: 2016-06-13 23:42:26.495078
revision = "790b9af160b5"
down_revision = "488cd2ea543d"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
try:
op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
except NotImplementedError:
print("Using SQLITE3 lol no ALTER, good luck.")
op.add_column("user", sa.Column("zone", sa.String(length=10), nullable=False, server_default="iaru1"))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("user", "zone")
op.drop_constraint(None, "log", type_="foreignkey")
### end Alembic commands ###

+ 1
- 1
migrations/versions/010_516077ddda8d.py View File

@@ -10,7 +10,7 @@ Create Date: 2016-06-14 17:09:53.898423
revision = "516077ddda8d"
down_revision = "790b9af160b5"

from models import db, Band
from models import db, Band # noqa: E402


def upgrade():

+ 1
- 1
migrations/versions/011_8ddd19e5391a.py View File

@@ -10,7 +10,7 @@ Create Date: 2016-06-15 11:38:25.620662
revision = "8ddd19e5391a"
down_revision = "516077ddda8d"

from models import db, Mode
from models import db, Mode # noqa: E402


def upgrade():

+ 1
- 2
migrations/versions/012_0222deffc1dd.py View File

@@ -10,8 +10,7 @@ Create Date: 2016-06-15 22:09:53.293115
revision = "0222deffc1dd"
down_revision = "8ddd19e5391a"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402


def upgrade():

+ 2
- 6
migrations/versions/013_a69619a8fd47.py View File

@@ -10,21 +10,17 @@ Create Date: 2016-06-16 14:20:33.454389
revision = "a69619a8fd47"
down_revision = "0222deffc1dd"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index("ix_name", table_name="bands")
op.add_column("log", sa.Column("cache_gridsquare", sa.String(length=12), nullable=True))
op.drop_index("ix_country", table_name="log")
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_index("ix_country", "log", ["country"], unique=False)
op.drop_column("log", "cache_gridsquare")
op.create_index("ix_name", "bands", ["name"], unique=False)
### end Alembic commands ###

+ 2
- 6
migrations/versions/014_229e1f2ce062.py View File

@@ -10,17 +10,13 @@ Create Date: 2016-06-21 07:46:24.963938
revision = "229e1f2ce062"
down_revision = "a69619a8fd47"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("logbook", sa.Column("eqsl_qth_nickname", sa.String(length=255), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("logbook", "eqsl_qth_nickname")
### end Alembic commands ###

+ 2
- 6
migrations/versions/015_4669be672bc4.py View File

@@ -10,12 +10,11 @@ Create Date: 2016-06-21 08:15:48.785979
revision = "4669be672bc4"
down_revision = "229e1f2ce062"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table(
"logging",
sa.Column("id", sa.Integer(), nullable=False),
@@ -40,11 +39,8 @@ def upgrade():
sa.ForeignKeyConstraint(["user_id"], ["user.id"]),
sa.PrimaryKeyConstraint("id"),
)
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table("user_logging")
op.drop_table("logging")
### end Alembic commands ###

+ 2
- 6
migrations/versions/016_71ebbd5fe6de.py View File

@@ -10,17 +10,13 @@ Create Date: 2016-06-21 08:53:27.310029
revision = "71ebbd5fe6de"
down_revision = "4669be672bc4"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("log", sa.Column("qso_comment", sa.UnicodeText(), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("log", "qso_comment")
### end Alembic commands ###

+ 3
- 7
migrations/versions/017_eb1dd834c778.py View File

@@ -10,20 +10,16 @@ Create Date: 2016-06-21 08:56:30.584591
revision = "eb1dd834c778"
down_revision = "71ebbd5fe6de"

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402
from sqlalchemy.dialects import mysql # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("log", sa.Column("qsl_comment", sa.UnicodeText(), nullable=True))
op.drop_column("log", "qso_comment")
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("log", sa.Column("qso_comment", mysql.TEXT(), nullable=True))
op.drop_column("log", "qsl_comment")
### end Alembic commands ###

+ 2
- 6
migrations/versions/018_1cfbdbdced17.py View File

@@ -10,19 +10,15 @@ Create Date: 2016-06-21 11:06:41.681025
revision = "1cfbdbdced17"
down_revision = "eb1dd834c778"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("config", sa.Column("clublog_api_key", sa.String(length=255), nullable=True))
op.add_column("config", sa.Column("eqsl_upload_url", sa.String(length=255), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("config", "eqsl_upload_url")
op.drop_column("config", "clublog_api_key")
### end Alembic commands ###

+ 2
- 6
migrations/versions/019_4b8ff69cf574.py View File

@@ -10,19 +10,15 @@ Create Date: 2016-06-21 15:42:59.364330
revision = "4b8ff69cf574"
down_revision = "1cfbdbdced17"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("logging", sa.Column("timestamp", sa.DateTime(), server_default=sa.text("now()"), nullable=True))
op.add_column("user_logging", sa.Column("timestamp", sa.DateTime(), server_default=sa.text("now()"), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("user_logging", "timestamp")
op.drop_column("logging", "timestamp")
### end Alembic commands ###

+ 2
- 6
migrations/versions/020_96dd40d300ed.py View File

@@ -10,19 +10,15 @@ Create Date: 2016-07-12 22:07:04.069253
revision = "96dd40d300ed"
down_revision = "4b8ff69cf574"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("user", sa.Column("hamqth_name", sa.String(length=32), nullable=True))
op.add_column("user", sa.Column("hamqth_password", sa.String(length=255), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("user", "hamqth_password")
op.drop_column("user", "hamqth_name")
### end Alembic commands ###

+ 2
- 6
migrations/versions/021_b71a316c6504.py View File

@@ -10,17 +10,13 @@ Create Date: 2016-07-12 22:39:21.927365
revision = "b71a316c6504"
down_revision = "96dd40d300ed"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("log", sa.Column("consolidated_hamqth", sa.Boolean(), nullable=False))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("log", "consolidated_hamqth")
### end Alembic commands ###

+ 2
- 6
migrations/versions/022_98ea6ef6fc14.py View File

@@ -10,12 +10,11 @@ Create Date: 2016-08-20 18:03:07.039230
revision = "98ea6ef6fc14"
down_revision = "b71a316c6504"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("cat", sa.Column("slug", sa.String(length=255), nullable=True))
op.create_unique_constraint(None, "cat", ["slug"])
op.add_column("contact", sa.Column("slug", sa.String(length=255), nullable=True))
@@ -34,11 +33,9 @@ def upgrade():
op.create_unique_constraint(None, "picture", ["slug"])
op.add_column("user", sa.Column("slug", sa.String(length=255), nullable=True))
op.create_unique_constraint(None, "user", ["slug"])
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "user", type_="unique")
op.drop_column("user", "slug")
op.drop_constraint(None, "picture", type_="unique")
@@ -57,4 +54,3 @@ def downgrade():
op.drop_column("contact", "slug")
op.drop_constraint(None, "cat", type_="unique")
op.drop_column("cat", "slug")
### end Alembic commands ###

+ 4
- 6
migrations/versions/024_5539ae4bd72a.py View File

@@ -10,10 +10,10 @@ Create Date: 2016-08-20 22:56:36.905104
revision = "5539ae4bd72a"
down_revision = "98ea6ef6fc14"

from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from sqlalchemy_searchable import sync_trigger
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402
import sqlalchemy_utils # noqa: E402
from sqlalchemy_searchable import sync_trigger # noqa: E402


def upgrade():
@@ -42,7 +42,5 @@ def upgrade():


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index("ix_log_search_vector", table_name="log")
op.drop_column("log", "search_vector")
### end Alembic commands ###

+ 2
- 6
migrations/versions/025_df93b7d9aa63.py View File

@@ -10,21 +10,17 @@ Create Date: 2016-08-21 17:37:14.235848
revision = "df93b7d9aa63"
down_revision = "5539ae4bd72a"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("picture_hash_key", "picture", type_="unique")
op.drop_column("picture", "hash")
op.drop_column("picture", "filesize")
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("picture", sa.Column("filesize", sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column("picture", sa.Column("hash", sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.create_unique_constraint("picture_hash_key", "picture", ["hash"])
### end Alembic commands ###

+ 1
- 1
migrations/versions/026_eb8858fd3d9c.py View File

@@ -10,7 +10,7 @@ Create Date: 2016-08-24 13:07:47.278565
revision = "eb8858fd3d9c"
down_revision = "df93b7d9aa63"

from models import db, Band
from models import db, Band # noqa: E402


def upgrade():

+ 2
- 6
migrations/versions/027_e072762b7964_.py View File

@@ -10,17 +10,13 @@ Create Date: 2016-12-22 11:38:09.835930
revision = "e072762b7964"
down_revision = "eb8858fd3d9c"

from alembic import op
import sqlalchemy as sa
from alembic import op # noqa: E402
import sqlalchemy as sa # noqa: E402


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("logbook", sa.Column("old", sa.Boolean(), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("logbook", "old")
### end Alembic commands ###

+ 9
- 9
models.py View File

@@ -571,7 +571,7 @@ def cutename(call, name=None):

@event.listens_for(User, "after_update")
@event.listens_for(User, "after_insert")
def make_slug(mapper, connection, target):
def make_user_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.name)
slug = slugify(title)
connection.execute(User.__table__.update().where(User.__table__.c.id == target.id).values(slug=slug))
@@ -579,7 +579,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(Cat, "after_update")
@event.listens_for(Cat, "after_insert")
def make_slug(mapper, connection, target):
def make_cat_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.radio)
slug = slugify(title)
connection.execute(Cat.__table__.update().where(Cat.__table__.c.id == target.id).values(slug=slug))
@@ -587,7 +587,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(ContestTemplate, "after_update")
@event.listens_for(ContestTemplate, "after_insert")
def make_slug(mapper, connection, target):
def make_contestt_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.name)
slug = slugify(title)
connection.execute(
@@ -597,7 +597,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(Contest, "after_update")
@event.listens_for(Contest, "after_insert")
def make_slug(mapper, connection, target):
def make_contest_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.name)
slug = slugify(title)
connection.execute(Contest.__table__.update().where(Contest.__table__.c.id == target.id).values(slug=slug))
@@ -605,7 +605,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(Contact, "after_update")
@event.listens_for(Contact, "after_insert")
def make_slug(mapper, connection, target):
def make_contact_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.callsign)
slug = slugify(title)
connection.execute(Contact.__table__.update().where(Contact.__table__.c.id == target.id).values(slug=slug))
@@ -613,7 +613,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(Logbook, "after_update")
@event.listens_for(Logbook, "after_insert")
def make_slug(mapper, connection, target):
def make_logbook_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.name)
slug = slugify(title)
connection.execute(Logbook.__table__.update().where(Logbook.__table__.c.id == target.id).values(slug=slug))
@@ -621,7 +621,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(Picture, "after_update")
@event.listens_for(Picture, "after_insert")
def make_slug(mapper, connection, target):
def make_picture_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.name)
slug = slugify(title)
connection.execute(Picture.__table__.update().where(Picture.__table__.c.id == target.id).values(slug=slug))
@@ -629,7 +629,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(Log, "after_update")
@event.listens_for(Log, "after_insert")
def make_slug(mapper, connection, target):
def make_log_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.call)
slug = slugify(title)
connection.execute(Log.__table__.update().where(Log.__table__.c.id == target.id).values(slug=slug))
@@ -637,7 +637,7 @@ def make_slug(mapper, connection, target):

@event.listens_for(Note, "after_update")
@event.listens_for(Note, "after_insert")
def make_slug(mapper, connection, target):
def make_note_slug(mapper, connection, target):
title = "{0} {1}".format(target.id, target.title)
slug = slugify(title)
connection.execute(Note.__table__.update().where(Note.__table__.c.id == target.id).values(slug=slug))

+ 1
- 0
pyproject.toml View File

@@ -8,6 +8,7 @@ exclude = '''
| \.idea
| \__pycache__
| venv
| \.ropeproject
)/
'''
skip-numeric-underscore-normalization = true

+ 1
- 1
setup.cfg View File

@@ -8,4 +8,4 @@ python_files = tests/*.py
[flake8]
max-line-length = 120
ignore = E501
exclude = .git,__pycache__,.eggs,venv,build,dist
exclude = .git,__pycache__,.eggs,venv,build,dist,.ropeproject

+ 4
- 4
tests/test_libjambon.py View File

@@ -1,10 +1,10 @@
import sys

sys.path.insert(0, sys.path[0] + "/../")
from geohelper import bearing
from libjambon import coordinates2adif, adif2coordinates, adif, geo_bearing_star
import unittest
from nose_parameterized import parameterized
from geohelper import bearing # noqa: E402
from libjambon import coordinates2adif, adif2coordinates, adif, geo_bearing_star # noqa: E402
import unittest # noqa: E402
from nose_parameterized import parameterized # noqa: E402


class TestLibjambon(unittest.TestCase):

+ 2
- 2
tests/test_utils.py View File

@@ -1,8 +1,8 @@
import sys

sys.path.insert(0, sys.path[0] + "/../")
from utils import gen_random_str
import unittest
from utils import gen_random_str # noqa: E402
import unittest # noqa: E402


class TestUtils(unittest.TestCase):

Loading…
Cancel
Save