Skip to content

Commit

Permalink
Eliminated all D401 in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KrissiHub committed Aug 15, 2023
1 parent 4d796df commit c973068
Show file tree
Hide file tree
Showing 19 changed files with 93 additions and 92 deletions.
4 changes: 2 additions & 2 deletions deepcave/evaluators/epm/fanova_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(

def _get_model(self) -> regression.base_tree:
"""
Returns the internal model.
Return the internal model.
Returns
-------
Expand Down Expand Up @@ -123,7 +123,7 @@ def _train(self, X: np.ndarray, Y: np.ndarray) -> None:

def compute_marginals(self, hp_ids: List[int], depth=1):
"""
Returns the marginal of selected parameters.
Return the marginal of selected parameters.
Parameters
----------
Expand Down
6 changes: 3 additions & 3 deletions deepcave/evaluators/epm/random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(

def _get_model(self) -> regression.base_tree:
"""
Returns the internal model.
Return the internal model.
Returns
-------
Expand Down Expand Up @@ -180,7 +180,7 @@ def _impute_inactive(self, X: np.ndarray) -> np.ndarray:

def _check_dimensions(self, X: np.ndarray, Y: Optional[np.ndarray] = None) -> None:
"""
Checks if the dimensions of X and Y are correct wrt features.
Check if the dimensions of X and Y are correct wrt features.
Parameters
----------
Expand Down Expand Up @@ -210,7 +210,7 @@ def _get_data_container(
self, X: np.ndarray, y: np.ndarray
) -> regression.default_data_container:
"""
Fills a pyrfr default data container s.t. the forest knows
Fill a pyrfr default data container s.t. the forest knows
categoricals and bounds for continuous data.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion deepcave/evaluators/fanova.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_importances(
self, hp_names: Optional[List[str]] = None, depth: int = 1, sort: bool = True
) -> Dict[Union[str, Tuple[str, ...]], Tuple[float, float, float, float]]:
"""
Returns the importance scores from the passed hyperparameter names.
Return the importance scores from the passed hyperparameter names.
Warning
-------
Expand Down
10 changes: 5 additions & 5 deletions deepcave/evaluators/footprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def calculate(
exclude_configs: bool = False,
) -> None:
"""
Calculates the distances and trains the model.
Calculate the distances and trains the model.
Parameters
----------
Expand Down Expand Up @@ -255,7 +255,7 @@ def get_surface(

def get_points(self, category: str = "configs") -> Tuple[List[float], List[float], List[int]]:
"""
Returns the points of the MDS plot.
Return the points of the MDS plot.
Parameters
----------
Expand Down Expand Up @@ -319,7 +319,7 @@ def _get_max_distance(self) -> float:

def _get_distance(self, x: np.ndarray, y: np.ndarray) -> float:
"""
Calculates distance between x and y. Both arrays must have the same length.
Calculate distance between x and y. Both arrays must have the same length.
Parameters
----------
Expand Down Expand Up @@ -361,7 +361,7 @@ def _init_distances(
self, X: np.ndarray, config_ids: List[int], exclude_configs: bool = False
) -> None:
"""
Initializes the distances.
Initialize the distances.
Parameters
----------
Expand Down Expand Up @@ -389,7 +389,7 @@ def _update_distances(
rejection_threshold: Optional[float] = 0.0,
) -> bool:
"""
Updates the internal distance if the passed config is not rejectded.
Update the internal distance if the passed config is not rejectded.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions deepcave/evaluators/lpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def calculate(
seed: Optional[int] = None,
) -> None:
"""
Prepares the data and trains a RandomForest model.
Prepare the data and trains a RandomForest model.
Parameters
----------
Expand Down Expand Up @@ -187,7 +187,7 @@ def calculate(

def get_importances(self, hp_names: List[str]) -> Dict[str, Tuple[float, float]]:
"""
Returns the importances.
Return the importances.
Parameters
----------
Expand Down
41 changes: 21 additions & 20 deletions deepcave/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self) -> None:
@interactive
def get_base_url(cls) -> str:
"""
Generates the url for the plugin.
Generate the url for the plugin.
Returns
-------
Expand All @@ -100,7 +100,7 @@ def get_base_url(cls) -> str:
@staticmethod
def check_run_compatibility(run: AbstractRun) -> bool:
"""
Checks if a run is compatible with this plugin. If a plugin is not compatible,
Check if a run is compatible with this plugin. If a plugin is not compatible,
you can not select the run.
Note
Expand Down Expand Up @@ -145,7 +145,7 @@ def register_input(
type: Any = None,
) -> str:
"""
Registers an input variable for the plugin. It is important to register the inputs
Register an input variable for the plugin. It is important to register the inputs
because callbacks have to be defined before the server is started.
After registering all inputs, an internal mapping is created.
Expand Down Expand Up @@ -189,7 +189,7 @@ def register_output(
self, id: str, attributes: Union[str, List[str]] = "value", mpl: bool = False
) -> str:
"""
Registers an output variable for the plugin.
Register an output variable for the plugin.
Parameters
----------
Expand Down Expand Up @@ -230,7 +230,7 @@ def get_internal_output_id(self, id: str) -> str:
@interactive
def register_callbacks(self) -> None:
"""
Registers basic callbacks for the plugin. Following callbacks are registered:
Register basic callbacks for the plugin. Following callbacks are registered:
- If inputs changes, the changes are pasted back. This is in particular
interest if input dependencies are used.
- Raw data dialog to display raw data.
Expand Down Expand Up @@ -449,7 +449,7 @@ def _inputs_changed(
self, inputs: Dict[str, Dict[str, str]], last_inputs: Dict[str, Dict[str, str]]
) -> Tuple[bool, bool]:
"""
Checks if the inputs have changed.
Check if the inputs have changed.
Parameters
----------
Expand Down Expand Up @@ -542,7 +542,7 @@ def _process_raw_outputs(
@interactive
def _list_to_dict(self, values: List[str], input: bool = True) -> Dict[str, Dict[str, str]]:
"""
Maps the given values to a dict, regarding the sorting from
Map the given values to a dict, regarding the sorting from
either self.inputs or self.outputs.
Parameters
Expand Down Expand Up @@ -576,7 +576,7 @@ def _dict_to_list(
self, d: Dict[str, Dict[str, str]], input: bool = False
) -> List[Optional[str]]:
"""
Maps the given dict to a list, respecting the sorting from either
Map the given dict to a list, respecting the sorting from either
self.inputs or self.outputs.
Parameters
Expand Down Expand Up @@ -617,7 +617,7 @@ def _dict_to_list(
@interactive
def _dict_as_key(self, d: Dict[str, Any], remove_filters: bool = False) -> Optional[str]:
"""
Converts a dictionary to a key. Only ids from self.inputs are considered.
Convert a dictionary to a key. Only ids from self.inputs are considered.
Parameters
----------
Expand Down Expand Up @@ -678,7 +678,7 @@ def _cast_inputs(self, inputs: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str,

def _clean_inputs(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
"""
Cleans the given inputs s.t. only the first value is used.
Clean the given inputs s.t. only the first value is used.
Also, boolean values are casted to booleans.
Example
Expand Down Expand Up @@ -742,7 +742,7 @@ def all_runs(self) -> List[AbstractRun]:
@interactive
def __call__(self, render_button: bool = False) -> List[Component]:
"""
Returns the components for the plugin. Basically, all blocks and elements of the plugin
Return the components for the plugin. Basically, all blocks and elements of the plugin
are stacked-up here
Returns
Expand Down Expand Up @@ -933,7 +933,7 @@ def register_out(a, b): # type: ignore
@interactive
def get_run_input_layout(register: Callable[[str, Union[str, List[str]]], str]) -> Component:
"""
Generates the run selection input.
Generate the run selection input.
This is only the case if `activate_run_selection` is True.
Parameters
Expand Down Expand Up @@ -963,7 +963,7 @@ def load_run_inputs(
check_run_compatibility: Callable[[AbstractRun], bool],
) -> Dict[str, Any]:
"""
Loads the options for `get_run_input_layout`.
Load the options for `get_run_input_layout`.
Both runs and groups are displayed.
Parameters
Expand Down Expand Up @@ -1016,7 +1016,7 @@ def load_run_inputs(
@interactive
def get_selected_runs(self, inputs: Dict[str, Any]) -> List[AbstractRun]:
"""
Parses selected runs from inputs.
Parse selected runs from inputs.
If self.activate_run_selection is set, return only selected run. Otherwise, return all
possible runs.
Expand Down Expand Up @@ -1077,7 +1077,8 @@ def load_dependency_inputs(
inputs: Dict[str, Any],
) -> Dict[str, Any]:
"""
Same as `load_inputs` but called after inputs have changed. Provides a lot of flexibility.
Load the content as in 'load_inputs' but called after inputs have changed.
Provides a lot of flexibility.
Note
----
Expand Down Expand Up @@ -1180,7 +1181,7 @@ def load_outputs(
outputs: Dict[str, Union[str, Dict[str, str]]],
) -> Union[Component, List[Component]]:
"""
Reads in the raw data and prepares them for the layout.
Read in the raw data and prepares them for the layout.
Note
----
Expand Down Expand Up @@ -1212,7 +1213,7 @@ def load_mpl_outputs(
outputs: Dict[str, Union[str, Dict[str, str]]],
) -> Union[Component, List[Component]]:
"""
Reads in the raw data and prepares them for the layout.
Read in the raw data and prepares them for the layout.
Note
----
Expand Down Expand Up @@ -1240,7 +1241,7 @@ def load_mpl_outputs(
@staticmethod
def process(run: AbstractRun, inputs: Dict[str, Any]) -> Dict[str, Any]:
"""
Returns raw data based on a run and input data.
Return raw data based on a run and input data.
Warning
-------
Expand Down Expand Up @@ -1270,7 +1271,7 @@ def generate_outputs(
cls, runs: Union[AbstractRun, List[AbstractRun]], inputs: Dict[str, Any]
) -> Union[Dict[str, Any], Dict[str, Dict[str, Any]]]:
"""
Checks whether run selection is active and accepts either one or multiple runs at once.
Check whether run selection is active and accepts either one or multiple runs at once.
Calls `process` internally.
Parameters
Expand Down Expand Up @@ -1312,7 +1313,7 @@ def generate_outputs(

def generate_inputs(self, **kwargs: Any) -> Dict[str, Any]:
"""
Generates inputs for the `process` and `load_outputs` required for api mode.
Generate inputs for the `process` and `load_outputs` required for api mode.
The arguments are validated against the input schema.
Note
Expand Down
2 changes: 1 addition & 1 deletion deepcave/plugins/summary/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Configurations(DynamicPlugin):
@staticmethod
def get_link(run: AbstractRun, config_id: int) -> str:
"""
Creates a link to a specific configuration.
Create a link to a specific configuration.
Parameters
----------
Expand Down
Loading

0 comments on commit c973068

Please sign in to comment.