class_docstr: A configurational facade made available in an ``env.py`` script.
  
  The :class:`.EnvironmentContext` acts as a *facade* to the more
  nuts-and-bolts objects of :class:`.MigrationContext` as well as certain
  aspects of :class:`.Config`,
  within the context of the ``env.py`` script that is invoked by
  most Alembic commands.
  
  :class:`.EnvironmentContext` is normally instantiated
  when a command in :mod:`alembic.command` is run.  It then makes
  itself available in the ``alembic.context`` module for the scope
  of the command.   From within an ``env.py`` script, the current
  :class:`.EnvironmentContext` is available by importing this module.
  
  :class:`.EnvironmentContext` also supports programmatic usage.
  At this level, it acts as a Python context manager, that is, is
  intended to be used using the
  ``with:`` statement.  A typical use of :class:`.EnvironmentContext`::
  
      from alembic.config import Config
      from alembic.script import ScriptDirectory
  
      config = Config()
      config.set_main_option("script_location", "myapp:migrations")
      script = ScriptDirectory.from_config(config)
  
  
      def my_function(rev, context):
          '''do something with revision "rev", which
          will be the current database revision,
          and "context", which is the MigrationContext
          that the env.py will create'''
  
  
      with EnvironmentContext(
          config,
          script,
          fn=my_function,
          as_sql=False,
          starting_rev="base",
          destination_rev="head",
          tag="sometag",
      ):
          script.run_env()
  
  The above script will invoke the ``env.py`` script
  within the migration environment.  If and when ``env.py``
  calls :meth:`.MigrationContext.run_migrations`, the
  ``my_function()`` function above will be called
  by the :class:`.MigrationContext`, given the context
  itself as well as the current revision in the database.
  
  .. note::
  
      For most API usages other than full blown
      invocation of migration scripts, the :class:`.MigrationContext`
      and :class:`.ScriptDirectory` objects can be created and
      used directly.  The :class:`.EnvironmentContext` object
      is *only* needed when you need to actually invoke the
      ``env.py`` module present in the migration environment.
class_docstr_tok: ["A","configurational","facade","made","available","in","an","``","env.py","``","script",".","The",":","class",":","`",".EnvironmentContext","`","acts","as","a","*","facade","*","to","the","more","nuts-and-bolts","objects","of",":","class",":","`",".MigrationContext","`","as","well","as","certain","aspects","of",":","class",":","`",".Config","`",",","within","the","context","of","the","``","env.py","``","script","that","is","invoked","by","most","Alembic","commands",".",":","class",":","`",".EnvironmentContext","`","is","normally","instantiated","when","a","command","in",":","mod",":","`","alembic.command","`","is","run",".","It","then","makes","itself","available","in","the","``","alembic.context","``","module","for","the","scope","of","the","command",".","From","within","an","``","env.py","``","script",",","the","current",":","class",":","`",".EnvironmentContext","`","is","available","by","importing","this","module",".",":","class",":","`",".EnvironmentContext","`","also","supports","programmatic","usage",".","At","this","level",",","it","acts","as","a","Python","context","manager",",","that","is",",","is","intended","to","be","used","using","the","``","with",":","``","statement",".","A","typical","use","of",":","class",":","`",".EnvironmentContext","`",":",":","from","alembic.config","import","Config","from","alembic.script","import","ScriptDirectory","config","=","Config","(",")","config.set_main_option","(","``","script_location","''",",","``","myapp",":","migrations","''",")","script","=","ScriptDirectory.from_config","(","config",")","def","my_function","(","rev",",","context",")",":","``","'do","something","with","revision","``","rev","''",",","which","will","be","the","current","database","revision",",","and","``","context","''",",","which","is","the","MigrationContext","that","the","env.py","will","create","''","'","with","EnvironmentContext","(","config",",","script",",","fn=my_function",",","as_sql=False",",","starting_rev=","''","base","''",",","destination_rev=","''","head","''",",","tag=","''","sometag","''",",",")",":","script.run_env","(",")","The","above","script","will","invoke","the","``","env.py","``","script","within","the","migration","environment",".","If","and","when","``","env.py","``","calls",":","meth",":","`",".MigrationContext.run_migrations","`",",","the","``","my_function","(",")","``","function","above","will","be","called","by","the",":","class",":","`",".MigrationContext","`",",","given","the","context","itself","as","well","as","the","current","revision","in","the","database",".","..","note",":",":","For","most","API","usages","other","than","full","blown","invocation","of","migration","scripts",",","the",":","class",":","`",".MigrationContext","`","and",":","class",":","`",".ScriptDirectory","`","objects","can","be","created","and","used","directly",".","The",":","class",":","`",".EnvironmentContext","`","object","is","*","only","*","needed","when","you","need","to","actually","invoke","the","``","env.py","``","module","present","in","the","migration","environment","."]
docstr: Get the 'destination' revision argument.
  
  This is typically the argument passed to the
  ``upgrade`` or ``downgrade`` command.
  
  If it was specified as ``head``, the actual
  version number is returned; if specified
  as ``base``, ``None`` is returned.
  
  This function does not require that the :class:`.MigrationContext`
  has been configured.
docstr_tok: ["Get","the","'destination","'","revision","argument",".","This","is","typically","the","argument","passed","to","the","``","upgrade","``","or","``","downgrade","``","command",".","If","it","was","specified","as","``","head","``",",","the","actual","version","number","is","returned",";","if","specified","as","``","base","``",",","``","None","``","is","returned",".","This","function","does","not","require","that","the",":","class",":","`",".MigrationContext","`","has","been","configured","."]
code: def get_revision_argument(self) -> _RevNumber:
      """Get the 'destination' revision argument.
  
      This is typically the argument passed to the
      ``upgrade`` or ``downgrade`` command.
  
      If it was specified as ``head``, the actual
      version number is returned; if specified
      as ``base``, ``None`` is returned.
  
      This function does not require that the :class:`.MigrationContext`
      has been configured.
  
      """
      return self.script.as_revision_number(
          self.context_opts["destination_rev"]
      )
  
imports: from __future__ import annotations
  from typing import Any
  from typing import Callable
  from typing import Collection
  from typing import ContextManager
  from typing import Dict
  from typing import List
  from typing import Mapping
  from typing import MutableMapping
  from typing import Optional
  from typing import overload
  from typing import Sequence
  from typing import TextIO
  from typing import Tuple
  from typing import TYPE_CHECKING
  from typing import Union
  from sqlalchemy.sql.schema import Column
  from sqlalchemy.sql.schema import FetchedValue
  from typing_extensions import Literal
  from .migration import _ProxyTransaction
  from .migration import MigrationContext
  from ..None import util
  from ..operations import Operations
  from ..script.revision import _GetRevArg
label_desc: Use image node_id 10 for calling the EnvironmentContext obj's underlying member method code with example usage: obj.get_revision_argument() and returns: self