File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ def is_regex_projection(self) -> bool:
6262        raise  NotImplementedError 
6363
6464
65- def  profile_polars_expr (expr : pl .Expr ) ->  dict [str , Any ]:
65+ def  polars_expr_metadata (expr : pl .Expr ) ->  dict [str , Any ]:
6666    """Gather all metadata for a native `Expr`. 
6767
6868    Eventual goal would be that a `nw.Expr` matches a `pl.Expr` in as much of this as possible. 
@@ -83,3 +83,15 @@ def profile_polars_expr(expr: pl.Expr) -> dict[str, Any]:
8383        "undo_aliases" : expr .meta .undo_aliases (),
8484        "expr" : expr ,
8585    }
86+ 
87+ 
88+ def  polars_expr_to_dict (expr : pl .Expr ) ->  dict [str , Any ]:
89+     """Serialize a native `Expr`, roundtrip back to `dict`. 
90+ 
91+     Using to inspect [`FunctionOptions`] and ensure we combine them in a similar way. 
92+ 
93+     [`FunctionOptions`]: https://github.com/narwhals-dev/narwhals/pull/2572#issuecomment-2891577685 
94+     """ 
95+     import  json 
96+ 
97+     return  json .loads (expr .meta .serialize (format = "json" ))  # type: ignore[no-any-return] 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments