Skip to content

Commit

Permalink
Parsing type hints in Sphinx documentation (#205)
Browse files Browse the repository at this point in the history
* update sphinx in order to parse type hints; make flake8-docstyle numpydocstyle compatible
* update deps
  • Loading branch information
iKintosh authored Nov 24, 2021
1 parent e814219 commit e66058f
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 25 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ignore = F, E203, W605, E501, W503, D100, D104
max-line-length = 121
max-complexity = 18
docstring-convention=numpy
select = E, W, C, F401, N, D101, D102, D103, D200, D201, D202, D206, D207, D208, D209, D300, D400, D401, D402, D403, D404, D405, D414, D413, D417, D409
per-file-ignores=
__init__.py:F401
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
"sphinx.ext.githubpages",
]

autodoc_typehints = "both"
autodoc_typehints_description_target = "all"
add_module_names = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
2 changes: 1 addition & 1 deletion etna/analysis/outliers/median_outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_anomalies_median(
Returns
-------
dict of outliers: typing.Dict[str, typing.List[pd.Timestamp]]
:
dict of outliers in format {segment: [outliers_timestamps]}
"""
outliers_per_segment = {}
Expand Down
4 changes: 2 additions & 2 deletions etna/analysis/plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def get_correlation_matrix(ts: "TSDataset", segments: Optional[List[str]] = None
"""Compute pairwise correlation of timeseries for selected segments.
Parameters
-----------
----------
ts:
TSDataset with timeseries data
segments:
Expand Down Expand Up @@ -362,7 +362,7 @@ def plot_correlation_matrix(
"""Plot pairwise correlation heatmap for selected segments.
Parameters
-----------
----------
ts:
TSDataset with timeseries data
segments:
Expand Down
3 changes: 2 additions & 1 deletion etna/datasets/tsdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def make_future(self, future_steps: int) -> "TSDataset":
Returns
-------
dataset with features in the future.
:
dataset with features in the future.
Examples
--------
Expand Down
3 changes: 2 additions & 1 deletion etna/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def __init__(self, mode: str = MetricAggregationMode.per_segment, **kwargs):
.. math::
MAE(y\_true, y\_pred) = \\frac{\\sum_{i=0}^{n-1}{\\mid y\_true_i - y\_pred_i \\mid}}{n}
Notes:
Notes
-----
You can read more about logic of multi-segment metrics in Metric docs.
Parameters
Expand Down
4 changes: 2 additions & 2 deletions etna/transforms/special_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, find_special_weekday: bool = True, find_special_month_day: bo
flag, if True, find special monthdays in transform
Raises
----------
------
ValueError:
if all the modes are False
"""
Expand Down Expand Up @@ -179,7 +179,7 @@ def __init__(self, find_special_weekday: bool = True, find_special_month_day: bo
flag, if True, find special monthdays in transform
Raises
----------
------
ValueError:
if all the modes are False
"""
Expand Down
78 changes: 64 additions & 14 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ loguru = "^0.5.3"
saxpy = "^1.0.1-dev167"
hydra-slayer = "^0.2.0"
typer = "^0.4.0"
omegaconf = "^2.1.1"

prophet = {version = "^1.0", optional = true}

Expand All @@ -61,10 +62,10 @@ wandb = {version = "^0.12.2", optional = true}

sphinx-mathjax-offline = {version = "^0.0.1", optional = true}
nbsphinx = {version = "^0.8.2", optional = true}
Sphinx = {version = "^3.5.1", optional = true}
Sphinx = {version = "^4.1", optional = true}
numpydoc = {version = "^1.1.0", optional = true}
sphinx-rtd-theme = {version = "^0.5.1", optional = true}
myst-parser = {version = "^0.14.0", optional = true}
myst-parser = {version = "^0.15.0", optional = true}
GitPython = {version = "^3.1.20", optional = true}

pytest = {version = "^6.2", optional = true}
Expand All @@ -86,7 +87,6 @@ ipywidgets = {version = "^7.6.5", optional = true}

jupyter = {version = "*", optional = true}
nbconvert = {version = "*", optional = true}
omegaconf = "^2.1.1"

[tool.poetry.extras]
# optional deps
Expand Down Expand Up @@ -154,4 +154,4 @@ line_length = 120

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
build-backend = "poetry.masonry.api"

0 comments on commit e66058f

Please sign in to comment.