# Path: molmod/io/common.py
# class FileFormatError(Exception):
#     """Is raised when unexpected data is encountered while reading a file"""
#     pass


import numpy as np
from molmod.io.common import FileFormatError
    def dump(self, f, name):
        """Write the attribute to a file-like object"""
        array = self.get()
        # print the header line
        print("% 40s  kind=%s  shape=(%s)" % (
            name,
            array.dtype.kind,
            ",".join([str(int(size_axis)) for size_axis in array.shape]),
        ), file=f)
        # print the numbers
        counter = 0
        for value in array.flat:
            counter += 1
            print("% 20s" % value, end=' ', file=f)
            if counter % 4 == 0:
                print(file=f)
        if counter % 4 != 0:
            print(file=f)

    def load(self, f, skip):
        """Load the array data from a file-like object"""
        array = self.get()
        counter = 0
        counter_limit = array.size
        convert = array.dtype.type
        while counter < counter_limit:
            line = f.readline()
            words = line.split()
            for word in words:
                if counter >= counter_limit:

# Path: molmod/io/common.py
# class FileFormatError(Exception):
#     """Is raised when unexpected data is encountered while reading a file"""
#     pass


# Path: molmod/io/number_state.py
import numpy as np
from molmod.io.common import FileFormatError

    def dump(self, f, name):
        """Write the attribute to a file-like object"""
        array = self.get()
        # print the header line
        print("% 40s  kind=%s  shape=(%s)" % (
            name,
            array.dtype.kind,
            ",".join([str(int(size_axis)) for size_axis in array.shape]),
        ), file=f)
        # print the numbers
        counter = 0
        for value in array.flat:
            counter += 1
            print("% 20s" % value, end=' ', file=f)
            if counter % 4 == 0:
                print(file=f)
        if counter % 4 != 0:
            print(file=f)

    def load(self, f, skip):
        """Load the array data from a file-like object"""
        array = self.get()
        counter = 0
        counter_limit = array.size
        convert = array.dtype.type
        while counter < counter_limit:
            line = f.readline()
            words = line.split()
            for word in words:
                if counter >= counter_limit:

                    raise FileFormatError("Wrong array data: too many values.")