Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
frederik-sandfort1 committed Oct 1, 2024
1 parent 47d4d90 commit 1f8dc1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 7 additions & 7 deletions molpipeline/abstract_pipeline_elements/mol2mol/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


def _within_boundaries(
lower_bound: Optional[float], upper_bound: Optional[float], property: float
lower_bound: Optional[float], upper_bound: Optional[float], property_value: float
) -> bool:
"""Check if a value is within the specified boundaries.
Expand All @@ -40,17 +40,17 @@ def _within_boundaries(
Lower boundary.
upper_bound: Optional[float]
Upper boundary.
property: float
Property to check.
property_value: float
Property value to check.
Returns
-------
bool
True if the value is within the boundaries, else False.
"""
if lower_bound is not None and property < lower_bound:
if lower_bound is not None and property_value < lower_bound:
return False
if upper_bound is not None and property > upper_bound:
if upper_bound is not None and property_value > upper_bound:
return False
return True

Expand Down Expand Up @@ -190,8 +190,8 @@ def pretransform_single(self, value: RDKitMol) -> OptionalMol:
Molecule that matches defined filter elements, else InvalidInstance.
"""
for filter_element, (lower_limit, upper_limit) in self.filter_elements.items():
property = self._calculate_single_element_value(filter_element, value)
if _within_boundaries(lower_limit, upper_limit, property):
property_value = self._calculate_single_element_value(filter_element, value)
if _within_boundaries(lower_limit, upper_limit, property_value):
# For "any" mode we can return early if a match is found
if self.mode == "any":
if not self.keep_matches:
Expand Down
3 changes: 1 addition & 2 deletions molpipeline/mol2mol/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from collections import Counter
from typing import Any, Mapping, Optional, Sequence, Union

from molpipeline.abstract_pipeline_elements.mol2mol.filter import _within_boundaries

try:
from typing import Self # type: ignore[attr-defined]
except ImportError:
Expand All @@ -26,6 +24,7 @@
from molpipeline.abstract_pipeline_elements.mol2mol import (
BasePatternsFilter as _BasePatternsFilter,
)
from molpipeline.abstract_pipeline_elements.mol2mol.filter import _within_boundaries
from molpipeline.utils.molpipeline_types import (
FloatCountRange,
IntCountRange,
Expand Down

0 comments on commit 1f8dc1c

Please sign in to comment.