class_docstr: Object representing a single Python job to execute.
  
  Examples
  --------
  
  Create a new Python job that multiplies two numbers and then adds 5 to the result:
  
  .. code-block:: python
  
      # Create a batch object with a default Python image
  
      b = Batch(default_python_image='hailgenetics/python-dill:3.9-slim')
  
      def multiply(x, y):
          return x * y
  
      def add(x, y):
          return x + y
  
      j = b.new_python_job()
      result = j.call(multiply, 2, 3)
      result = j.call(add, result, 5)
  
      # Write out the str representation of result to a file
  
      b.write_output(result.as_str(), 'hello.txt')
  
      b.run()
  
  Notes
  -----
  This class should never be created directly by the user. Use :meth:`.Batch.new_python_job`
  instead.
class_docstr_tok: ["Object","representing","a","single","Python","job","to","execute",".","Examples","--","--","--","--","Create","a","new","Python","job","that","multiplies","two","numbers","and","then","adds","5","to","the","result",":","..","code-block",":",":","python","#","Create","a","batch","object","with","a","default","Python","image","b","=","Batch","(","default_python_image='hailgenetics\/python-dill:3.9-slim","'",")","def","multiply","(","x",",","y",")",":","return","x","*","y","def","add","(","x",",","y",")",":","return","x","+","y","j","=","b.new_python_job","(",")","result","=","j.call","(","multiply",",","2",",","3",")","result","=","j.call","(","add",",","result",",","5",")","#","Write","out","the","str","representation","of","result","to","a","file","b.write_output","(","result.as_str","(",")",",","'hello.txt","'",")","b.run","(",")","Notes","--","--","-","This","class","should","never","be","created","directly","by","the","user",".","Use",":","meth",":","`",".Batch.new_python_job","`","instead","."]
code: def __init__(
      self,
      batch: "batch.Batch",
      token: str,
      *,
      name: Optional[str] = None,
      attributes: Optional[Dict[str, str]] = None,
  ):
      super().__init__(
          batch, token, name=name, attributes=attributes, shell=None
      )
      self._resources: Dict[str, _resource.Resource] = {}
      self._resources_inverse: Dict[_resource.Resource, str] = {}
      self._function_calls: List[
          Tuple[
              _resource.PythonResult,
              int,
              Tuple[UnpreparedArg, ...],
              Dict[str, UnpreparedArg],
          ]
      ] = []
      self.n_results = 0
  
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 1 to create a new PythonJob object from inherited base classes: Job with example: obj = PythonJob(batch, token)