class_docstr: Shuffles and writes Examples to Arrow files.
class_docstr_tok: ["Shuffles","and","writes","Examples","to","Arrow","files","."]
code: def __init__(
      self,
      schema: Optional[pa.Schema] = None,
      features: Optional[Features] = None,
      path: Optional[str] = None,
      stream: Optional[pa.NativeFile] = None,
      fingerprint: Optional[str] = None,
      writer_batch_size: Optional[int] = None,
      hash_salt: Optional[str] = None,
      check_duplicates: Optional[bool] = False,
      disable_nullable: bool = False,
      update_features: bool = False,
      with_metadata: bool = True,
      unit: str = "examples",
      embed_local_files: bool = False,
      storage_options: Optional[dict] = None,
  ):
      if path is None and stream is None:
          raise ValueError(
              "At least one of path and stream must be provided."
          )
      if features is not None:
          self._features = features
          self._schema = None
      elif schema is not None:
          self._schema: pa.Schema = schema
          self._features = Features.from_arrow_schema(self._schema)
      else:
          self._features = None
          self._schema = None
  
      if hash_salt is not None:
          # Create KeyHasher instance using split name as hash salt
          self._hasher = KeyHasher(hash_salt)
      else:
          self._hasher = KeyHasher("")
  
      self._check_duplicates = check_duplicates
      self._disable_nullable = disable_nullable
  
      if stream is None:
          fs_token_paths = fsspec.get_fs_token_paths(
              path, storage_options=storage_options
          )
          self._fs: fsspec.AbstractFileSystem = fs_token_paths[0]
          self._path = (
              fs_token_paths[2][0]
              if not is_remote_filesystem(self._fs)
              else self._fs.unstrip_protocol(fs_token_paths[2][0])
          )
          self.stream = self._fs.open(fs_token_paths[2][0], "wb")
          self._closable_stream = True
      else:
          self._fs = None
          self._path = None
          self.stream = stream
          self._closable_stream = False
  
      self.fingerprint = fingerprint
      self.disable_nullable = disable_nullable
      self.writer_batch_size = (
          writer_batch_size or config.DEFAULT_MAX_BATCH_SIZE
      )
      self.update_features = update_features
      self.with_metadata = with_metadata
      self.unit = unit
      self.embed_local_files = embed_local_files
  
      self._num_examples = 0
      self._num_bytes = 0
      self.current_examples: List[Tuple[Dict[str, Any], str]] = []
      self.current_rows: List[pa.Table] = []
      self.pa_writer: Optional[pa.RecordBatchStreamWriter] = None
      self.hkey_record = []
  
imports: import errno
  import json
  import os
  import sys
  from pathlib import Path
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import fsspec
  import numpy
  import pyarrow
  import pyarrow.parquet
  from .None import config
  from .features import Features, Image, Value
  from .features.features import FeatureType, _ArrayXDExtensionType, cast_to_python_objects, generate_from_arrow_type, get_nested_type, list_of_np_array_to_pyarrow_listarray, numpy_to_pyarrow_listarray, to_pyarrow_listarray
  from .filesystems import is_remote_filesystem
  from .info import DatasetInfo
  from .keyhash import DuplicatedKeysError, KeyHasher
  from .table import array_cast, array_concat, cast_array_to_feature, embed_table_storage, table_cast
  from .utils import logging
  from .utils import tqdm
  from .utils.file_utils import hash_url_to_filename
  from .utils.py_utils import asdict, first_non_null_value
label_desc: Use image node_id 1 to create a new ArrowWriter object  with example: obj = ArrowWriter(schema, features, path, stream, fingerprint, writer_batch_size, hash_salt, check_duplicates, disable_nullable, update_features, with_metadata, unit, embed_local_files, storage_options)