class_docstr: TaskDataStore is obtained through FlowDataStore.get_datastore_for_task and
  is used to store three things:
      - Task artifacts (using save_artifacts and load_artifacts) which will
        ultimately be stored using ContentAddressedStore's save_blobs and
        load_blobs. This is basically the content indexed portion of the
        storage (identical objects are stored only once).
      - Metadata information (using save_metadata and load_metadata) which
        stores JSON encoded metadata about a task in a non-content indexed
        way in a hierarchical manner (ie: the files are stored
        in a path indicated by the pathspec (run_id/step_name/task_id)).
        This portion of the store can be viewed as name indexed (storing
        two metadata items with the same name will overwrite the previous item
        so the condition of equality is the name as
        opposed to the content).
      - Logs which are a special sort of task metadata but are handled
        differently (they are not JSON-encodable dictionaries).
class_docstr_tok: ["TaskDataStore","is","obtained","through","FlowDataStore.get_datastore_for_task","and","is","used","to","store","three","things",":","-","Task","artifacts","(","using","save_artifacts","and","load_artifacts",")","which","will","ultimately","be","stored","using","ContentAddressedStore","'s","save_blobs","and","load_blobs",".","This","is","basically","the","content","indexed","portion","of","the","storage","(","identical","objects","are","stored","only","once",")",".","-","Metadata","information","(","using","save_metadata","and","load_metadata",")","which","stores","JSON","encoded","metadata","about","a","task","in","a","non-content","indexed","way","in","a","hierarchical","manner","(","ie",":","the","files","are","stored","in","a","path","indicated","by","the","pathspec","(","run_id\/step_name\/task_id",")",")",".","This","portion","of","the","store","can","be","viewed","as","name","indexed","(","storing","two","metadata","items","with","the","same","name","will","overwrite","the","previous","item","so","the","condition","of","equality","is","the","name","as","opposed","to","the","content",")",".","-","Logs","which","are","a","special","sort","of","task","metadata","but","are","handled","differently","(","they","are","not","JSON-encodable","dictionaries",")","."]
docstr: Saves files in the directory for this TaskDataStore. This can be
  metadata, a log file or any other data that doesn't need to (or
  shouldn't) be stored in the Content Addressed Store.
  
  Parameters
  ----------
  contents : Dict[string -> stringish or RawIOBase or BufferedIOBase]
      Dictionary of file to store
  allow_overwrite : boolean, optional
      If True, allows the overwriting of the metadata, defaults to True
  add_attempt : boolean, optional
      If True, adds the attempt identifier to the metadata,
      defaults to True
docstr_tok: ["Saves","files","in","the","directory","for","this","TaskDataStore",".","This","can","be","metadata",",","a","log","file","or","any","other","data","that","does","n't","need","to","(","or","should","n't",")","be","stored","in","the","Content","Addressed","Store",".","Parameters","--","--","--","--","--","contents",":","Dict","[","string","-",">","stringish","or","RawIOBase","or","BufferedIOBase","]","Dictionary","of","file","to","store","allow_overwrite",":","boolean",",","optional","If","True",",","allows","the","overwriting","of","the","metadata",",","defaults","to","True","add_attempt",":","boolean",",","optional","If","True",",","adds","the","attempt","identifier","to","the","metadata",",","defaults","to","True"]
code: def _save_file(
      self, contents, allow_overwrite=True, add_attempt=True
  ):
      """
      Saves files in the directory for this TaskDataStore. This can be
      metadata, a log file or any other data that doesn't need to (or
      shouldn't) be stored in the Content Addressed Store.
  
      Parameters
      ----------
      contents : Dict[string -> stringish or RawIOBase or BufferedIOBase]
          Dictionary of file to store
      allow_overwrite : boolean, optional
          If True, allows the overwriting of the metadata, defaults to True
      add_attempt : boolean, optional
          If True, adds the attempt identifier to the metadata,
          defaults to True
      """
  
      def blob_iter():
          for name, value in contents.items():
              if add_attempt:
                  path = self._storage_impl.path_join(
                      self._path, self._metadata_name_for_attempt(name)
                  )
              else:
                  path = self._storage_impl.path_join(self._path, name)
              if (
                  isinstance(value, (RawIOBase, BufferedIOBase))
                  and value.readable()
              ):
                  yield path, value
              elif is_stringish(value):
                  yield path, to_fileobj(value)
              else:
                  raise DataException(
                      "Metadata '%s' for task '%s' has an invalid type: %s"
                      % (name, self._path, type(value))
                  )
  
      self._storage_impl.save_bytes(
          blob_iter(), overwrite=allow_overwrite
      )
  
imports: from collections import defaultdict
  import json
  import pickle
  import sys
  import time
  from functools import wraps
  from io import BufferedIOBase, FileIO, RawIOBase
  from types import MethodType, FunctionType
  from ..None import metaflow_config
  from ..exception import MetaflowInternalError
  from ..metadata import DataArtifact, MetaDatum
  from ..parameters import Parameter
  from ..util import Path, is_stringish, to_fileobj
  from .exceptions import DataException, UnpicklableArtifactException
label_desc: Use image node_id 42 for calling the TaskDataStore obj's underlying member method code with example usage: obj._save_file(contents, allow_overwrite, add_attempt) without return types