Skip to content

Commit c896924

Browse files
fix docstrings
1 parent af24fcf commit c896924

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

rsl_rl/networks/normalization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
4747

4848
@torch.jit.unused
4949
def update(self, x: torch.Tensor) -> None:
50-
"""Learn input values without computing the output values of them"""
50+
"""Learn input values without computing the output values of them."""
5151
if not self.training:
5252
return
5353
if self.until is not None and self.count >= self.until:

rsl_rl/runners/on_policy_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def _construct_algorithm(self, obs: TensorDict) -> PPO:
440440
return alg
441441

442442
def _prepare_logging_writer(self) -> None:
443-
"""Prepares the logging writers."""
443+
"""Prepare the logging writers."""
444444
if self.log_dir is not None and self.writer is None and not self.disable_logs:
445445
# Launch either Tensorboard or Neptune & Tensorboard summary writer(s), default: Tensorboard.
446446
self.logger_type = self.cfg.get("logger", "tensorboard")

rsl_rl/utils/utils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
def resolve_nn_activation(act_name: str) -> torch.nn.Module:
19-
"""Resolves the activation function from the name.
19+
"""Resolve the activation function from the name.
2020
2121
Args:
2222
act_name: The name of the activation function.
@@ -50,7 +50,7 @@ def resolve_nn_activation(act_name: str) -> torch.nn.Module:
5050

5151

5252
def resolve_optimizer(optimizer_name: str) -> torch.optim.Optimizer:
53-
"""Resolves the optimizer from the name.
53+
"""Resolve the optimizer from the name.
5454
5555
Args:
5656
optimizer_name: The name of the optimizer.
@@ -78,9 +78,9 @@ def resolve_optimizer(optimizer_name: str) -> torch.optim.Optimizer:
7878
def split_and_pad_trajectories(
7979
tensor: torch.Tensor | TensorDict, dones: torch.Tensor
8080
) -> tuple[torch.Tensor | TensorDict, torch.Tensor]:
81-
"""Splits trajectories at done indices.
81+
"""Split trajectories at done indices.
8282
83-
Splits trajectories, concatenates them and pads with zeros up to the length of the longest trajectory. Returns masks
83+
Split trajectories, concatenate them and pad with zeros up to the length of the longest trajectory. Return masks
8484
corresponding to valid parts of the trajectories.
8585
8686
Example:
@@ -133,7 +133,7 @@ def split_and_pad_trajectories(
133133

134134

135135
def unpad_trajectories(trajectories: torch.Tensor | TensorDict, masks: torch.Tensor) -> torch.Tensor | TensorDict:
136-
"""Does the inverse operation of `split_and_pad_trajectories()`."""
136+
"""Do the inverse operation of `split_and_pad_trajectories()`."""
137137
# Need to transpose before and after the masking to have proper reshaping
138138
return (
139139
trajectories.transpose(1, 0)[masks.transpose(1, 0)]
@@ -171,7 +171,7 @@ def store_code_state(logdir: str, repositories: list[str]) -> list[str]:
171171

172172

173173
def string_to_callable(name: str) -> Callable:
174-
"""Resolves the module and function names to return the function.
174+
"""Resolve the module and function names to return the function.
175175
176176
Args:
177177
name: The function name. The format should be 'module:attribute_name'.
@@ -203,7 +203,7 @@ def string_to_callable(name: str) -> Callable:
203203
def resolve_obs_groups(
204204
obs: TensorDict, obs_groups: dict[str, list[str]], default_sets: list[str]
205205
) -> dict[str, list[str]]:
206-
"""Validates the observation configuration and defaults missing observation sets.
206+
"""Validate the observation configuration and defaults missing observation sets.
207207
208208
The input is an observation dictionary `obs` containing observation groups and a configuration dictionary
209209
`obs_groups` where the keys are the observation sets and the values are lists of observation groups.

ruff.toml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ select = [
77
# pycodestyle
88
"E", "W",
99
# pydocstyle
10-
# "D",
11-
# pydoclint
12-
# "DOC",
10+
"D",
1311
# pylint for later
1412
# "PL",
1513
# pyflakes
@@ -33,7 +31,22 @@ select = [
3331
# ruff
3432
"RUF",
3533
]
36-
ignore = ["B006", "B007", "B028", "ANN401"]
34+
ignore = ["B006",
35+
"B007",
36+
"B028",
37+
"ANN401",
38+
"D100",
39+
"D101",
40+
"D102",
41+
"D103",
42+
"D104",
43+
"D105",
44+
"D106",
45+
"D107",
46+
"D203",
47+
"D213",
48+
"D413",
49+
]
3750
per-file-ignores = {"*/__init__.py" = ["F401"]}
3851

3952
[lint.isort]

0 commit comments

Comments
 (0)