Skip to content

Commit

Permalink
Merge branch 'hint' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau authored Jan 5, 2023
2 parents 9197c13 + 6197fd4 commit bc1804f
Show file tree
Hide file tree
Showing 56 changed files with 2,662 additions and 1,703 deletions.
42 changes: 27 additions & 15 deletions docs/source/_extentions/line_break.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
# -*- coding: utf-8 -*-

"""
ReST directive for creating line break in your documentation when needed.
The directive does note require any argument.
Example::
.. line-break::
"""

from docutils import nodes
from docutils.parsers.rst import Directive, directives


class LineBreak(Directive):
has_content = False
required_arguments = 0
optional_arguments = 0
final_argument_whitespace = False
option_spec = {}
html = "<br/>"

def run(self):
"""
ReST directive for creating line break in your documentation when needed. The directive does note require any argument.
Example:
.. line-break::"""

has_content: bool = False
"directive have no content"

required_arguments: int = 0
"directive have no arguments"

optional_arguments: int = 0
"directive have no optional arguments"

final_argument_whitespace: bool = False
"directive have no whitspaces between arguments"

option_spec: dict = {}
"no option specs"

html: str = "<br/>"
"the html code to inject in the output"

def run(self) -> list:
return [nodes.raw("", self.html, format="html")]


def setup(builder):
def setup(builder) -> None:
directives.register_directive("line-break", LineBreak)
87 changes: 0 additions & 87 deletions docs/source/_extentions/video.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{% block details %}
{% if methods -%}
{% for item in methods if item not in inherited_members -%}
.. autofunction:: {{ module }}.{{ objname }}.{{ item }}
.. automethod:: {{ module }}.{{ objname }}.{{ item }}
{% endfor -%}
{% endif -%}
{% endblock -%}
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"notfound.extension",
"sphinxcontrib.spelling",
"sphinxcontrib.autoprogram",
"_extentions.video",
"_extentions.line_break",
# "sphinx_autodoc_typehints",
]
Expand Down Expand Up @@ -170,3 +169,4 @@
# -- Options for autosummary/autodoc output ------------------------------------
autosummary_generate = True
autoclass_content = "class"
autodoc_typehints = "description"
25 changes: 22 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ def lint(session):
session.run("pre-commit", "run", "--a", *session.posargs)


@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
@nox.session(python=["3.7", "3.8", "3.9", "3.10"], reuse_venv=True)
def test(session):
session.install(".[test]")
session.run("pytest", "--color=yes", "tests")
test_files = session.posargs or ["tests"]
session.run("pytest", "--color=yes", *test_files)


@nox.session(reuse_venv=True)
def docs(session):
session.install(".[doc]")
session.run("rm", "-rf", "docs/build/", external=True)
session.run(
"sphinx-apidoc",
"--force",
Expand All @@ -25,7 +27,7 @@ def docs(session):
"docs/source/modules",
"./sepal_ui",
)
session.run("sphinx-build", "-b", "html", "docs/source", "build")
session.run("sphinx-build", "-v", "-b", "html", "docs/source", "build")


@nox.session(name="docs-live", reuse_venv=False)
Expand All @@ -41,3 +43,20 @@ def docs_live(session):
"./sepal_ui",
)
session.run("sphinx-autobuild", "-b", "html", "docs/source", "build")


@nox.session(name="mypy", reuse_venv=True)
def mypy(session):
session.install(".[dev]")
test_files = session.posargs or ["sepal_ui"]
session.run(
"mypy",
"--scripts-are-modules",
"--ignore-missing-imports",
"--install-types",
"--non-interactive",
"--disable-error-code",
"func-returns-value",
"--warn-redundant-casts",
*test_files,
)
Loading

0 comments on commit bc1804f

Please # to comment.