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

132 ant 1 #133

Merged
merged 2 commits into from
Nov 27, 2024
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning].

## [Unreleased]

## [0.1.12] - 2024-11-27

### Removed in 0.1.12

- Removed kwargs from all method definitions

### Fixed in 0.1.12

- Typo and spelling errors

### Added in 0.1.12

- Additional docstring documentation where missing


## [0.1.11] - 2024-11-26

### Changed in 0.1.11
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = senzing_abstract
version = 0.1.11
version = 0.1.12
author = senzing
author_email = support@senzing.com
description = Python SDK method definitions
Expand Down
39 changes: 0 additions & 39 deletions src/senzing_abstract/observer_abstract.py

This file was deleted.

15 changes: 7 additions & 8 deletions src/senzing_abstract/szabstractfactory_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


from abc import ABC, abstractmethod
from typing import Any

from .szconfig_abstract import SzConfigAbstract
from .szconfigmanager_abstract import SzConfigManagerAbstract
Expand All @@ -29,7 +28,7 @@

class SzAbstractFactoryAbstract(ABC):
"""
SzAbstractFactoryAbstract is the definition of the Senzing Python API
SzAbstractFactoryAbstract is the definition of the Senzing Python SDK
SzAbstractFactory implementations.
"""

Expand All @@ -38,7 +37,7 @@ class SzAbstractFactoryAbstract(ABC):
# -------------------------------------------------------------------------

@abstractmethod
def create_config(self, **kwargs: Any) -> SzConfigAbstract:
def create_config(self) -> SzConfigAbstract:
"""
The `create_config` method creates a new implementation of an `SzConfigAbstract` object.

Expand All @@ -63,7 +62,7 @@ def create_config(self, **kwargs: Any) -> SzConfigAbstract:
"""

@abstractmethod
def create_configmanager(self, **kwargs: Any) -> SzConfigManagerAbstract:
def create_configmanager(self) -> SzConfigManagerAbstract:
"""
The `create_configmanager` method creates a new implementation of an `SzConfigManagerAbstract` object.

Expand All @@ -88,7 +87,7 @@ def create_configmanager(self, **kwargs: Any) -> SzConfigManagerAbstract:
"""

@abstractmethod
def create_diagnostic(self, **kwargs: Any) -> SzDiagnosticAbstract:
def create_diagnostic(self) -> SzDiagnosticAbstract:
"""
The `create_diagnostic` method creates a new implementation of an `SzDiagnosticAbstract` object.

Expand All @@ -113,7 +112,7 @@ def create_diagnostic(self, **kwargs: Any) -> SzDiagnosticAbstract:
"""

@abstractmethod
def create_engine(self, **kwargs: Any) -> SzEngineAbstract:
def create_engine(self) -> SzEngineAbstract:
"""
The `create_engine` method creates a new implementation of an `SzEngineAbstract` object.

Expand All @@ -138,7 +137,7 @@ def create_engine(self, **kwargs: Any) -> SzEngineAbstract:
"""

@abstractmethod
def create_product(self, **kwargs: Any) -> SzProductAbstract:
def create_product(self) -> SzProductAbstract:
"""
The `create_product` method creates a new implementation of an `SzProductAbstract` object.

Expand All @@ -163,7 +162,7 @@ def create_product(self, **kwargs: Any) -> SzProductAbstract:
"""

@abstractmethod
def reinitialize(self, config_id: int, **kwargs: Any) -> None:
def reinitialize(self, config_id: int) -> None:
"""
The `reinitialize` method reinitializes the Senzing objects using a specific configuration
identifier. A list of available configuration identifiers can be retrieved using
Expand Down
41 changes: 11 additions & 30 deletions src/senzing_abstract/szconfig_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# TODO: Determine specific SzErrors, Errors for "Raises:" documentation.

from abc import ABC, abstractmethod
from typing import Any

from .szhelpers import construct_help

Expand All @@ -25,34 +24,16 @@

class SzConfigAbstract(ABC):
"""
SzConfigAbstract is the definition of the Senzing Python API that is
SzConfigAbstract is the definition of the Senzing Python SDK that is
implemented by packages such as szconfig.py.
"""

# -------------------------------------------------------------------------
# Messages
# -------------------------------------------------------------------------

PREFIX = "szconfig."
ID_MESSAGES = {
4001: PREFIX + "add_data_source({0}) failed. Return code: {1}",
4002: PREFIX + "close_config() failed. Return code: {0}",
4003: PREFIX + "create_config() failed. Return code: {0}",
4004: PREFIX + "delete_data_source({0}) failed. Return code: {1}",
4005: PREFIX + "destroy() failed. Return code: {0}",
4006: PREFIX + "export_config() failed. Return code: {0}",
4007: PREFIX + "get_data_sources() failed. Return code: {0}",
4008: PREFIX + "initialize({0}, {1}, {2}) failed. Return code: {3}",
4009: PREFIX + "import_config({0}) failed. Return code: {1}",
4010: PREFIX + "SzConfig({0}, {1}) failed. instance_name and settings must both be set or both be empty",
}

# -------------------------------------------------------------------------
# Interface definition
# -------------------------------------------------------------------------

@abstractmethod
def add_data_source(self, config_handle: int, data_source_code: str, **kwargs: Any) -> str:
def add_data_source(self, config_handle: int, data_source_code: str) -> str:
"""
The `add_data_source` method adds a data source to an existing in-memory configuration.

Expand Down Expand Up @@ -80,7 +61,7 @@ def add_data_source(self, config_handle: int, data_source_code: str, **kwargs: A
"""

@abstractmethod
def close_config(self, config_handle: int, **kwargs: Any) -> None:
def close_config(self, config_handle: int) -> None:
"""
The `close_config` method cleans up the Senzing SzConfig object pointed to by the `config_handle`.

Expand All @@ -98,7 +79,7 @@ def close_config(self, config_handle: int, **kwargs: Any) -> None:
"""

@abstractmethod
def create_config(self, **kwargs: Any) -> int:
def create_config(self) -> int:
"""
The `create_config` method creates an in-memory Senzing configuration
from the `g2config.json` template configuration file located
Expand All @@ -122,12 +103,12 @@ def create_config(self, **kwargs: Any) -> int:
"""

@abstractmethod
def delete_data_source(self, config_handle: int, data_source_code: str, **kwargs: Any) -> None:
def delete_data_source(self, config_handle: int, data_source_code: str) -> None:
"""
The `delete_data_source` method removes a data source from an existing in-memory configuration.

Args:
config_handle (int): An identifier of an in-memory configuration. Usually created by the `create` or `load` methods
config_handle (int): An identifier of an in-memory configuration. Usually created by the `create` or `load` methods.
data_source_code (str): Name of data source code to delete.

Raises:
Expand All @@ -141,12 +122,12 @@ def delete_data_source(self, config_handle: int, data_source_code: str, **kwargs
"""

@abstractmethod
def export_config(self, config_handle: int, **kwargs: Any) -> str:
def export_config(self, config_handle: int) -> str:
"""
The `export_config` method creates a JSON string representation of the Senzing SzConfig object.

Args:
config_handle (int): An identifier of an in-memory configuration. Usually created by the `create` or `load` methods
config_handle (int): An identifier of an in-memory configuration. Usually created by the `create` or `load` methods.

Returns:
str: A string containing a JSON Document representation of the Senzing SzConfig object.
Expand Down Expand Up @@ -174,13 +155,13 @@ def export_config(self, config_handle: int, **kwargs: Any) -> str:
"""

@abstractmethod
def get_data_sources(self, config_handle: int, **kwargs: Any) -> str:
def get_data_sources(self, config_handle: int) -> str:
"""
The `get_data_sources` method returns a JSON document of data sources
contained in an in-memory configuration.

Args:
config_handle (int): An identifier of an in-memory configuration. Usually created by the `create` or `load` methods
config_handle (int): An identifier of an in-memory configuration. Usually created by the `create` or `load` methods.

Returns:
str: A string containing a JSON document listing all of the data sources.
Expand All @@ -202,7 +183,7 @@ def get_data_sources(self, config_handle: int, **kwargs: Any) -> str:
"""

@abstractmethod
def import_config(self, config_definition: str, **kwargs: Any) -> int:
def import_config(self, config_definition: str) -> int:
"""
The `import_config` method initializes an in-memory Senzing SzConfig object from a JSON string.
A handle is returned to identify the in-memory configuration.
Expand Down
36 changes: 8 additions & 28 deletions src/senzing_abstract/szconfigmanager_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# TODO: Determine specific SzErrors, Errors for "Raises:" documentation.

from abc import ABC, abstractmethod
from typing import Any

from .szhelpers import construct_help

Expand All @@ -25,33 +24,16 @@

class SzConfigManagerAbstract(ABC):
"""
SzConfigManagerAbstract is the definition of the Senzing Python API that is
SzConfigManagerAbstract is the definition of the Senzing Python SDK that is
implemented by packages such as szconfigmanager.py.
"""

# -------------------------------------------------------------------------
# Messages
# -------------------------------------------------------------------------

PREFIX = "szconfigmanager."
ID_MESSAGES = {
4001: PREFIX + "add_config({0}, {1}) failed. Return code: {2}",
4002: PREFIX + "destroy() failed. Return code: {0}",
4003: PREFIX + "get_config({0}) failed. Return code: {1}",
4004: PREFIX + "get_configs() failed. Return code: {0}",
4005: PREFIX + "get_default_config_id() failed. Return code: {0}",
4006: PREFIX + "initialize({0}, {1}, {2}) failed. Return code: {3}",
4007: PREFIX + "replace_default_config_id({0}, {1}) failed. Return code: {2}",
4008: PREFIX + "set_default_config_id({0}) failed. Return code: {1}",
4009: PREFIX + "SzConfigManager({0}, {1}) failed. instance_name and settings must both be set or both be empty",
}

# -------------------------------------------------------------------------
# Interface definition
# -------------------------------------------------------------------------

@abstractmethod
def add_config(self, config_definition: str, config_comment: str, **kwargs: Any) -> int:
def add_config(self, config_definition: str, config_comment: str) -> int:
"""
The `add_config` method adds a Senzing configuration JSON document to the Senzing database.

Expand All @@ -73,7 +55,7 @@ def add_config(self, config_definition: str, config_comment: str, **kwargs: Any)
"""

@abstractmethod
def get_config(self, config_id: int, **kwargs: Any) -> str:
def get_config(self, config_id: int) -> str:
"""
The `get_config` method retrieves a specific Senzing configuration JSON document from the Senzing database.

Expand All @@ -100,7 +82,7 @@ def get_config(self, config_id: int, **kwargs: Any) -> str:
"""

@abstractmethod
def get_configs(self, **kwargs: Any) -> str:
def get_configs(self) -> str:
"""
The `get_configs` method retrieves a list of Senzing configurations from the Senzing database.

Expand All @@ -124,7 +106,7 @@ def get_configs(self, **kwargs: Any) -> str:
"""

@abstractmethod
def get_default_config_id(self, **kwargs: Any) -> int:
def get_default_config_id(self) -> int:
"""
The `get_default_config_id` method retrieves from the Senzing database the configuration identifier of the default Senzing configuration.

Expand All @@ -142,9 +124,7 @@ def get_default_config_id(self, **kwargs: Any) -> int:
"""

@abstractmethod
def replace_default_config_id(
self, current_default_config_id: int, new_default_config_id: int, **kwargs: Any
) -> None:
def replace_default_config_id(self, current_default_config_id: int, new_default_config_id: int) -> None:
"""
The `replace_default_config_id` method replaces the old configuration identifier with a new configuration identifier in the Senzing database.
It is like a "compare-and-swap" instruction to serialize concurrent editing of configuration.
Expand All @@ -166,9 +146,9 @@ def replace_default_config_id(
"""

@abstractmethod
def set_default_config_id(self, config_id: int, **kwargs: Any) -> None:
def set_default_config_id(self, config_id: int) -> None:
"""
The `set_default_config_id` method replaces the sets a new configuration identifier in the Senzing database.
The `set_default_config_id` method replaces and sets a new configuration identifier in the Senzing database.
To serialize modifying of the configuration identifier, see `replace_default_config_id`.

Args:
Expand Down
Loading
Loading