Browse Source

Fix all PEP8 and errors

pull/9/head
Dashie der otter 9 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):
51 51
         file_handler.setFormatter(formatter)
52 52
         app.logger.addHandler(file_handler)
53 53
 
54
-    mail = Mail(app)
55
-    migrate = Migrate(app, db)
54
+    mail = Mail(app)  # noqa: F841
55
+    migrate = Migrate(app, db)  # noqa: F841
56 56
 
57 57
     db.init_app(app)
58 58
 
59 59
     # Setup Flask-Security
60
-    security = Security(app, user_datastore, register_form=ExtendedRegisterForm)
60
+    security = Security(app, user_datastore, register_form=ExtendedRegisterForm)  # noqa: F841
61 61
 
62 62
     git_version = ""
63 63
     gitpath = os.path.join(os.getcwd(), ".git")

+ 1
- 2
controllers/extapi.py View File

@@ -1,7 +1,6 @@
1 1
 from flask import Blueprint, request, Response
2
-from xmlrpc.server import CGIXMLRPCRequestHandler, SimpleXMLRPCDispatcher
2
+from xmlrpc.server import SimpleXMLRPCDispatcher
3 3
 from adif import parse as adif_parser
4
-from models import db, Log, Band, Mode
5 4
 
6 5
 bp_extapi = Blueprint("bp_extapi", __name__)
7 6
 

+ 1
- 1
controllers/main.py View File

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

+ 1
- 1
controllers/qsos.py View File

@@ -1199,7 +1199,7 @@ def logbook_search_adv(username, logbook_slug):
1199 1199
         filtered = True
1200 1200
         bq = bq.filter(Log.pictures)
1201 1201
     elif form.pictures.data == "N":
1202
-        bq = bq.filter(Log.pictures == None)  # the " == " seems mandatory for sqlalchemy
1202
+        bq = bq.filter(Log.pictures == None)  # noqa: E711, the " == " seems mandatory for sqlalchemy
1203 1203
 
1204 1204
     if not filtered:
1205 1205
         bq = bq.limit(20)

+ 1
- 1
controllers/tools.py View File

@@ -64,7 +64,7 @@ def adif_import_file():
64 64
                 duplicates += 1
65 65
                 continue  # duplicate found, skip record
66 66
 
67
-            l = Log()
67
+            l = Log()  # noqa: E741, FIXME: rename properly later
68 68
             for key in ADIF_FIELDS:
69 69
                 if key not in log:
70 70
                     continue

+ 2
- 2
dbseed.py View File

@@ -9,7 +9,7 @@ def make_db_seed(db):
9 9
         seed_config(db)
10 10
         seed_users(db)  # after timezones because not null relation
11 11
         # also seeds roles admin/user
12
-    except:
12
+    except:  # noqa: E722
13 13
         db.session.rollback()
14 14
         raise
15 15
 
@@ -56,7 +56,7 @@ def seed_config(db):
56 56
     # Bug, two commit necessary
57 57
 
58 58
 
59
-#### Only used by tests
59
+# Only used by tests
60 60
 def seed_bands(db):
61 61
     db.session.add(Band(name="2222m", zone="iaru1", lower=135700, upper=137800))
62 62
     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)
21 21
 
22 22
 pictures = UploadSet("pictures", IMAGES)
23 23
 
24
+
24 25
 # monkeypatch for https://github.com/wtforms/wtforms/issues/373
25 26
 def _patch_wtforms_sqlalchemy():
26 27
     from wtforms.ext.sqlalchemy import fields

+ 1
- 1
libjambon.py View File

@@ -298,7 +298,7 @@ def get_dxcc_from_clublog(callsign):
298 298
 
299 299
     try:
300 300
         r = requests.get(clublog_uri)
301
-    except:
301
+    except:  # noqa: E722
302 302
         raise InvalidUsage("Error getting DXCC from ClubLog", status_code=500)
303 303
 
304 304
     if r.status_code != 200:

+ 1
- 1
migrations/env.py View File

@@ -17,7 +17,7 @@ logger = logging.getLogger("alembic.env")
17 17
 # for 'autogenerate' support
18 18
 # from myapp import mymodel
19 19
 # target_metadata = mymodel.Base.metadata
20
-from flask import current_app
20
+from flask import current_app  # noqa: E402
21 21
 
22 22
 config.set_main_option("sqlalchemy.url", current_app.config.get("SQLALCHEMY_DATABASE_URI"))
23 23
 target_metadata = current_app.extensions["migrate"].db.metadata

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

@@ -10,8 +10,8 @@ Create Date: ${create_date}
10 10
 revision = ${repr(up_revision)}
11 11
 down_revision = ${repr(down_revision)}
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 ${imports if imports else ""}
16 16
 
17 17
 def upgrade():

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

@@ -10,12 +10,11 @@ Create Date: 2016-05-05 21:12:22.134639
10 10
 revision = "33200cef9060"
11 11
 down_revision = None
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.create_table(
20 19
         "bands",
21 20
         sa.Column("id", sa.Integer(), nullable=False),
@@ -309,11 +308,9 @@ def upgrade():
309 308
         sa.ForeignKeyConstraint(["role_id"], ["role.id"]),
310 309
         sa.ForeignKeyConstraint(["user_id"], ["user.id"]),
311 310
     )
312
-    ### end Alembic commands ###
313 311
 
314 312
 
315 313
 def downgrade():
316
-    ### commands auto generated by Alembic - please adjust! ###
317 314
     op.drop_table("roles_users")
318 315
     op.drop_table("notes")
319 316
     op.drop_index(op.f("ix_log_time_on"), table_name="log")
@@ -339,4 +336,3 @@ def downgrade():
339 336
     op.drop_table("config")
340 337
     op.drop_table("cat")
341 338
     op.drop_table("bands")
342
-    ### 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
10 10
 revision = "1981d67bd949"
11 11
 down_revision = "33200cef9060"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.create_table(
20 19
         "contact",
21 20
         sa.Column("id", sa.Integer(), nullable=False),
@@ -30,10 +29,7 @@ def upgrade():
30 29
         sa.ForeignKeyConstraint(["user_id"], ["user.id"]),
31 30
         sa.PrimaryKeyConstraint("id"),
32 31
     )
33
-    ### end Alembic commands ###
34 32
 
35 33
 
36 34
 def downgrade():
37
-    ### commands auto generated by Alembic - please adjust! ###
38 35
     op.drop_table("contact")
39
-    ### 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
10 10
 revision = "dba2c36b8d15"
11 11
 down_revision = "1981d67bd949"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.create_table(
20 19
         "logbook",
21 20
         sa.Column("id", sa.Integer(), nullable=False),
@@ -35,12 +34,9 @@ def upgrade():
35 34
         op.alter_column("log", "logbook_id", server_default=None)
36 35
     except NotImplementedError:
37 36
         print("Using SQLITE3 lol no ALTER, good luck.")
38
-    ### end Alembic commands ###
39 37
 
40 38
 
41 39
 def downgrade():
42
-    ### commands auto generated by Alembic - please adjust! ###
43 40
     op.drop_constraint(None, "log", type_="foreignkey")
44 41
     op.drop_column("log", "logbook_id")
45 42
     op.drop_table("logbook")
46
-    ### 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
10 10
 revision = "85dc2959dc8c"
11 11
 down_revision = "dba2c36b8d15"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.create_table(
20 19
         "picture",
21 20
         sa.Column("id", sa.Integer(), nullable=False),
@@ -32,11 +31,8 @@ def upgrade():
32 31
         op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
33 32
     except NotImplementedError:
34 33
         print("Using SQLITE3 lol no ALTER, good luck.")
35
-    ### end Alembic commands ###
36 34
 
37 35
 
38 36
 def downgrade():
39
-    ### commands auto generated by Alembic - please adjust! ###
40 37
     op.drop_constraint(None, "log", type_="foreignkey")
41 38
     op.drop_table("picture")
42
-    ### 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
10 10
 revision = "b68e04878516"
11 11
 down_revision = "85dc2959dc8c"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.create_table(
20 19
         "dxcc_entities",
21 20
         sa.Column("id", sa.Integer(), nullable=False),
@@ -68,11 +67,9 @@ def upgrade():
68 67
         op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
69 68
     except NotImplementedError:
70 69
         print("Using SQLITE3 lol no ALTER, good luck.")
71
-    ### end Alembic commands ###
72 70
 
73 71
 
74 72
 def downgrade():
75
-    ### commands auto generated by Alembic - please adjust! ###
76 73
     op.drop_constraint(None, "log", type_="foreignkey")
77 74
     op.drop_index(op.f("ix_dxcc_prefixes_record"), table_name="dxcc_prefixes")
78 75
     op.drop_table("dxcc_prefixes")
@@ -80,4 +77,3 @@ def downgrade():
80 77
     op.drop_table("dxcc_exceptions")
81 78
     op.drop_index(op.f("ix_dxcc_entities_adif"), table_name="dxcc_entities")
82 79
     op.drop_table("dxcc_entities")
83
-    ### 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
10 10
 revision = "d1c8faa24092"
11 11
 down_revision = "b68e04878516"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.drop_table("dxccexceptions")
20 19
     op.drop_table("dxcc")
21 20
     # WTF alembic you drunk
22 21
     # op.create_foreign_key(None, 'log', 'logbook', ['logbook_id'], ['id'])
23
-    ### end Alembic commands ###
24 22
 
25 23
 
26 24
 def downgrade():
27
-    ### commands auto generated by Alembic - please adjust! ###
28 25
     op.drop_constraint(None, "log", type_="foreignkey")
29 26
     op.create_table(
30 27
         "dxcc",
@@ -52,4 +49,3 @@ def downgrade():
52 49
         sa.Column("end", sa.DATETIME(), nullable=False),
53 50
         sa.PrimaryKeyConstraint("id"),
54 51
     )
55
-    ### 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
10 10
 revision = "f4d4e3c42eb7"
11 11
 down_revision = "d1c8faa24092"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("bands", sa.Column("zone", sa.String(length=10), nullable=False, server_default="iaru1"))
20 19
     try:
21 20
         op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
22 21
     except NotImplementedError:
23 22
         print("Using SQLITE3 lol no ALTER, good luck.")
24
-    ### end Alembic commands ###
25 23
 
26 24
 
27 25
 def downgrade():
28
-    ### commands auto generated by Alembic - please adjust! ###
29 26
     op.drop_constraint(None, "log", type_="foreignkey")
30 27
     op.drop_column("bands", "zone")
31
-    ### end Alembic commands ###

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

@@ -19,7 +19,7 @@ Help:
19 19
 revision = "488cd2ea543d"
20 20
 down_revision = "f4d4e3c42eb7"
21 21
 
22
-from models import db, Band, Log
22
+from models import db, Band, Log  # noqa: E402
23 23
 
24 24
 
25 25
 def upgrade():

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

@@ -10,22 +10,18 @@ Create Date: 2016-06-13 23:42:26.495078
10 10
 revision = "790b9af160b5"
11 11
 down_revision = "488cd2ea543d"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     try:
20 19
         op.create_foreign_key(None, "log", "logbook", ["logbook_id"], ["id"])
21 20
     except NotImplementedError:
22 21
         print("Using SQLITE3 lol no ALTER, good luck.")
23 22
     op.add_column("user", sa.Column("zone", sa.String(length=10), nullable=False, server_default="iaru1"))
24
-    ### end Alembic commands ###
25 23
 
26 24
 
27 25
 def downgrade():
28
-    ### commands auto generated by Alembic - please adjust! ###
29 26
     op.drop_column("user", "zone")
30 27
     op.drop_constraint(None, "log", type_="foreignkey")
31
-    ### 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
10 10
 revision = "516077ddda8d"
11 11
 down_revision = "790b9af160b5"
12 12
 
13
-from models import db, Band
13
+from models import db, Band  # noqa: E402
14 14
 
15 15
 
16 16
 def upgrade():

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

@@ -10,7 +10,7 @@ Create Date: 2016-06-15 11:38:25.620662
10 10
 revision = "8ddd19e5391a"
11 11
 down_revision = "516077ddda8d"
12 12
 
13
-from models import db, Mode
13
+from models import db, Mode  # noqa: E402
14 14
 
15 15
 
16 16
 def upgrade():

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

@@ -10,8 +10,7 @@ Create Date: 2016-06-15 22:09:53.293115
10 10
 revision = "0222deffc1dd"
11 11
 down_revision = "8ddd19e5391a"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
15 14
 
16 15
 
17 16
 def upgrade():

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

@@ -10,21 +10,17 @@ Create Date: 2016-06-16 14:20:33.454389
10 10
 revision = "a69619a8fd47"
11 11
 down_revision = "0222deffc1dd"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.drop_index("ix_name", table_name="bands")
20 19
     op.add_column("log", sa.Column("cache_gridsquare", sa.String(length=12), nullable=True))
21 20
     op.drop_index("ix_country", table_name="log")
22
-    ### end Alembic commands ###
23 21
 
24 22
 
25 23
 def downgrade():
26
-    ### commands auto generated by Alembic - please adjust! ###
27 24
     op.create_index("ix_country", "log", ["country"], unique=False)
28 25
     op.drop_column("log", "cache_gridsquare")
29 26
     op.create_index("ix_name", "bands", ["name"], unique=False)
30
-    ### 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
10 10
 revision = "229e1f2ce062"
11 11
 down_revision = "a69619a8fd47"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("logbook", sa.Column("eqsl_qth_nickname", sa.String(length=255), nullable=True))
20
-    ### end Alembic commands ###
21 19
 
22 20
 
23 21
 def downgrade():
24
-    ### commands auto generated by Alembic - please adjust! ###
25 22
     op.drop_column("logbook", "eqsl_qth_nickname")
26
-    ### 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
10 10
 revision = "4669be672bc4"
11 11
 down_revision = "229e1f2ce062"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.create_table(
20 19
         "logging",
21 20
         sa.Column("id", sa.Integer(), nullable=False),
@@ -40,11 +39,8 @@ def upgrade():
40 39
         sa.ForeignKeyConstraint(["user_id"], ["user.id"]),
41 40
         sa.PrimaryKeyConstraint("id"),
42 41
     )
43
-    ### end Alembic commands ###
44 42
 
45 43
 
46 44
 def downgrade():
47
-    ### commands auto generated by Alembic - please adjust! ###
48 45
     op.drop_table("user_logging")
49 46
     op.drop_table("logging")
50
-    ### 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
10 10
 revision = "71ebbd5fe6de"
11 11
 down_revision = "4669be672bc4"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("log", sa.Column("qso_comment", sa.UnicodeText(), nullable=True))
20
-    ### end Alembic commands ###
21 19
 
22 20
 
23 21
 def downgrade():
24
-    ### commands auto generated by Alembic - please adjust! ###
25 22
     op.drop_column("log", "qso_comment")
26
-    ### 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
10 10
 revision = "eb1dd834c778"
11 11
 down_revision = "71ebbd5fe6de"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
15
-from sqlalchemy.dialects import mysql
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15
+from sqlalchemy.dialects import mysql  # noqa: E402
16 16
 
17 17
 
18 18
 def upgrade():
19
-    ### commands auto generated by Alembic - please adjust! ###
20 19
     op.add_column("log", sa.Column("qsl_comment", sa.UnicodeText(), nullable=True))
21 20
     op.drop_column("log", "qso_comment")
22
-    ### end Alembic commands ###
23 21
 
24 22
 
25 23
 def downgrade():
26
-    ### commands auto generated by Alembic - please adjust! ###
27 24
     op.add_column("log", sa.Column("qso_comment", mysql.TEXT(), nullable=True))
28 25
     op.drop_column("log", "qsl_comment")
29
-    ### 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
10 10
 revision = "1cfbdbdced17"
11 11
 down_revision = "eb1dd834c778"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("config", sa.Column("clublog_api_key", sa.String(length=255), nullable=True))
20 19
     op.add_column("config", sa.Column("eqsl_upload_url", sa.String(length=255), nullable=True))
21
-    ### end Alembic commands ###
22 20
 
23 21
 
24 22
 def downgrade():
25
-    ### commands auto generated by Alembic - please adjust! ###
26 23
     op.drop_column("config", "eqsl_upload_url")
27 24
     op.drop_column("config", "clublog_api_key")
28
-    ### 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
10 10
 revision = "4b8ff69cf574"
11 11
 down_revision = "1cfbdbdced17"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("logging", sa.Column("timestamp", sa.DateTime(), server_default=sa.text("now()"), nullable=True))
20 19
     op.add_column("user_logging", sa.Column("timestamp", sa.DateTime(), server_default=sa.text("now()"), nullable=True))
21
-    ### end Alembic commands ###
22 20
 
23 21
 
24 22
 def downgrade():
25
-    ### commands auto generated by Alembic - please adjust! ###
26 23
     op.drop_column("user_logging", "timestamp")
27 24
     op.drop_column("logging", "timestamp")
28
-    ### 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
10 10
 revision = "96dd40d300ed"
11 11
 down_revision = "4b8ff69cf574"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("user", sa.Column("hamqth_name", sa.String(length=32), nullable=True))
20 19
     op.add_column("user", sa.Column("hamqth_password", sa.String(length=255), nullable=True))
21
-    ### end Alembic commands ###
22 20
 
23 21
 
24 22
 def downgrade():
25
-    ### commands auto generated by Alembic - please adjust! ###
26 23
     op.drop_column("user", "hamqth_password")
27 24
     op.drop_column("user", "hamqth_name")
28
-    ### 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
10 10
 revision = "b71a316c6504"
11 11
 down_revision = "96dd40d300ed"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("log", sa.Column("consolidated_hamqth", sa.Boolean(), nullable=False))
20
-    ### end Alembic commands ###
21 19
 
22 20
 
23 21
 def downgrade():
24
-    ### commands auto generated by Alembic - please adjust! ###
25 22
     op.drop_column("log", "consolidated_hamqth")
26
-    ### 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
10 10
 revision = "98ea6ef6fc14"
11 11
 down_revision = "b71a316c6504"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("cat", sa.Column("slug", sa.String(length=255), nullable=True))
20 19
     op.create_unique_constraint(None, "cat", ["slug"])
21 20
     op.add_column("contact", sa.Column("slug", sa.String(length=255), nullable=True))
@@ -34,11 +33,9 @@ def upgrade():
34 33
     op.create_unique_constraint(None, "picture", ["slug"])
35 34
     op.add_column("user", sa.Column("slug", sa.String(length=255), nullable=True))
36 35
     op.create_unique_constraint(None, "user", ["slug"])
37
-    ### end Alembic commands ###
38 36
 
39 37
 
40 38
 def downgrade():
41
-    ### commands auto generated by Alembic - please adjust! ###
42 39
     op.drop_constraint(None, "user", type_="unique")
43 40
     op.drop_column("user", "slug")
44 41
     op.drop_constraint(None, "picture", type_="unique")
@@ -57,4 +54,3 @@ def downgrade():
57 54
     op.drop_column("contact", "slug")
58 55
     op.drop_constraint(None, "cat", type_="unique")
59 56
     op.drop_column("cat", "slug")
60
-    ### 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
10 10
 revision = "5539ae4bd72a"
11 11
 down_revision = "98ea6ef6fc14"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
15
-import sqlalchemy_utils
16
-from sqlalchemy_searchable import sync_trigger
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15
+import sqlalchemy_utils  # noqa: E402
16
+from sqlalchemy_searchable import sync_trigger  # noqa: E402
17 17
 
18 18
 
19 19
 def upgrade():
@@ -42,7 +42,5 @@ def upgrade():
42 42
 
43 43
 
44 44
 def downgrade():
45
-    ### commands auto generated by Alembic - please adjust! ###
46 45
     op.drop_index("ix_log_search_vector", table_name="log")
47 46
     op.drop_column("log", "search_vector")
48
-    ### 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
10 10
 revision = "df93b7d9aa63"
11 11
 down_revision = "5539ae4bd72a"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.drop_constraint("picture_hash_key", "picture", type_="unique")
20 19
     op.drop_column("picture", "hash")
21 20
     op.drop_column("picture", "filesize")
22
-    ### end Alembic commands ###
23 21
 
24 22
 
25 23
 def downgrade():
26
-    ### commands auto generated by Alembic - please adjust! ###
27 24
     op.add_column("picture", sa.Column("filesize", sa.INTEGER(), autoincrement=False, nullable=True))
28 25
     op.add_column("picture", sa.Column("hash", sa.VARCHAR(length=255), autoincrement=False, nullable=True))
29 26
     op.create_unique_constraint("picture_hash_key", "picture", ["hash"])
30
-    ### 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
10 10
 revision = "eb8858fd3d9c"
11 11
 down_revision = "df93b7d9aa63"
12 12
 
13
-from models import db, Band
13
+from models import db, Band  # noqa: E402
14 14
 
15 15
 
16 16
 def upgrade():

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

@@ -10,17 +10,13 @@ Create Date: 2016-12-22 11:38:09.835930
10 10
 revision = "e072762b7964"
11 11
 down_revision = "eb8858fd3d9c"
12 12
 
13
-from alembic import op
14
-import sqlalchemy as sa
13
+from alembic import op  # noqa: E402
14
+import sqlalchemy as sa  # noqa: E402
15 15
 
16 16
 
17 17
 def upgrade():
18
-    ### commands auto generated by Alembic - please adjust! ###
19 18
     op.add_column("logbook", sa.Column("old", sa.Boolean(), nullable=True))
20
-    ### end Alembic commands ###
21 19
 
22 20
 
23 21
 def downgrade():
24
-    ### commands auto generated by Alembic - please adjust! ###
25 22
     op.drop_column("logbook", "old")
26
-    ### end Alembic commands ###

+ 9
- 9
models.py View File

@@ -571,7 +571,7 @@ def cutename(call, name=None):
571 571
 
572 572
 @event.listens_for(User, "after_update")
573 573
 @event.listens_for(User, "after_insert")
574
-def make_slug(mapper, connection, target):
574
+def make_user_slug(mapper, connection, target):
575 575
     title = "{0} {1}".format(target.id, target.name)
576 576
     slug = slugify(title)
577 577
     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):
579 579
 
580 580
 @event.listens_for(Cat, "after_update")
581 581
 @event.listens_for(Cat, "after_insert")
582
-def make_slug(mapper, connection, target):
582
+def make_cat_slug(mapper, connection, target):
583 583
     title = "{0} {1}".format(target.id, target.radio)
584 584
     slug = slugify(title)
585 585
     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):
587 587
 
588 588
 @event.listens_for(ContestTemplate, "after_update")
589 589
 @event.listens_for(ContestTemplate, "after_insert")
590
-def make_slug(mapper, connection, target):
590
+def make_contestt_slug(mapper, connection, target):
591 591
     title = "{0} {1}".format(target.id, target.name)
592 592
     slug = slugify(title)
593 593
     connection.execute(
@@ -597,7 +597,7 @@ def make_slug(mapper, connection, target):
597 597
 
598 598
 @event.listens_for(Contest, "after_update")
599 599
 @event.listens_for(Contest, "after_insert")
600
-def make_slug(mapper, connection, target):
600
+def make_contest_slug(mapper, connection, target):
601 601
     title = "{0} {1}".format(target.id, target.name)
602 602
     slug = slugify(title)
603 603
     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):
605 605
 
606 606
 @event.listens_for(Contact, "after_update")
607 607
 @event.listens_for(Contact, "after_insert")
608
-def make_slug(mapper, connection, target):
608
+def make_contact_slug(mapper, connection, target):
609 609
     title = "{0} {1}".format(target.id, target.callsign)
610 610
     slug = slugify(title)
611 611
     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):
613 613
 
614 614
 @event.listens_for(Logbook, "after_update")
615 615
 @event.listens_for(Logbook, "after_insert")
616
-def make_slug(mapper, connection, target):
616
+def make_logbook_slug(mapper, connection, target):
617 617
     title = "{0} {1}".format(target.id, target.name)
618 618
     slug = slugify(title)
619 619
     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):
621 621
 
622 622
 @event.listens_for(Picture, "after_update")
623 623
 @event.listens_for(Picture, "after_insert")
624
-def make_slug(mapper, connection, target):
624
+def make_picture_slug(mapper, connection, target):
625 625
     title = "{0} {1}".format(target.id, target.name)
626 626
     slug = slugify(title)
627 627
     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):
629 629
 
630 630
 @event.listens_for(Log, "after_update")
631 631
 @event.listens_for(Log, "after_insert")
632
-def make_slug(mapper, connection, target):
632
+def make_log_slug(mapper, connection, target):
633 633
     title = "{0} {1}".format(target.id, target.call)
634 634
     slug = slugify(title)
635 635
     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):
637 637
 
638 638
 @event.listens_for(Note, "after_update")
639 639
 @event.listens_for(Note, "after_insert")
640
-def make_slug(mapper, connection, target):
640
+def make_note_slug(mapper, connection, target):
641 641
     title = "{0} {1}".format(target.id, target.title)
642 642
     slug = slugify(title)
643 643
     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 = '''
8 8
   | \.idea
9 9
   | \__pycache__
10 10
   | venv
11
+  | \.ropeproject
11 12
 )/
12 13
 '''
13 14
 skip-numeric-underscore-normalization = true

+ 1
- 1
setup.cfg View File

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

+ 4
- 4
tests/test_libjambon.py View File

@@ -1,10 +1,10 @@
1 1
 import sys
2 2
 
3 3
 sys.path.insert(0, sys.path[0] + "/../")
4
-from geohelper import bearing
5
-from libjambon import coordinates2adif, adif2coordinates, adif, geo_bearing_star
6
-import unittest
7
-from nose_parameterized import parameterized
4
+from geohelper import bearing  # noqa: E402
5
+from libjambon import coordinates2adif, adif2coordinates, adif, geo_bearing_star  # noqa: E402
6
+import unittest  # noqa: E402
7
+from nose_parameterized import parameterized  # noqa: E402
8 8
 
9 9
 
10 10
 class TestLibjambon(unittest.TestCase):

+ 2
- 2
tests/test_utils.py View File

@@ -1,8 +1,8 @@
1 1
 import sys
2 2
 
3 3
 sys.path.insert(0, sys.path[0] + "/../")
4
-from utils import gen_random_str
5
-import unittest
4
+from utils import gen_random_str  # noqa: E402
5
+import unittest  # noqa: E402
6 6
 
7 7
 
8 8
 class TestUtils(unittest.TestCase):

Loading…
Cancel
Save