Skip to content

Test with mypy --strict #62

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

Merged
merged 3 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion case_utils/case_file/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import typing
import warnings

import rdflib # type: ignore
import rdflib

import case_utils
from case_utils.namespace import (
Expand Down
4 changes: 2 additions & 2 deletions case_utils/case_sparql_construct/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import sys
import typing

import rdflib.plugins.sparql # type: ignore
import rdflib.plugins.sparql

import case_utils.ontology
from case_utils.ontology.version_info import (
Expand Down Expand Up @@ -90,7 +90,7 @@ def main() -> None:
in_graph, built_version=args.built_version
)

construct_query_object = rdflib.plugins.sparql.prepareQuery(
construct_query_object = rdflib.plugins.sparql.processor.prepareQuery(
construct_query_text, initNs=nsdict
)

Expand Down
4 changes: 2 additions & 2 deletions case_utils/case_sparql_select/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import sys

import pandas as pd # type: ignore
import rdflib.plugins.sparql # type: ignore
import rdflib.plugins.sparql

import case_utils.ontology
from case_utils.ontology.version_info import (
Expand Down Expand Up @@ -107,7 +107,7 @@ def main() -> None:

tally = 0
records = []
select_query_object = rdflib.plugins.sparql.prepareQuery(
select_query_object = rdflib.plugins.sparql.processor.prepareQuery(
select_query_text, initNs=nsdict
)
for (row_no, row) in enumerate(graph.query(select_query_object)):
Expand Down
2 changes: 1 addition & 1 deletion case_utils/case_validate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import typing

import pyshacl # type: ignore
import rdflib.util # type: ignore
import rdflib.util

import case_utils.ontology
from case_utils.ontology.version_info import (
Expand Down
2 changes: 1 addition & 1 deletion case_utils/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

__version__ = "0.1.0"

import rdflib # type: ignore
import rdflib

NS_SH = rdflib.SH
NS_RDF = rdflib.RDF
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include_package_data = true
install_requires =
pandas
pyshacl
rdflib >= 6.0.2
rdflib >= 6.2.0
requests
tabulate
packages = find:
Expand Down
8 changes: 4 additions & 4 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ check-isomorphic_diff: \
--directory isomorphic_diff \
check

# mypy is called against specific members of the tests directory to avoid descending into the virtual environment.
# TODO - Fix type signatures in UCO test.
check-mypy: \
.venv.done.log
source venv/bin/activate \
&& mypy \
--exclude case_utils/case_validate/case_test_examples/test_case_validation.py \
--exclude case_utils/case_validate/uco_test_examples/test_uco_validation.py \
--exclude venv \
--strict \
$(top_srcdir)/case_utils \
case_utils \
hexbinary \
src
.

clean:
@$(MAKE) \
Expand Down
8 changes: 5 additions & 3 deletions tests/case_utils/case_file/test_case_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os

import pytest
import rdflib.plugins.sparql # type: ignore
import rdflib.plugins.sparql

import case_utils.ontology
from case_utils.namespace import NS_UCO_CORE, NS_UCO_OBSERVABLE, NS_UCO_TYPES
Expand Down Expand Up @@ -80,7 +80,9 @@ def test_confirm_hashes(graph_case_file: rdflib.Graph) -> None:
}
"""

query_object = rdflib.plugins.sparql.prepareQuery(query_sparql, initNs=NSDICT)
query_object = rdflib.plugins.sparql.processor.prepareQuery(
query_sparql, initNs=NSDICT
)

for result in graph_case_file.query(query_object):
(l_hash_method, l_hash_value) = result
Expand Down Expand Up @@ -109,7 +111,7 @@ def test_confirm_mtime(
.
}
"""
query_object = rdflib.plugins.sparql.prepareQuery(
query_object = rdflib.plugins.sparql.processor.prepareQuery(
query_confirm_mtime, initNs=NSDICT
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import typing

import rdflib.plugins.sparql # type: ignore
import rdflib.plugins.sparql


def _test_subclass_templates_result(filename: str, expected: typing.Set[str]) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import typing

import pytest
import rdflib.plugins.parsers.notation3 # type: ignore
import rdflib.plugins.parsers.notation3

srcdir = pathlib.Path(__file__).parent

Expand All @@ -26,7 +26,7 @@
""".strip()


def _guess_format(basename) -> typing.Optional[str]:
def _guess_format(basename: str) -> typing.Optional[str]:
"""
Guess format by file extension.
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/case_utils/ontology/test_version_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import pathlib
import typing

import rdflib # type: ignore
import rdflib

import case_utils.ontology
from case_utils.ontology.version_info import (
Expand Down
2 changes: 1 addition & 1 deletion tests/case_utils/test_guess_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# We would appreciate acknowledgement if the software is used.

import pytest
import rdflib # type: ignore
import rdflib

PATH_TO_TTL = "/nonexistent/foo.ttl"
PATH_TO_JSON = "/nonexistent/foo.json"
Expand Down
2 changes: 1 addition & 1 deletion tests/hexbinary/test_hexbinary.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import typing

import pytest
import rdflib.plugins.sparql # type: ignore
import rdflib.plugins.sparql

_logger = logging.getLogger(os.path.basename(__file__))

Expand Down
2 changes: 1 addition & 1 deletion tests/src/glom_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

__version__ = "0.2.1"

import rdflib # type: ignore
import rdflib


def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/src/isomorphic_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import os
import sys

import rdflib.compare # type: ignore
import rdflib.compare

_logger = logging.getLogger(os.path.basename(__file__))

Expand Down