def _validate_database(self):
        # If there is no file there, that's fine.  It will get created when
        # we connect.
        if not os.path.exists(self.filename):
            self._create_database()
            return

        # If we can connect to the database, and do anything, then all is good.
        try:
            with self._connect() as conn:
                self._create_tables(conn)
                return
        except sqlite3.DatabaseError:
            pass  # fall through to next case

        # If the file contains JSON with the right stuff in it, convert from
        # the old representation.
        try:
            with open(self.filename, 'rb') as f:
                data = json.loads(f.read().decode('utf-8'))
                keys = [
                    'account_id', 'application_key', 'account_auth_token', 'api_url',
                    'download_url', 'minimum_part_size', 'realm'
                ]
                if all(k in data for k in keys):
                    # remove the json file
                    os.unlink(self.filename)
                    # create a database
                    self._create_database()
                    # add the data from the JSON file
                    with self._connect() as conn:
                        self._create_tables(conn)
                        insert_statement = """
                            INSERT INTO account
                            (account_id, application_key, account_auth_token, api_url, download_url, minimum_part_size, realm)
                            values (?, ?, ?, ?, ?, ?, ?);
                        """

                        conn.execute(insert_statement, tuple(data[k] for k in keys))
                    # all is happy now
                    return
        except ValueError:  # includes json.decoder.JSONDecodeError
            pass

        # Remove the corrupted file and create a new database
        raise CorruptAccountInfo(self.filename)
:type nums: List[int]
dataset/ETHPy150Open Backblaze/B2_Command_Line_Tool/b2/account_info.py/SqliteAccountInfo._validate_database--crossover with--dataset/ETHPy150Open kamyu104/LeetCode/Python/4sum.py/Solution2.fourSum