Skip to content

Commit

Permalink
#114 drop python 3.6, support py 3.8+
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasGe committed Aug 4, 2022
1 parent 6761477 commit 6a6833b
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 65 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
sudo: false
language: python
os: linux
dist: focal
python:
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
install:
- pip install -r requirements-dev.txt
- python setup.py develop
Expand Down
25 changes: 12 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Skosprovider documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 7 22:37:01 2013.
Expand Down Expand Up @@ -40,8 +39,8 @@
master_doc = 'index'

# General information about the project.
project = u'Skosprovider'
copyright = u'2012-2021, Koen Van Daele'
project = 'Skosprovider'
copyright = '2012-2021, 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 +182,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.tex', u'Skosprovider Documentation',
u'Koen Van Daele', 'manual'),
('index', 'Skosprovider.tex', 'Skosprovider 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 +212,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'skosprovider', u'Skosprovider Documentation',
[u'Koen Van Daele'], 1)
('index', 'skosprovider', 'Skosprovider Documentation',
['Koen Van Daele'], 1)
]

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

Expand All @@ -245,10 +244,10 @@
# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = u'Skosprovider'
epub_author = u'Koen Van Daele'
epub_publisher = u'Koen Van Daele'
epub_copyright = u'2012-2021, Koen Van Daele'
epub_title = 'Skosprovider'
epub_author = 'Koen Van Daele'
epub_publisher = 'Koen Van Daele'
epub_copyright = '2012-2021, Koen Van Daele'

# The language of the text. It defaults to the language option
# or en if the language is not set.
Expand Down
1 change: 0 additions & 1 deletion examples/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
'''
This example demonstrates the skosprovider API with a simple
DictionaryProvider containing just three items.
Expand Down
1 change: 0 additions & 1 deletion examples/dump_jsonld.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
'''
This example demonstrates the skosprovider API with a simple
DictionaryProvider containing just three items.
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
test_suite='nose.collector'
)
2 changes: 0 additions & 2 deletions skosprovider/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

'''This module provides custom exceptions for skos providers.
.. versionadded:: 0.5.0
Expand Down
1 change: 0 additions & 1 deletion skosprovider/jsonld.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
'''
This module contains functions dealing with jsonld reading and writing.
Expand Down
12 changes: 5 additions & 7 deletions skosprovider/providers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

'''This module provides an abstraction of controlled vocabularies.
This abstraction allows our application to work with both local and remote
Expand Down Expand Up @@ -468,7 +466,7 @@ def __init__(self, metadata, list, **kwargs):
:param Boolean case_insensitive: Should searching for labels be done
case-insensitive?
'''
super(MemoryProvider, self).__init__(metadata, **kwargs)
super().__init__(metadata, **kwargs)
if not 'allowed_instance_scopes' in kwargs:
self.allowed_instance_scopes = [
'single', 'threaded_thread', 'threaded_global'
Expand Down Expand Up @@ -614,7 +612,7 @@ def expand(self, id):
for c in self.list:
if str(c.id) == id:
if isinstance(c, Concept):
ret = set([c.id])
ret = {c.id}
for cid in c.narrower:
ret |= set(self.expand(cid))
for collid in c.subordinate_arrays:
Expand All @@ -623,7 +621,7 @@ def expand(self, id):
ret |= set(self.expand(collid))
return list(ret)
elif isinstance(c, Collection):
ret = set([])
ret = set()
for m in c.members:
ret |= set(self.expand(m))
return list(ret)
Expand Down Expand Up @@ -673,7 +671,7 @@ class DictionaryProvider(MemoryProvider):
'''

def __init__(self, metadata, list, **kwargs):
super(DictionaryProvider, self).__init__(metadata, [], **kwargs)
super().__init__(metadata, [], **kwargs)
self.list = [self._from_dict(c) for c in list]

def _from_dict(self, data):
Expand Down Expand Up @@ -725,7 +723,7 @@ def __init__(self, metadata, reader, **kwargs):
:param metadata: A metadata dictionary.
:param reader: A csv reader.
'''
super(SimpleCsvProvider, self).__init__(metadata, [], **kwargs)
super().__init__(metadata, [], **kwargs)
self.list = [self._from_row(row) for row in reader]

def _from_row(self, row):
Expand Down
2 changes: 0 additions & 2 deletions skosprovider/registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

'''This module provides a registry for skos providers.
This registry helps us find providers during runtime. We can also apply some
Expand Down
4 changes: 1 addition & 3 deletions skosprovider/skos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

'''
This module contains a read-only model of the :term:`SKOS` specification.
Expand Down Expand Up @@ -79,7 +77,7 @@ def is_valid_type(type):
return type in Label.valid_types

def __repr__(self):
return "Label('%s', '%s', '%s')" % (self.label, self.type, self.language)
return "Label('{}', '{}', '{}')".format(self.label, self.type, self.language)


class Note:
Expand Down
3 changes: 1 addition & 2 deletions skosprovider/uri.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
'''
This module provides utilities for working with :term:`URIs <URI>`.
Expand All @@ -20,7 +19,7 @@ def is_uri(uri):
return rfc3987.match(uri, rule='URI')


class UriGenerator(object):
class UriGenerator:
'''
An abstract class for generating URIs.
'''
Expand Down
1 change: 0 additions & 1 deletion skosprovider/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
'''
This module contains utility functions for dealing with skos providers.
'''
Expand Down
1 change: 0 additions & 1 deletion tests/test_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import unittest
from skosprovider.exceptions import ProviderUnavailableException

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

import unittest

from skosprovider.jsonld import (
Expand Down
18 changes: 7 additions & 11 deletions tests/test_providers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import unittest

import warnings
Expand Down Expand Up @@ -395,7 +393,7 @@ def test_expand_unexisting(self):
self.assertEqual(False, trees.expand(987654321))

def test_expand_collection(self):
self.assertEqual(set(['1', '2']), set(trees.expand(3)))
self.assertEqual({'1', '2'}, set(trees.expand(3)))

def test_get_all(self):
self.assertEqual(
Expand Down Expand Up @@ -899,7 +897,7 @@ def test_get_by_id(self):
def test_get_belgium_by_id(self):
belgium = geo.get_by_id(4)
self.assertEqual(4, belgium.id)
self.assertEqual(set(['333']), set(belgium.member_of))
self.assertEqual({'333'}, set(belgium.member_of))

def test_get_by_uri(self):
wereld = geo.get_by_uri('urn:x-skosprovider:geography:1')
Expand All @@ -918,19 +916,19 @@ def test_get_collection_by_uri(self):
self.assertEqual(['4', '7', '8'], dutch_speaking.members)

def test_expand_Belgium(self):
self.assertEqual(set([4, 7, 8, 9, 16]), set(geo.expand(4)))
self.assertEqual({4, 7, 8, 9, 16}, set(geo.expand(4)))

def test_expand_UK(self):
self.assertEqual(set([5, 10, 11, 12]), set(geo.expand(5)))
self.assertEqual({5, 10, 11, 12}, set(geo.expand(5)))

def test_expand_string(self):
self.assertEqual(set([4, 7, 8, 9, 16]), set(geo.expand('4')))
self.assertEqual({4, 7, 8, 9, 16}, set(geo.expand('4')))

def test_expand_unexisting(self):
self.assertEqual(False, geo.expand(987654321))

def test_expand_collection(self):
self.assertEqual(set([4, 7, 8, 9, 16]), set(geo.expand(333)))
self.assertEqual({4, 7, 8, 9, 16}, set(geo.expand(333)))

def test_find_in_collection(self):
c = geo.find({'collection': {'id': 333}})
Expand Down Expand Up @@ -1050,9 +1048,7 @@ class SimpleCsvProviderTests(unittest.TestCase):
def setUp(self):
from skosprovider.uri import UriPatternGenerator
self.ifile = open(
os.path.join(os.path.dirname(__file__), 'data', 'menu.csv'),
"r"
)
os.path.join(os.path.dirname(__file__), 'data', 'menu.csv'))
reader = csv.reader(self.ifile)
self.csvprovider = SimpleCsvProvider(
{'id': 'MENU'},
Expand Down
2 changes: 0 additions & 2 deletions tests/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import unittest

from unittest.mock import Mock, MagicMock
Expand Down
8 changes: 3 additions & 5 deletions tests/test_skos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import unittest

import pytest
Expand Down Expand Up @@ -341,7 +339,7 @@ def testMemberOf(self):
1,
uri='urn:x-skosprovider:gemeenten:1',
member_of=[15])
self.assertEqual(set([15]), set(c.member_of))
self.assertEqual({15}, set(c.member_of))

def testMatches(self):
c = Concept(
Expand Down Expand Up @@ -436,14 +434,14 @@ def testMembers(self):
labels=labels,
members=[1, 2]
)
self.assertTrue(set([1, 2]), set(coll.members))
self.assertTrue({1, 2}, set(coll.members))

def testMemberOf(self):
coll = Collection(
id=1,
member_of=[350]
)
self.assertTrue(set([350]), set(coll.member_of))
self.assertTrue({350}, set(coll.member_of))

def testSource(self):
coll = Collection(
Expand Down
2 changes: 0 additions & 2 deletions tests/test_uri.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import unittest

from skosprovider.uri import (
Expand Down
8 changes: 3 additions & 5 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import unittest

from skosprovider.utils import (
Expand Down Expand Up @@ -39,7 +37,7 @@ def setUp(self):
],
'sources': [
{
'citation': u'Monthy Python. Episode Three: How to recognise different types of trees from quite a long way away.',
'citation': 'Monthy Python. Episode Three: How to recognise different types of trees from quite a long way away.',
'markup': None
}
],
Expand Down Expand Up @@ -198,7 +196,7 @@ def testTreeProviderRoundTrip(self):
dump2 = dict_dumper(self._get_tree_provider(dict_dumper(geo)))
self.assertEqual(dump, dump2)

class TestExtractLanguage(object):
class TestExtractLanguage:

def test_extract_language_nlBE(self):
assert 'nl-BE' == extract_language('nl-BE')
Expand All @@ -207,7 +205,7 @@ def test_extract_language_None(self):
assert 'und' == extract_language(None)


class TestHtml(object):
class TestHtml:

def test_lang_und(self):
assert '' == add_lang_to_html('', 'und')
Expand Down

0 comments on commit 6a6833b

Please sign in to comment.