File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
crates/pyrefly_python/src Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,10 @@ impl ModulePath {
225225 self . style ( ) == ModuleStyle :: Interface
226226 }
227227
228+ pub fn is_notebook ( & self ) -> bool {
229+ self . as_path ( ) . extension ( ) == Some ( "ipynb" . as_ref ( ) )
230+ }
231+
228232 /// Attempt to match the given [`ModuleName`]'s components to this `ModulePath`,
229233 /// returning the directory that is the import root for the `ModuleName`, if
230234 /// *all* module components could be matched to directories. `ModulePath`s
Original file line number Diff line number Diff line change @@ -723,7 +723,7 @@ impl<'a> BindingsBuilder<'a> {
723723 }
724724 Expr :: Await ( x) => {
725725 self . ensure_expr ( & mut x. value , usage) ;
726- if !self . scopes . is_in_async_def ( ) {
726+ if !self . scopes . is_in_async_def ( ) && ! self . module_info . path ( ) . is_notebook ( ) {
727727 self . error (
728728 x. range ( ) ,
729729 ErrorInfo :: Kind ( ErrorKind :: InvalidSyntax ) ,
You can’t perform that action at this time.
0 commit comments