class_docstr: A dataset containing two subsets, one to be used for training purposes, and
  the other for testing purposes, as well as metadata.
class_docstr_tok: ["A","dataset","containing","two","subsets",",","one","to","be","used","for","training","purposes",",","and","the","other","for","testing","purposes",",","as","well","as","metadata","."]
docstr: Saves an TrainDatasets object to a JSON Lines file.
  
  Parameters
  ----------
  path_str
      Where to save the dataset.
  overwrite
      Whether to delete previous version in this folder.
code: def save(
      self,
      path_str: str,
      writer: DatasetWriter,
      overwrite=False,
  ) -> None:
      """
      Saves an TrainDatasets object to a JSON Lines file.
  
      Parameters
      ----------
      path_str
          Where to save the dataset.
      overwrite
          Whether to delete previous version in this folder.
      """
      path = Path(path_str)
  
      if overwrite:
          shutil.rmtree(path, ignore_errors=True)
  
      path.mkdir(parents=True)
      with open(path / "metadata.json", "wb") as out_file:
          json.bdump(self.metadata.dict(), out_file, nl=True)
  
      train = path / "train"
      train.mkdir(parents=True)
      writer.write_to_folder(self.train, train)
  
      if self.test is not None:
          test = path / "test"
          test.mkdir(parents=True)
          writer.write_to_folder(self.test, test)
  
imports: import functools
  import logging
  import shutil
  from pathlib import Path
  from types import ModuleType
  from typing import Callable, List, NamedTuple, Optional, Union, cast
  import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from gluonts import json
  from gluonts.itertools import Cached, Map
  from gluonts.dataset.field_names import FieldName
  from gluonts.dataset.schema import Translator
  from gluonts.exceptions import GluonTSDataError
  from gluonts.pydantic import pydantic
  from .None import Dataset, DatasetCollection, DataEntry, DataBatch
  from .None import jsonl, DatasetWriter
label_desc: Use image node_id 1 for calling the TrainDatasets obj's underlying member method code with example usage: obj.save(path_str, writer, overwrite) without return types