def read(self, f_name=""):
        """
        read the json file.
        :param f_name: <str> file input name.
        :return: <bool> True for success. <bool> False for failure.
        """
        Serializer.read(self, f_name=f_name)

        with open(self.OUTPUT_PATH, 'rb') as pickle_data:
            try:
                rdata = pickle.load(pickle_data)
                pickle_data.close()
                self.READ_DATA = rdata
                return True
            except ValueError:
                return False
Пример #2
0
    def read(self, f_name=""):
        """
        read the yaml file.
        :param f_name: <str> file input name.
        :return: <bool> True for success. <bool> False for failure.
        """
        success = Serializer.read(self, f_name=f_name)
        if not success:
            raise IOError("[No File] :: There is no file to read from.")

        with open(self.OUTPUT_PATH, 'r') as yaml_data:
            rdata = yaml.load(yaml_data)
            self.READ_DATA = rdata
            yaml_data.close()
            return True
Пример #3
0
    def read(self, f_name=""):
        """
        read the json file.
        :param f_name: <str> file input name.
        :return: <bool> True for success. <bool> False for failure.
        """
        success = Serializer.read(self, f_name=f_name)
        if not success:
            raise IOError("[No File] :: There is no file to read from.")

        with open(self.OUTPUT_PATH, 'rb') as pickle_data:
            try:
                rdata = pickle.load(pickle_data)
                pickle_data.close()
                self.READ_DATA = rdata
                return True
            except ValueError:
                return False
Пример #4
0
    def read(self, f_name=""):
        """
        read the numpy file.
        :param f_name: <str> file input name.
        :return: <bool> True for success. <bool> False for failure.
        """
        success = Serializer.read(self, f_name=f_name)

        if not success:
            raise IOError("[No File] :: There is no file to read from.")
        try:
            rdata = numpy.load(self.OUTPUT_PATH,
                               encoding='bytes',
                               allow_pickle=True)
            self.READ_DATA = rdata.tolist()
            return True
        except ValueError:
            return False