295
295
296
296
297
297
def check_pds_member (ds , mem ):
298
+ """Check if a member exists in a PDS.
299
+
300
+ Parameters
301
+ ----------
302
+ ds : str
303
+ PDS data set name.
304
+ mem : str
305
+ Member name to check if is under PDS.
306
+
307
+ Returns
308
+ -------
309
+ bool
310
+ If it is a member of the data set.
311
+
312
+ Raises
313
+ ------
314
+ EncodeError
315
+ Can not find member in provided dataset.
316
+ """
298
317
check_rc = False
299
318
if mem in datasets .list_members (ds ):
300
319
check_rc = True
@@ -304,7 +323,25 @@ def check_pds_member(ds, mem):
304
323
305
324
306
325
def check_mvs_dataset (ds ):
307
- """ To call data_set utils to check if the MVS data set exists or not """
326
+ """To call data_set utils to check if the MVS data set exists or not.
327
+
328
+ Parameters
329
+ ----------
330
+ ds : str
331
+ Data set name.
332
+
333
+ Returns
334
+ -------
335
+ tuple(bool,str)
336
+ If the data set exists and it's type.
337
+
338
+ Raises
339
+ ------
340
+ EncodeError
341
+ If data set is not cataloged.
342
+ EncodeError
343
+ Unable to determine data set type.
344
+ """
308
345
check_rc = False
309
346
ds_type = None
310
347
if not data_set .DataSet .data_set_exists (ds ):
@@ -321,7 +358,23 @@ def check_mvs_dataset(ds):
321
358
322
359
323
360
def check_file (file ):
324
- """ check file is a USS file or an MVS data set """
361
+ """Check file is a USS file or an MVS data set.
362
+
363
+ Parameters
364
+ ----------
365
+ file : str
366
+ File to check.
367
+
368
+ Returns
369
+ -------
370
+ tuple(bool,bool,str)
371
+ If is USS file, MVS dataset, and the dataset type.
372
+
373
+ Raises
374
+ ------
375
+ EncodeError
376
+ The data set is not partitioned.
377
+ """
325
378
is_uss = False
326
379
is_mvs = False
327
380
ds_type = None
@@ -347,6 +400,18 @@ def check_file(file):
347
400
348
401
349
402
def verify_uss_path_exists (file ):
403
+ """Verify if USS path exists.
404
+
405
+ Parameters
406
+ ----------
407
+ file : str
408
+ Path of the file.
409
+
410
+ Raises
411
+ ------
412
+ EncodeError
413
+ File does not exist in the directory.
414
+ """
350
415
if not path .exists (file ):
351
416
mypath = "/" + file .split ("/" )[0 ] + "/*"
352
417
ld = listdir (mypath )
@@ -359,6 +424,13 @@ def verify_uss_path_exists(file):
359
424
360
425
361
426
def run_module ():
427
+ """Runs the module.
428
+
429
+ Raises
430
+ ------
431
+ fail_json
432
+ Exception during execution.
433
+ """
362
434
module_args = dict (
363
435
src = dict (type = "str" , required = True ),
364
436
dest = dict (type = "str" ),
@@ -530,6 +602,18 @@ def run_module():
530
602
531
603
class EncodeError (Exception ):
532
604
def __init__ (self , message ):
605
+ """Error during encoding.
606
+
607
+ Parameters
608
+ ----------
609
+ message : str
610
+ Human readable string describing the exception.
611
+
612
+ Attributes
613
+ ----------
614
+ msg : str
615
+ Human readable string describing the exception.
616
+ """
533
617
self .msg = 'An error occurred during encoding: "{0}"' .format (message )
534
618
super (EncodeError , self ).__init__ (self .msg )
535
619
0 commit comments