docstr: Open a file named `filename` in a temporary directory.
  
  This context manager is preferred over `NamedTemporaryFile` in
  stdlib `tempfile` when one needs to reopen the file.
  
  Arguments `mode` and `bufsize` are passed to `open`.
  Rest of the arguments are passed to `TemporaryDirectory`.
docstr_tok: ["Open","a","file","named","`","filename","`","in","a","temporary","directory",".","This","context","manager","is","preferred","over","`","NamedTemporaryFile","`","in","stdlib","`","tempfile","`","when","one","needs","to","reopen","the","file",".","Arguments","`","mode","`","and","`","bufsize","`","are","passed","to","`","open","`",".","Rest","of","the","arguments","are","passed","to","`","TemporaryDirectory","`","."]
code: def __init__(self, filename, mode="w+b", bufsize=-1, **kwds):
      """
      Open a file named `filename` in a temporary directory.
  
      This context manager is preferred over `NamedTemporaryFile` in
      stdlib `tempfile` when one needs to reopen the file.
  
      Arguments `mode` and `bufsize` are passed to `open`.
      Rest of the arguments are passed to `TemporaryDirectory`.
  
      """
      self._tmpdir = TemporaryDirectory(**kwds)
      path = _os.path.join(self._tmpdir.name, filename)
      self.file = open(path, mode, bufsize)
  
file_path: catboost/contrib/python/ipython-genutils/py3/ipython_genutils/tempdir.py
imports: from __future__ import print_function
  import os
  import warnings
  import sys
label_desc: Use image node_id 1 to create a new NamedFileInTemporaryDirectory object from inherited base classes: object with example: obj = NamedFileInTemporaryDirectory(filename, mode, bufsize)