From 5ff87d5ea44a919fab5173bbfc77c68f1c56be78 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 13 Nov 2023 17:26:58 +0000 Subject: [PATCH 1/2] Add local Pylint E1130 rule ignores for false positives --- src/tlo/util.py | 2 +- tests/test_bladder_cancer.py | 4 ++-- tests/test_breast_cancer.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tlo/util.py b/src/tlo/util.py index b37159e3b1..bbc496af5e 100644 --- a/src/tlo/util.py +++ b/src/tlo/util.py @@ -203,7 +203,7 @@ def unset(self, where, *elements: str, columns: Optional[Union[str, List[str]]] update. If set to ``None`` (the default) a ``column`` argument must have been specified when constructing the ``BitsetHandler`` object. """ - self.df.loc[where, self._get_columns(columns)] &= ~self.element_repr(*elements) + self.df.loc[where, self._get_columns(columns)] &= ~self.element_repr(*elements) # pylint: disable=E1130 def clear(self, where, columns: Optional[Union[str, List[str]]] = None): """Clears all the bits for the specified rows. diff --git a/tests/test_bladder_cancer.py b/tests/test_bladder_cancer.py index 6de69d67a1..104630f99b 100644 --- a/tests/test_bladder_cancer.py +++ b/tests/test_bladder_cancer.py @@ -264,7 +264,7 @@ def test_check_progression_through_stages_is_happening(seed): # check that there are now some people in each of the later stages: df = sim.population.props - assert not pd.isnull(df.bc_status[~pd.isna(df.date_of_birth)]).any() + assert not pd.isnull(df.bc_status[~pd.isna(df.date_of_birth)]).any() # pylint: disable=E1130 assert (df.loc[df.is_alive & (df.age_years >= 15)].bc_status.value_counts().drop(index='none') > 0).all() # check that some people have died of bladder cancer @@ -314,7 +314,7 @@ def test_that_there_is_no_treatment_without_the_hsi_running(seed): # check that there are now some people in each of the later stages: df = sim.population.props assert len(df.loc[df.is_alive & (df.bc_status != 'none')]) > 0 - assert not pd.isnull(df.bc_status[~pd.isna(df.date_of_birth)]).any() + assert not pd.isnull(df.bc_status[~pd.isna(df.date_of_birth)]).any() # pylint: disable=E1130 assert (df.loc[df.is_alive].bc_status.value_counts().drop(index='none') > 0).all() # check that some people have died of bladder cancer diff --git a/tests/test_breast_cancer.py b/tests/test_breast_cancer.py index f9d885e8b4..5544b38765 100644 --- a/tests/test_breast_cancer.py +++ b/tests/test_breast_cancer.py @@ -264,7 +264,7 @@ def test_check_progression_through_stages_is_happening(seed): # check that there are now some people in each of the later stages: df = sim.population.props - assert not pd.isnull(df.brc_status[~pd.isna(df.date_of_birth)]).any() + assert not pd.isnull(df.brc_status[~pd.isna(df.date_of_birth)]).any() # pylint: disable=E1130 # debugging on this line below and there are women alive with breast cancer so not sure why assert is not working # Create variable for the condition # condition = df.is_alive & (df.age_years >= 15) & (df.sex == 'F') From 81e3f95fcdd2f186b2a46197253221000aff42ef Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 13 Nov 2023 17:27:13 +0000 Subject: [PATCH 2/2] Remove global Pylint E1130 rule ignore --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2d08c48ba0..5c2f31203a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,7 +100,6 @@ disable = [ "E1137", # doesn't support item assignment "E1101", # no-member "E1120", # no-value-for-parameter - "E1130", # bad operand type for unary ~ ]