Skip to content

Commit 5a10f6c

Browse files
committed
cleanup
1 parent 86ec0f5 commit 5a10f6c

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/sasctl/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ def get_version(x):
247247
files.append({'name': 'dmcas_epscorecode.sas',
248248
'file': mas_module.score_code(dest='CAS'),
249249
'role': 'score'})
250-
files.append({'name': 'python_wrappercode.py',
251-
'file': mas_module.score_code(dest='PY')})
250+
files.append({'name': 'python_wrapper.py',
251+
'file': mas_module.score_code(dest='Python')})
252252

253253
model['inputVariables'] = [var.as_model_metadata()
254254
for var in mas_module.variables

src/sasctl/utils/astore.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,6 @@ def create_files_from_astore(table):
131131
sess.loadactionset('astore')
132132

133133
result = sess.astore.describe(rstore=table, epcode=True)
134-
# astore = sess.astore.download(rstore=table)
135-
# if not hasattr(astore, "blob"):
136-
# raise ValueError("Failed to download binary data for ASTORE '%s'."
137-
# % astore)
138-
# astore = astore.blob
139-
#
140-
# astore = bytes(astore) # Convert from SWAT blob type
141134

142135
# Model Manager expects a 0-byte ASTORE file. Will retrieve actual ASTORE
143136
# from CAS during model publish.
@@ -149,11 +142,12 @@ def create_files_from_astore(table):
149142

150143
astore_key = result.Key.Key[0].strip()
151144

152-
# Remove "Keep" sas code from CAS/EP code so full table plus output are returned
153-
# This is so the MM performance charts and test work
154-
keepstart=result.epcode.find("Keep")
155-
keepend=result.epcode.find(";",keepstart)
145+
# Remove "Keep" sas code from CAS/EP code so full table plus output are
146+
# returned. This is so the MM performance charts and test work.
147+
keepstart = result.epcode.find("Keep")
148+
keepend = result.epcode.find(";", keepstart)
156149
ep_ds2 = result.epcode[0:keepstart] + result.epcode[keepend+1:]
150+
157151
package_ds2 = _generate_package_code(result)
158152
model_properties = _get_model_properties(result)
159153
input_vars = [get_variable_properties(var)

src/sasctl/utils/pymas/core.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,19 +350,21 @@ def score_code(self, input_table=None, output_table=None, columns=None, dest='MA
350350
The name of the table where execution results will be written
351351
columns : list of str
352352
Names of the columns from `table` that will be passed to `func`
353-
dest : str {'MAS', 'EP', 'CAS'}
353+
dest : str {'MAS', 'EP', 'CAS', 'Python'}
354+
Specifies the publishing destination for the score code to ensure
355+
that compatible code is generated.
354356
355357
Returns
356358
-------
359+
str
360+
Score code
357361
358-
"""
362+
.. versionchanged:: 1.3.1
363+
Added `dest='Python'` option
359364
365+
"""
360366
dest = dest.upper()
361367

362-
# Python code return
363-
if dest == 'PY':
364-
return '\n'.join(map(str, self.python_source))
365-
366368
# Check for names that could result in DS2 errors.
367369
DS2_KEYWORDS = ['input', 'output']
368370
for k in DS2_KEYWORDS:
@@ -394,4 +396,8 @@ def score_code(self, input_table=None, output_table=None, columns=None, dest='MA
394396
' end;',
395397
'enddata;')
396398

399+
elif dest == 'PYTHON':
400+
# Python code return
401+
code = self.package._python_code
402+
397403
return '\n'.join(code)

0 commit comments

Comments
 (0)