class_docstr: Maintains configuration and state that's specific to an
  autogenerate operation.
code: def __init__(
      self,
      migration_context: MigrationContext,
      metadata: Optional[MetaData] = None,
      opts: Optional[Dict[str, Any]] = None,
      autogenerate: bool = True,
  ) -> None:
      if (
          autogenerate
          and migration_context is not None
          and migration_context.as_sql
      ):
          raise util.CommandError(
              "autogenerate can't use as_sql=True as it prevents querying "
              "the database for schema information"
          )
  
      if opts is None:
          opts = migration_context.opts
  
      self.metadata = metadata = (
          opts.get("target_metadata", None)
          if metadata is None
          else metadata
      )
  
      if (
          autogenerate
          and metadata is None
          and migration_context is not None
          and migration_context.script is not None
      ):
          raise util.CommandError(
              "Can't proceed with --autogenerate option; environment "
              "script %s does not provide "
              "a MetaData object or sequence of objects to the context."
              % (migration_context.script.env_py_location)
          )
  
      include_object = opts.get("include_object", None)
      include_name = opts.get("include_name", None)
  
      object_filters = []
      name_filters = []
      if include_object:
          object_filters.append(include_object)
      if include_name:
          name_filters.append(include_name)
  
      self._object_filters = object_filters
      self._name_filters = name_filters
  
      self.migration_context = migration_context
      if self.migration_context is not None:
          self.connection = self.migration_context.bind
          self.dialect = self.migration_context.dialect
  
      self.imports = set()
      self.opts: Dict[str, Any] = opts
      self._has_batch: bool = False
  
imports: from __future__ import annotations
  import contextlib
  from typing import Any
  from typing import Dict
  from typing import Iterator
  from typing import List
  from typing import Optional
  from typing import Sequence
  from typing import Set
  from typing import TYPE_CHECKING
  from typing import Union
  from sqlalchemy import inspect
  from .None import compare
  from .None import render
  from ..None import util
  from ..operations import ops
  from ..util import sqla_compat
label_desc: Use image node_id 1 to create a new AutogenContext object  with example: obj = AutogenContext(migration_context, metadata, opts, autogenerate)