pylint-dev / pylint-dev/astroid
Understand the inference of calls with decorators
- Dominant language
- Python
- Stars
- 582
- Forks
- 357
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
Currently `astroid` doesn't really understand decorators:
```
call = astroid.extract_node("""
def dec(func):
def _():
return func() - 1
return _
@dec
def a():
return 5
a() #@
""")
call.inferred()[0].value
```
The above will return `5` when it should return 4 because of the decorator.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the example with astroid.extract_node and call.inferred(). The relevant behavior is inference for the decorated function a and its call; compare the current value of 5 with the expected value of 4. Done means decorated calls account for dec and produce the expected inferred result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100