class_docstr: Handles copying context variables to threads created by ThreadPoolExecutor
class_docstr_tok: ["Handles","copying","context","variables","to","threads","created","by","ThreadPoolExecutor"]
code: def __init__(self, max_workers=None):
      self.context = contextvars.copy_context()
      # ThreadPoolExecutor does not propagate context to threads by default, so we need a custom initializer.
      super().__init__(
          max_workers=max_workers, initializer=self._set_child_context
      )
  
imports: from concurrent.futures import ThreadPoolExecutor
  import contextvars
label_desc: Use image node_id 1 to create a new ContextThreadPoolExecutor object from inherited base classes: ThreadPoolExecutor with example: obj = ContextThreadPoolExecutor(max_workers)