77
88# this is the Alembic Config object, which provides
99# access to the values within the .ini file in use.
10- config = context .config
10+ config : context . Config = context .config
1111
1212# Interpret the config file for Python logging.
1313# This line sets up loggers basically.
1414fileConfig (config .config_file_name )
15- logger = logging .getLogger ("alembic.env" )
15+ logger : logging . Logger = logging .getLogger ("alembic.env" )
1616
1717
1818def get_engine ():
@@ -24,7 +24,7 @@ def get_engine():
2424 return current_app .extensions ["migrate" ].db .engine
2525
2626
27- def get_engine_url ():
27+ def get_engine_url () -> logging . Any | str :
2828 try :
2929 return get_engine ().url .render_as_string (hide_password = False ).replace ("%" , "%%" )
3030 except AttributeError :
@@ -44,13 +44,13 @@ def get_engine_url():
4444# ... etc.
4545
4646
47- def get_metadata ():
47+ def get_metadata () -> target_db :
4848 if hasattr (target_db , "metadatas" ):
4949 return target_db .metadatas [None ]
5050 return target_db .metadata
5151
5252
53- def run_migrations_offline ():
53+ def run_migrations_offline () -> None :
5454 """Run migrations in 'offline' mode.
5555
5656 This configures the context with just a URL
@@ -70,7 +70,7 @@ def run_migrations_offline():
7070 context .run_migrations ()
7171
7272
73- def run_migrations_online ():
73+ def run_migrations_online () -> None :
7474 """Run migrations in 'online' mode.
7575
7676 In this scenario we need to create an Engine
@@ -81,7 +81,7 @@ def run_migrations_online():
8181 # this callback is used to prevent an auto-migration from being generated
8282 # when there are no changes to the schema
8383 # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
84- def process_revision_directives (context , revision , directives ):
84+ def process_revision_directives (context , revision , directives ) -> None :
8585 if getattr (config .cmd_opts , "autogenerate" , False ):
8686 script = directives [0 ]
8787 if script .upgrade_ops .is_empty ():
0 commit comments