graphit/graph_io/io_pydata_format.py
def serialize(self, **kwargs):
        """
        Serialize a node as Python dictionary
        
        :param allow_none:  serialize None values
        :type allow_none:   :py:bool
        :param default:     default value to return if value is None
        
        :return:            dictionary name (node key) and dictionary
        """
        
        attributes = {}
        
        # collect node attribute
        for key in self.nodes[self.nid].keys():
            if key in excluded_keys or key == self.key_tag:
                continue
            
            value = self.get(key, default=kwargs.get('default'))
            if not kwargs.get('allow_none') and value is None:
                continue
            
            attributes[key] = value

        # Iterate child attributes
        for cid in self.children(return_nids=True):
            child_node = self.origin.getnodes(cid)

            if not hasattr(child_node, 'serialize'):
                continue

            key, value = child_node.serialize(**kwargs)

            # Check for dictionary key overload
            if key in attributes:
                logging.warning('Key {0} already defined. Values will be updated'.format(key))
            
            attributes[key] = value

        return self.get(self.key_tag), attributes

        Serialize a node as Python dictionary
        
        :param allow_none:  serialize None values
        :type allow_none:   :py:bool
        :param default:     default value to return if value is None
        
        :return:            dictionary name (node key) and dictionary
        
Serialize a node as Python dictionary
Serialize a node as Python dictionary
def serialize(self, **kwargs):
        attributes = {}
        for key in self.nodes[self.nid].keys():
            if key in excluded_keys or key == self.key_tag:
                continue
            value = self.get(key, default=kwargs.get('default'))
            if not kwargs.get('allow_none') and value is None:
                continue
            attributes[key] = value
        for cid in self.children(return_nids=True):
            child_node = self.origin.getnodes(cid)
            if not hasattr(child_node, 'serialize'):
                continue
            key, value = child_node.serialize(**kwargs)
            if key in attributes:
                logging.warning('Key {0} already defined. Values will be updated'.format(key))
            attributes[key] = value
        return self.get(self.key_tag), attributes
def serialize ( self , ** kwargs ) : attributes = { } for key in self . nodes [ self . nid ] . keys ( ) : if key in excluded_keys or key == self . key_tag : continue value = self . get ( key , default = kwargs . get ( 'default' ) ) if not kwargs . get ( 'allow_none' ) and value is None : continue attributes [ key ] = value for cid in self . children ( return_nids = True ) : child_node = self . origin . getnodes ( cid ) if not hasattr ( child_node , 'serialize' ) : continue key , value = child_node . serialize ( ** kwargs ) if key in attributes : logging . warning ( 'Key {0} already defined. Values will be updated' . format ( key ) ) attributes [ key ] = value return self . get ( self . key_tag ) , attributes
Serialize a node as Python dictionary
Serialize a node as Python dictionary
"""
        Serialize a node as Python dictionary
        
        :param allow_none:  serialize None values
        :type allow_none:   :py:bool
        :param default:     default value to return if value is None
        
        :return:            dictionary name (node key) and dictionary
        """ # collect node attribute # Iterate child attributes # Check for dictionary key overload
dictionary name (node key) and dictionary
dictionary name ( node key ) and dictionary
self
allow_none
serialize None values
serialize None values
default
default value to return if value is None
default value to return if value is None