Skip to content

improve override completion signature generation #7998

Description

@heejaechang

this is a follow up of #6036 fix

"""
Repro for https://github.com/microsoft/pylance-release/issues/6036

When auto-completing __init__ override of FileSensor, Pylance replaces
complex default values (like conf.getboolean(...)) with `...` (Ellipsis)
instead of preserving the original default expression.

Steps:
1. Open this file in VS Code with Pylance
2. Place cursor inside _FileSensor class
3. Start typing `def __init__` and accept the auto-completion
4. Observe that `deferrable` parameter's default value becomes `...`
   instead of `conf.getboolean("operators", "default_deferrable", fallback=False)`
"""

from airflow.providers.standard.sensors.filesystem import FileSensor

class _FileSensor(FileSensor):
    def __init__ <= here

it now generates default value in the signature, but it doesn't auto add imports for symbols used in the default value expressions.

ex) deferrable = conf.getboolean("operators", "default_deferrable", fallback=False)

it would be nice if it can add

from airflow.providers.common.compat.sdk import conf

one-way pylance can do it without costing (perf) it too much is checking where the default value is defined and check which imports the symbols in default value is bound to, and bring that to current file using same mechanism as add import so it can dedup with existing imports in current file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.repro workspaceIssue has a retained repro workspace

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions