Skip to content

Commit

Permalink
#188 Migrate imports
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj committed Jan 10, 2025
1 parent fcfb7e8 commit 65a0d39
Show file tree
Hide file tree
Showing 69 changed files with 308 additions and 402 deletions.
12 changes: 4 additions & 8 deletions examples/misc/add_truthset_data.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
#! /usr/bin/env python3

import grpc
from senzing import SZ_WITHOUT_INFO, SzError
from senzing_truthset import (
TRUTHSET_CUSTOMER_RECORDS,
TRUTHSET_REFERENCE_RECORDS,
TRUTHSET_WATCHLIST_RECORDS,
)

from senzing_grpc import (
SZ_WITHOUT_INFO,
SzAbstractFactory,
SzAbstractFactoryParameters,
SzError,
)
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_engine = sz_abstract_factory.create_engine()
record_sets = [
TRUTHSET_CUSTOMER_RECORDS,
Expand Down
7 changes: 4 additions & 3 deletions examples/misc/add_truthset_datasources.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError
from senzing_truthset import TRUTHSET_DATASOURCES

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
sz_configmanager = sz_abstract_factory.create_configmanager()
sz_diagnostic = sz_abstract_factory.create_diagnostic()
Expand Down
7 changes: 4 additions & 3 deletions examples/misc/individual_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import grpc
from senzing import (
SzAbstractFactory,
SzConfig,
SzConfigManager,
SzDiagnostic,
Expand All @@ -10,9 +11,9 @@
SzProduct,
)

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

Expand Down Expand Up @@ -48,7 +49,7 @@ def try_sz_product(sz_product_local: SzProduct) -> None:


try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
sz_configmanager = sz_abstract_factory.create_configmanager()
sz_diagnostic = sz_abstract_factory.create_diagnostic()
Expand Down
7 changes: 4 additions & 3 deletions examples/szabstractfactory/create_config.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
except SzError as err:
print(f"\nFile {__file__}:\nError:\n{err}\n")
7 changes: 4 additions & 3 deletions examples/szabstractfactory/create_configmanager.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_configmanager = sz_abstract_factory.create_configmanager()
except SzError as err:
print(f"\nFile {__file__}:\nError:\n{err}\n")
7 changes: 4 additions & 3 deletions examples/szabstractfactory/create_diagnostic.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_diagnostic = sz_abstract_factory.create_diagnostic()
except SzError as err:
print(f"\nFile {__file__}:\nError:\n{err}\n")
7 changes: 4 additions & 3 deletions examples/szabstractfactory/create_engine.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_engine = sz_abstract_factory.create_engine()
except SzError as err:
print(f"\nFile {__file__}:\nError:\n{err}\n")
7 changes: 4 additions & 3 deletions examples/szabstractfactory/create_product.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_product = sz_abstract_factory.create_product()
except SzError as err:
print(f"\nFile {__file__}:\nError:\n{err}\n")
7 changes: 4 additions & 3 deletions examples/szabstractfactory/initialize_with_config_id.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_configmanager = sz_abstract_factory.create_configmanager()
config_id = sz_configmanager.get_default_config_id()
sz_abstract_factory.reinitialize(config_id)
Expand Down
7 changes: 4 additions & 3 deletions examples/szabstractfactory/initialize_with_debug.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
except SzError as err:
print(f"\nFile {__file__}:\nError:\n{err}\n")
7 changes: 4 additions & 3 deletions examples/szabstractfactory/reinitialize.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
# Using get_active_config_id for demonstrations purposes.
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_engine = sz_abstract_factory.create_engine()
config_id = sz_engine.get_active_config_id()
sz_abstract_factory.reinitialize(config_id)
Expand Down
7 changes: 4 additions & 3 deletions examples/szconfig/add_data_source.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

DATA_SOURCE_CODE = "NAME_OF_DATASOURCE"
FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
config_handle = sz_config.create_config()
RESULT = sz_config.add_data_source(config_handle, DATA_SOURCE_CODE)
Expand Down
7 changes: 4 additions & 3 deletions examples/szconfig/create_and_close.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
config_handle = sz_config.create_config()

Expand Down
7 changes: 4 additions & 3 deletions examples/szconfig/create_export_import_close.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
config_handle_1 = sz_config.create_config() # Create first in-memory.
CONFIG_DEFINITION = sz_config.export_config(config_handle_1) # Save in-memory to string.
Expand Down
7 changes: 4 additions & 3 deletions examples/szconfig/delete_data_source.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

DATA_SOURCE_CODE = "TEST"
FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
config_handle = sz_config.create_config()
sz_config.delete_data_source(config_handle, DATA_SOURCE_CODE)
Expand Down
7 changes: 4 additions & 3 deletions examples/szconfig/export_config.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
config_handle = sz_config.create_config() # Create first in-memory.
CONFIG_DEFINITION = sz_config.export_config(config_handle) # Save in-memory to string.
Expand Down
7 changes: 4 additions & 3 deletions examples/szconfig/get_data_sources.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
config_handle = sz_config.create_config()
RESULT = sz_config.get_data_sources(config_handle)
Expand Down
7 changes: 4 additions & 3 deletions examples/szconfig/import_config.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env python3

import grpc
from senzing import SzError

from senzing_grpc import SzAbstractFactory, SzAbstractFactoryParameters, SzError
from senzing_grpc import SzAbstractFactoryGrpc, SzAbstractFactoryParametersGrpc

FACTORY_PARAMETERS: SzAbstractFactoryParameters = {
FACTORY_PARAMETERS: SzAbstractFactoryParametersGrpc = {
"grpc_channel": grpc.insecure_channel("localhost:8261"),
}

try:
sz_abstract_factory = SzAbstractFactory(**FACTORY_PARAMETERS)
sz_abstract_factory = SzAbstractFactoryGrpc(**FACTORY_PARAMETERS)
sz_config = sz_abstract_factory.create_config()
sz_configmanager = sz_abstract_factory.create_configmanager()
config_id = sz_configmanager.get_default_config_id()
Expand Down
Loading

0 comments on commit 65a0d39

Please sign in to comment.