Skip to content

Commit

Permalink
style: 🎨 fix code style issues with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
lint-action committed Feb 21, 2024
1 parent 814ff95 commit 8c64c8d
Show file tree
Hide file tree
Showing 49 changed files with 116 additions and 59 deletions.
1 change: 1 addition & 0 deletions alembic/versions/0defbfc71c59_add_identifier_to_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-01-05 13:25:15.547450
"""

from typing import Sequence, Union

from alembic import op
Expand Down
1 change: 1 addition & 0 deletions alembic/versions/29e42ce4be3f_adding_license_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-12-21 13:34:26.478808
"""

from typing import Sequence, Union

from alembic import op
Expand Down
9 changes: 6 additions & 3 deletions alembic/versions/31703d707dfb_contributor_name_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
Create Date: 2024-02-20 08:25:11.511833
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '31703d707dfb'
down_revision: Union[str, None] = '0defbfc71c59'
revision: str = "31703d707dfb"
down_revision: Union[str, None] = "0defbfc71c59"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.drop_column("dataset_contributor", "name")
op.add_column("dataset_contributor", sa.Column("family_name", sa.String, nullable=True))
op.add_column(
"dataset_contributor", sa.Column("family_name", sa.String, nullable=True)
)
op.add_column("dataset_contributor", sa.Column("given_name", sa.String))
op.execute("UPDATE dataset_contributor SET given_name = 'name'")
with op.batch_alter_table("dataset_contributor") as batch_op:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-11-08 15:47:00.205940
"""

from typing import Sequence, Union

import alembic
Expand Down
1 change: 1 addition & 0 deletions apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Initialize the api system for the backend"""

from flask_restx import Api, Resource

from apis.dataset_metadata_namespace import api as dataset_metadata_namespace
Expand Down
1 change: 1 addition & 0 deletions apis/authentication.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module is used to authenticate users to the system and
handle few authentication errors. Also, it sets token for logged user
along with expiration date"""

import datetime
import importlib
import os
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_alternate_identifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API endpoints for dataset alternate identifier"""

from typing import Any, Union

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_consent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for dataset consent metadata"""

from flask import request
from flask_restx import Resource, fields
from jsonschema import ValidationError, validate
Expand Down
11 changes: 3 additions & 8 deletions apis/dataset_metadata/dataset_contributor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for dataset contributor metadata"""

from typing import Any, Union

from flask import Response, request
Expand Down Expand Up @@ -57,10 +58,7 @@ def post(self, study_id: int, dataset_id: int):
"type": "string",
"minLength": 1,
},
"family_name": {
"type":
["string", "null"]
},
"family_name": {"type": ["string", "null"]},
"name_identifier": {
"type": "string",
"minLength": 1,
Expand Down Expand Up @@ -201,10 +199,7 @@ def post(self, study_id: int, dataset_id: int):
"type": "string",
"minLength": 1,
},
"family_name": {
"type":
["string", "null"]
},
"family_name": {"type": ["string", "null"]},
"name_identifier": {
"type": "string",
"minLength": 1,
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_date.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""APIs for dataset date metadata"""

from typing import Any, Union

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_funder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API endpoints for dataset funder"""

from typing import Any, Union

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_other.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API endpoints for other dataset metadata"""

from flask import request
from flask_restx import Resource, fields
from jsonschema import ValidationError, validate
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_record_keys.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API endpoints for dataset record keys"""

from flask import request
from flask_restx import Resource, fields
from jsonschema import ValidationError, validate
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_related_item.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for dataset related item"""

from typing import Any, Union

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/dataset_metadata/dataset_title.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for dataset title metadata"""

from typing import Any, Union

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""APIs for study files"""

import importlib
import os
import uuid
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_arm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study arm metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_available_ipd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study available ipd metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_contact.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study contact metadata"""

import typing

from email_validator import EmailNotValidError, validate_email
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_description.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study description metadata"""

from flask import request
from flask_restx import Resource, fields
from jsonschema import ValidationError, validate
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_design.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study design metadata"""

import typing

from flask import request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_eligibility.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study eligibility metadata"""

from flask import request
from flask_restx import Resource, fields
from jsonschema import ValidationError, validate
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_identification.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study identification metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_intervention.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study intervention metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_ipdsharing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study ipdsharing metadata"""

import typing

from flask import request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_link.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study link metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_location.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study location metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_other.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study other metadata"""

import typing

from flask import request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_overall_official.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study overall official metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_reference.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study reference metadata"""

import typing

from flask import Response, request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_sponsors_collaborators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study sponsors and collaborators metadata"""

import typing

from flask import request
Expand Down
1 change: 1 addition & 0 deletions apis/study_metadata/study_status.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API routes for study status metadata"""

import typing

from flask import request
Expand Down
1 change: 1 addition & 0 deletions apis/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils Endpoints"""

from flask import request
from flask_restx import Namespace, Resource

Expand Down
1 change: 1 addition & 0 deletions apis/utils_namespace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Namespace for utils operations"""

from flask_restx import Namespace

api = Namespace("Utils", description="utils operations", path="/")
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Entry point for the application."""

import datetime
import importlib
import logging
Expand Down
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration for the application."""

from os import environ
from pathlib import Path
from dotenv import dotenv_values
Expand Down
1 change: 0 additions & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""Core package for the application."""


from . import utils # noqa: F401
1 change: 1 addition & 0 deletions core/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils for core"""

import requests


Expand Down
72 changes: 45 additions & 27 deletions model/dataset_metadata/dataset_related_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,51 @@ def to_dict(self):
],
"creators": [c.to_dict() for c in creators],
"contributors": [c.to_dict() for c in contributors],
"publication_year": self.dataset_related_item_other.publication_year
if self.dataset_related_item_other
else None,
"volume": self.dataset_related_item_other.volume
if self.dataset_related_item_other
else None,
"issue": self.dataset_related_item_other.issue
if self.dataset_related_item_other
else None,
"number_value": self.dataset_related_item_other.number_value
if self.dataset_related_item_other
else None,
"number_type": self.dataset_related_item_other.number_type
if self.dataset_related_item_other
else None,
"first_page": self.dataset_related_item_other.first_page
if self.dataset_related_item_other
else None,
"last_page": self.dataset_related_item_other.last_page
if self.dataset_related_item_other
else None,
"publisher": self.dataset_related_item_other.publisher
if self.dataset_related_item_other
else None,
"edition": self.dataset_related_item_other.edition
if self.dataset_related_item_other
else None,
"publication_year": (
self.dataset_related_item_other.publication_year
if self.dataset_related_item_other
else None
),
"volume": (
self.dataset_related_item_other.volume
if self.dataset_related_item_other
else None
),
"issue": (
self.dataset_related_item_other.issue
if self.dataset_related_item_other
else None
),
"number_value": (
self.dataset_related_item_other.number_value
if self.dataset_related_item_other
else None
),
"number_type": (
self.dataset_related_item_other.number_type
if self.dataset_related_item_other
else None
),
"first_page": (
self.dataset_related_item_other.first_page
if self.dataset_related_item_other
else None
),
"last_page": (
self.dataset_related_item_other.last_page
if self.dataset_related_item_other
else None
),
"publisher": (
self.dataset_related_item_other.publisher
if self.dataset_related_item_other
else None
),
"edition": (
self.dataset_related_item_other.edition
if self.dataset_related_item_other
else None
),
"identifiers": [
i.to_dict()
for i in self.dataset_related_item_identifier # type: ignore
Expand Down
6 changes: 3 additions & 3 deletions model/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ def to_dict(self):
"created_at": self.created_at,
"updated_on": self.updated_on,
"size": self.study_other.size if self.study_other else None,
"description": self.study_description.brief_summary
if self.study_description
else None,
"description": (
self.study_description.brief_summary if self.study_description else None
),
"owner": owner.to_dict()["id"] if owner else None,
"role": contributor_permission.to_dict()["role"],
}
Expand Down
6 changes: 3 additions & 3 deletions model/study_contributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def __init__(self, study: Study, user: User, permission):
def to_dict(self):
return {
"id": self.user_id,
"name": self.user.user_details.first_name
if self.user.user_details
else None,
"name": (
self.user.user_details.first_name if self.user.user_details else None
),
"email_address": self.user.email_address,
"orcid": self.user.user_details.orcid if self.user.user_details else None,
"role": self.permission,
Expand Down
Loading

0 comments on commit 8c64c8d

Please sign in to comment.