-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathszproduct.py
90 lines (65 loc) · 2.63 KB
/
szproduct.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /usr/bin/env python3
"""
szproduct.py is the abstract class for all implementations of SzProduct.
"""
# TODO: Determine specific SzError, Errors for "Raises:" documentation.
from abc import ABC, abstractmethod
from .szhelpers import construct_help
# Metadata
__all__ = ["SzProduct"]
__version__ = "0.0.1" # See https://www.python.org/dev/peps/pep-0396/
__date__ = "2023-10-30"
__updated__ = "2025-01-28"
# -----------------------------------------------------------------------------
# SzProduct
# -----------------------------------------------------------------------------
class SzProduct(ABC):
"""
SzProduct is the definition of the Senzing Python SDK that is
implemented by packages such as szproduct.py.
"""
# -------------------------------------------------------------------------
# Interface definition
# -------------------------------------------------------------------------
@abstractmethod
def get_license(self) -> str:
"""
The `get_license` method retrieves information about the currently used license.
Returns:
str: A JSON document containing Senzing license metadata.
.. collapse:: Example:
.. literalinclude:: ../../examples/szproduct/get_license.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szproduct/get_license.txt
:linenos:
:language: json
"""
@abstractmethod
def get_version(self) -> str:
"""
The `get_version` method returns the version of Senzing.
Returns:
str: A JSON document containing metadata about the Senzing Engine version being used.
.. collapse:: Example:
.. literalinclude:: ../../examples/szproduct/get_version.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szproduct/get_version.txt
:linenos:
:language: json
"""
# -------------------------------------------------------------------------
# Convenience methods
# -------------------------------------------------------------------------
def help(self, method_name: str = "") -> str:
"""
Return the help for a particular message.
Args:
method_name (str): The name of the method. (e.g. "init"). If empty, a list of methods and descriptions is returned.
Returns:
str: The Help information about the requested method
"""
return construct_help(self, method_name=method_name)