@@ -26,8 +26,8 @@ def convertMetadata(zPath, pythonScoreCode=None):
26
26
27
27
Returns
28
28
-------
29
- scoreResource : string
30
- File name of the score resource file.
29
+ scoreResource : list
30
+ File name(s) of the score resource file.
31
31
pythonScoreCode : string
32
32
File name of the Python score code file.
33
33
@@ -67,11 +67,14 @@ def convertMetadata(zPath, pythonScoreCode=None):
67
67
+ " name of the Python score code file as an argument."
68
68
)
69
69
raise SyntaxError (message )
70
+ scoreResource = []
70
71
for i in range (len (metaData )):
71
72
if metaData [i ]["role" ] == "score" :
72
73
metaData [i ].update ({"name" : pythonScoreCode })
73
74
if metaData [i ]["role" ] == "scoreResource" :
74
- scoreResource = metaData [i ]["name" ]
75
+ scoreResource .append (metaData [i ]["name" ])
76
+ if metaData [i ]["role" ] == "python pickle" :
77
+ scoreResource .append (metaData [i ]["name" ])
75
78
with open (Path (zPath ) / "fileMetaData.json" , "w" ) as jFile :
76
79
json .dump (metaData , jFile , indent = 4 , skipkeys = True )
77
80
print ("fileMetaData.json has been modified and rewritten for SAS Viya 4" )
@@ -89,8 +92,8 @@ def convertScoreCode(zPath, scoreResource, pythonScoreCode):
89
92
----------
90
93
zPath : string or Path object
91
94
Location of files in the SAS Viya 3.5 model zip.
92
- scoreResource : string
93
- File name of the score resource file.
95
+ scoreResource : list
96
+ File name(s) of the score resource file.
94
97
pythonScoreCode : string
95
98
File name of the Python score code file.
96
99
"""
@@ -103,7 +106,9 @@ def convertScoreCode(zPath, scoreResource, pythonScoreCode):
103
106
104
107
# Search for all directory paths in score code that contain the scoreResource
105
108
oldString = re .findall (r"['\"]\/.*?\.[\w:]+['\"]" , scoreCode )
106
- oldString = [s for s in oldString if scoreResource in s ]
109
+ parsedOldString = []
110
+ for resource in scoreResource :
111
+ parsedOldString = parsedOldString + [s for s in oldString if resource in s ]
107
112
# Remove duplicates, as .replace() checks for all instances
108
113
oldString = list (set (oldString ))
109
114
# Replace Viya 3.5 style with Viya 4 style
0 commit comments