Skip to content

Commit 60b2d07

Browse files
committed
Updated constants and usage of those
1 parent 6557484 commit 60b2d07

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

nyoka/base/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
limitations under the License.
1818
"""
1919

20+
class HEADER_INFO:
21+
COPYRIGHT = "Copyright (c) 2021 Software AG"
22+
APPLICATION_NAME = "Nyoka"
23+
APPLICATION_VERSION = "5.0.0"
24+
DEFAULT_DESCRIPTION = "Default description"
25+
2026
class MISSING_VALUE_TREATMENT_METHOD:
2127
AS_IS = "asIs"
2228
AS_MEAN = "asMean"

nyoka/custom/trendminer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
_JSON = ".json"
3535
_MAX_VALUE = "maxValue"
3636
_MIN_VALUE = "minValue"
37-
_APPLICATION_NAME = "Nyoka"
38-
_APPLICATION_VERSION = "4.2.1"
3937

4038

4139
class FingerprintToPmml:
@@ -107,8 +105,8 @@ def _generate_pmml(self):
107105
def get_header():
108106
header = pml.Header(
109107
Application=pml.Application(
110-
name=_APPLICATION_NAME,
111-
version=_APPLICATION_VERSION
108+
name=HEADER_INFO.APPLICATION_NAME,
109+
version=HEADER_INFO.APPLICATION_VERSION
112110
),
113111
description=self._fingerprint_description
114112
)

nyoka/skl/skl_to_pmml.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from skl import pre_process as pp
2727
from datetime import datetime
2828
import math
29-
import metadata
3029
from base.constants import *
3130

3231
def skl_to_pmml(pipeline, col_names, target_name='target', pmml_f_name='from_sklearn.pmml', model_name=None, description=None):
@@ -2218,9 +2217,6 @@ def super_cls_names(cls):
22182217
super_cls_names(cls)
22192218
return parents
22202219

2221-
2222-
from nyoka import metadata
2223-
22242220
def get_header(description):
22252221

22262222
"""
@@ -2232,10 +2228,10 @@ def get_header(description):
22322228
Returns Nyoka's Header object.
22332229
22342230
"""
2235-
copyryt = "Copyright (c) 2018 Software AG"
2236-
description = description if description else "Default Description"
2231+
copyryt = HEADER_INFO.COPYRIGHT
2232+
description = description if description else HEADER_INFO.DEFAULT_DESCRIPTION
22372233
timestamp = pml.Timestamp(datetime.now())
2238-
application=pml.Application(name="Nyoka",version=metadata.__version__)
2234+
application=pml.Application(name=HEADER_INFO.APPLICATION_NAME,version=HEADER_INFO.APPLICATION_VERSION)
22392235
header = pml.Header(copyright=copyryt, description=description, Timestamp=timestamp, Application=application)
22402236
return header
22412237

nyoka/statsmodels/exponential_smoothing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,12 @@ def get_mining_field_objs():
168168
else:
169169
season_obj = None
170170
pmml = PMML(
171-
version='4.4',
171+
version=PMML_SCHEMA.VERSION,
172172
Header=Header(
173-
copyright="Copyright (c) 2018 Software AG", description=description if description else "Exponential Smoothing Model",
173+
copyright=HEADER_INFO.COPYRIGHT,
174+
description=description if description else HEADER_INFO.DEFAULT_DESCRIPTION,
174175
Timestamp=Timestamp(datetime.now()),
175-
Application=Application(name="Nyoka",version=metadata.__version__)
176+
Application=Application(name=HEADER_INFO.APPLICATION_NAME,version=HEADER_INFO.APPLICATION_VERSION)
176177
),
177178
DataDictionary=DataDictionary(numberOfFields=n_columns, DataField=get_data_field_objs()),
178179
TimeSeriesModel=[TimeSeriesModel(

nyoka/statsmodels/statsmodels_to_pmml.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from pprint import pprint
2727
from PMML44 import *
2828
from datetime import datetime
29-
import metadata
3029
import warnings
3130
import math
3231
from base.constants import *
@@ -69,10 +68,10 @@ def export_pmml(self):
6968
pmml = PMML(
7069
version=PMML_SCHEMA.VERSION,
7170
Header=Header(
72-
copyright = "Copyright (c) 2018 Software AG",
73-
description = self.description,
71+
copyright = HEADER_INFO.COPYRIGHT,
72+
description = self.description if self.description else HEADER_INFO.DEFAULT_DESCRIPTION,
7473
Timestamp = Timestamp(datetime.now()),
75-
Application=Application(name="Nyoka",version=metadata.__version__)
74+
Application=Application(name=HEADER_INFO.APPLICATION_NAME,version=HEADER_INFO.APPLICATION_VERSION)
7675
),
7776
DataDictionary=self.data_dictionary,
7877
TimeSeriesModel=[self.ts_model]

0 commit comments

Comments
 (0)