Skip to content

Commit

Permalink
lambda: Fix bug for using lambdas in jupyter notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-nambiar committed Sep 17, 2024
1 parent 1d8778d commit 92ad425
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions fennel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [1.5.23] - 2024-09-17
- Fix bug for using lambdas in jupyter notebooks

## [1.5.22] - 2024-09-12
- Add casting to pyarrow for using expression in assign.

Expand Down
17 changes: 12 additions & 5 deletions fennel/internal_lib/to_proto/source_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,18 @@ def check_ambiguous_lambda(
"""
# Get the next line and append to lambda text
next_line = ""
with open(lambda_func.__code__.co_filename, "r") as f:
lines = f.readlines()
if line_num < len(lines):
next_line = lines[line_num].strip()

try:
with open(lambda_func.__code__.co_filename, "r") as f:
lines = f.readlines()
if line_num < len(lines):
next_line = lines[line_num].strip()
except Exception:
src_code = fennel_get_source(lambda_func)
num_lines = src_code.count("\n")
if num_lines <= 1:
return
next_line = src_code.split("\n")[1]

# No Next line found
if next_line == "":
return
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fennel-ai"
version = "1.5.22"
version = "1.5.23"
description = "The modern realtime feature engineering platform"
authors = ["Fennel AI <developers@fennel.ai>"]
packages = [{ include = "fennel" }]
Expand Down

0 comments on commit 92ad425

Please sign in to comment.