class_docstr: Abstract base class defining methods for KernelProvisioner classes.
  
  A majority of methods are abstract (requiring implementations via a subclass) while
  some are optional and others provide implementations common to all instances.
  Subclasses should be aware of which methods require a call to the superclass.
  
  Many of these methods model those of :class:`subprocess.Popen` for parity with
  previous versions where the kernel process was managed directly.
class_docstr_tok: ["Abstract","base","class","defining","methods","for","KernelProvisioner","classes",".","A","majority","of","methods","are","abstract","(","requiring","implementations","via","a","subclass",")","while","some","are","optional","and","others","provide","implementations","common","to","all","instances",".","Subclasses","should","be","aware","of","which","methods","require","a","call","to","the","superclass",".","Many","of","these","methods","model","those","of",":","class",":","`","subprocess.Popen","`","for","parity","with","previous","versions","where","the","kernel","process","was","managed","directly","."]
docstr: Walks entries in the kernelspec's env stanza and applies substitutions from current env.
  
  This method is called from `KernelProvisionerBase.pre_launch()` during the kernel's
  start sequence.
  
  Returns the substituted list of env entries.
  
  NOTE: This method is private and is not intended to be overridden by provisioners.
docstr_tok: ["Walks","entries","in","the","kernelspec","'s","env","stanza","and","applies","substitutions","from","current","env",".","This","method","is","called","from","`","KernelProvisionerBase.pre_launch","(",")","`","during","the","kernel's","start","sequence",".","Returns","the","substituted","list","of","env","entries",".","NOTE",":","This","method","is","private","and","is","not","intended","to","be","overridden","by","provisioners","."]
code: def __apply_env_substitutions(
      self, substitution_values: Dict[str, str]
  ) -> Dict[str, str]:
      """
      Walks entries in the kernelspec's env stanza and applies substitutions from current env.
  
      This method is called from `KernelProvisionerBase.pre_launch()` during the kernel's
      start sequence.
  
      Returns the substituted list of env entries.
  
      NOTE: This method is private and is not intended to be overridden by provisioners.
      """
      substituted_env = {}
      if self.kernel_spec:
          from string import Template
  
          # For each templated env entry, fill any templated references
          # matching names of env variables with those values and build
          # new dict with substitutions.
          templated_env = self.kernel_spec.env
          for k, v in templated_env.items():
              substituted_env.update(
                  {k: Template(v).safe_substitute(substitution_values)}
              )
      return substituted_env
  
file_path: jupyter_client/jupyter_client/provisioning/provisioner_base.py
imports: import os
  from abc import ABC, ABCMeta, abstractmethod
  from typing import Any, Dict, List, Optional, Union
  from traitlets.config import Instance, LoggingConfigurable, Unicode
  from ..connect import KernelConnectionInfo
label_desc: Use image node_id 5 for calling the KernelProvisionerBase obj's underlying member method code with example usage: obj.__apply_env_substitutions(substitution_values) and returns: substituted_env