Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usage of deprecated sphinx.util.status_iterator #398

Merged
merged 2 commits into from
Sep 24, 2023
Merged
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
13 changes: 10 additions & 3 deletions autoapi/mappers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
from sphinx.util.osutil import ensuredir
import sphinx.util.logging

try:
from sphinx.util.display import status_iterator
except ImportError:
# This method was moved into sphinx.util.display in Sphinx 6.1.0. Before
# that it resided in sphinx.util.
from sphinx.util import status_iterator

from ..settings import API_ROOT, TEMPLATE_DIR

LOGGER = sphinx.util.logging.getLogger(__name__)
Expand Down Expand Up @@ -207,7 +214,7 @@ def _wrapped_prepare(value):
def load(self, patterns, dirs, ignore=None):
"""Load objects from the filesystem into the ``paths`` dictionary."""
paths = list(self.find_files(patterns=patterns, dirs=dirs, ignore=ignore))
for path in sphinx.util.status_iterator(
for path in status_iterator(
paths,
colorize("bold", "[AutoAPI] Reading files... "),
"darkgreen",
Expand Down Expand Up @@ -290,7 +297,7 @@ def add_object(self, obj):

def map(self, options=None):
"""Trigger find of serialized sources and build objects"""
for _, data in sphinx.util.status_iterator(
for _, data in status_iterator(
self.paths.items(),
colorize("bold", "[AutoAPI] ") + "Mapping Data... ",
length=len(self.paths),
Expand All @@ -308,7 +315,7 @@ def create_class(self, data, options=None, **kwargs):
raise NotImplementedError

def output_rst(self, root, source_suffix):
for _, obj in sphinx.util.status_iterator(
for _, obj in status_iterator(
self.objects.items(),
colorize("bold", "[AutoAPI] ") + "Rendering Data... ",
length=len(self.objects),
Expand Down
9 changes: 8 additions & 1 deletion autoapi/mappers/python/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
import sphinx.util.docstrings
import sphinx.util.logging

try:
from sphinx.util.display import status_iterator
except ImportError:
# This method was moved into sphinx.util.display in Sphinx 6.1.0. Before
# that it resided in sphinx.util.
from sphinx.util import status_iterator

from ..base import SphinxMapperBase
from .parser import Parser
from .objects import (
Expand Down Expand Up @@ -291,7 +298,7 @@ def load(self, patterns, dirs, ignore=None):
)
return False

for dir_root, path in sphinx.util.status_iterator(
for dir_root, path in status_iterator(
dir_root_files,
colorize("bold", "[AutoAPI] Reading files... "),
length=len(dir_root_files),
Expand Down