@@ -295,7 +295,7 @@ def score(var1, var2, var3, var4):
295295
296296 if preprocess_function :
297297 self ._add_preprocess_code (preprocess_function )
298-
298+
299299 # SAS Viya 3.5 model
300300 if model_id :
301301 mas_code , cas_code = self ._viya35_score_code_import (
@@ -2260,13 +2260,10 @@ def _viya35_score_code_import(
22602260 mr .update_model (model )
22612261 return mas_code , cas_code
22622262
2263- def _add_preprocess_code (
2264- self ,
2265- preprocess_function : Callable [DataFrame , DataFrame ]
2266- ):
2263+ def _add_preprocess_code (self , preprocess_function : Callable [DataFrame , DataFrame ]):
22672264 """
22682265 Places the given preprocess function, which must both take a DataFrame as an argument
2269- and return a DataFrame, into the score code. If the preprocess function does not
2266+ and return a DataFrame, into the score code. If the preprocess function does not
22702267 return anything, an error is thrown.
22712268
22722269 Parameters
@@ -2275,14 +2272,15 @@ def _add_preprocess_code(
22752272 The preprocess function to be added to the score code.
22762273 """
22772274 import inspect
2275+
22782276 preprocess_code = inspect .getsource (preprocess_function )
22792277 if not "return" in preprocess_code :
22802278 raise ValueError (
2281- "The given score code does not return a value. " +
2282- "To allow for the score code to work correctly, please ensure the preprocessed " +
2283- "data is returned."
2279+ "The given score code does not return a value. "
2280+ + "To allow for the score code to work correctly, please ensure the preprocessed "
2281+ + "data is returned."
22842282 )
2285- if self .score_code [- 1 ] == ' \n ' :
2283+ if self .score_code [- 1 ] == " \n " :
22862284 self .score_code += preprocess_code
22872285 else :
2288- self .score_code += ' \n ' + preprocess_code
2286+ self .score_code += " \n " + preprocess_code
0 commit comments