MCPcopy Create free account
hub / github.com/SegataLab/lefse / funcIsValidDictionary

Method funcIsValidDictionary

lefsebiom/ValidateData.py:504–542  ·  view source on GitHub ↗

Validates a parameter as a dictionary. :param parameterValue: Value to be evaluated. :type Unknown :return Boolean: True indicates the parameter is a dictionary. :type Boolean

(parameterValue)

Source from the content-addressed store, hash-verified

502 #Tested 9
503 @staticmethod
504 def funcIsValidDictionary(parameterValue):
505 """
506 Validates a parameter as a dictionary.
507
508 :param parameterValue: Value to be evaluated.
509 :type Unknown
510 :return Boolean: True indicates the parameter is a dictionary.
511 :type Boolean
512 """
513
514 #Check to make sure it is not null
515 if parameterValue == None:
516 return False
517
518 #Check to make sure it is a string
519 if not type(parameterValue) is DictType:
520 return False
521
522 #Check key elements
523 keyList = list(parameterValue.keys())
524 keyListSize = len(keyList)
525 for i in range(0,keyListSize):
526 if keyList[i] == None:
527 return False
528 if type(keyList[i]) is ListType:
529 if validateData.funcIsValidList(keyList[i]) == False:
530 return False
531
532 #Check key elements
533 itemList = list(parameterValue.values())
534 itemListSize = len(itemList)
535
536 for i in range(0,itemListSize):
537 if itemList[i] == None:
538 return False
539 if type(itemList[i]) is ListType:
540 if ValidateData.funcIsValidList(itemList[i]) == False:
541 return False
542 return True
543
544 #Tested 18
545 @staticmethod

Callers

nothing calls this directly

Calls 1

funcIsValidListMethod · 0.80

Tested by

no test coverage detected