Skip to content

Commit

Permalink
global: remove python2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Panero committed Jan 31, 2022
1 parent ec28a02 commit e15b447
Show file tree
Hide file tree
Showing 22 changed files with 20 additions and 74 deletions.
4 changes: 1 addition & 3 deletions invenio_oaiserver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2015-2022 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.
Expand Down Expand Up @@ -182,8 +182,6 @@
(GPLv3 licensed).
"""

from __future__ import absolute_import, print_function

from .ext import InvenioOAIServer
from .proxies import current_oaiserver
from .version import __version__
Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/errors.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
# Copyright (C) 2016-2022 CERN.
# Copyright (C) 2022 Graz University of Technology.
#
# 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.

"""Error."""

from __future__ import absolute_import, print_function


class OAIBadMetadataFormatError(Exception):
"""Metadata format required doesn't exist."""
Expand Down
5 changes: 1 addition & 4 deletions invenio_oaiserver/ext.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2015-2022 CERN.
# Copyright (C) 2021-2022 Graz University of Technology.
#
# 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.

"""Invenio-OAIServer extension implementation."""

from __future__ import absolute_import, print_function

from invenio_base.utils import obj_or_import_string
from invenio_records import signals as records_signals
from sqlalchemy.event import contains, listen, remove

from . import config
Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/fetchers.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
# Copyright (C) 2016-2022 CERN.
# Copyright (C) 2021 Graz University of Technology.
#
# 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.

"""Persistent identifier fetchers."""

from __future__ import absolute_import, print_function

from elasticsearch_dsl.query import Q
from invenio_pidstore.errors import PersistentIdentifierError
from invenio_pidstore.fetchers import FetchedPID
Expand Down
7 changes: 1 addition & 6 deletions invenio_oaiserver/minters.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
# Copyright (C) 2016-2022 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.

"""Persistent identifier minters."""

from __future__ import absolute_import, print_function

from datetime import datetime

from flask import current_app
from invenio_pidstore import current_pidstore

from .provider import OAIIDProvider
from .utils import datetime_to_datestamp


def oaiid_minter(record_uuid, data):
Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2015-2022 CERN.
# Copyright (C) 2022 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
Expand All @@ -11,12 +11,10 @@

from flask_babelex import lazy_gettext as _
from invenio_db import db
from sqlalchemy.event import listen
from sqlalchemy.orm import validates
from sqlalchemy_utils import Timestamp

from .errors import OAISetSpecUpdateError
from .proxies import current_oaiserver


class OAISet(db.Model, Timestamp):
Expand Down
6 changes: 1 addition & 5 deletions invenio_oaiserver/percolator.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017-2018 CERN.
# Copyright (C) 2017-2022 CERN.
# Copyright (C) 2022 Graz University of Technology.
#
# 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.

"""Percolator."""

from __future__ import absolute_import, print_function

import json

from elasticsearch import VERSION as ES_VERSION
Expand All @@ -23,8 +21,6 @@

from invenio_oaiserver.query import query_string_parser

from .proxies import current_oaiserver


def _build_percolator_index_name(index):
"""Build percolator index name."""
Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/provider.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2015-2022 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.

"""OAI-PMH ID provider."""

from __future__ import absolute_import, print_function

from invenio_pidstore.models import PIDStatus
from invenio_pidstore.providers.base import BaseProvider

Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/proxies.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
# Copyright (C) 2016-2022 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.

"""Helper proxy to the state object."""

from __future__ import absolute_import, print_function

from flask import current_app
from werkzeug.local import LocalProxy

Expand Down
5 changes: 2 additions & 3 deletions invenio_oaiserver/query.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
# Copyright (C) 2016-2022 CERN.
# Copyright (C) 2022 Graz University of Technology.
#
# 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.

"""Query parser."""

import six
from elasticsearch import VERSION as ES_VERSION
from elasticsearch_dsl import Q
from flask import current_app
Expand All @@ -25,7 +24,7 @@ def query_string_parser(search_pattern):
"""Elasticsearch query string parser."""
if not hasattr(current_oaiserver, 'query_parser'):
query_parser = current_app.config['OAISERVER_QUERY_PARSER']
if isinstance(query_parser, six.string_types):
if isinstance(query_parser, str):
query_parser = import_string(query_parser)
current_oaiserver.query_parser = query_parser
query_parser_fields = (
Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/receivers.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
# Copyright (C) 2016-2022 CERN.
# Copyright (C) 2022 Graz University of Technology.
#
# 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.

"""Record field function."""

from __future__ import absolute_import, print_function

from .percolator import _delete_percolator, _new_percolator


Expand Down
12 changes: 2 additions & 10 deletions invenio_oaiserver/utils.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2015-2022 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.

"""Utilities."""

from __future__ import absolute_import, print_function

import re
from datetime import datetime
from functools import partial
from functools import lru_cache, partial

from flask import current_app
from invenio_base.utils import obj_or_import_string
Expand All @@ -22,12 +20,6 @@

from .proxies import current_oaiserver

try:
from functools import lru_cache
except ImportError: # pragma: no cover
from functools32 import lru_cache


ns = {
None: 'http://datacite.org/schema/kernel-4',
'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/verbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@

"""OAI-PMH verbs."""

from __future__ import absolute_import

from flask import current_app, request
from invenio_rest.serializer import BaseSchema
from marshmallow import ValidationError, fields, utils, validates_schema
from marshmallow import ValidationError, fields, validates_schema
from marshmallow.fields import DateTime as _DateTime
from marshmallow.utils import isoformat

Expand Down
4 changes: 1 addition & 3 deletions invenio_oaiserver/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2020 CERN.
# Copyright (C) 2015-2022 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.
Expand All @@ -12,6 +12,4 @@
and parsed by ``setup.py``.
"""

from __future__ import absolute_import, print_function

__version__ = '1.3.0'
2 changes: 0 additions & 2 deletions invenio_oaiserver/views/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

"""OAI-PMH 2.0 server."""

from __future__ import absolute_import

from flask import Blueprint, make_response
from invenio_pidstore.errors import PIDDoesNotExistError
from itsdangerous import BadSignature
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2019 CERN.
# Copyright (C) 2015-2022 CERN.
# Copyright (C) 2021 Graz University of Technology.
# Copyright (C) 2021 TU Wien.
#
Expand Down Expand Up @@ -148,10 +148,10 @@
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Development Status :: 5 - Production/Stable',
],
)
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

"""Pytest configuration."""

from __future__ import absolute_import, print_function

import os
import shutil
import tempfile
Expand Down
3 changes: 0 additions & 3 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

"""Utilities for loading test records."""

from __future__ import absolute_import, print_function

import uuid

import mock
Expand All @@ -21,7 +19,6 @@
from invenio_indexer.api import RecordIndexer
from invenio_pidstore.minters import recid_minter
from invenio_pidstore.models import PersistentIdentifier
from invenio_records import Record
from invenio_records.models import RecordMetadata
from invenio_search import current_search, current_search_client

Expand Down
2 changes: 0 additions & 2 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

"""Test admin interface."""

from __future__ import absolute_import, print_function

from flask import url_for
from flask_admin import Admin, menu
from invenio_db import db
Expand Down
2 changes: 0 additions & 2 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

"""Test app."""

from __future__ import absolute_import

import pytest
from flask import Flask

Expand Down
2 changes: 0 additions & 2 deletions tests/test_invenio_oaiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

"""Module tests."""

from __future__ import absolute_import, print_function

import socket

import pytest
Expand Down
2 changes: 0 additions & 2 deletions tests/test_verbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

"""Test OAI verbs."""

from __future__ import absolute_import

import uuid
from copy import deepcopy
from datetime import datetime, timedelta
Expand Down

0 comments on commit e15b447

Please sign in to comment.