Skip to content

Commit

Permalink
#59 Add szabstractfactory interface
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj committed Sep 23, 2024
1 parent 074792f commit 78863ad
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.2] - 2024-09-23

### Changed in 0.1.2

- Added `abstract_factory`

## [0.1.1] - 2024-07-30

### Changed in 0.1.1
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ include makefiles/osdetect.mk
PROGRAM_NAME := $(shell basename `git rev-parse --show-toplevel`)
MAKEFILE_PATH := $(abspath $(firstword $(MAKEFILE_LIST)))
MAKEFILE_DIRECTORY := $(shell dirname $(MAKEFILE_PATH))
TARGET_DIRECTORY := $(MAKEFILE_DIRECTORY)/target
DIST_DIRECTORY := $(MAKEFILE_DIRECTORY)/dist
BUILD_TAG := $(shell git describe --always --tags --abbrev=0 | sed 's/v//')
BUILD_ITERATION := $(shell git log $(BUILD_TAG)..HEAD --oneline | wc -l | sed 's/^ *//')
BUILD_VERSION := $(shell git describe --always --tags --abbrev=0 --dirty | sed 's/v//')
Expand All @@ -25,7 +27,6 @@ GIT_REMOTE_URL := $(shell git config --get remote.origin.url)
GIT_REPOSITORY_NAME := $(shell basename `git rev-parse --show-toplevel`)
GIT_VERSION := $(shell git describe --always --tags --long --dirty | sed -e 's/\-0//' -e 's/\-g.......//')
PATH := $(MAKEFILE_DIRECTORY)/bin:$(PATH)
TARGET_DIRECTORY := $(MAKEFILE_DIRECTORY)/target

# Conditional assignment. ('?=')
# Can be overridden with "export"
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ the recommendation is not to use it yet.
The Senzing `sz-sdk-python-abstract` package contains the abstract base class from which
implmentations of the Senzing Python SDK are derived.

[![Python 3.11 Badge]][Python 3.11]
[![PEP8 Badge]][PEP8]

## Overview

## Use
Expand All @@ -36,4 +39,11 @@ implmentations of the Senzing Python SDK are derived.
[DockerHub]: https://hub.docker.com/r/senzing/template-python
[Errors]: docs/errors.md
[Examples]: docs/examples.md
[PEP8 Badge]: https://img.shields.io/badge/code%20style-pep8-orange.svg
[PEP8]: https://www.python.org/dev/peps/pep-0008/
[Python 3.11 Badge]: https://img.shields.io/badge/python-3.6-blue.svg
[Python 3.11]: https://www.python.org/downloads/release/python-3110/
[Senzing Garage]: https://github.com/senzing-garage
[Senzing Quick Start guides]: https://docs.senzing.com/quickstart/
[Senzing]: https://senzing.com/
[sz-sdk-python-abstract package reference]: https://hub.senzing.com/sz-sdk-python-abstract/
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.1
version = 0.1.2
author = senzing
author_email = support@senzing.com
description = Python SDK method definitions
Expand Down
163 changes: 163 additions & 0 deletions src/senzing_abstract/szabstractfactory_abstract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#! /usr/bin/env python3

"""
szabstractfactory_abstract.py is the abstract class for all implementations of szabstractfactory.
"""


from abc import ABC, abstractmethod

from senzing_abstract import (
SzConfigAbstract,
SzConfigManagerAbstract,
SzDiagnosticAbstract,
SzEngineAbstract,
SzProductAbstract,
)

# Metadata

__all__ = ["SzAbstractFactoryAbstract"]
__version__ = "0.0.1" # See https://www.python.org/dev/peps/pep-0396/
__date__ = "2024-09-23"
__updated__ = "2024-09-23"

# -----------------------------------------------------------------------------
# SzAbstractFactoryAbstract
# -----------------------------------------------------------------------------


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

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

@abstractmethod
def create_sz_config(self) -> SzConfigAbstract:
"""
The `create_sz_config` method creates a new implementation of an `SzConfigAbstract` object.
Args:
Returns:
SzConfigAbstract: A new implementation.
Raises:
.. collapse:: Example:
.. literalinclude:: ../../examples/szabstractfactory/create_sz_config.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szabstractfactory/create_sz_config.txt
:linenos:
:language: json
"""

@abstractmethod
def create_sz_configmanager(self) -> SzConfigManagerAbstract:
"""
The `create_sz_configmanager` method creates a new implementation of an `SzConfigManagerAbstract` object.
Args:
Returns:
SzConfigManagerAbstract: A new implementation.
Raises:
.. collapse:: Example:
.. literalinclude:: ../../examples/szabstractfactory/create_sz_configmanager.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szabstractfactory/create_sz_configmanger.txt
:linenos:
:language: json
"""

@abstractmethod
def create_sz_diagnostic(self) -> SzDiagnosticAbstract:
"""
The `create_sz_diagnostic` method creates a new implementation of an `SzDiagnosticAbstract` object.
Args:
Returns:
SzDiagnosticAbstract: A new implementation.
Raises:
.. collapse:: Example:
.. literalinclude:: ../../examples/szabstractfactory/create_sz_diagnostic.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szabstractfactory/create_sz_diagnostic.txt
:linenos:
:language: json
"""

@abstractmethod
def create_sz_engine(self) -> SzEngineAbstract:
"""
The `create_sz_engine` method creates a new implementation of an `SzEngineAbstract` object.
Args:
Returns:
SzEngineAbstract: A new implementation.
Raises:
.. collapse:: Example:
.. literalinclude:: ../../examples/szabstractfactory/create_sz_engine.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szabstractfactory/create_sz_engine.txt
:linenos:
:language: json
"""

@abstractmethod
def create_sz_product(self) -> SzProductAbstract:
"""
The `create_sz_product` method creates a new implementation of an `SzProductAbstract` object.
Args:
Returns:
SzProductAbstract: A new implementation.
Raises:
.. collapse:: Example:
.. literalinclude:: ../../examples/szabstractfactory/create_sz_product.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szabstractfactory/create_sz_product.txt
:linenos:
:language: json
"""

0 comments on commit 78863ad

Please sign in to comment.