@@ -42,8 +42,8 @@ def flatten(nestedList):
42
42
43
43
44
44
class JSONFiles :
45
- @classmethod
46
- def writeVarJSON (cls , inputData , isInput = True , jPath = Path .cwd ()):
45
+ @staticmethod
46
+ def writeVarJSON (inputData , isInput = True , jPath = Path .cwd ()):
47
47
"""
48
48
Writes a variable descriptor JSON file for input or output variables, based on input data containing predictor
49
49
and prediction columns.
@@ -142,9 +142,8 @@ def writeVarJSON(cls, inputData, isInput=True, jPath=Path.cwd()):
142
142
)
143
143
)
144
144
145
- @classmethod
145
+ @staticmethod
146
146
def writeModelPropertiesJSON (
147
- cls ,
148
147
modelName ,
149
148
modelDesc ,
150
149
targetVariable ,
@@ -260,8 +259,8 @@ def writeModelPropertiesJSON(
260
259
)
261
260
)
262
261
263
- @classmethod
264
- def writeFileMetadataJSON (cls , modelPrefix , jPath = Path .cwd (), isH2OModel = False ):
262
+ @staticmethod
263
+ def writeFileMetadataJSON (modelPrefix , jPath = Path .cwd (), isH2OModel = False ):
265
264
"""
266
265
Writes a file metadata JSON file pointing to all relevant files.
267
266
@@ -855,7 +854,8 @@ def generateROCLiftStat(
855
854
)
856
855
)
857
856
858
- def readJSONFile (self , path ):
857
+ @staticmethod
858
+ def readJSONFile (path ):
859
859
"""
860
860
Reads a JSON file from a given path.
861
861
@@ -873,7 +873,8 @@ def readJSONFile(self, path):
873
873
with open (path ) as jFile :
874
874
return json .load (jFile )
875
875
876
- def formatParameter (self , paramName ):
876
+ @staticmethod
877
+ def formatParameter (paramName ):
877
878
"""
878
879
Formats the parameter name to the JSON standard.
879
880
@@ -898,7 +899,8 @@ def formatParameter(self, paramName):
898
899
899
900
return paramName
900
901
901
- def convertDataRole (self , dataRole ):
902
+ @staticmethod
903
+ def convertDataRole (dataRole ):
902
904
"""
903
905
Converts the data role identifier from string to int or int to string.
904
906
@@ -1010,8 +1012,8 @@ def create_requirements_json(cls, model_path=Path.cwd()):
1010
1012
1011
1013
return json_dicts
1012
1014
1013
- @classmethod
1014
- def get_local_package_version (cls , package_list ):
1015
+ @staticmethod
1016
+ def get_local_package_version (package_list ):
1015
1017
"""
1016
1018
Get package_name versions from the local environment.
1017
1019
@@ -1086,8 +1088,8 @@ def get_code_dependencies(cls, model_path=Path.cwd()):
1086
1088
import_info = list (set (flatten (import_info )))
1087
1089
return import_info
1088
1090
1089
- @classmethod
1090
- def find_imports (cls , file_path ):
1091
+ @staticmethod
1092
+ def find_imports (file_path ):
1091
1093
"""
1092
1094
Find import calls in provided Python code path.
1093
1095
@@ -1133,8 +1135,8 @@ def find_imports(cls, file_path):
1133
1135
except ValueError :
1134
1136
return modules
1135
1137
1136
- @classmethod
1137
- def get_pickle_file (cls , pickle_folder = Path .cwd ()):
1138
+ @staticmethod
1139
+ def get_pickle_file (pickle_folder = Path .cwd ()):
1138
1140
"""
1139
1141
Given a file path, retrieve the pickle file(s).
1140
1142
@@ -1177,8 +1179,8 @@ def get_pickle_dependencies(cls, pickle_file):
1177
1179
modules = cls .get_package_names (dumps )
1178
1180
return modules
1179
1181
1180
- @classmethod
1181
- def get_package_names (cls , stream ):
1182
+ @staticmethod
1183
+ def get_package_names (stream ):
1182
1184
"""
1183
1185
Generates a list of found `package` names from a pickle stream.
1184
1186
@@ -1237,8 +1239,8 @@ def get_package_names(cls, stream):
1237
1239
# Return the package list without any None values
1238
1240
return [x for x in packages if x ]
1239
1241
1240
- @classmethod
1241
- def remove_standard_library_packages (cls , package_list ):
1242
+ @staticmethod
1243
+ def remove_standard_library_packages (package_list ):
1242
1244
"""
1243
1245
Remove any packages from the required list of installed packages that are part of the Python Standard Library.
1244
1246
0 commit comments