Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:
- id: text-unicode-replacement-char

- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
rev: v2.4.3
hooks:
- id: codespell
name: codespell (add false positives to pyproject.toml)
Expand All @@ -67,7 +67,7 @@ repos:
- tomli

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
rev: v0.16.1
hooks:
- id: ruff
name: ruff (see https://docs.astral.sh/ruff/rules)
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import os
import sys

from datetime import datetime

from packaging.version import Version

sys.path.insert(0, os.path.abspath(".."))
Expand Down
3 changes: 1 addition & 2 deletions plasmapy_sphinx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@
if sys.version_info < (3, 8): # coverage: ignore
raise ImportError("plasmapy_sphinx does not support Python < 3.8")

from importlib.metadata import version, PackageNotFoundError
from importlib.metadata import PackageNotFoundError, version

from plasmapy_sphinx import autodoc, automodsumm, directives, utils


# define version
try:
# note: if there's any distribution metadata in your source files, then this
Expand Down
11 changes: 6 additions & 5 deletions plasmapy_sphinx/autodoc/automodapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@
import inspect
import re
import warnings

from collections import OrderedDict

from docutils.parsers.rst import directives
from docutils.statemachine import StringList
from packaging.version import Version
Expand All @@ -320,10 +320,11 @@ class RemovedInSphinx50Warning(PendingDeprecationWarning):
pass


from sphinx.ext.autodoc import bool_option, ModuleDocumenter
from typing import Any, Callable, Dict, List, Optional, Union

from sphinx.ext.autodoc import ModuleDocumenter, bool_option
from sphinx.locale import __
from sphinx.util import logging
from typing import Any, Callable, Dict, List, Optional, Union

from plasmapy_sphinx.automodsumm.core import AutomodsummOptions, option_str_list
from plasmapy_sphinx.utils import default_grouping_info
Expand Down Expand Up @@ -380,7 +381,7 @@ def condition_toctree_option(self):
:rst:dir:`automodapi:toctree` and :rst:dir:`automodapi:no-toctree`
for additional details.)
"""
if "no-toctree" in self.options and self.options["no-toctree"]:
if self.options.get("no-toctree"):
if "toctree" in self.options:
del self.options["toctree"]
elif "toctree" not in self.options:
Expand Down Expand Up @@ -433,7 +434,7 @@ def condition_group_options(self):
:rst:dir:`automodapi:groups`, :rst:dir:`automodapi:exclude-groups`, and
:rst:dir:`automodapi:no-groups` for additional details.)
"""
if "no-groups" in self.options and self.options["no-groups"]:
if self.options.get("no-groups"):
self.options["groups"] = []
if "exclude-groups" in self.options:
del self.options["exclude-groups"]
Expand Down
4 changes: 2 additions & 2 deletions plasmapy_sphinx/automodsumm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@
]

import os

from importlib import import_module
from typing import Any, Callable, Dict, List, Tuple, Union

from packaging.version import Version
from sphinx import __version__ as sphinx_version
from sphinx.ext.autosummary import Autosummary
from sphinx.util import logging
from typing import Any, Callable, Dict, List, Tuple, Union

from plasmapy_sphinx.automodsumm.generate import GenDocsFromAutomodsumm
from plasmapy_sphinx.utils import (
Expand Down
4 changes: 2 additions & 2 deletions plasmapy_sphinx/automodsumm/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import os
import re
from typing import Any, Dict, List

from jinja2 import TemplateNotFound
from packaging.version import Version
Expand All @@ -20,7 +21,6 @@
from sphinx.locale import __
from sphinx.util import logging
from sphinx.util.osutil import ensuredir
from typing import Any, Dict, List

from plasmapy_sphinx.utils import templates_dir

Expand Down Expand Up @@ -255,7 +255,7 @@ def generate_docs(
_info = self.logger.info
_warn = self.logger.warning

showed_sources = list(sorted(source_filenames))
showed_sources = sorted(source_filenames)
_info(
__(f"[automodsumm] generating stub files for {len(showed_sources)} sources")
)
Expand Down
2 changes: 1 addition & 1 deletion plasmapy_sphinx/ext/css.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from sphinx.application import Sphinx

from plasmapy_sphinx.utils import static_dir, css_dir
from plasmapy_sphinx.utils import css_dir, static_dir


def add_plasmapy_css(app, config):
Expand Down
8 changes: 4 additions & 4 deletions plasmapy_sphinx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
the core functionality in `plasmapy_sphinx`.
"""
__all__ = [
"css_dir",
"default_grouping_info",
"find_mod_objs",
"get_custom_grouping_info",
"package_dir",
"static_dir",
"templates_dir",
"theme_dir",
"css_dir",
"static_dir",
]

import inspect

from collections import OrderedDict
from importlib import import_module
from sphinx.application import Sphinx
from pathlib import Path
from typing import Any, Dict

from sphinx.application import Sphinx

package_dir = Path(__file__).parent.absolute()
"""Absolute path to the `plasmapy_sphinx` package directory."""

Expand Down