Merge ~cjwatson/launchpad:bugbear-getattr-setattr into launchpad:master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | 39015f0c2ec9c6f2bf3fe940bca22d605c566814 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:bugbear-getattr-setattr |
Merge into: | launchpad:master |
Diff against target: |
241 lines (+23/-34) 9 files modified
lib/lp/answers/tests/test_question_workflow.py (+10/-14) lib/lp/blueprints/model/sprint.py (+1/-1) lib/lp/code/model/branchtarget.py (+2/-8) lib/lp/codehosting/vfs/branchfs.py (+1/-1) lib/lp/codehosting/vfs/transport.py (+1/-1) lib/lp/registry/tests/test_product.py (+4/-4) lib/lp/services/webapp/error.py (+1/-1) lib/lp/services/webapp/publisher.py (+1/-1) lib/lp/testing/factory.py (+2/-3) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email: mp+454020@code.launchpad.net |
Commit message
Remove useless uses of getattr/setattr
Description of the change
`flake8-bugbear` points out:
B009: Do not call getattr(x, 'attr'), instead use normal property access: x.attr. Missing a default to getattr will cause an AttributeError to be raised for non-existent properties. There is no additional safety in using getattr if you know the attribute name ahead of time.
B010: Do not call setattr(x, 'attr', val), instead use normal property access: x.attr = val. There is no additional safety in using setattr if you know the attribute name ahead of time.
To post a comment you must log in.