Skip to content

Commit

Permalink
fix isort
Browse files Browse the repository at this point in the history
  • Loading branch information
zzacharo committed Oct 22, 2024
1 parent b94f66e commit a54ff21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

"""Creation of CDS RDM migration models."""

from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy_utils.types import JSONType, UUIDType


# revision identifiers, used by Alembic.
revision = "dd80f65f557b"
down_revision = "a3957490361d"
Expand Down
8 changes: 5 additions & 3 deletions site/cds_rdm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
# under the terms of the MIT License; see LICENSE file for more details.
#

"""CDS Migration models."""

import json
import uuid

from invenio_db import db
from sqlalchemy import Column, Integer
from sqlalchemy.dialects import postgresql
from sqlalchemy_utils.types import UUIDType
from invenio_rdm_records.records.models import RDMParentMetadata, RDMRecordMetadata
from invenio_db import db


class CDSMigrationLegacyRecord(db.Model):
Expand Down Expand Up @@ -51,4 +52,5 @@ class CDSMigrationLegacyRecord(db.Model):
)

def __repr__(self):
return f"<CDSMigrationLegacyRecord id={self.id} parent_record_id={self.parent_record_id} json={json.dumps(self.json)}>"
"""Representation of the model."""
return f"<CDSMigrationLegacyRecord legacy_recid={self.legacy_recid} parent_object_uuid={self.parent_object_uuid} migrated_record_object_uuid={self.migrated_record_object_uuid} json={json.dumps(self.json)}>"
15 changes: 12 additions & 3 deletions site/cds_rdm/schemes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2024 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#

"""CDS speficic identifier schemes."""

import re


Expand All @@ -11,7 +22,6 @@ def cds_reference_number():
}



aleph_regexp = re.compile(r"\d+CER$", flags=re.I)


Expand Down Expand Up @@ -46,12 +56,11 @@ def is_inspire(val):
return inspire_regexp.match(val)



def inspire():
"""Define validator for `custom_scheme`."""
return {
"validator": is_inspire,
"normalizer": lambda value: value,
"filter": ["inspire"],
"url_generator": None,
}
}

0 comments on commit a54ff21

Please sign in to comment.