refactor(rope): restructure import reuse through the public import_filter hook (flext-2lout)

Merged
MA
13h ago
+16-22

Summary

FlextInfraRopeRestructure overrode Rope's private Restructure._add_imports to drop the import declarations whose binding the changed module already defines (keeping a richer public facade instead of rebinding it). The pinned rope (dc-use, the same hook proposed upstream as python-rope/rope#918) calls a public import_filter(resource, imports) exactly before adding imports, so this passes _admit_imports as that hook and deletes the private override.

  • Same selection: with a mapping policy, keep only the declarations whose binding is not defined by the module; otherwise keep the requested imports.
  • No private-method coupling to Rope; 16 insertions, 22 deletions.

Bead: flext-2lout (rope fork reduced to what flext-infra needs, through public hooks).

Note

This lane's commit hook did not run (its workspace setup had not finished, so prek was not installed); the integration CI is the gate for this PR.

šŸ¤– Generated with Claude Code


Summary by cubic

Replaces the private Restructure._add_imports override with the public import_filter hook that the pinned rope fork exposes, keeping the same import-admission behavior. This removes coupling to rope's private API and trims the restructure code.