Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

Conversation

@praharsh777
Copy link

Hello!! This PR resolves an issue where Bowler would crash when transforming functions with complex type annotations like typing.List[str].

🐞Problem:
When processing code like:
"""
def foo(bar: typing.List[str]):
pass
"""
Bowler raised:
""" AttributeError: 'Node' object has no attribute 'value' """

✅My Solution for the above problem :
Updated FunctionArgument.build() to:
-Safely check whether the annotation is a Leaf or Node
-Use .value for Leaf, str(...) for complex Nodes
-Clone values safely and avoid AttributeError

🧪Tests Added
New test file: test_typehints.py
Verifies Query(...).add_argument(...) works correctly with functions using typehints like typing.List[str]

🔄Code Changes
In imr.py:
Improved logic in FunctionArgument.build() for safe annotation parsing
In query.py:
Added a lightweight inline test for typing.List[str]
In tests/test_typehints.py:
Full test case validating transformation on typehinted functions

🧵Related Issue
Closes #129

@facebook-github-bot
Copy link

Hi @praharsh777!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@praharsh777
Copy link
Author

Hi, I've signed the CLA. Just waiting for the status to update. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Apr 4, 2025
@praharsh777
Copy link
Author

Hi @facebook-github-bot , just checking in to see if this PR needs any changes. Happy to help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash on functions with certain typehinting

2 participants