verdict.py
def to_json(
        self,
        filepath,
        overwrite_existing_file = True,
    ):
        '''Save the contents as a JSON file.

        Args:
            filepath (str):
                Location to save the hdf5 file at.

            overwrite_existing_file (boolean):
                If True and a file already exists at filepath, delete it prior
                to saving.

            condensed (boolean):
                If True, combine the innermost dictionaries into a condensed
                DataFrame/array-like format.
        '''

        # Check for existing
        if os.path.isfile( filepath ):
            if overwrite_existing_file:
                os.remove( filepath )
            else:
                raise IOError( 'File {} already exists'.format( filepath ) )

        # Format data
        def recursive_format( data ):

            # Turn to regular dictionary
            if isinstance( data, Dict ):
                formatted = data._storage
            elif isinstance( data, np.ndarray ):
                formatted = list( data )
            elif isinstance( data, set ):
                formatted = list( data )
            else:
                formatted = data

            # Repeat
            if isinstance( formatted, dict ):
                for key, item in formatted.items():
                    formatted[key] = recursive_format( item )
            if isinstance( formatted, list ):
                for i, item in enumerate( formatted ):
                    formatted[i] = recursive_format( item )

            return formatted

        data_to_save = recursive_format( self._storage )

        # Save
        with open( filepath, 'w', encoding='utf-8') as f:
            json.dump( data_to_save, f, ensure_ascii=False, indent=4)
Save the contents as a JSON file.

        Args:
            filepath (str):
                Location to save the hdf5 file at.

            overwrite_existing_file (boolean):
                If True and a file already exists at filepath, delete it prior
                to saving.

            condensed (boolean):
                If True, combine the innermost dictionaries into a condensed
                DataFrame/array-like format.
        
Save the contents as a JSON file.
Save the contents as a JSON file .
def to_json(
        self,
        filepath,
        overwrite_existing_file = True,
    ):
        if os.path.isfile( filepath ):
            if overwrite_existing_file:
                os.remove( filepath )
            else:
                raise IOError( 'File {} already exists'.format( filepath ) )
        def recursive_format( data ):
            if isinstance( data, Dict ):
                formatted = data._storage
            elif isinstance( data, np.ndarray ):
                formatted = list( data )
            elif isinstance( data, set ):
                formatted = list( data )
            else:
                formatted = data
            if isinstance( formatted, dict ):
                for key, item in formatted.items():
                    formatted[key] = recursive_format( item )
            if isinstance( formatted, list ):
                for i, item in enumerate( formatted ):
                    formatted[i] = recursive_format( item )
            return formatted
        data_to_save = recursive_format( self._storage )
        with open( filepath, 'w', encoding='utf-8') as f:
            json.dump( data_to_save, f, ensure_ascii=False, indent=4)
def to_json ( self , filepath , overwrite_existing_file = True , ) : if os . path . isfile ( filepath ) : if overwrite_existing_file : os . remove ( filepath ) else : raise IOError ( 'File {} already exists' . format ( filepath ) ) def recursive_format ( data ) : if isinstance ( data , Dict ) : formatted = data . _storage elif isinstance ( data , np . ndarray ) : formatted = list ( data ) elif isinstance ( data , set ) : formatted = list ( data ) else : formatted = data if isinstance ( formatted , dict ) : for key , item in formatted . items ( ) : formatted [ key ] = recursive_format ( item ) if isinstance ( formatted , list ) : for i , item in enumerate ( formatted ) : formatted [ i ] = recursive_format ( item ) return formatted data_to_save = recursive_format ( self . _storage ) with open ( filepath , 'w' , encoding = 'utf-8' ) as f : json . dump ( data_to_save , f , ensure_ascii = False , indent = 4 )
Save the contents as a JSON file.
Save the contents as a JSON file .
'''Save the contents as a JSON file.

        Args:
            filepath (str):
                Location to save the hdf5 file at.

            overwrite_existing_file (boolean):
                If True and a file already exists at filepath, delete it prior
                to saving.

            condensed (boolean):
                If True, combine the innermost dictionaries into a condensed
                DataFrame/array-like format.
        ''' # Check for existing # Format data # Turn to regular dictionary # Repeat # Save
self
filepath
Location to save the hdf5 file at.
Location to save the hdf5 file at .
overwrite_existing_file
If True and a file already exists at filepath, delete it prior
to saving.
If True and a file already exists at filepath delete it prior to saving .
condensed
If True, combine the innermost dictionaries into a condensed
DataFrame/array-like format.
If True combine the innermost dictionaries into a condensed DataFrame / array - like format .