Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brain_mechanize provides an incomplete Browser #793

Closed
pkolbus opened this issue May 24, 2020 · 0 comments · Fixed by #794
Closed

brain_mechanize provides an incomplete Browser #793

pkolbus opened this issue May 24, 2020 · 0 comments · Fixed by #794

Comments

@pkolbus
Copy link
Contributor

pkolbus commented May 24, 2020

The mechanize.Browser provided by astroid.brain.brain_mechanize.mechanize_transform is incomplete, causing false positives E1101 / E1137 in pylint.

note: the transform itself is needed still, otherwise there are E1102 / not-callable false-positives.

Steps to reproduce

Run pylint on the following script:

import mechanize

LOGIN_URL = "https://example.com/login"
USERNAME = "my_username"
PASSWORD = "hunter2"

br = mechanize.Browser()
br.open(LOGIN_URL)
br.select_form(nr=0)
br["u"] = USERNAME
br["p"] = PASSWORD
br.submit() 

Current behavior

False positives:

E1101: Instance of 'Browser' has no 'select_form' member (no-member)
E1137: 'br' does not support item assignment (unsupported-assignment-operation)
E1101: Instance of 'Browser' has no 'submit' member (no-member)

Expected behavior

No false positives

python3 -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.5.0 (and reproduced with commit 3f7cea4)

pkolbus added a commit to pkolbus/astroid that referenced this issue May 24, 2020
The brain transform for mechanize was missing most methods for the
Browser class, leading to false positives in pylint, such as:

E1101: Instance of 'Browser' has no 'select_form' member (no-member)
E1137: 'browser' does not support item assignment
    (unsupported-assignment-operation)

Add missing methods to align with mechanize 0.4.5.

Fixes pylint-dev#793.
PCManticore added a commit that referenced this issue May 28, 2020
The brain transform for mechanize was missing most methods for the
Browser class, leading to false positives in pylint, such as:

E1101: Instance of 'Browser' has no 'select_form' member (no-member)
E1137: 'browser' does not support item assignment
    (unsupported-assignment-operation)

Add missing methods to align with mechanize 0.4.5.

Fixes #793.

Co-authored-by: Claudiu Popa <pcmanticore@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant