def validate(self):
        """ validate: Makes sure node is valid
            Args: None
            Returns: boolean indicating if node is valid
        """
        from .files import File

        assert self.source_id is not None, "Assumption Failed: Node must have a source_id"
        assert isinstance(self.title, str), "Assumption Failed: Node title is not a string"
        assert isinstance(self.description, str) or self.description is None, "Assumption Failed: Node description is not a string"
        assert isinstance(self.children, list), "Assumption Failed: Node children is not a list"
        for f in self.files:
            assert isinstance(f, File), "Assumption Failed: files must be file class"
            f.validate()

        source_ids = [c.source_id for c in self.children]
        duplicates = set([x for x in source_ids if source_ids.count(x) > 1])
        assert len(duplicates) == 0, "Assumption Failed: Node must have unique source id among siblings ({} appears multiple times)".format(duplicates)
        return True
def validate ( self ) : from . files import File assert self . source_id is not None , "Assumption Failed: Node must have a source_id" assert isinstance ( self . title , str ) , "Assumption Failed: Node title is not a string" assert isinstance ( self . description , str ) or self . description is None , "Assumption Failed: Node description is not a string" assert isinstance ( self . children , list ) , "Assumption Failed: Node children is not a list" for f in self . files : assert isinstance ( f , File ) , "Assumption Failed: files must be file class" f . validate ( ) source_ids = [ c . source_id for c in self . children ] duplicates = set ( [ x for x in source_ids if source_ids . count ( x ) > 1 ] ) assert len ( duplicates ) == 0 , "Assumption Failed: Node must have unique source id among siblings ({} appears multiple times)" . format ( duplicates ) return True
validate: Makes sure node is valid
            Args: None
            Returns: boolean indicating if node is valid