diff --git a/.mypy.ini b/.mypy.ini index 544a83e2..44aa767f 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -3,5 +3,8 @@ [mypy-grpc.*] ignore_missing_imports = True +[mypy-pytest_schema.*] +ignore_missing_imports = True + [mypy-senzing_grpc.*] disable_error_code = attr-defined,no-untyped-call diff --git a/examples/szengine/find_network_by_entity_id.py b/examples/szengine/find_network_by_entity_id.py index d6c10f76..b76ace7c 100755 --- a/examples/szengine/find_network_by_entity_id.py +++ b/examples/szengine/find_network_by_entity_id.py @@ -5,12 +5,7 @@ from senzing_grpc import SzEngine, SzEngineFlags, SzError BUILD_OUT_DEGREE = 1 -ENTITY_LIST = { - "ENTITIES": [ - {"ENTITY_ID": 1}, - {"ENTITY_ID": 100004}, - ] -} +ENTITY_LIST = [1, 100004] FLAGS = SzEngineFlags.SZ_FIND_NETWORK_DEFAULT_FLAGS GRPC_URL = "localhost:8261" MAX_DEGREES = 2 diff --git a/examples/szengine/find_path_by_entity_id.py b/examples/szengine/find_path_by_entity_id.py index 8acbdc3e..34bac4c3 100755 --- a/examples/szengine/find_path_by_entity_id.py +++ b/examples/szengine/find_path_by_entity_id.py @@ -1,15 +1,17 @@ #! /usr/bin/env python3 +from typing import List + import grpc from senzing_grpc import SzEngine, SzEngineFlags, SzError -AVOID_ENTITY_IDS = [] +AVOID_ENTITY_IDS: List[int] = [] END_ENTITY_ID = 100004 FLAGS = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS GRPC_URL = "localhost:8261" MAX_DEGREES = 2 -REQUIRED_DATA_SOURCES = [] +REQUIRED_DATA_SOURCES: List[str] = [] START_ENTITY_ID = 1 try: diff --git a/examples/szengine/find_path_by_record_id.py b/examples/szengine/find_path_by_record_id.py index 8d463e0d..5722c363 100755 --- a/examples/szengine/find_path_by_record_id.py +++ b/examples/szengine/find_path_by_record_id.py @@ -1,16 +1,18 @@ #! /usr/bin/env python3 +from typing import List, Tuple + import grpc from senzing_grpc import SzEngine, SzEngineFlags, SzError +AVOID_RECORD_KEYS: List[Tuple[str, str]] = [] END_DATA_SOURCE_CODE = "CUSTOMERS" END_RECORD_ID = "1009" -AVOID_RECORD_KEYS = [] FLAGS = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS GRPC_URL = "localhost:8261" MAX_DEGREES = 2 -REQUIRED_DATA_SOURCES = [] +REQUIRED_DATA_SOURCES: List[str] = [] START_DATA_SOURCE_CODE = "CUSTOMERS" START_RECORD_ID = "1001" diff --git a/examples/szengine/get_virtual_entity_by_record_id.py b/examples/szengine/get_virtual_entity_by_record_id.py index 47fbe516..3e10c515 100755 --- a/examples/szengine/get_virtual_entity_by_record_id.py +++ b/examples/szengine/get_virtual_entity_by_record_id.py @@ -6,12 +6,10 @@ FLAGS = SzEngineFlags.SZ_VIRTUAL_ENTITY_DEFAULT_FLAGS GRPC_URL = "localhost:8261" -RECORD_LIST = { - "RECORDS": [ - {"DATA_SOURCE": "CUSTOMERS", "RECORD_ID": "1001"}, - {"DATA_SOURCE": "CUSTOMERS", "RECORD_ID": "1002"}, - ] -} +RECORD_LIST = [ + ("CUSTOMERS", "1001"), + ("CUSTOMERS", "1002"), +] try: grpc_channel = grpc.insecure_channel(GRPC_URL) diff --git a/src/senzing_grpc/szconfig.py b/src/senzing_grpc/szconfig.py index 7f7814ee..561216ee 100644 --- a/src/senzing_grpc/szconfig.py +++ b/src/senzing_grpc/szconfig.py @@ -31,7 +31,7 @@ # ----------------------------------------------------------------------------- -class SzConfig(SzConfigAbstract): # type: ignore +class SzConfig(SzConfigAbstract): """ SzConfig module access library over gRPC. """ diff --git a/src/senzing_grpc/szconfigmanager.py b/src/senzing_grpc/szconfigmanager.py index 903b2848..eb40e131 100644 --- a/src/senzing_grpc/szconfigmanager.py +++ b/src/senzing_grpc/szconfigmanager.py @@ -31,7 +31,7 @@ # ----------------------------------------------------------------------------- -class SzConfigManager(SzConfigManagerAbstract): # type: ignore +class SzConfigManager(SzConfigManagerAbstract): """ SzConfigManager module access library over gRPC. """ diff --git a/tests/szconfig_test.py b/tests/szconfig_test.py index a551cb8c..8bf0beff 100755 --- a/tests/szconfig_test.py +++ b/tests/szconfig_test.py @@ -234,7 +234,7 @@ def test_context_managment() -> None: # ----------------------------------------------------------------------------- -@pytest.fixture(name="sz_config", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_config", scope="module") def szconfig_fixture() -> SzConfig: """ Single szconfig object to use for all tests. diff --git a/tests/szconfigmanager_test.py b/tests/szconfigmanager_test.py index 51810f13..572e0a85 100755 --- a/tests/szconfigmanager_test.py +++ b/tests/szconfigmanager_test.py @@ -270,7 +270,7 @@ def test_context_managment() -> None: # ----------------------------------------------------------------------------- -@pytest.fixture(name="sz_config", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_config", scope="module") def szconfig_fixture() -> SzConfig: """ Single szconfigmanager object to use for all tests. @@ -282,7 +282,7 @@ def szconfig_fixture() -> SzConfig: return result -@pytest.fixture(name="sz_configmanager", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_configmanager", scope="module") def szconfigmanager_fixture() -> SzConfigManager: """ Single engine object to use for all tests. diff --git a/tests/szdiagnostic_test.py b/tests/szdiagnostic_test.py index 1c917bf0..890487c4 100755 --- a/tests/szdiagnostic_test.py +++ b/tests/szdiagnostic_test.py @@ -80,7 +80,7 @@ def test_context_managment() -> None: # ----------------------------------------------------------------------------- -@pytest.fixture(name="sz_diagnostic", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_diagnostic", scope="module") def szdiagnostic_fixture() -> SzDiagnostic: """ Single engine object to use for all tests. diff --git a/tests/szengine_test.py b/tests/szengine_test.py index 62af05b5..c271195a 100755 --- a/tests/szengine_test.py +++ b/tests/szengine_test.py @@ -467,8 +467,8 @@ def test_find_path_by_entity_id(sz_engine: SzEngine) -> None: start_entity_id = get_entity_id_from_record_id(sz_engine, "CUSTOMERS", "1001") end_entity_id = get_entity_id_from_record_id(sz_engine, "CUSTOMERS", "1002") max_degrees = 1 - avoid_entity_ids = [] - required_data_sources = [] + avoid_entity_ids: List[int] = [] + required_data_sources: List[str] = [] flags = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS actual = sz_engine.find_path_by_entity_id( start_entity_id, @@ -488,8 +488,8 @@ def test_find_path_by_entity_id_bad_entity_ids(sz_engine: SzEngine) -> None: bad_start_entity_id = 0 bad_end_entity_id = 1 max_degrees = 1 - avoid_record_keys = [] - required_data_sources = [] + avoid_entity_ids: List[int] = [] + required_data_sources: List[str] = [] flags = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS max_degrees = 1 with pytest.raises(SzNotFoundError): @@ -497,7 +497,7 @@ def test_find_path_by_entity_id_bad_entity_ids(sz_engine: SzEngine) -> None: bad_start_entity_id, bad_end_entity_id, max_degrees, - avoid_record_keys, + avoid_entity_ids, required_data_sources, flags, ) @@ -515,8 +515,8 @@ def test_find_path_by_record_id(sz_engine: SzEngine) -> None: end_data_source_code = "CUSTOMERS" end_record_id = "1002" max_degrees = 1 - avoid_record_keys = [] - required_data_sources = [] + avoid_record_keys: List[Tuple[str, str]] = [] + required_data_sources: List[str] = [] flags = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS actual = sz_engine.find_path_by_record_id( start_data_source_code, @@ -540,8 +540,8 @@ def test_find_path_by_record_id_bad_data_source_code(sz_engine: SzEngine) -> Non bad_end_data_source_code = "XXXX" end_record_id = "9998" max_degrees = 1 - avoid_record_keys = [] - required_data_sources = [] + avoid_record_keys: List[Tuple[str, str]] = [] + required_data_sources: List[str] = [] flags = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS with pytest.raises(SzConfigurationError): _ = sz_engine.find_path_by_record_id( @@ -563,8 +563,8 @@ def test_find_path_by_record_id_bad_record_ids(sz_engine: SzEngine) -> None: end_data_source_code = "CUSTOMERS" bad_end_record_id = "9998" max_degrees = 1 - avoid_record_keys = [] - required_data_sources = [] + avoid_record_keys: List[Tuple[str, str]] = [] + required_data_sources: List[str] = [] flags = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS with pytest.raises(SzNotFoundError): _ = sz_engine.find_path_by_record_id( @@ -1030,7 +1030,7 @@ def test_destroy(sz_engine: SzEngine) -> None: # ----------------------------------------------------------------------------- -@pytest.fixture(name="sz_config", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_config", scope="module") def szconfig_fixture() -> SzConfig: """ Single szconfig object to use for all tests. @@ -1042,7 +1042,7 @@ def szconfig_fixture() -> SzConfig: return result -@pytest.fixture(name="sz_configmanager", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_configmanager", scope="module") def szconfigmanager_fixture() -> SzConfigManager: """ Single szconfigmanager object to use for all tests. @@ -1053,7 +1053,7 @@ def szconfigmanager_fixture() -> SzConfigManager: return result -@pytest.fixture(name="sz_engine", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_engine", scope="module") def szengine_fixture() -> SzEngine: """ Single szengine object to use for all tests. diff --git a/tests/szproduct_test.py b/tests/szproduct_test.py index a3caec2e..1bfab054 100755 --- a/tests/szproduct_test.py +++ b/tests/szproduct_test.py @@ -70,7 +70,7 @@ def test_context_managment() -> None: # ----------------------------------------------------------------------------- -@pytest.fixture(name="sz_product", scope="module") # type: ignore[misc] +@pytest.fixture(name="sz_product", scope="module") def szproduct_fixture() -> SzProduct: """ Single engine object to use for all tests.