class_docstr: Object representing a single job to execute.
  
  Notes
  -----
  This class should never be created directly by the user. Use :meth:`.Batch.new_job`,
  :meth:`.Batch.new_bash_job`, or :meth:`.Batch.new_python_job` instead.
class_docstr_tok: ["Object","representing","a","single","job","to","execute",".","Notes","--","--","-","This","class","should","never","be","created","directly","by","the","user",".","Use",":","meth",":","`",".Batch.new_job","`",",",":","meth",":","`",".Batch.new_bash_job","`",",","or",":","meth",":","`",".Batch.new_python_job","`","instead","."]
code: def _interpolate_command(self, command, allow_python_results=False):
      def handler(match_obj):
          groups = match_obj.groupdict()
  
          if groups["JOB"]:
              raise BatchException(
                  f"found a reference to a Job object in command '{command}'."
              )
          if groups["BATCH"]:
              raise BatchException(
                  f"found a reference to a Batch object in command '{command}'."
              )
          if groups["PYTHON_RESULT"] and not allow_python_results:
              raise BatchException(
                  f"found a reference to a PythonResult object. hint: Use one of the methods `as_str`, `as_json` or `as_repr` on a PythonResult. command: '{command}'"
              )
  
          assert (
              groups["RESOURCE_FILE"]
              or groups["RESOURCE_GROUP"]
              or groups["PYTHON_RESULT"]
          )
          r_uid = match_obj.group()
          r = self._batch._resource_map.get(r_uid)
  
          if r is None:
              raise BatchException(
                  f"undefined resource '{r_uid}' in command '{command}'.\n"
                  f"Hint: resources must be from the same batch as the current job."
              )
  
          source = r.source()
          if source != self:
              self._add_inputs(r)
              if source is not None:
                  if r not in source._valid:
                      name = source._resources_inverse[r]
                      raise BatchException(
                          f"undefined resource '{name}'\n"
                          f"Hint: resources must be defined within "
                          f"the job methods 'command' or 'declare_resource_group'"
                      )
  
                  if self._always_run:
                      warnings.warn(
                          "A job marked as always run has a resource file dependency on another job. If the dependent job fails, "
                          f"the always run job with the following command may not succeed:\n{command}"
                      )
  
                  self._dependencies.add(source)
                  source._add_internal_outputs(r)
          else:
              _add_resource_to_set(self._valid, r)
  
          self._mentioned.add(r)
          return "${BATCH_TMPDIR}" + shq(r._get_path(""))
  
      regexes = [
          _resource.ResourceFile._regex_pattern,
          _resource.ResourceGroup._regex_pattern,
          _resource.PythonResult._regex_pattern,
          Job._regex_pattern,
          batch.Batch._regex_pattern,
      ]
  
      subst_command = re.sub(
          "(" + ")|(".join(regexes) + ")", handler, command
      )
  
      return subst_command
  
imports: import asyncio
  import inspect
  import os
  import re
  import textwrap
  import warnings
  from shlex import quote
  from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union, cast, Literal
  from typing_extensions import Self
  import hailtop.batch_client.client
  from .None import backend, batch
  from .None import resource
  from .exceptions import BatchException
label_desc: Use image node_id 20 for calling the Job obj's underlying member method code with example usage: obj._interpolate_command(command, allow_python_results) and returns: subst_command, unknown