@@ -45,7 +45,8 @@ pub(crate) enum ProviderReplacement {
4545
4646pub ( crate ) fn is_guarded_by_try_except (
4747 expr : & Expr ,
48- replacement : & Replacement ,
48+ module : & str ,
49+ name : & str ,
4950 semantic : & SemanticModel ,
5051) -> bool {
5152 match expr {
@@ -63,7 +64,7 @@ pub(crate) fn is_guarded_by_try_except(
6364 if !suspended_exceptions. contains ( Exceptions :: ATTRIBUTE_ERROR ) {
6465 return false ;
6566 }
66- try_block_contains_undeprecated_attribute ( try_node, replacement , semantic)
67+ try_block_contains_undeprecated_attribute ( try_node, module , name , semantic)
6768 }
6869 Expr :: Name ( ExprName { id, .. } ) => {
6970 let Some ( binding_id) = semantic. lookup_symbol ( id. as_str ( ) ) else {
@@ -89,7 +90,7 @@ pub(crate) fn is_guarded_by_try_except(
8990 {
9091 return false ;
9192 }
92- try_block_contains_undeprecated_import ( try_node, replacement )
93+ try_block_contains_undeprecated_import ( try_node, module , name )
9394 }
9495 _ => false ,
9596 }
@@ -100,12 +101,10 @@ pub(crate) fn is_guarded_by_try_except(
100101/// member is being accessed from the non-deprecated location?
101102fn try_block_contains_undeprecated_attribute (
102103 try_node : & StmtTry ,
103- replacement : & Replacement ,
104+ module : & str ,
105+ name : & str ,
104106 semantic : & SemanticModel ,
105107) -> bool {
106- let Replacement :: AutoImport { module, name } = replacement else {
107- return false ;
108- } ;
109108 let undeprecated_qualified_name = {
110109 let mut builder = QualifiedNameBuilder :: default ( ) ;
111110 for part in module. split ( '.' ) {
@@ -122,10 +121,7 @@ fn try_block_contains_undeprecated_attribute(
122121/// Given an [`ast::StmtTry`] node, does the `try` branch of that node
123122/// contain any [`ast::StmtImportFrom`] nodes that indicate the airflow
124123/// member is being imported from the non-deprecated location?
125- fn try_block_contains_undeprecated_import ( try_node : & StmtTry , replacement : & Replacement ) -> bool {
126- let Replacement :: AutoImport { module, name } = replacement else {
127- return false ;
128- } ;
124+ fn try_block_contains_undeprecated_import ( try_node : & StmtTry , module : & str , name : & str ) -> bool {
129125 let mut import_searcher = ImportSearcher :: new ( module, name) ;
130126 import_searcher. visit_body ( & try_node. body ) ;
131127 import_searcher. found_import
0 commit comments