Skip to content

Commit 1eb9334

Browse files
CI fixes for Flask, black, & testing (#123)
* Upgrade black version * Clean up using pre-commit * Upgrade Flask and Flask-Login dependencies to fix Werkzeug missing function error * Make browser thread daemon thread so tests actually exit * Fix pre-commit error! Co-authored-by: sea-kelp <66500457+sea-kelp@users.noreply.github.com>
1 parent 84fb1c6 commit 1eb9334

File tree

15 files changed

+40
-42
lines changed

15 files changed

+40
-42
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ repos:
8080
- --ignore=E203,E402,E501,E800,W503,W391,E261
8181
- --select=B,C,E,F,W,T4,B9
8282

83-
- repo: https://github.com/ambv/black
84-
rev: 21.6b0
83+
- repo: https://github.com/psf/black
84+
rev: 22.3.0
8585
hooks:
8686
- id: black
8787
args:

OpenOversight/app/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def bulk_add_officers(filename, no_create, update_by_name, update_static_fields)
460460

461461
# handles unicode errors that can occur when the file was made in Excel
462462
with open(filename, "r") as f:
463-
if u"\ufeff" in f.readline():
463+
if "\ufeff" in f.readline():
464464
encoding = "utf-8-sig"
465465

466466
with open(filename, "r", encoding=encoding) as f:

OpenOversight/app/formfields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _value(self):
2020
return self.data and self.data.strftime(self.format) or ""
2121

2222
def process_formdata(self, valuelist):
23-
if valuelist and valuelist != [u""]:
23+
if valuelist and valuelist != [""]:
2424
time_str = " ".join(valuelist)
2525
try:
2626
components = time_str.split(":")

OpenOversight/app/main/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class AssignmentForm(Form):
163163
query_factory=unit_choices,
164164
get_label="descrip",
165165
allow_blank=True,
166-
blank_text=u"None",
166+
blank_text="None",
167167
)
168168
star_date = DateField("Assignment start date", validators=[Optional()])
169169
resign_date = DateField(
@@ -329,7 +329,7 @@ class AddOfficerForm(Form):
329329
query_factory=unit_choices,
330330
get_label="descrip",
331331
allow_blank=True,
332-
blank_text=u"None",
332+
blank_text="None",
333333
)
334334
employment_date = DateField("Employment Date", validators=[Optional()])
335335
birth_year = IntegerField("Birth Year", validators=[Optional()])

OpenOversight/app/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(self, html_tag="ul", prefix_label=True, classes="list-unstyled"):
1010

1111
def __call__(self, field, **kwargs):
1212
c = kwargs.pop("classes", "") or kwargs.pop("class_", "")
13-
kwargs["class"] = u"%s %s" % (self.classes, c)
13+
kwargs["class"] = "%s %s" % (self.classes, c)
1414
kwargs.setdefault("id", field.id)
1515
html = ["<%s %s>" % (self.html_tag, html_params(**kwargs))]
1616
for subfield in field:

OpenOversight/migrations/versions/114919b27a9f_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ def downgrade():
4545
),
4646
sa.Column("repository_path", sa.TEXT(), autoincrement=False, nullable=True),
4747
sa.Column("version", sa.INTEGER(), autoincrement=False, nullable=True),
48-
sa.PrimaryKeyConstraint("repository_id", name=u"migrate_version_pkey"),
48+
sa.PrimaryKeyConstraint("repository_id", name="migrate_version_pkey"),
4949
)
5050
# ### end Alembic commands ###

OpenOversight/migrations/versions/4a490771dda1_add_original_image_fk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def upgrade():
2121
op.add_column(
2222
"faces", sa.Column("fk_face_original_image_id", sa.Integer(), nullable=True)
2323
)
24-
op.drop_constraint(u"faces_img_id_fkey", "faces", type_="foreignkey")
24+
op.drop_constraint("faces_img_id_fkey", "faces", type_="foreignkey")
2525
op.create_foreign_key(
2626
"fk_face_image_id",
2727
"faces",
@@ -50,7 +50,7 @@ def downgrade():
5050
op.drop_constraint(None, "faces", type_="foreignkey")
5151
op.drop_constraint("fk_face_image_id", "faces", type_="foreignkey")
5252
op.create_foreign_key(
53-
u"faces_img_id_fkey", "faces", "raw_images", ["img_id"], ["id"]
53+
"faces_img_id_fkey", "faces", "raw_images", ["img_id"], ["id"]
5454
)
5555
op.drop_column("faces", "fk_face_original_image_id")
5656
# ### end Alembic commands ###

OpenOversight/migrations/versions/6065d7cdcbf8_.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,35 @@ def upgrade():
3333
sa.PrimaryKeyConstraint("incident_id", "officers_id"),
3434
)
3535
op.add_column(
36-
u"incident_license_plates",
36+
"incident_license_plates",
3737
sa.Column("license_plate_id", sa.Integer(), nullable=False),
3838
)
3939
op.drop_constraint(
40-
u"incident_license_plates_link_id_fkey",
40+
"incident_license_plates_link_id_fkey",
4141
"incident_license_plates",
4242
type_="foreignkey",
4343
)
4444
op.create_foreign_key(
4545
None, "incident_license_plates", "license_plates", ["license_plate_id"], ["id"]
4646
)
47-
op.drop_column(u"incident_license_plates", "link_id")
47+
op.drop_column("incident_license_plates", "link_id")
4848
# ### end Alembic commands ###
4949

5050

5151
def downgrade():
5252
# ### commands auto generated by Alembic - please adjust! ###
5353
op.add_column(
54-
u"incident_license_plates",
54+
"incident_license_plates",
5555
sa.Column("link_id", sa.INTEGER(), autoincrement=False, nullable=False),
5656
)
5757
op.drop_constraint(None, "incident_license_plates", type_="foreignkey")
5858
op.create_foreign_key(
59-
u"incident_license_plates_link_id_fkey",
59+
"incident_license_plates_link_id_fkey",
6060
"incident_license_plates",
6161
"license_plates",
6262
["link_id"],
6363
["id"],
6464
)
65-
op.drop_column(u"incident_license_plates", "license_plate_id")
65+
op.drop_column("incident_license_plates", "license_plate_id")
6666
op.drop_table("incident_officers")
6767
# ### end Alembic commands ###

OpenOversight/migrations/versions/8ce7926aa132_.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
def upgrade():
1919
# ### commands auto generated by Alembic - please adjust! ###
20-
op.drop_constraint(u"notes_officer_id_fkey", "notes", type_="foreignkey")
21-
op.drop_constraint(u"notes_creator_id_fkey", "notes", type_="foreignkey")
20+
op.drop_constraint("notes_officer_id_fkey", "notes", type_="foreignkey")
21+
op.drop_constraint("notes_creator_id_fkey", "notes", type_="foreignkey")
2222
op.create_foreign_key(
2323
None, "notes", "officers", ["officer_id"], ["id"], ondelete="CASCADE"
2424
)
@@ -33,9 +33,9 @@ def downgrade():
3333
op.drop_constraint(None, "notes", type_="foreignkey")
3434
op.drop_constraint(None, "notes", type_="foreignkey")
3535
op.create_foreign_key(
36-
u"notes_creator_id_fkey", "notes", "users", ["creator_id"], ["id"]
36+
"notes_creator_id_fkey", "notes", "users", ["creator_id"], ["id"]
3737
)
3838
op.create_foreign_key(
39-
u"notes_officer_id_fkey", "notes", "officers", ["officer_id"], ["id"]
39+
"notes_officer_id_fkey", "notes", "officers", ["officer_id"], ["id"]
4040
)
4141
# ### end Alembic commands ###

OpenOversight/migrations/versions/9e2827dae28c_.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717

1818
def upgrade():
1919
# ### commands auto generated by Alembic - please adjust! ###
20-
op.drop_constraint(
21-
u"assignments_officer_id_fkey", "assignments", type_="foreignkey"
22-
)
20+
op.drop_constraint("assignments_officer_id_fkey", "assignments", type_="foreignkey")
2321
op.create_foreign_key(
2422
None, "assignments", "officers", ["officer_id"], ["id"], ondelete="CASCADE"
2523
)
@@ -30,7 +28,7 @@ def downgrade():
3028
# ### commands auto generated by Alembic - please adjust! ###
3129
op.drop_constraint(None, "assignments", type_="foreignkey")
3230
op.create_foreign_key(
33-
u"assignments_officer_id_fkey",
31+
"assignments_officer_id_fkey",
3432
"assignments",
3533
"officers",
3634
["officer_id"],

0 commit comments

Comments
 (0)