Skip to content

Commit

Permalink
refactor: Format by Ruff (using pre-commit run)
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed May 9, 2024
1 parent 9deed6e commit eb11ea1
Show file tree
Hide file tree
Showing 34 changed files with 40 additions and 18 deletions.
1 change: 1 addition & 0 deletions sphinx_revealjs/_ext/highlightings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Internal extension for highlighting of Reveal.js."""

from docutils.parsers.rst import directives # type: ignore
from sphinx.application import Sphinx
from sphinx.directives.code import CodeBlock, LiteralInclude
Expand Down
1 change: 1 addition & 0 deletions sphinx_revealjs/_ext/notes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Internal extension for Speaker view or Reveal.js."""

import html

from docutils import nodes # type: ignore
Expand Down
5 changes: 2 additions & 3 deletions sphinx_revealjs/contexts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contexts for passing between objects."""

import json
from typing import Dict, List, Optional, Union

Expand All @@ -12,9 +13,7 @@
class RevealjsEngine:
"""Reveal.js core metadata."""

def __init__(
self, version: int, js_path: str, css_path: str, theme_dir: str
): # noqa
def __init__(self, version: int, js_path: str, css_path: str, theme_dir: str): # noqa
self.version = version
self.js_path = js_path
self.css_path = css_path
Expand Down
1 change: 1 addition & 0 deletions sphinx_revealjs/directives.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom directives for Reveal.js."""

import json

from docutils.nodes import Sequential # type: ignore
Expand Down
1 change: 1 addition & 0 deletions sphinx_revealjs/ext/footnotes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extension to add custom CSS for footnotes."""

from pathlib import Path

from sphinx.application import Sphinx
Expand Down
1 change: 1 addition & 0 deletions sphinx_revealjs/ext/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This is optional extension.
You need install extra and configure to use it.
"""

from pathlib import Path
from typing import Dict, Set

Expand Down
13 changes: 4 additions & 9 deletions sphinx_revealjs/nodes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom docutils nodes for Reveal.js."""

from docutils import nodes # type: ignore


Expand Down Expand Up @@ -28,21 +29,15 @@ def attributes_str(self):
return " ".join(pair)


class revealjs_vertical(
SectionTagRenderer, nodes.Structural, nodes.Element
): # noqa: D101,E501
class revealjs_vertical(SectionTagRenderer, nodes.Structural, nodes.Element): # noqa: D101,E501
pass


class revealjs_section(
SectionTagRenderer, nodes.Structural, nodes.Element
): # noqa: D101,E501
class revealjs_section(SectionTagRenderer, nodes.Structural, nodes.Element): # noqa: D101,E501
pass


class revealjs_break(
SectionTagRenderer, nodes.Structural, nodes.Element
): # noqa: D101,E501
class revealjs_break(SectionTagRenderer, nodes.Structural, nodes.Element): # noqa: D101,E501
pass


Expand Down
1 change: 1 addition & 0 deletions sphinx_revealjs/themes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Theme handle module."""

from pathlib import Path

DEFAULT_THEME = "revealjs-basic"
Expand Down
1 change: 1 addition & 0 deletions sphinx_revealjs/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Util as functions for some modules."""

from pathlib import Path
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions sphinx_revealjs/writers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom write module."""

from docutils.nodes import ( # type: ignore
Element,
SkipNode,
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration for pytest."""

import inspect

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_comments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for comment block."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_configurations/test_adding_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build tests for configuration parameters."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
5 changes: 2 additions & 3 deletions tests/test_configurations/test_complex_variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build tests for configuration parameters."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand All @@ -12,9 +13,7 @@
"revealjs_css_files": ["custom.css"],
},
)
def test_default_theme_css_comes_before_custom_css(
app: SphinxTestApp, status, warning
): # noqa
def test_default_theme_css_comes_before_custom_css(app: SphinxTestApp, status, warning): # noqa
soup = soup_html(app, "index.html")
stylesheet_href_list = [e["href"] for e in soup.find_all("link", rel="stylesheet")]
default_theme_index = stylesheet_href_list.index(
Expand Down
1 change: 1 addition & 0 deletions tests/test_configurations/test_generatings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for generating giles."""

import pytest
from sphinx.testing.util import SphinxTestApp

Expand Down
1 change: 1 addition & 0 deletions tests/test_configurations/test_scripts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build tests for configuration parameters."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_configurations/test_theme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build tests for configuration parameters."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
5 changes: 2 additions & 3 deletions tests/test_configurations/test_use_section_ids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build tests for configuration parameters."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down Expand Up @@ -26,9 +27,7 @@ def test_inject_id_to_all_sections(app: SphinxTestApp, status, warning): # noqa
"revealjs_use_section_ids": True,
},
)
def test_inject_id_to_all_sections_with_label(
app: SphinxTestApp, status, warning
): # noqa
def test_inject_id_to_all_sections_with_label(app: SphinxTestApp, status, warning): # noqa
soup = soup_html(app, "with-label.html")
h2_section = soup.h2.parent
assert "id" in h2_section.attrs
Expand Down
1 change: 1 addition & 0 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for deprecated messages from Sphinx."""

import sys

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_directives/test_break.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for ``revealjs-break`` directive."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_directives/test_code_block.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for ``revealjs-code-block`` directive."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_directives/test_fragments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for ``revealjs-fragments`` directive."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_directives/test_literalinclude.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for ``revealjs-literalinclude`` directive."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_directives/test_notes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for ``revealjs-notes`` directive."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_directives/test_section.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for ``revealjs-section`` directive."""

import io
from textwrap import dedent

Expand Down
1 change: 1 addition & 0 deletions tests/test_directives/test_slide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for ``revealjs_slide`` directive."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/test_extensions/test_footnotes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for sphix_revealjs.ext.footnotes."""

import pytest
from sphinx.testing.util import SphinxTestApp

Expand Down
1 change: 1 addition & 0 deletions tests/test_extensions/test_screenshot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for sphix_revealjs.ext.screenshot."""

import magic
import pytest
from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions tests/test_generatings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for generating files."""

from pathlib import Path

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_other_builders.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cases for not revealjs builders."""

import pytest
from sphinx.testing.util import SphinxTestApp

Expand Down
1 change: 1 addition & 0 deletions tests/test_section.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build tests for core behaviors of presentation(sections)."""

import pytest
from sphinx.testing.util import SphinxTestApp
from testutils import soup_html
Expand Down
1 change: 1 addition & 0 deletions tests/testutils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test support functions."""

from bs4 import BeautifulSoup
from sphinx.testing.util import SphinxTestApp

Expand Down
1 change: 1 addition & 0 deletions tools/bump_extra_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Bump post version writer."""

import argparse
import configparser
from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions tools/fetch_revealjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* After editable install
* Before build package archibves
"""

import argparse
import json
import logging
Expand Down

0 comments on commit eb11ea1

Please sign in to comment.