Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(native): Jinja - pass kwargs correctly into Python #9276

Merged
merged 8 commits into from
Feb 26, 2025

Conversation

ovr
Copy link
Member

@ovr ovr commented Feb 26, 2025

In Python, *args and **kwargs are used to allow functions to accept an arbitrary number of arguments. kwarg is passed separately while you are calling a function. It's a separate structure.

@template.function
def arg_named_arguments(arg1, arg2):
    return "arg1: " + arg1 + ", arg2: " + arg2
arg_named_arguments1: {{ arg_named_arguments(arg2="2 arg", arg1="1 arg") }}
arg_named_arguments2: {{ arg_named_arguments(arg1="1 arg", arg2="2 arg") }}

Should output:

arg_named_arguments1: "arg1: 1 arg, arg2: 2 arg"
arg_named_arguments2: "arg1: 1 arg, arg2: 2 arg"

@ovr ovr requested a review from a team as a code owner February 26, 2025 11:08
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.65%. Comparing base (1dfa10d) to head (eb21c9c).
Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9276   +/-   ##
=======================================
  Coverage   83.65%   83.65%           
=======================================
  Files         227      227           
  Lines       81773    81773           
=======================================
  Hits        68409    68409           
  Misses      13364    13364           
Flag Coverage Δ
cubesql 83.65% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ovr ovr force-pushed the fix/native-jinja-kwarg-support branch 2 times, most recently from 7bf97ff to dc68a24 Compare February 26, 2025 14:37
chore: stable test
@ovr ovr force-pushed the fix/native-jinja-kwarg-support branch from dc68a24 to fe1c715 Compare February 26, 2025 14:45
@ovr ovr merged commit 9d1c3f8 into master Feb 26, 2025
70 checks passed
@ovr ovr deleted the fix/native-jinja-kwarg-support branch February 26, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants