Repository navigation
Conversation
|
Hi @Flpvoigt! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thanks @Flpvoigt! Could you please sign our CLA: https://code.facebook.com/cla? After that, we'll be able to review this PR (and any others going forward). |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
There was a problem hiding this comment.
Thanks @Flpvoigt!
This looks good to me, but can you rebase?
We have tooling to auto-import PRs, but it doesn't run on first-time contributions before the CLA is signed, and it's harder for me to review and merge without the auto-import. Usually a rebase will trigger an import.
While you're at it, two other concerns worth addressing:
Contributor attestation in the summary
The PR’s “I am a human, and I fully understand the code I am submitting” checkbox is unchecked. CONTRIBUTING.md requires that attestation; include it in the author’s requested updates.
Filter invalid dot-completion names
[attr.rs:3674–3679](https://github.com/meta/pyrefly/blob/c0937eb9931783ec2219e5da9d6404dbd5641b49/pyrefly/lib/alt/attr.rs#L3674-L3679) converts every string literal into a completion without identifier validation.
For Literal["good", "bad-name", "class", ""], all four appear:
classcreates invalid syntax.bad-nameinserts subtraction rather than attribute access.""produces an empty suggestion.
These strings are legitimate inputs to getattr, but cannot follow a dot. Use the existing pyrefly_python::keywords::is_valid_identifier helper and add a negative test covering invalid identifiers, keywords, and empty strings.
Summary
Pyrefly previously did not provide completion suggestions for attributes dynamically handled by
__getattr__.This change reads the string literals from the parameter after
self. For example, when the parameter is annotated withLiteral["A", "B"], Pyrefly suggestsAandBas attribute completions while avoiding duplicates with attributes already defined on the class.Fixes #5312
Original description in Portuguese
Foi implementado o autocomplete de atributos definidos dinamicamente pelo
__getattr__.Antes, neste código: