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

Fix Pylint E1101 violations and false positives and remove global rule ignore #1195

Merged
merged 7 commits into from
Nov 14, 2023

Conversation

matt-graham
Copy link
Collaborator

Part of #1181.

Fixes for Pylint E1101 (no-member) violations and false positives, plus removal of global rule ignore:

  • Adds local ignore for E1101 false positive in src/tlo/logging/helpers.py.
  • Fixes E1101 violation in src/tlo/test/random_birth.py involving accessing parameter directly as attribute of module (syntax was removed in Remove attribute based access of module parameters #378).
  • Refactors class hierarchy locally defined in test_arithmetic_of_disability_aggregation_calcs in tests/test_healthburden.py to avoid false positive trigger of E1101. While we could have just added local ignores, the approach of defining class instance attributes after instantiation here is a bit unclear and the more idiomatic approach of passing as an argument to the __init__ method avoids the false positive while also being I think more readable.
  • Fixes a E1101 violation due to calling a (possibly deprecated?) pandas.ExcelWriter.save method in src/tlo/analysis/utils.py. Whilst pandas.ExcelWriter.close is referred to as an alias of pandas.ExcelWriter.save in the documentation, only pandas.ExcelWriter._save seems to exist in Panda v2.0+. This will conflict with the changes in Locally disable pylint E0110 as false positive #1192 which fix a separate Pylint false positive on using ExcelWriter by adding a local rule ignore, but also change to using ExcelWriter as a context manager as recommended in the documentation as this automatically closes the object on exit. Change save to close here ensures checks still pass with global E1101 rule ignore removed.

@matt-graham matt-graham requested a review from tamuri November 13, 2023 16:09
@matt-graham matt-graham merged commit 4bffc1a into master Nov 14, 2023
55 checks passed
@matt-graham matt-graham deleted the mmg/fix-pylint-e1101 branch November 14, 2023 12:27
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 this pull request may close these issues.

2 participants