Skip to content

Commit

Permalink
#3 Successful pylint and mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj committed Jul 29, 2024
1 parent 0604dce commit 3369384
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 1 addition & 6 deletions examples/szengine/find_network_by_entity_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions examples/szengine/find_path_by_entity_id.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 4 additions & 2 deletions examples/szengine/find_path_by_record_id.py
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
10 changes: 4 additions & 6 deletions examples/szengine/get_virtual_entity_by_record_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/senzing_grpc/szconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# -----------------------------------------------------------------------------


class SzConfig(SzConfigAbstract): # type: ignore
class SzConfig(SzConfigAbstract):
"""
SzConfig module access library over gRPC.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/senzing_grpc/szconfigmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# -----------------------------------------------------------------------------


class SzConfigManager(SzConfigManagerAbstract): # type: ignore
class SzConfigManager(SzConfigManagerAbstract):
"""
SzConfigManager module access library over gRPC.
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/szconfig_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tests/szconfigmanager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/szdiagnostic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 14 additions & 14 deletions tests/szengine_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -488,16 +488,16 @@ 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):
_ = sz_engine.find_path_by_entity_id(
bad_start_entity_id,
bad_end_entity_id,
max_degrees,
avoid_record_keys,
avoid_entity_ids,
required_data_sources,
flags,
)
Expand All @@ -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,
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/szproduct_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3369384

Please sign in to comment.