Skip to content

Commit b0be540

Browse files
committed
Fix docstrings to PEP8 standards with regards to the Yields section #143
1 parent f58e19e commit b0be540

File tree

1 file changed

+13
-37
lines changed

1 file changed

+13
-37
lines changed

src/sasctl/pzmm/write_json_files.py

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def writeVarJSON(cls, inputData, isInput=True, jPath=Path.cwd()):
4848
Writes a variable descriptor JSON file for input or output variables, based on input data containing predictor
4949
and prediction columns.
5050
51+
This function creates a JSON file named either InputVar.json or OutputVar.json based on argument inputs.
52+
5153
Parameters
5254
----------
5355
inputData : dataframe or list of dicts
@@ -58,11 +60,6 @@ def writeVarJSON(cls, inputData, isInput=True, jPath=Path.cwd()):
5860
Boolean flag to check if generating the input or output variable JSON.
5961
jPath : string, optional
6062
File location for the output JSON file. Default is the current working directory.
61-
62-
Yields
63-
------
64-
JSON file
65-
A JSON file named either InputVar.json or OutputVar.json based on argument inputs.
6663
"""
6764
outputJSON = pd.DataFrame()
6865
if isinstance(inputData, list):
@@ -163,6 +160,7 @@ def writeModelPropertiesJSON(
163160
Writes a JSON file containing SAS Model Manager model properties.
164161
165162
The JSON file format is required by the SAS Model Repository API service and only eventProbVar can be 'None'.
163+
This function outputs a JSON file located named "ModelProperties.json".
166164
167165
Parameters
168166
----------
@@ -186,11 +184,6 @@ def writeModelPropertiesJSON(
186184
Location for the output JSON file. The default is the current working directory.
187185
modeler : string, optional
188186
The modeler name to be displayed in the model properties. The default value is None.
189-
190-
Yields
191-
------
192-
'ModelProperties.json'
193-
Output JSON file located at jPath.
194187
"""
195188

196189
# Check if model description provided is smaller than then 1024 character limit
@@ -272,6 +265,8 @@ def writeFileMetadataJSON(cls, modelPrefix, jPath=Path.cwd(), isH2OModel=False):
272265
"""
273266
Writes a file metadata JSON file pointing to all relevant files.
274267
268+
This function outputs a JSON file named "fileMetadata.json".
269+
275270
Parameters
276271
----------
277272
modelPrefix : string
@@ -282,11 +277,6 @@ def writeFileMetadataJSON(cls, modelPrefix, jPath=Path.cwd(), isH2OModel=False):
282277
isH2OModel : boolean, optional
283278
Sets whether the model metadata is associated with an H2O.ai model. If set as True, the MOJO model file
284279
will be set as a score resource. The default value is False.
285-
286-
Yields
287-
------
288-
'fileMetadata.json'
289-
Output JSON file located at jPath.
290280
"""
291281

292282
if not isH2OModel:
@@ -353,6 +343,8 @@ def writeBaseFitStat(
353343
* KSCut = KS Cutoff
354344
* C = Area Under ROC
355345
346+
This function outputs a JSON file named "dmcas_fitstat.json".
347+
356348
Parameters
357349
----------
358350
csvPath : string, optional
@@ -365,11 +357,6 @@ def writeBaseFitStat(
365357
Input parameter tuples in the form of (parameterName, parameterLabel, parameterValue, dataRole). For
366358
example, a sample parameter call would be ('NObs', 'Sum of Frequencies', 3488, 'TRAIN'). Variable dataRole
367359
is typically either TRAIN, TEST, or VALIDATE or 1, 2, 3 respectively. The default value is None.
368-
369-
Yields
370-
------
371-
'dmcas_fitstat.json'
372-
Output JSON file located at jPath.
373360
"""
374361

375362
validParams = [
@@ -467,6 +454,8 @@ def calculateFitStat(
467454
values come first and the predicted second
468455
* list; the actual and predicted values are their own indexed entry
469456
457+
This function outputs a JSON file named "dmcas_fitstat.json".
458+
470459
Parameters
471460
----------
472461
validateData : pandas dataframe, numpy array, or list, optional
@@ -481,11 +470,6 @@ def calculateFitStat(
481470
jPath : string, optional
482471
Location for the output JSON file. The default value is the current
483472
working directory.
484-
485-
Yields
486-
------
487-
'dmcas_fitstat.json'
488-
Output JSON file located at jPath.
489473
"""
490474
# If numpy inputs are supplied, then it is assumed that numpy is installed in the environment
491475
try:
@@ -611,6 +595,8 @@ def generateROCLiftStat(
611595
ROC and Lift calculations are completed by CAS through a SWAT call. Note that if no data set is provided
612596
(validate, train, or test), this function raises an error and does not create any JSON files.
613597
598+
This function outputs a pair of JSON files named "dmcas_lift.json" and "dmcas_roc.json".
599+
614600
Parameters
615601
---------------
616602
targetName: str
@@ -631,13 +617,6 @@ def generateROCLiftStat(
631617
probabilities. The default value is None.
632618
jPath : string, optional
633619
Location for the output JSON file. The default value is the current working directory.
634-
635-
Yields
636-
---------------
637-
'dmcas_roc.json'
638-
Output JSON file located at jPath.
639-
'dmcas_lift.json'
640-
Output JSON file located at jPath.
641620
"""
642621
# If numpy inputs are supplied, then it is assumed that numpy is installed in the environment
643622
try:
@@ -980,6 +959,8 @@ def create_requirements_json(cls, model_path=Path.cwd()):
980959
model development environment, it is recommended to the user that they adjust the requirements.json file's
981960
package versions to match the model development environment.
982961
962+
This function outputs a JSON file named "requirements.json".
963+
983964
Parameters
984965
----------
985966
model_path : str, optional
@@ -989,11 +970,6 @@ def create_requirements_json(cls, model_path=Path.cwd()):
989970
-------
990971
list of dicts
991972
List of dictionary representations of the json file contents, split into each package and/or warning.
992-
993-
Yields
994-
------
995-
requirements.json : file
996-
JSON file used to create a specific Python environment in a SAS Model Manager published container.
997973
"""
998974

999975
pickle_packages = []

0 commit comments

Comments
 (0)