Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#80 drop python 2 support #81

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Skosprovider_sqlalchemy documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 24 08:21:49 2013.
Expand All @@ -11,8 +10,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand All @@ -34,14 +31,14 @@
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Skosprovider_sqlalchemy'
copyright = u'2013-2020, Koen Van Daele'
project = 'Skosprovider_sqlalchemy'
copyright = '2013-2020, Koen Van Daele'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -183,8 +180,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Skosprovider_sqlalchemy.tex', u'Skosprovider\\_sqlalchemy Documentation',
u'Koen Van Daele', 'manual'),
('index', 'Skosprovider_sqlalchemy.tex', 'Skosprovider\\_sqlalchemy Documentation',
'Koen Van Daele', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -213,8 +210,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'skosprovider_sqlalchemy', u'Skosprovider_sqlalchemy Documentation',
[u'Koen Van Daele'], 1)
('index', 'skosprovider_sqlalchemy', 'Skosprovider_sqlalchemy Documentation',
['Koen Van Daele'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -227,35 +224,35 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Skosprovider_sqlalchemy', u'Skosprovider_sqlalchemy Documentation',
u'Koen Van Daele', 'Skosprovider_sqlalchemy', 'One line description of project.',
'Miscellaneous'),
('index', 'Skosprovider_sqlalchemy', 'Skosprovider_sqlalchemy Documentation',
'Koen Van Daele', 'Skosprovider_sqlalchemy', 'One line description of project.',
'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'


# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = u'Skosprovider_sqlalchemy'
epub_author = u'Koen Van Daele'
epub_publisher = u'Koen Van Daele'
epub_copyright = u'2013, Koen Van Daele'
epub_title = 'Skosprovider_sqlalchemy'
epub_author = 'Koen Van Daele'
epub_publisher = 'Koen Van Daele'
epub_copyright = '2013, Koen Van Daele'

# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''
# epub_language = ''

# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# epub_scheme = ''

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
Expand Down
39 changes: 13 additions & 26 deletions skosprovider_sqlalchemy/models.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

import logging

log = logging.getLogger(__name__)

from language_tags import tags
from skosprovider.skos import label as skoslabel

from sqlalchemy import (
Column,
Integer,
Text,
String,
Boolean,
ForeignKey,
UniqueConstraint,
Table,
event
)

from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy import Text
from sqlalchemy import UniqueConstraint
from sqlalchemy import event
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import backref
from sqlalchemy.orm import relationship

from sqlalchemy.orm import (
relationship,
backref
)

log = logging.getLogger(__name__)
Base = declarative_base()

concept_label = Table(
Expand Down Expand Up @@ -643,7 +630,7 @@ def label(labels=[], language='any', sortLabel=False):
return skoslabel(labels, language, sortLabel)


class Initialiser(object):
class Initialiser:
'''
Initialises a database.
Expand Down
52 changes: 18 additions & 34 deletions skosprovider_sqlalchemy/providers.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
# -*- coding: utf-8 -*-

import logging
log = logging.getLogger(__name__)

from skosprovider.providers import VocabularyProvider
from skosprovider.skos import Collection
from skosprovider.skos import Concept
from skosprovider.skos import ConceptScheme
from skosprovider.skos import Label
from skosprovider.skos import Note
from skosprovider.skos import Source
from skosprovider.uri import DefaultUrnGenerator
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import NoResultFound

from skosprovider_sqlalchemy.models import Collection as CollectionModel
from skosprovider_sqlalchemy.models import Concept as ConceptModel
from skosprovider_sqlalchemy.models import ConceptScheme as ConceptSchemeModel
from skosprovider_sqlalchemy.models import Label as LabelModel
from skosprovider_sqlalchemy.models import Match as MatchModel
from skosprovider_sqlalchemy.models import Thing
from skosprovider_sqlalchemy.models import Visitation

from skosprovider.skos import (
ConceptScheme,
Concept,
Collection,
Label,
Note,
Source
)

from skosprovider_sqlalchemy.models import (
Thing,
ConceptScheme as ConceptSchemeModel,
Concept as ConceptModel,
Collection as CollectionModel,
Label as LabelModel,
Match as MatchModel,
Visitation
)

from sqlalchemy.orm import (
joinedload,
)

from sqlalchemy.orm.exc import (
NoResultFound
)

from skosprovider.uri import (
DefaultUrnGenerator,
DefaultConceptSchemeUrnGenerator
)
log = logging.getLogger(__name__)


class SQLAlchemyProvider(VocabularyProvider):
Expand Down
12 changes: 3 additions & 9 deletions skosprovider_sqlalchemy/scripts/calc_visitation.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
# -*- coding: utf-8 -*-

import os
import sys

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from ..models import (
ConceptScheme,
Visitation
)
from ..models import ConceptScheme
from ..models import Visitation
from ..utils import VisitationCalculator

from ..utils import (
VisitationCalculator
)


def usage(argv):
Expand Down
8 changes: 2 additions & 6 deletions skosprovider_sqlalchemy/scripts/init_skos_db.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# -*- coding: utf-8 -*-

import os
import sys

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from ..models import (
Base,
Initialiser
)
from ..models import Base
from ..models import Initialiser


def usage(argv):
Expand Down
34 changes: 13 additions & 21 deletions skosprovider_sqlalchemy/utils.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
# -*- coding: utf-8 -*-

import logging

log = logging.getLogger(__name__)

from skosprovider.skos import (
Concept,
Collection
)

from language_tags import tags
from skosprovider.skos import Collection
from skosprovider.skos import Concept
from sqlalchemy.orm.exc import NoResultFound

from skosprovider_sqlalchemy.models import (
Thing as ThingModel,
Concept as ConceptModel,
Collection as CollectionModel,
Label as LabelModel,
Note as NoteModel,
Match as MatchModel,
Language as LanguageModel,
Source as SourceModel
)
from skosprovider_sqlalchemy.models import Collection as CollectionModel
from skosprovider_sqlalchemy.models import Concept as ConceptModel
from skosprovider_sqlalchemy.models import Label as LabelModel
from skosprovider_sqlalchemy.models import Language as LanguageModel
from skosprovider_sqlalchemy.models import Match as MatchModel
from skosprovider_sqlalchemy.models import Note as NoteModel
from skosprovider_sqlalchemy.models import Source as SourceModel
from skosprovider_sqlalchemy.models import Thing as ThingModel

from sqlalchemy.orm.exc import NoResultFound
log = logging.getLogger(__name__)


def import_provider(provider, conceptscheme, session):
Expand Down Expand Up @@ -208,7 +200,7 @@ def _add_sources(target, sources, session):
))
return target

class VisitationCalculator(object):
class VisitationCalculator:
'''
Generates a nested set for a conceptscheme.
'''
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import unittest

import pytest


Expand Down
8 changes: 3 additions & 5 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-

import unittest

import pytest

from sqlalchemy.orm import session
from skosprovider_sqlalchemy.models import Initialiser, Base

from skosprovider_sqlalchemy.models import Base
from skosprovider_sqlalchemy.models import Initialiser
from tests import DBTestCase


Expand Down
20 changes: 5 additions & 15 deletions tests/test_providers.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# -*- coding: utf-8 -*-

import pytest

from skosprovider.uri import UriPatternGenerator
from sqlalchemy.orm import session

from skosprovider.uri import UriPatternGenerator
from skosprovider_sqlalchemy.models import Base
from skosprovider_sqlalchemy.models import Initialiser

from skosprovider_sqlalchemy.providers import (
SQLAlchemyProvider
)
from skosprovider_sqlalchemy.providers import SQLAlchemyProvider
from tests import DBTestCase
from tests.conftest import create_data, create_visitation
from skosprovider_sqlalchemy.models import (
Base
)
from tests.conftest import create_data
from tests.conftest import create_visitation


class TestSQLAlchemyProvider(DBTestCase):
Expand Down Expand Up @@ -117,9 +110,6 @@ def test_concept_scheme(self):
assert 'en' in cs.languages

def test_concept_scheme_is_cached(self):
from skosprovider.skos import (
ConceptScheme
)
assert self.provider._conceptscheme is None
cs = self.provider.concept_scheme
assert self.provider._conceptscheme == cs
Expand Down
Loading