lint: fix multi-part imports
Metadata
Current evaluation
Merged to main. Fixes linting errors from a pyright 1.1.299 regression that flagged multi-part imports. Updated imports across three files to comply with the new type checker. Approved and passed CI.
Suggested action: —
No scores available.
Issue body
- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [X] Have you successfully run `make lint`?
- [X] Have you successfully run `pytest tests/unit`?
-----
Update from [`pyright 1.1.299`](https://github.com/microsoft/pyright/releases/tag/1.1.299):
> Fixed a recent regression that resulted in multi-part imports being evaluated as unknown if a namespace package was used for an intermediate part of the module path and useLibraryCodeForTypes was set to false.
In other words, pyright now complains if you do this:
```python
import xdg.BaseDirectory
CONFIG_PATH = Path(xdg.BaseDirectory.xdg_config_home) / "snapcraft/snapcraft.cfg"
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged to main. Fixes linting errors from a pyright 1.1.299 regression that flagged multi-part imports. Updated imports across three files to comply with the new type checker. Approved and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main. Fixed linting errors for multi-part imports caused by a pyright regression. Code updated for pyright 1.1.299 compliance. Passed lint and unit tests. Codecov noted a 0.01% coverage decrease. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main to resolve pyright 1.1.299 linting errors that incorrectly flagged multi-part imports. Updated import syntax to comply with the new type checker. Diff coverage reached 100% with a 0.01% overall decrease. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #58 lint: fix typing issues with updated pyright | craft-archives | merged | Merged following reviewer approval and successful CI checks. Fixed typing errors introduced by an updated pyright version across seven files. Improved overall code coverage by 0.03%. | |
| #4485 style(lint): fix pyright errors | snapcraft | merged | Merged after approval by three reviewers. Resolved pyright linting errors across nine files (+59/-38 lines). Codecov confirmed test coverage remained stable at 89.2%. | |
| #177 linting: address pyright issues | craft-parts | merged | Merged following approval and passing CI. Updated type declarations to comply with Pyright 1.1.225 by adding Optional to None arguments and correcting callback type typos across 16 files. |