1- from typing import Optional , cast
1+ from typing import cast
22
33from sqlalchemy .engine import Engine
44
@@ -14,11 +14,11 @@ class TablesInspector(BaseInspector, DiffMixin):
1414 key = "tables"
1515 db_level = True
1616
17- def inspect (self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None ) -> dict :
17+ def inspect (self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None ) -> dict :
1818 ignore_clauses = self ._filter_ignorers (ignore_specs )
1919 inspector = self ._get_inspector (engine )
2020
21- def get_comment (table_name : str ) -> Optional [ str ] :
21+ def get_comment (table_name : str ) -> str | None :
2222 try :
2323 return inspector .get_table_comment (table_name )["text" ]
2424 except NotImplementedError :
@@ -30,7 +30,7 @@ def get_comment(table_name: str) -> Optional[str]:
3030 if table_name not in ignore_clauses .tables
3131 }
3232
33- def _format_table (self , table_name : str , comment : Optional [ str ] = None ) -> dict :
33+ def _format_table (self , table_name : str , comment : str | None = None ) -> dict :
3434 return {
3535 "name" : table_name ,
3636 "comment" : comment or "" ,
@@ -48,7 +48,7 @@ class ColumnsInspector(BaseInspector, DiffMixin):
4848
4949 key = "columns"
5050
51- def inspect (self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None ) -> dict :
51+ def inspect (self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None ) -> dict :
5252 ignore_clauses = self ._filter_ignorers (ignore_specs )
5353
5454 inspector = self ._get_inspector (engine )
@@ -90,7 +90,7 @@ class PrimaryKeysInspector(BaseInspector, DiffMixin):
9090
9191 key = "primary_keys"
9292
93- def inspect (self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None ) -> dict :
93+ def inspect (self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None ) -> dict :
9494 ignore_clauses = self ._filter_ignorers (ignore_specs )
9595
9696 inspector = self ._get_inspector (engine )
@@ -121,7 +121,7 @@ class ForeignKeysInspector(BaseInspector, DiffMixin):
121121
122122 key = "foreign_keys"
123123
124- def inspect (self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None ) -> dict :
124+ def inspect (self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None ) -> dict :
125125 ignore_clauses = self ._filter_ignorers (ignore_specs )
126126
127127 inspector = self ._get_inspector (engine )
@@ -155,7 +155,7 @@ class IndexesInspector(BaseInspector, DiffMixin):
155155
156156 key = "indexes"
157157
158- def inspect (self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None ) -> dict :
158+ def inspect (self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None ) -> dict :
159159 ignore_clauses = self ._filter_ignorers (ignore_specs )
160160 inspector = self ._get_inspector (engine )
161161 table_names = inspector .get_table_names ()
@@ -183,7 +183,7 @@ class UniqueConstraintsInspector(BaseInspector, DiffMixin):
183183
184184 key = "unique_constraints"
185185
186- def inspect (self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None ) -> dict :
186+ def inspect (self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None ) -> dict :
187187 ignore_clauses = self ._filter_ignorers (ignore_specs )
188188 inspector = self ._get_inspector (engine )
189189 table_names = inspector .get_table_names ()
@@ -220,7 +220,7 @@ class CheckConstraintsInspector(BaseInspector, DiffMixin):
220220
221221 key = "check_constraints"
222222
223- def inspect (self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None ) -> dict :
223+ def inspect (self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None ) -> dict :
224224 ignore_clauses = self ._filter_ignorers (ignore_specs )
225225 inspector = self ._get_inspector (engine )
226226 table_names = inspector .get_table_names ()
@@ -250,7 +250,7 @@ class EnumsInspector(BaseInspector, DiffMixin):
250250 db_level = True
251251
252252 def inspect (
253- self , engine : Engine , ignore_specs : Optional [ list [IgnoreSpecType ]] = None
253+ self , engine : Engine , ignore_specs : list [IgnoreSpecType ] | None = None
254254 ) -> list [dict ]:
255255 inspector = self ._get_inspector (engine )
256256
0 commit comments