Fix Pylint E1101 violations and false positives and remove global rule ignore #1195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #1181.
Fixes for Pylint E1101 (no-member) violations and false positives, plus removal of global rule ignore:
src/tlo/logging/helpers.py
.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).test_arithmetic_of_disability_aggregation_calcs
intests/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.pandas.ExcelWriter.save
method insrc/tlo/analysis/utils.py
. Whilstpandas.ExcelWriter.close
is referred to as an alias ofpandas.ExcelWriter.save
in the documentation, onlypandas.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 usingExcelWriter
by adding a local rule ignore, but also change to usingExcelWriter
as a context manager as recommended in the documentation as this automatically closes the object on exit. Changesave
toclose
here ensures checks still pass with global E1101 rule ignore removed.