class_docstr: Metaclass that handles Document backward compatibility.
class_docstr_tok: ["Metaclass","that","handles","Document","backward","compatibility","."]
docstr: Called before Document.__init__, will remap legacy fields to new ones.
  Also handles building a Document from a flattened dictionary.
docstr_tok: ["Called","before","Document.__init__",",","will","remap","legacy","fields","to","new","ones",".","Also","handles","building","a","Document","from","a","flattened","dictionary","."]
code: def __call__(cls, *args, **kwargs):
      """
      Called before Document.__init__, will remap legacy fields to new ones.
      Also handles building a Document from a flattened dictionary.
      """
      # Move `content` to new fields depending on the type
      content = kwargs.get("content")
      if isinstance(content, pandas.DataFrame):
          kwargs["dataframe"] = content
          del kwargs["content"]
  
      # Not used anymore
      if "content_type" in kwargs:
          del kwargs["content_type"]
  
      # Embedding were stored as NumPy arrays in 1.x, so we convert it to the new type
      if isinstance(
          embedding := kwargs.get("embedding"), numpy.ndarray
      ):
          kwargs["embedding"] = embedding.tolist()
  
      # id_hash_keys is not used anymore
      if "id_hash_keys" in kwargs:
          del kwargs["id_hash_keys"]
  
      return super().__call__(*args, **kwargs)
  
file_path: haystack/haystack/dataclasses/document.py
imports: import io
  import hashlib
  import logging
  from dataclasses import asdict, dataclass, field, fields
  from typing import Any, Dict, List, Optional
  import numpy
  import pandas
  from haystack.dataclasses.byte_stream import ByteStream
label_desc: Use image node_id 1 for calling the _BackwardCompatible obj's underlying member method code with example usage: obj.__call__(cls) and returns: super