Skip to content

Commit

Permalink
Return from property docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w-feldmann committed May 17, 2024
1 parent 2aa3141 commit 1b08d36
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 238 deletions.
56 changes: 7 additions & 49 deletions molpipeline/abstract_pipeline_elements/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,12 @@ def set_params(self, **parameters: dict[str, Any]) -> Self:

@property
def additional_attributes(self) -> dict[str, Any]:
"""Any attribute relevant for recreating and exact copy, which is not a parameter.
Returns
-------
dict[str, Any]
Additional attributes.
"""
"""Any attribute relevant for recreating and exact copy, which is not a parameter."""
return {}

@property
def n_jobs(self) -> int:
"""Get the number of cores.
Returns
-------
int
Number of cores used for processing.
"""
"""Get the number of cores."""
return self._n_jobs

@n_jobs.setter
Expand All @@ -242,13 +230,7 @@ def n_jobs(self, n_jobs: int) -> None:

@property
def requires_fitting(self) -> bool:
"""Return whether the object requires fitting or not.
Returns
-------
bool
True if object requires fitting, else False.
"""
"""Return whether the object requires fitting or not."""
return self._requires_fitting

def finish(self) -> None:
Expand Down Expand Up @@ -376,46 +358,22 @@ def __init__(

@property
def input_type(self) -> str:
"""Return the input type.
Returns
-------
str
Input type of the object.
"""
"""Return the input type."""
return self._input_type

@property
def is_fitted(self) -> bool:
"""Return whether the object is fitted or not.
Returns
-------
bool
True if object is fitted, else False.
"""
"""Return whether the object is fitted or not."""
return self._is_fitted

@property
def output_type(self) -> str:
"""Return the output type.
Returns
-------
str
Output type of the object.
"""
"""Return the output type."""
return self._output_type

@property
def parameters(self) -> dict[str, Any]:
"""Return the parameters of the object.
Returns
-------
dict[str, Any]
Object parameters as a dictionary.
"""
"""Return the parameters of the object."""
return self.get_params()

@parameters.setter
Expand Down
24 changes: 3 additions & 21 deletions molpipeline/abstract_pipeline_elements/mol2any/mol2bitvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,7 @@ def __init__(

@property
def n_bits(self) -> int:
"""Get number of bits in (or size of) fingerprint.
Returns
-------
int
Number of bits in fingerprint.
"""
"""Get number of bits in (or size of) fingerprint."""
return self._n_bits

@overload
Expand Down Expand Up @@ -303,24 +297,12 @@ def set_params(self, **parameters: dict[str, Any]) -> Self:

@property
def radius(self) -> int:
"""Get radius of Morgan fingerprint.
Returns
-------
int
Radius of Morgan fingerprint.
"""
"""Get radius of Morgan fingerprint."""
return self._radius

@property
def use_features(self) -> bool:
"""Get whether to encode atoms by features or not.
Returns
-------
bool
Whether to encode atoms by features or not.
"""
"""Get whether to encode atoms by features or not."""
return self._use_features

@abc.abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ def __init__(
@property
@abc.abstractmethod
def n_features(self) -> int:
"""Return the number of features.
Returns
-------
int
Number of features.
"""
"""Return the number of features."""

def assemble_output(
self,
Expand Down
8 changes: 1 addition & 7 deletions molpipeline/error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,7 @@ def set_params(self, **parameters: dict[str, Any]) -> Self:

@property
def error_filter(self) -> ErrorFilter:
"""Get the ErrorFilter connected to this FilterReinserter.
Returns
-------
ErrorFilter
ErrorFilter used for filling removed values.
"""
"""Get the ErrorFilter connected to this FilterReinserter."""
if self._error_filter is None:
raise ValueError("ErrorFilter not set")
return self._error_filter
Expand Down
16 changes: 2 additions & 14 deletions molpipeline/estimators/chemprop/component_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,7 @@ def __init__(

@property
def input_dim(self) -> int:
"""Get the dimension of input.
Returns
-------
int
The dimension of input.
"""
"""Get the dimension of input."""
return self._input_dim

@input_dim.setter
Expand All @@ -233,13 +227,7 @@ def input_dim(self, value: int) -> None:

@property
def n_tasks(self) -> int:
"""Get the number of tasks.
Returns
-------
int
The number of tasks.
"""
"""Get the number of tasks."""
return self._n_tasks

@n_tasks.setter
Expand Down
16 changes: 2 additions & 14 deletions molpipeline/estimators/chemprop/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ def __init__(

@property
def classes_(self) -> npt.NDArray[np.int_]:
"""Return the classes.
Returns
-------
npt.NDArray[np.int_]
The classes.
"""
"""Return the classes."""
if not self._is_classifier():
raise ValueError("Model is not a classifier.")
if self._classes_ is None:
Expand All @@ -93,13 +87,7 @@ def classes_(self) -> npt.NDArray[np.int_]:

@property
def _estimator_type(self) -> str:
"""Return the estimator type.
Returns
-------
str
The estimator type.
"""
"""Return the estimator type."""
if self._is_classifier():
return "classifier"
return "regressor"
Expand Down
8 changes: 1 addition & 7 deletions molpipeline/mol2any/mol2concatinated_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@ def __init__(

@property
def element_list(self) -> list[tuple[str, MolToAnyPipelineElement]]:
"""Get pipeline elements.
Returns
-------
list[tuple[str, MolToAnyPipelineElement]]
List of pipeline elements.
"""
"""Get pipeline elements."""
return self._element_list

def get_params(self, deep: bool = True) -> dict[str, Any]:
Expand Down
16 changes: 2 additions & 14 deletions molpipeline/mol2any/mol2net_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,12 @@ def __init__(

@property
def n_features(self) -> int:
"""Return the number of features.
Returns
-------
int
Number of features.
"""
"""Return the number of features."""
return len(self._descriptor_list)

@property
def descriptor_list(self) -> list[str]:
"""Return a copy of the descriptor list.
Returns
-------
list[str]
List of descriptor names.
"""
"""Return a copy of the descriptor list."""
return self._descriptor_list[:]

def _get_net_charge_gasteiger(
Expand Down
16 changes: 2 additions & 14 deletions molpipeline/mol2any/mol2rdkit_phys_chem.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,12 @@ def __init__(

@property
def n_features(self) -> int:
"""Return the number of features.
Returns
-------
int
Number of features.
"""
"""Return the number of features."""
return len(self._descriptor_list)

@property
def descriptor_list(self) -> list[str]:
"""Return a copy of the descriptor list.
Returns
-------
list[str]
List of descriptor names.
"""
"""Return a copy of the descriptor list."""
return self._descriptor_list[:]

def pretransform_single(
Expand Down
8 changes: 1 addition & 7 deletions molpipeline/mol2mol/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,7 @@ def set_params(self, **parameters: dict[str, Any]) -> Self:

@property
def reaction(self) -> AllChem.ChemicalReaction:
"""Get the reaction which is applied to the input molecule.
Returns
-------
AllChem.ChemicalReaction
Reaction which is applied to molecules.
"""
"""Get the reaction which is applied to the input molecule."""
return self._reaction

@reaction.setter
Expand Down
16 changes: 2 additions & 14 deletions molpipeline/mol2mol/standardization.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,24 +494,12 @@ def __init__(

@property
def solvent_mol_list(self) -> list[RDKitMol]:
"""Return molecule representation of smiles list.
Returns
-------
list[RDKitMol]
List of molecule objects to remove.
"""
"""Return molecule representation of smiles list."""
return self._solvent_mol_list

@property
def solvent_smiles_list(self) -> list[str]:
"""Return the smiles list.
Returns
-------
list[str]
List of SMILES of fragments to remove.
"""
"""Return the smiles list."""
return self._solvent_smiles_list

@solvent_smiles_list.setter
Expand Down
Loading

0 comments on commit 1b08d36

Please sign in to comment.