Skip to content

Commit

Permalink
mol2rdkit_phys_chem: descriptor_list ignore None type in setter
Browse files Browse the repository at this point in the history
    - Ignore None type in setter for descriptor_list to enable
      optional input validation and an optional None.
    - See python/mypy#3004 as reference.
  • Loading branch information
JochenSiegWork committed May 17, 2024
1 parent 25298c1 commit 0cf3896
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion molpipeline/mol2any/mol2rdkit_phys_chem.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(
uuid: Optional[str], optional (default=None)
UUID of the PipelineElement. If None, a new UUID is generated.
"""
self.descriptor_list = descriptor_list
self.descriptor_list = descriptor_list # type: ignore
self._return_with_errors = return_with_errors
self._log_exceptions = log_exceptions
super().__init__(
Expand Down Expand Up @@ -105,6 +105,18 @@ def descriptor_list(self) -> list[str]:

@descriptor_list.setter
def descriptor_list(self, descriptor_list: list[str] | None) -> None:
"""Set the descriptor list.
Parameters
----------
descriptor_list: list[str] | None
List of descriptor names to calculate. If None, DEFAULT_DESCRIPTORS are used.
Raises
------
ValueError
If an unknown descriptor name is used.
"""
if descriptor_list is None or descriptor_list is DEFAULT_DESCRIPTORS:
# if None or DEFAULT_DESCRIPTORS are used, set the default descriptors
self._descriptor_list = DEFAULT_DESCRIPTORS
Expand Down

0 comments on commit 0cf3896

Please sign in to comment.