Docs: fixing spelling, re-adding spellcheck to pipeline

This commit is contained in:
Michael Panchenko 2023-12-05 13:22:04 +01:00
parent a846b52063
commit 0b67447541
6 changed files with 53 additions and 11 deletions

View File

@ -101,7 +101,7 @@
"source": [
"You may notice that the speed doesn't increase linearly when we add subprocess numbers. There are multiple reasons behind this. One reason is that synchronize exception causes straggler effect. One way to solve this would be to use asynchronous mode. We leave this for further reading if you feel interested.\n",
"\n",
"Note that SubprocVectorEnv should only be used when the environment exection is slow. In practice, DummyVectorEnv (or raw Gym environment) is actually more efficient for a simple environment like CartPole because now you avoid both straggler effect and the overhead of communication between subprocesses."
"Note that SubprocVectorEnv should only be used when the environment execution is slow. In practice, DummyVectorEnv (or raw Gym environment) is actually more efficient for a simple environment like CartPole because now you avoid both straggler effect and the overhead of communication between subprocesses."
]
},
{
@ -154,7 +154,7 @@
"id": "kvIfqh0vqAR5"
},
"source": [
"### Environment exection and resetting\n",
"### Environment execution and resetting\n",
"The only difference between Vectorized environments and standard Gym environments is that passed in actions and returned rewards/observations are also vectorized."
]
},

View File

@ -93,7 +93,11 @@ repository:
#######################################################################################
# Advanced and power-user settings
sphinx:
extra_extensions : ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx_toolbox.more_autodoc.sourcelink']
extra_extensions :
- sphinx.ext.autodoc
- sphinx.ext.viewcode
- sphinx_toolbox.more_autodoc.sourcelink
- sphinxcontrib.spelling
local_extensions : # A list of local extensions to load by sphinx specified by "name: path" items
recursive_update : false # A boolean indicating whether to overwrite the Sphinx config (true) or recursively update (false)
config : # key-value pairs to directly over-ride the Sphinx configuration

View File

@ -199,3 +199,40 @@ img
src
parallelized
infty
venv
venvs
subproc
bcq
highlevel
icm
modelbased
td
psrl
ddpg
npg
tf
trpo
crr
pettingzoo
multidiscrete
vecbuf
prio
colab
segtree
multiagent
mapolicy
sensai
sensAI
docstrings
superclass
iterable
functools
str
sklearn
attr
bc
redq
modelfree
bdq
util
logp

View File

@ -180,10 +180,11 @@ _poetry_sort = "poetry sort"
_clean-nbs = "nbstripout docs/02_notebooks/*"
format = ["_black_format", "_ruff_format", "_poetry_install_sort_plugin", "_poetry_sort", "_clean-nbs"]
_autogen_rst = "python docs/autogen_rst.py"
_spellcheck = "sphinx-build -W -b spelling docs docs/_build"
_sphinx_build = "sphinx-build -W -b html docs docs/_build"
_jb_generate_toc = "bash -c \"jupyter-book toc from-project docs -e .rst -e .md -e .ipynb > docs/_toc.yml \""
_jb_config = "jupyter-book config sphinx docs/"
_jb_generate_config = "jupyter-book config sphinx docs/"
doc-clean = "rm -rf docs/_build"
doc-build = ["_autogen_rst", "_jb_generate_toc", " _jb_config", "_sphinx_build"]
doc-generate-files = ["_autogen_rst", "_jb_generate_toc", "_jb_generate_config"]
doc-spellcheck = "sphinx-build -W -b spelling docs docs/_build"
doc-build = ["doc-generate-files", "doc-spellcheck", "_sphinx_build"]
type-check = "mypy tianshou"

View File

@ -95,10 +95,10 @@ def create_value(
size: int,
stack: bool = True,
) -> Union["Batch", np.ndarray, torch.Tensor]:
"""Create empty place-holders accroding to inst's shape.
"""Create empty place-holders according to inst's shape.
:param stack: whether to stack or to concatenate. E.g. if inst has shape of
(3, 5), size = 10, stack=True returns an np.ndarry with shape of (10, 3, 5),
(3, 5), size = 10, stack=True returns an np.array with shape of (10, 3, 5),
otherwise (10, 5)
"""
has_shape = isinstance(inst, np.ndarray | torch.Tensor)

View File

@ -1,4 +1,5 @@
"""Copy of sensai.util.string from sensAI commit d7b4afcc89b4d2e922a816cb07dffde27f297354."""
"""Copy of sensai.util.string from sensAI """
# From commit commit d7b4afcc89b4d2e922a816cb07dffde27f297354
import functools
@ -11,7 +12,6 @@ from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import (
Any,
Self,
cast,
)
reCommaWhitespacePotentiallyBreaks = re.compile(r",\s+")
@ -136,7 +136,7 @@ def object_repr(obj: Any, member_names_or_dict: list[str] | dict[str, Any]) -> s
def or_regex_group(allowed_names: Sequence[str]) -> str:
""":param allowed_names: strings to include as literals in the regex
:return: a regular expression string of the form (<name1>| ...|<nameN>), which any of the given names
:return: a regular expression string of the form `(<name_1>| ...|<name_N>)`, which any of the given names
"""
allowed_names = [re.escape(name) for name in allowed_names]
return r"(%s)" % "|".join(allowed_names)