Skip to content

Commit

Permalink
Merge pull request #1510 from ScilifelabDataCentre/DDS-1686-Black-ver…
Browse files Browse the repository at this point in the history
…sion-should-be-the-same-locally-and-on-Github-actions

Dds 1686 Fixed black version on GitHub Actions - update code to black 24.1.1
  • Loading branch information
rv0lt authored Jan 30, 2024
2 parents c77130b + 9ca8bf6 commit bdc8a8b
Show file tree
Hide file tree
Showing 42 changed files with 115 additions and 55 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/python-black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ name: Black

on: [push, pull_request]

env:
INPUT_VERSION: 24.1.1

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
version: ${{ env.INPUT_VERSION }}
4 changes: 4 additions & 0 deletions SPRINTLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,7 @@ _Nothing merged in CLI during this sprint_

- Minor update jinja2 package to address cve ([#1503](https://github.com/ScilifelabDataCentre/dds_web/pull/1503))
- Minor update jwcrypto package to address cve ([#1504](https://github.com/ScilifelabDataCentre/dds_web/pull/1504))

# 2024-01-29 - 2024-02-09

- Use of a fix version of black and linted files to 24.1.1 ([#1510](https://github.com/ScilifelabDataCentre/dds_web/pull/1510))
6 changes: 3 additions & 3 deletions dds_web/api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,9 +1063,9 @@ def give_project_access(project_list, current_user, user):
from_user_token=dds_web.security.auth.obtain_current_encrypted_token(),
)
except KeyNotFoundError as keyerr:
fix_errors[
proj.public_id
] = "You do not have access to this project. Please contact the responsible unit."
fix_errors[proj.public_id] = (
"You do not have access to this project. Please contact the responsible unit."
)

return fix_errors

Expand Down
6 changes: 3 additions & 3 deletions dds_web/api/schemas/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ def return_items(self, data, **kwargs):
{
z.name: {
**fileschema.dump(z),
"url": s3.generate_get_url(key=z.name_in_bucket)
if url
else None,
"url": (
s3.generate_get_url(key=z.name_in_bucket) if url else None
),
}
for z in y
}
Expand Down
12 changes: 6 additions & 6 deletions dds_web/api/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ def invite_user(email, new_user_role, project=None, unit=None):
project=unit_project,
)
except ddserr.KeyNotFoundError as keyerr:
projects_not_shared[
unit_project.public_id
] = "You do not have access to the project(s)"
projects_not_shared[unit_project.public_id] = (
"You do not have access to the project(s)"
)
else:
goahead = True
else:
Expand All @@ -258,9 +258,9 @@ def invite_user(email, new_user_role, project=None, unit=None):
is_project_owner=new_user_role == "Project Owner",
)
except ddserr.KeyNotFoundError as keyerr:
projects_not_shared[
project.public_id
] = "You do not have access to the specified project."
projects_not_shared[project.public_id] = (
"You do not have access to the specified project."
)
else:
goahead = True
else:
Expand Down
88 changes: 52 additions & 36 deletions dds_web/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,21 @@ def list_lost_files(project_id: str):
# Connect to S3
resource = session.resource(
service_name="s3",
endpoint_url=project.responsible_unit.sto4_endpoint
if sto4
else project.responsible_unit.sto2_endpoint,
aws_access_key_id=project.responsible_unit.sto4_access
if sto4
else project.responsible_unit.sto2_access,
aws_secret_access_key=project.responsible_unit.sto4_secret
if sto4
else project.responsible_unit.sto2_secret,
endpoint_url=(
project.responsible_unit.sto4_endpoint
if sto4
else project.responsible_unit.sto2_endpoint
),
aws_access_key_id=(
project.responsible_unit.sto4_access
if sto4
else project.responsible_unit.sto2_access
),
aws_secret_access_key=(
project.responsible_unit.sto4_secret
if sto4
else project.responsible_unit.sto2_secret
),
)

# List the lost files
Expand Down Expand Up @@ -340,15 +346,21 @@ def list_lost_files(project_id: str):
# Connect to S3
resource_unit = session.resource(
service_name="s3",
endpoint_url=proj.responsible_unit.sto4_endpoint
if sto4
else proj.responsible_unit.sto2_endpoint,
aws_access_key_id=proj.responsible_unit.sto4_access
if sto4
else proj.responsible_unit.sto2_access,
aws_secret_access_key=proj.responsible_unit.sto4_secret
if sto4
else proj.responsible_unit.sto2_secret,
endpoint_url=(
proj.responsible_unit.sto4_endpoint
if sto4
else proj.responsible_unit.sto2_endpoint
),
aws_access_key_id=(
proj.responsible_unit.sto4_access
if sto4
else proj.responsible_unit.sto2_access
),
aws_secret_access_key=(
proj.responsible_unit.sto4_secret
if sto4
else proj.responsible_unit.sto2_secret
),
)

# List the lost files
Expand Down Expand Up @@ -411,15 +423,17 @@ def add_missing_bucket(project_id: str):
# Connect to S3
resource = session.resource(
service_name="s3",
endpoint_url=project.responsible_unit.sto4_endpoint
if sto4
else project.responsible_unit.sto2_endpoint,
aws_access_key_id=project.responsible_unit.sto4_access
if sto4
else project.responsible_unit.sto2_access,
aws_secret_access_key=project.responsible_unit.sto4_secret
if sto4
else project.responsible_unit.sto2_secret,
endpoint_url=(
project.responsible_unit.sto4_endpoint
if sto4
else project.responsible_unit.sto2_endpoint
),
aws_access_key_id=(
project.responsible_unit.sto4_access if sto4 else project.responsible_unit.sto2_access
),
aws_secret_access_key=(
project.responsible_unit.sto4_secret if sto4 else project.responsible_unit.sto2_secret
),
)

# Check if bucket exists
Expand Down Expand Up @@ -474,15 +488,17 @@ def delete_lost_files(project_id: str):
# Connect to S3
resource = session.resource(
service_name="s3",
endpoint_url=project.responsible_unit.sto4_endpoint
if sto4
else project.responsible_unit.sto2_endpoint,
aws_access_key_id=project.responsible_unit.sto4_access
if sto4
else project.responsible_unit.sto2_access,
aws_secret_access_key=project.responsible_unit.sto4_secret
if sto4
else project.responsible_unit.sto2_secret,
endpoint_url=(
project.responsible_unit.sto4_endpoint
if sto4
else project.responsible_unit.sto2_endpoint
),
aws_access_key_id=(
project.responsible_unit.sto4_access if sto4 else project.responsible_unit.sto2_access
),
aws_secret_access_key=(
project.responsible_unit.sto4_secret if sto4 else project.responsible_unit.sto2_secret
),
)

# Get list of lost files
Expand Down
1 change: 1 addition & 0 deletions dds_web/security/project_user_keys.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Code for generating and maintaining project and user related keys """

import os

import argon2
Expand Down
1 change: 1 addition & 0 deletions dds_web/web/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Most of the app routes are in `dds_web/web/user.py`.
Here we have the routes that are not specific to a user.
"""

from datetime import datetime, timedelta
import functools
import threading
Expand Down
6 changes: 3 additions & 3 deletions dds_web/web/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,9 @@ def password_reset_completed():
unit_admins_to_contact = users
else:
if project.responsible_unit.external_display_name not in units_to_contact:
units_to_contact[
project.responsible_unit.external_display_name
] = project.responsible_unit.contact_email
units_to_contact[project.responsible_unit.external_display_name] = (
project.responsible_unit.contact_email
)

if len(unit_admins_to_contact) > 0:
for unit_admin in unit_admins_to_contact:
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/02acefb3057a_add_done_to_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-08-17 08:32:57.578324
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/0c9c237cced5_unit_quota_and_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-01-10 14:30:57.089391
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/1256117ad629_add_password_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-03-14 16:23:44.287254
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/19b877061c98_add_motd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-05 13:49:44.087517
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-13 06:16:56.046361
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/1e56b6212479_add_sto4_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-07-26 10:40:22.591583
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/1fbd604872e9_add_column_created_at.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-08 14:32:26.800385
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-06-02 12:07:01.372912
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-05-29 09:37:31.007336
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-11-03 08:36:35.425045
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-05-30 13:24:52.406907
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-02-24 16:35:34.228040
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/6e9b74878553_add_busy_to_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-09-07 09:09:06.081829
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/879b99e7f212_unit_personnel_added.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-05-29 07:51:05.491352
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Revises: cd1903e5f2b0
Create Date: 2022-06-13 12:34:34.981373
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-05-30 08:47:53.926692
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/a5a40d843415_changed_sensitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-02-19 10:32:31.626236
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.orm.session import Session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-05-31 14:09:07.327919
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/b01fc48f5939_add_totp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-13 14:27:49.319000
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
1 change: 1 addition & 0 deletions migrations/versions/b976f6cda95c_add_reporting_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-01-26 10:02:37.535695
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-07-26 07:11:20.429058
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-05-29 11:27:10.843043
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
Expand Down
Loading

0 comments on commit bdc8a8b

Please sign in to comment.