-
Notifications
You must be signed in to change notification settings - Fork 71
Fix DeclarativeExecutor passing down empty configs #869
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,6 +169,7 @@ def get_connector_executor( # noqa: PLR0912, PLR0913, PLR0914, PLR0915, C901 # | |
| install_root: Path | None = None, | ||
| use_python: bool | Path | str | None = None, | ||
| no_executor: bool = False, | ||
| config: dict[str, Any] = {} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace mutable default argument with Using a mutable default argument ( - config: dict[str, Any] = {}
+ config: dict[str, Any] | None = None,Then at the beginning of the function body (after the docstring), add: if config is None:
config = {}🤖 Prompt for AI Agents |
||
| ) -> Executor: | ||
| """This factory function creates an executor for a connector. | ||
|
|
||
|
|
@@ -334,6 +335,7 @@ def get_connector_executor( # noqa: PLR0912, PLR0913, PLR0914, PLR0915, C901 # | |
| return DeclarativeExecutor( | ||
| name=name, | ||
| manifest=source_manifest, | ||
| config=config, | ||
| components_py=components_py_path, | ||
| ) | ||
|
|
||
|
|
@@ -349,6 +351,7 @@ def get_connector_executor( # noqa: PLR0912, PLR0913, PLR0914, PLR0915, C901 # | |
| return DeclarativeExecutor( | ||
| name=name, | ||
| manifest=manifest_dict, | ||
| config=config, | ||
| components_py=components_py, | ||
| components_py_checksum=components_py_checksum, | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Replace mutable default argument with
None.The linter is correctly flagging B006 here. Using
{}as a default is particularly problematic in this case becauseconfig_dictis mutated on lines 78-81 whencomponents_pyis provided. This means the default dict would accumulate injected components across multiple calls, causing unpredictable behavior. Wdyt about switching toNone?Then update line 70:
Or alternatively at line 70:
(Using
.copy()would be safer to avoid mutating the caller's dict, though it depends on whether mutation is intended.)🧰 Tools
🪛 GitHub Actions: Run Linters
[error] 48-48: B006 Do not use mutable data structures for argument defaults. Replace with None; initialize within function.
🤖 Prompt for AI Agents