From ba04dd495f62b59287114dfd7cb3e6d49cd7eb8b Mon Sep 17 00:00:00 2001 From: Chao Pang Date: Fri, 6 Sep 2024 11:36:41 -0400 Subject: [PATCH] disabled C0114,C0115,C0116,C0103,E0401,W1203,B101 in the github pylint action --- .github/workflows/pylint.yml | 2 +- .pre-commit-config.yaml | 4 +++- pyproject.toml | 3 +++ src/cehrbert/data_generators/data_generator_base.py | 11 ++++------- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 33eaa856..df2c34a0 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -20,4 +20,4 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - pylint $(git ls-files '*.py') + pylint $(git ls-files '*.py') --disable=C0114,C0115,C0116,C0103,E0401,W1203,B101,B311 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13490f41..0181854c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,8 @@ repos: [ "-rn", # Only display messages "-sn", # Don't display the score - "--disable=pointless-statement,duplicate-code" # do not warn on bit operator statements + "--disable=pointless-statement,duplicate-code,line-too-long,missing-module-docstring,missing-class-docstring" + # do not warn on bit operator statements ] - repo: https://github.com/DanielNoord/pydocstringformatter @@ -87,3 +88,4 @@ repos: rev: '1.7.7' hooks: - id: bandit + args: ["--skip", "B101,B311"] diff --git a/pyproject.toml b/pyproject.toml index 16034832..9e22426f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,3 +71,6 @@ dev = [ [tool.black] line-length = 100 + +[tool.flake8] +max-line-length = 100 diff --git a/src/cehrbert/data_generators/data_generator_base.py b/src/cehrbert/data_generators/data_generator_base.py index 04ac373c..99b69cb7 100644 --- a/src/cehrbert/data_generators/data_generator_base.py +++ b/src/cehrbert/data_generators/data_generator_base.py @@ -275,9 +275,7 @@ def __init__(self, concept_tokenizer: ConceptTokenizer, *args, **kwargs): def _clean_dataframe(self): self._training_data = self._training_data[ - self._training_data[self.default_required_column].apply( - lambda token_ids: len(token_ids) - ) + self._training_data[self.default_required_column].apply(len) >= max(self.default_min_num_of_concepts, self._min_num_of_concepts) ] @@ -330,9 +328,9 @@ def __init__( max_num_of_concepts: int, include_att_prediction: bool, include_visit_prediction: bool, + *args, min_num_of_concepts: int = 5, min_num_of_visits: int = 2, - *args, **kwargs, ): @@ -341,7 +339,7 @@ def __init__( self._max_num_of_visits = max_num_of_visits self._max_num_of_concepts = max_num_of_concepts - super(HierarchicalBertDataGenerator, self).__init__( + super().__init__( concept_tokenizer=concept_tokenizer, visit_tokenizer=visit_tokenizer, max_num_of_visits=max_num_of_visits, @@ -410,8 +408,7 @@ def __init__( ): self._include_readmission = include_readmission self._include_prolonged_length_stay = include_prolonged_length_stay - - super(HierarchicalBertMultiTaskDataGenerator, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def _get_learning_objective_classes(self):