mkdocstrings-matlab 0.5.0__py3-none-any.whl → 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mkdocstrings_handlers/matlab/__init__.py +2 -1
- mkdocstrings_handlers/matlab/collect.py +87 -33
- mkdocstrings_handlers/matlab/handler.py +7 -1
- mkdocstrings_handlers/matlab/models.py +31 -27
- mkdocstrings_handlers/matlab/treesitter.py +2 -1
- {mkdocstrings_matlab-0.5.0.dist-info → mkdocstrings_matlab-0.7.0.dist-info}/METADATA +14 -8
- mkdocstrings_matlab-0.7.0.dist-info/RECORD +15 -0
- mkdocstrings_matlab-0.5.0.dist-info/RECORD +0 -15
- {mkdocstrings_matlab-0.5.0.dist-info → mkdocstrings_matlab-0.7.0.dist-info}/WHEEL +0 -0
- {mkdocstrings_matlab-0.5.0.dist-info → mkdocstrings_matlab-0.7.0.dist-info}/entry_points.txt +0 -0
- {mkdocstrings_matlab-0.5.0.dist-info → mkdocstrings_matlab-0.7.0.dist-info}/licenses/LICENSE +0 -0
| @@ -1,10 +1,11 @@ | |
| 1 1 | 
             
            """MATLAB handler for mkdocstrings."""
         | 
| 2 2 |  | 
| 3 3 | 
             
            from mkdocstrings_handlers.matlab.handler import get_handler
         | 
| 4 | 
            +
            from mkdocstrings_handlers.matlab import collect, handler, models, treesitter
         | 
| 4 5 | 
             
            from _griffe.enumerations import DocstringSectionKind
         | 
| 5 6 | 
             
            from _griffe.docstrings import numpy, google
         | 
| 6 7 |  | 
| 7 | 
            -
            __all__ = ["get_handler"]
         | 
| 8 | 
            +
            __all__ = ["get_handler", "collect", "handler", "models", "treesitter"]
         | 
| 8 9 |  | 
| 9 10 |  | 
| 10 11 | 
             
            # Add custom sections to the numpy and google docstring parsers
         | 
| @@ -1,7 +1,9 @@ | |
| 1 | 
            +
            """Functions and classes for collecting MATLAB objects from paths."""
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            from collections import defaultdict, deque
         | 
| 2 4 | 
             
            from copy import copy, deepcopy
         | 
| 3 5 | 
             
            from pathlib import Path
         | 
| 4 | 
            -
            from typing import Mapping, Sequence
         | 
| 6 | 
            +
            from typing import Mapping, Sequence, Callable, TypeVar
         | 
| 5 7 |  | 
| 6 8 | 
             
            from _griffe.collections import LinesCollection as GLC, ModulesCollection
         | 
| 7 9 | 
             
            from _griffe.docstrings.models import (
         | 
| @@ -22,14 +24,16 @@ from mkdocstrings_handlers.matlab.models import ( | |
| 22 24 | 
             
                Docstring,
         | 
| 23 25 | 
             
                DocstringSectionText,
         | 
| 24 26 | 
             
                Function,
         | 
| 27 | 
            +
                Folder,
         | 
| 25 28 | 
             
                MatlabMixin,
         | 
| 26 | 
            -
                Object,
         | 
| 27 29 | 
             
                Namespace,
         | 
| 28 | 
            -
                 | 
| 30 | 
            +
                PathMixin,
         | 
| 29 31 | 
             
            )
         | 
| 30 32 | 
             
            from mkdocstrings_handlers.matlab.treesitter import FileParser
         | 
| 31 33 |  | 
| 32 34 |  | 
| 35 | 
            +
            PathType = TypeVar("PathType", bound=PathMixin)
         | 
| 36 | 
            +
             | 
| 33 37 | 
             
            __all__ = ["LinesCollection", "PathCollection"]
         | 
| 34 38 |  | 
| 35 39 |  | 
| @@ -102,6 +106,7 @@ class PathCollection(ModulesCollection): | |
| 102 106 | 
             
                    matlab_path (Sequence[str | Path]): A list of strings or Path objects representing the MATLAB paths.
         | 
| 103 107 | 
             
                    recursive (bool, optional): If True, recursively adds all subdirectories of the given paths to the search path. Defaults to False.
         | 
| 104 108 | 
             
                    config (Mapping, optional): Configuration settings for the PathCollection. Defaults to {}.
         | 
| 109 | 
            +
                    config_path (Path | None, optional): The path to the configuration file. Defaults to None.
         | 
| 105 110 |  | 
| 106 111 | 
             
                Methods:
         | 
| 107 112 | 
             
                    members() -> dict:
         | 
| @@ -128,6 +133,7 @@ class PathCollection(ModulesCollection): | |
| 128 133 | 
             
                    matlab_path: Sequence[str | Path],
         | 
| 129 134 | 
             
                    recursive: bool = False,
         | 
| 130 135 | 
             
                    config: Mapping = {},
         | 
| 136 | 
            +
                    config_path: Path | None = None,
         | 
| 131 137 | 
             
                ) -> None:
         | 
| 132 138 | 
             
                    """
         | 
| 133 139 | 
             
                    Initialize an instance of PathCollection.
         | 
| @@ -146,6 +152,8 @@ class PathCollection(ModulesCollection): | |
| 146 152 | 
             
                    self._mapping: dict[str, deque[Path]] = defaultdict(deque)
         | 
| 147 153 | 
             
                    self._models: dict[Path, LazyModel] = {}
         | 
| 148 154 | 
             
                    self._members: dict[Path, list[tuple[str, Path]]] = defaultdict(list)
         | 
| 155 | 
            +
                    self._folders: dict[str, LazyModel] = {}
         | 
| 156 | 
            +
                    self._config_path = config_path
         | 
| 149 157 |  | 
| 150 158 | 
             
                    self.config = config
         | 
| 151 159 | 
             
                    self.lines_collection = LinesCollection()
         | 
| @@ -186,6 +194,26 @@ class PathCollection(ModulesCollection): | |
| 186 194 | 
             
                        model = self._models[self._mapping[identifier][0]].model()
         | 
| 187 195 | 
             
                        if model is not None:
         | 
| 188 196 | 
             
                            model = self.update_model(model, config)
         | 
| 197 | 
            +
             | 
| 198 | 
            +
                    elif self._config_path is not None and "/" in identifier:
         | 
| 199 | 
            +
                        absolute_path = (self._config_path / Path(identifier)).resolve()
         | 
| 200 | 
            +
                        if absolute_path.exists():
         | 
| 201 | 
            +
                            path = absolute_path.relative_to(self._config_path)
         | 
| 202 | 
            +
                            if path.suffix:
         | 
| 203 | 
            +
                                path, member = path.parent, path.stem
         | 
| 204 | 
            +
                            else:
         | 
| 205 | 
            +
                                member = None
         | 
| 206 | 
            +
                            lazymodel = self._folders.get(str(path), None)
         | 
| 207 | 
            +
             | 
| 208 | 
            +
                            if lazymodel is not None:
         | 
| 209 | 
            +
                                model = lazymodel.model()
         | 
| 210 | 
            +
                                if model is not None and member is not None:
         | 
| 211 | 
            +
                                    model = model.members.get(member, None)
         | 
| 212 | 
            +
                            else:
         | 
| 213 | 
            +
                                model = None
         | 
| 214 | 
            +
                        else:
         | 
| 215 | 
            +
                            model = None
         | 
| 216 | 
            +
             | 
| 189 217 | 
             
                    else:
         | 
| 190 218 | 
             
                        model = None
         | 
| 191 219 | 
             
                        name_parts = identifier.split(".")
         | 
| @@ -236,7 +264,7 @@ class PathCollection(ModulesCollection): | |
| 236 264 | 
             
                                case DocstringSectionKind.parameters:
         | 
| 237 265 | 
             
                                    section.title = "Input arguments:"
         | 
| 238 266 | 
             
                                case DocstringSectionKind.returns:
         | 
| 239 | 
            -
                                    section.title= "Output arguments:"
         | 
| 267 | 
            +
                                    section.title = "Output arguments:"
         | 
| 240 268 | 
             
                                case DocstringSectionKind.other_parameters:
         | 
| 241 269 | 
             
                                    section.title = "Name-Value Arguments:"
         | 
| 242 270 |  | 
| @@ -509,13 +537,25 @@ class PathCollection(ModulesCollection): | |
| 509 537 | 
             
                    else:
         | 
| 510 538 | 
             
                        self._path.appendleft(path)
         | 
| 511 539 |  | 
| 512 | 
            -
                     | 
| 513 | 
            -
                    for member in members:
         | 
| 540 | 
            +
                    for member in PathGlobber(path, recursive=recursive):
         | 
| 514 541 | 
             
                        model = LazyModel(member, self)
         | 
| 515 542 | 
             
                        self._models[member] = model
         | 
| 516 543 | 
             
                        self._mapping[model.name].append(member)
         | 
| 517 544 | 
             
                        self._members[path].append((model.name, member))
         | 
| 518 545 |  | 
| 546 | 
            +
                        if self._config_path is not None and member.parent.stem[0] not in [
         | 
| 547 | 
            +
                            "+",
         | 
| 548 | 
            +
                            "@",
         | 
| 549 | 
            +
                        ]:
         | 
| 550 | 
            +
                            if member.parent.is_relative_to(self._config_path):
         | 
| 551 | 
            +
                                relative_path = member.parent.relative_to(self._config_path)
         | 
| 552 | 
            +
                                if member.parent not in self._folders:
         | 
| 553 | 
            +
                                    self._folders[str(relative_path)] = LazyModel(
         | 
| 554 | 
            +
                                        member.parent, self
         | 
| 555 | 
            +
                                    )
         | 
| 556 | 
            +
                            else:
         | 
| 557 | 
            +
                                pass  # TODO: Issue warning?
         | 
| 558 | 
            +
             | 
| 519 559 | 
             
                def rm_path(self, path: str | Path, recursive: bool = False):
         | 
| 520 560 | 
             
                    """
         | 
| 521 561 | 
             
                    Removes a path from the search path and updates the namespace and database accordingly.
         | 
| @@ -608,6 +648,10 @@ class LazyModel: | |
| 608 648 | 
             
                    self._path_collection: PathCollection = path_collection
         | 
| 609 649 | 
             
                    self._lines_collection: LinesCollection = path_collection.lines_collection
         | 
| 610 650 |  | 
| 651 | 
            +
                @property
         | 
| 652 | 
            +
                def is_folder(self) -> bool:
         | 
| 653 | 
            +
                    return self._path.is_dir() and self._path.name[0] not in ["+", "@"]
         | 
| 654 | 
            +
             | 
| 611 655 | 
             
                @property
         | 
| 612 656 | 
             
                def is_class_folder(self) -> bool:
         | 
| 613 657 | 
             
                    return self._path.is_dir() and self._path.name[0] == "@"
         | 
| @@ -646,7 +690,7 @@ class LazyModel: | |
| 646 690 | 
             
                    else:
         | 
| 647 691 | 
             
                        return name
         | 
| 648 692 |  | 
| 649 | 
            -
                def model(self):
         | 
| 693 | 
            +
                def model(self) -> MatlabMixin | None:
         | 
| 650 694 | 
             
                    if not self._path.exists():
         | 
| 651 695 | 
             
                        return None
         | 
| 652 696 |  | 
| @@ -655,19 +699,22 @@ class LazyModel: | |
| 655 699 | 
             
                            self._model = self._collect_classfolder(self._path)
         | 
| 656 700 | 
             
                        elif self.is_namespace:
         | 
| 657 701 | 
             
                            self._model = self._collect_namespace(self._path)
         | 
| 702 | 
            +
                        elif self.is_folder:
         | 
| 703 | 
            +
                            self._model = self._collect_folder(self._path)
         | 
| 658 704 | 
             
                        else:
         | 
| 659 705 | 
             
                            self._model = self._collect_path(self._path)
         | 
| 660 706 | 
             
                    if self._model is not None:
         | 
| 661 707 | 
             
                        self._model.parent = self._collect_parent(self._path.parent)
         | 
| 662 708 | 
             
                    return self._model
         | 
| 663 709 |  | 
| 664 | 
            -
                def _collect_parent(self, path: Path) ->  | 
| 710 | 
            +
                def _collect_parent(self, path: Path) -> _ParentGrabber | None:
         | 
| 665 711 | 
             
                    if self.is_in_namespace:
         | 
| 666 | 
            -
                         | 
| 667 | 
            -
                             | 
| 668 | 
            -
                         | 
| 712 | 
            +
                        grabber: Callable[[], MatlabMixin | None] = self._path_collection._models[
         | 
| 713 | 
            +
                            path
         | 
| 714 | 
            +
                        ].model
         | 
| 715 | 
            +
                        parent = _ParentGrabber(grabber)
         | 
| 669 716 | 
             
                    else:
         | 
| 670 | 
            -
                        parent =  | 
| 717 | 
            +
                        parent = None
         | 
| 671 718 | 
             
                    return parent
         | 
| 672 719 |  | 
| 673 720 | 
             
                def _collect_path(self, path: Path) -> MatlabMixin:
         | 
| @@ -676,6 +723,27 @@ class LazyModel: | |
| 676 723 | 
             
                    self._lines_collection[path] = file.content.split("\n")
         | 
| 677 724 | 
             
                    return model
         | 
| 678 725 |  | 
| 726 | 
            +
                def _collect_directory(self, path: Path, model: PathType) -> PathType:
         | 
| 727 | 
            +
                    for member in path.iterdir():
         | 
| 728 | 
            +
                        if member.is_dir() and member.name[0] in ["+", "@"]:
         | 
| 729 | 
            +
                            submodel = self._path_collection._models[member].model()
         | 
| 730 | 
            +
                            if submodel is not None:
         | 
| 731 | 
            +
                                model.members[submodel.name] = submodel
         | 
| 732 | 
            +
             | 
| 733 | 
            +
                        elif member.is_file() and member.suffix == ".m":
         | 
| 734 | 
            +
                            if member.name == "Contents.m":
         | 
| 735 | 
            +
                                contentsfile = self._collect_path(member)
         | 
| 736 | 
            +
                                model.docstring = contentsfile.docstring
         | 
| 737 | 
            +
                            else:
         | 
| 738 | 
            +
                                submodel = self._path_collection._models[member].model()
         | 
| 739 | 
            +
                                if submodel is not None:
         | 
| 740 | 
            +
                                    model.members[submodel.name] = submodel
         | 
| 741 | 
            +
             | 
| 742 | 
            +
                    if model.docstring is None:
         | 
| 743 | 
            +
                        model.docstring = self._collect_readme_md(path, model)
         | 
| 744 | 
            +
             | 
| 745 | 
            +
                    return model
         | 
| 746 | 
            +
             | 
| 679 747 | 
             
                def _collect_classfolder(self, path: Path) -> Classfolder | None:
         | 
| 680 748 | 
             
                    classfile = path / (path.name[1:] + ".m")
         | 
| 681 749 | 
             
                    if not classfile.exists():
         | 
| @@ -696,31 +764,17 @@ class LazyModel: | |
| 696 764 | 
             
                        model.docstring = self._collect_readme_md(path, model)
         | 
| 697 765 | 
             
                    return model
         | 
| 698 766 |  | 
| 699 | 
            -
                def _collect_namespace(self, path: Path) -> Namespace | 
| 767 | 
            +
                def _collect_namespace(self, path: Path) -> Namespace:
         | 
| 700 768 | 
             
                    name = self.name[1:].split(".")[-1]
         | 
| 701 769 | 
             
                    model = Namespace(name, filepath=path, path_collection=self._path_collection)
         | 
| 770 | 
            +
                    return self._collect_directory(path, model)
         | 
| 702 771 |  | 
| 703 | 
            -
             | 
| 704 | 
            -
             | 
| 705 | 
            -
             | 
| 706 | 
            -
             | 
| 707 | 
            -
                                model.members[submodel.name] = submodel
         | 
| 708 | 
            -
             | 
| 709 | 
            -
                        elif member.is_file() and member.suffix == ".m":
         | 
| 710 | 
            -
                            if member.name == "Contents.m":
         | 
| 711 | 
            -
                                contentsfile = self._collect_path(member)
         | 
| 712 | 
            -
                                model.docstring = contentsfile.docstring
         | 
| 713 | 
            -
                            else:
         | 
| 714 | 
            -
                                submodel = self._path_collection._models[member].model()
         | 
| 715 | 
            -
                                if submodel is not None:
         | 
| 716 | 
            -
                                    model.members[submodel.name] = submodel
         | 
| 717 | 
            -
             | 
| 718 | 
            -
                    if model.docstring is None:
         | 
| 719 | 
            -
                        model.docstring = self._collect_readme_md(path, model)
         | 
| 720 | 
            -
             | 
| 721 | 
            -
                    return model
         | 
| 772 | 
            +
                def _collect_folder(self, path: Path) -> Folder:
         | 
| 773 | 
            +
                    name = path.stem
         | 
| 774 | 
            +
                    model = Folder(name, filepath=path, path_collection=self._path_collection)
         | 
| 775 | 
            +
                    return self._collect_directory(path, model)
         | 
| 722 776 |  | 
| 723 | 
            -
                def _collect_readme_md(self, path, parent:  | 
| 777 | 
            +
                def _collect_readme_md(self, path, parent: PathMixin) -> Docstring | None:
         | 
| 724 778 | 
             
                    if (path / "README.md").exists():
         | 
| 725 779 | 
             
                        readme = path / "README.md"
         | 
| 726 780 | 
             
                    elif (path / "readme.md").exists():
         | 
| @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            """The mkdocstrings handler for processing MATLAB code documentation."""
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            from pathlib import Path
         | 
| 2 4 | 
             
            from collections import ChainMap
         | 
| 3 5 | 
             
            from markdown import Markdown
         | 
| @@ -51,6 +53,7 @@ class MatlabHandler(BaseHandler): | |
| 51 53 | 
             
                    "members_order": rendering.Order.alphabetical.value,
         | 
| 52 54 | 
             
                    "filters": ["!^delete$|^disp$"],
         | 
| 53 55 | 
             
                    "group_by_category": True,
         | 
| 56 | 
            +
                    "show_subnamespaces": False,
         | 
| 54 57 | 
             
                    "summary": False,
         | 
| 55 58 | 
             
                    "show_labels": True,
         | 
| 56 59 | 
             
                    # Docstring options
         | 
| @@ -118,6 +121,7 @@ class MatlabHandler(BaseHandler): | |
| 118 121 | 
             
                        The `members` option takes precedence over `filters` (filters will still be applied recursively
         | 
| 119 122 | 
             
                        to lower members in the hierarchy). Default: `["!^delete$|^disp$"]`.
         | 
| 120 123 | 
             
                    group_by_category (bool): Group the object's children by categories: properties, classes, functions, and namespaces. Default: `True`.
         | 
| 124 | 
            +
                    show_subnamespaces (bool): When rendering a namespace, show its subnamespaces recursively. Default: `False`.
         | 
| 121 125 | 
             
                    summary (bool | dict[str, bool]): Whether to render summaries of namespaces, classes, functions (methods) and properties. Default: `False`.
         | 
| 122 126 | 
             
                    show_labels (bool): Whether to show labels of the members. Default: `True`.
         | 
| 123 127 |  | 
| @@ -172,13 +176,14 @@ class MatlabHandler(BaseHandler): | |
| 172 176 | 
             
                    super().__init__(*args, **kwargs)
         | 
| 173 177 |  | 
| 174 178 | 
             
                    if paths is None or config_file_path is None:
         | 
| 179 | 
            +
                        config_path = None
         | 
| 175 180 | 
             
                        full_paths = []
         | 
| 176 181 | 
             
                    else:
         | 
| 177 182 | 
             
                        config_path = Path(config_file_path).parent
         | 
| 178 183 | 
             
                        full_paths = [(config_path / path).resolve() for path in paths]
         | 
| 179 184 |  | 
| 180 185 | 
             
                    self.paths: PathCollection = PathCollection(
         | 
| 181 | 
            -
                        full_paths, recursive=paths_recursive
         | 
| 186 | 
            +
                        full_paths, recursive=paths_recursive, config_path=config_path
         | 
| 182 187 | 
             
                    )
         | 
| 183 188 | 
             
                    self.lines: LinesCollection = self.paths.lines_collection
         | 
| 184 189 | 
             
                    self._locale: str = locale
         | 
| @@ -249,6 +254,7 @@ class MatlabHandler(BaseHandler): | |
| 249 254 | 
             
                        }
         | 
| 250 255 |  | 
| 251 256 | 
             
                    # Map docstring options
         | 
| 257 | 
            +
                    final_config["show_submodules"] = config.get("show_subnamespaces", False)
         | 
| 252 258 | 
             
                    final_config["show_docstring_attributes"] = config.get(
         | 
| 253 259 | 
             
                        "show_docstring_properties", True
         | 
| 254 260 | 
             
                    )
         | 
| @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            """Classes to represent MATLAB objects and their properties."""
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            from typing import Any, TYPE_CHECKING, Callable
         | 
| 2 4 | 
             
            from functools import cached_property
         | 
| 3 5 | 
             
            from pathlib import Path
         | 
| @@ -97,7 +99,7 @@ class _ParentGrabber: | |
| 97 99 | 
             
                    __call__(): Calls the grabber function and returns a MatlabObject.
         | 
| 98 100 | 
             
                """
         | 
| 99 101 |  | 
| 100 | 
            -
                def __init__(self, grabber: "Callable[[],  | 
| 102 | 
            +
                def __init__(self, grabber: "Callable[[], MatlabMixin | None]") -> None:
         | 
| 101 103 | 
             
                    """
         | 
| 102 104 | 
             
                    Initializes the _ParentGrabber with a grabber function.
         | 
| 103 105 |  | 
| @@ -107,7 +109,7 @@ class _ParentGrabber: | |
| 107 109 | 
             
                    self._grabber = grabber
         | 
| 108 110 |  | 
| 109 111 | 
             
                @property
         | 
| 110 | 
            -
                def parent(self) -> " | 
| 112 | 
            +
                def parent(self) -> "MatlabMixin | None":
         | 
| 111 113 | 
             
                    """
         | 
| 112 114 | 
             
                    Calls the grabber function and returns a MatlabObject.
         | 
| 113 115 |  | 
| @@ -154,7 +156,7 @@ class MatlabObject(Object): | |
| 154 156 | 
             
                    Returns:
         | 
| 155 157 | 
             
                        str: The canonical path of the object.
         | 
| 156 158 | 
             
                    """
         | 
| 157 | 
            -
                    if  | 
| 159 | 
            +
                    if self.parent is None:
         | 
| 158 160 | 
             
                        return self.name
         | 
| 159 161 |  | 
| 160 162 | 
             
                    if isinstance(self.parent, MatlabObject):
         | 
| @@ -163,7 +165,7 @@ class MatlabObject(Object): | |
| 163 165 | 
             
                        parent = getattr(self.parent, "model", self.parent)
         | 
| 164 166 |  | 
| 165 167 | 
             
                    if isinstance(parent, Classfolder) and self.name == parent.name:
         | 
| 166 | 
            -
                        if  | 
| 168 | 
            +
                        if parent.parent is None:
         | 
| 167 169 | 
             
                            return self.name
         | 
| 168 170 | 
             
                        else:
         | 
| 169 171 | 
             
                            return f"{parent.parent.canonical_path}.{self.name}"
         | 
| @@ -171,23 +173,6 @@ class MatlabObject(Object): | |
| 171 173 | 
             
                        return f"{parent.canonical_path}.{self.name}" if parent else self.name
         | 
| 172 174 |  | 
| 173 175 |  | 
| 174 | 
            -
            class _Root(MatlabObject):
         | 
| 175 | 
            -
                """
         | 
| 176 | 
            -
                A class representing the root object in a MATLAB structure.
         | 
| 177 | 
            -
                All the objects that have the root object as parent are at the top level,
         | 
| 178 | 
            -
                and can be called directly.
         | 
| 179 | 
            -
                """
         | 
| 180 | 
            -
             | 
| 181 | 
            -
                def __init__(self) -> None:
         | 
| 182 | 
            -
                    super().__init__("ROOT", parent=None)
         | 
| 183 | 
            -
             | 
| 184 | 
            -
                def __repr__(self) -> str:
         | 
| 185 | 
            -
                    return "MATLABROOT"
         | 
| 186 | 
            -
             | 
| 187 | 
            -
             | 
| 188 | 
            -
            ROOT = _Root()
         | 
| 189 | 
            -
             | 
| 190 | 
            -
             | 
| 191 176 | 
             
            class PathMixin(Object):
         | 
| 192 177 | 
             
                """
         | 
| 193 178 | 
             
                A mixin class that provides a filepath attribute and related functionality.
         | 
| @@ -198,7 +183,6 @@ class PathMixin(Object): | |
| 198 183 |  | 
| 199 184 | 
             
                def __init__(self, *args: Any, filepath: Path | None = None, **kwargs: Any) -> None:
         | 
| 200 185 | 
             
                    self._filepath: Path | None = filepath
         | 
| 201 | 
            -
             | 
| 202 186 | 
             
                    super().__init__(*args, **kwargs)
         | 
| 203 187 |  | 
| 204 188 | 
             
                @property
         | 
| @@ -213,22 +197,22 @@ class MatlabMixin(Object): | |
| 213 197 | 
             
                def __init__(
         | 
| 214 198 | 
             
                    self,
         | 
| 215 199 | 
             
                    *args: Any,
         | 
| 216 | 
            -
                    parent: "Class | Classfolder | Namespace |  | 
| 200 | 
            +
                    parent: "Class | Classfolder | Namespace | None" = None,
         | 
| 217 201 | 
             
                    docstring: Docstring | None = None,
         | 
| 218 202 | 
             
                    **kwargs: Any,
         | 
| 219 203 | 
             
                ):
         | 
| 220 | 
            -
                    self._parent: "Class | Classfolder | Namespace |  | 
| 204 | 
            +
                    self._parent: "Class | Classfolder | Namespace | _ParentGrabber | None" = parent
         | 
| 221 205 | 
             
                    self._docstring: Docstring | None = docstring
         | 
| 222 206 | 
             
                    super().__init__(*args, **kwargs)
         | 
| 223 207 |  | 
| 224 208 | 
             
                @property
         | 
| 225 | 
            -
                def parent(self) -> Object:
         | 
| 209 | 
            +
                def parent(self) -> Object | None:
         | 
| 226 210 | 
             
                    if isinstance(self._parent, MatlabMixin):
         | 
| 227 211 | 
             
                        return self._parent
         | 
| 228 212 | 
             
                    elif isinstance(self._parent, _ParentGrabber):
         | 
| 229 213 | 
             
                        return self._parent.parent
         | 
| 230 214 | 
             
                    else:
         | 
| 231 | 
            -
                        return  | 
| 215 | 
            +
                        return None
         | 
| 232 216 |  | 
| 233 217 | 
             
                @parent.setter
         | 
| 234 218 | 
             
                def parent(self, value):
         | 
| @@ -557,14 +541,34 @@ class Function(MatlabMixin, PathMixin, GriffeFunction, MatlabObject): | |
| 557 541 | 
             
                    pass
         | 
| 558 542 |  | 
| 559 543 |  | 
| 544 | 
            +
            class Folder(MatlabMixin, PathMixin, Module, MatlabObject):
         | 
| 545 | 
            +
                """
         | 
| 546 | 
            +
                A class representing a Folder in a MATLAB project.
         | 
| 547 | 
            +
             | 
| 548 | 
            +
                Inherits from:
         | 
| 549 | 
            +
                    - MatlabMixin: A mixin class providing MATLAB-specific functionality.
         | 
| 550 | 
            +
                    - PathMixin: A mixin class providing path-related functionality.
         | 
| 551 | 
            +
                    - Module: A class representing a module.
         | 
| 552 | 
            +
                    - MatlabObject: A base class for MATLAB objects.
         | 
| 553 | 
            +
                """
         | 
| 554 | 
            +
             | 
| 555 | 
            +
                def __init__(self, *args: Any, **kwargs: Any) -> None:
         | 
| 556 | 
            +
                    super().__init__(*args, **kwargs)
         | 
| 557 | 
            +
                    self.labels = {"Folder"}
         | 
| 558 | 
            +
             | 
| 559 | 
            +
                def __repr__(self) -> str:
         | 
| 560 | 
            +
                    return f"Folder({self.path!r})"
         | 
| 561 | 
            +
             | 
| 562 | 
            +
             | 
| 560 563 | 
             
            class Namespace(MatlabMixin, PathMixin, Module, MatlabObject):
         | 
| 561 564 | 
             
                """
         | 
| 562 565 | 
             
                A class representing a namespace in a MATLAB project.
         | 
| 563 566 |  | 
| 564 567 | 
             
                Inherits from:
         | 
| 568 | 
            +
                    - MatlabMixin: A mixin class providing MATLAB-specific functionality.
         | 
| 565 569 | 
             
                    - PathMixin: A mixin class providing path-related functionality.
         | 
| 566 | 
            -
                    - MatlabObject: A base class for MATLAB objects.
         | 
| 567 570 | 
             
                    - Module: A class representing a module.
         | 
| 571 | 
            +
                    - MatlabObject: A base class for MATLAB objects.
         | 
| 568 572 | 
             
                """
         | 
| 569 573 |  | 
| 570 574 | 
             
                def __init__(self, *args: Any, **kwargs: Any) -> None:
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            Metadata-Version: 2.4
         | 
| 2 2 | 
             
            Name: mkdocstrings-matlab
         | 
| 3 | 
            -
            Version: 0. | 
| 3 | 
            +
            Version: 0.7.0
         | 
| 4 4 | 
             
            Summary: A MATLAB handler for mkdocstrings
         | 
| 5 5 | 
             
            Author-email: Mark Hu <watermarkhu@gmail.com>
         | 
| 6 | 
            -
            License:  | 
| 6 | 
            +
            License: MIT
         | 
| 7 7 | 
             
            License-File: LICENSE
         | 
| 8 8 | 
             
            Classifier: Development Status :: 4 - Beta
         | 
| 9 9 | 
             
            Classifier: Intended Audience :: Developers
         | 
| @@ -28,6 +28,8 @@ Requires-Dist: tree-sitter-matlab>=1.0.2 | |
| 28 28 | 
             
            Requires-Dist: tree-sitter>=0.23.2
         | 
| 29 29 | 
             
            Description-Content-Type: text/markdown
         | 
| 30 30 |  | 
| 31 | 
            +
            <!-- --8<-- [start:header] -->
         | 
| 32 | 
            +
             | 
| 31 33 | 
             
            <h1 align="center">mkdocstrings-matlab</h1>
         | 
| 32 34 |  | 
| 33 35 | 
             
            <p align="center">A MATLAB handler for <a href="https://github.com/mkdocstrings/mkdocstrings"><i>mkdocstrings</i></a>.</p>
         | 
| @@ -38,9 +40,8 @@ Description-Content-Type: text/markdown | |
| 38 40 | 
             
            [](https://watermarkhu.nl/mkdocstrings-matlab)
         | 
| 39 41 | 
             
            [](https://pypi.org/project/mkdocstrings-matlab/)
         | 
| 40 42 |  | 
| 41 | 
            -
            The MATLAB handler uses [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) and its [MATLAB parser](https://github.com/acristoffers/tree-sitter-matlab) to collect documentation from MATLAB source code.  | 
| 43 | 
            +
            The MATLAB handler uses [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) and its [MATLAB parser](https://github.com/acristoffers/tree-sitter-matlab) to collect documentation from MATLAB source code. The AST information are imported as custom [Griffe](https://mkdocstrings.github.io/griffe/) objects and mocked for the [python handler](https://mkdocstrings.github.io/python/). 
         | 
| 42 44 |  | 
| 43 | 
            -
            ## Installation
         | 
| 44 45 |  | 
| 45 46 | 
             
            You can install this handler by specifying it as a dependency:
         | 
| 46 47 |  | 
| @@ -53,6 +54,9 @@ dependencies = [ | |
| 53 54 | 
             
            ]
         | 
| 54 55 | 
             
            ```
         | 
| 55 56 |  | 
| 57 | 
            +
            <!-- --8<-- [end:header] -->
         | 
| 58 | 
            +
            <!-- --8<-- [start:footer] -->
         | 
| 59 | 
            +
             | 
| 56 60 | 
             
            ## Features
         | 
| 57 61 |  | 
| 58 62 | 
             
            - **Data collection from source code**: collection of the object-tree and the docstrings is done thanks to
         | 
| @@ -60,10 +64,10 @@ dependencies = [ | |
| 60 64 |  | 
| 61 65 | 
             
            - **Support for argument validation blocks:** Tree-sitter collects your [function and method argument validation](https://mathworks.com/help/matlab/matlab_prog/function-argument-validation-1.html)
         | 
| 62 66 | 
             
               blocks to display input and output argument types and default values. 
         | 
| 63 | 
            -
               It is even able to automatically add cross-references  | 
| 67 | 
            +
               It is even able to automatically add cross-references to other objects from your API.
         | 
| 64 68 |  | 
| 65 | 
            -
            - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html):** 
         | 
| 66 | 
            -
              just add `+` to the identifer, and you get the  | 
| 69 | 
            +
            - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html) and folders:** 
         | 
| 70 | 
            +
              just add `+` to the identifer for namespaces or the relative path for folder, and you get documentation for the entire directory. You don't need to inject documentation for each class, function, and script. Additionaly, the directory documentation will be either extracted from the `Contents.m` or the `readme.md` file at the root of the namespace or folder.
         | 
| 67 71 |  | 
| 68 72 | 
             
            - **Support for documented properties:** properties definitions followed by a docstring will be recognized in classes. 
         | 
| 69 73 |  | 
| @@ -79,4 +83,6 @@ dependencies = [ | |
| 79 83 | 
             
              you can reference other objects within your docstrings, with the classic Markdown syntax:
         | 
| 80 84 | 
             
              `[this object][namespace.subnamespace.object]` or directly with `[namespace.subnamespace.object][]`
         | 
| 81 85 |  | 
| 82 | 
            -
            - **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code of the MATLAB object.
         | 
| 86 | 
            +
            - **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code of the MATLAB object.
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            <!-- --8<-- [end:footer] -->
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            mkdocs_material_matlab/__init__.py,sha256=9pmrwWbkIyr0T7qvADbsz3OR5bB3rWb231e6JSnwA7o,106
         | 
| 2 | 
            +
            mkdocs_material_matlab/mkdocs_material_matlab.py,sha256=s7vI1lv6hD8s7kDHWBfYKgN6EcldyUstGYJ45sA-VWY,850
         | 
| 3 | 
            +
            mkdocs_material_matlab/css/style.css,sha256=iVTPIKljgvK899jEQylD7yu9yjKfrVE_4GLaITjhk4g,132
         | 
| 4 | 
            +
            mkdocstrings_handlers/matlab/__init__.py,sha256=w5R9cGtqeJF0GUP_Jc_ad8FnS4FpbutnmHvzVRlohPM,1124
         | 
| 5 | 
            +
            mkdocstrings_handlers/matlab/collect.py,sha256=WXuRIDYL0T1fKv1MwwOC6uWAB80PxRCs4uYDgOHiQcg,29749
         | 
| 6 | 
            +
            mkdocstrings_handlers/matlab/enums.py,sha256=lr3wLlhPxyBym3O7Rt0cLUZYqPCz6wQ2PYBibLKLTek,982
         | 
| 7 | 
            +
            mkdocstrings_handlers/matlab/handler.py,sha256=-KA6kj8L55T9jxgKzNM_k59AXsyTSQJqFd8ltN00LQI,18710
         | 
| 8 | 
            +
            mkdocstrings_handlers/matlab/models.py,sha256=0qGk6UrGHB4fC49I2cjCgqLFAIozqtmLAxl9PPN6Blc,18461
         | 
| 9 | 
            +
            mkdocstrings_handlers/matlab/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 10 | 
            +
            mkdocstrings_handlers/matlab/treesitter.py,sha256=FkWGuH7EmE_aO2qub5-_NnOVacYeXW353SkB7cNMlRo,21820
         | 
| 11 | 
            +
            mkdocstrings_matlab-0.7.0.dist-info/METADATA,sha256=5jzSXQm4dSLd9GBaJWSAvJm1JGBcuAGUaLWLpMoiGu0,4736
         | 
| 12 | 
            +
            mkdocstrings_matlab-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         | 
| 13 | 
            +
            mkdocstrings_matlab-0.7.0.dist-info/entry_points.txt,sha256=qUZFuB2TKh7KPlg4dR2npfbNgNExw6O6j1vF276PtPw,92
         | 
| 14 | 
            +
            mkdocstrings_matlab-0.7.0.dist-info/licenses/LICENSE,sha256=TZQpwBuA3KLH56--XDAY2Qwo9gGdxeTITYhMOylmYhg,743
         | 
| 15 | 
            +
            mkdocstrings_matlab-0.7.0.dist-info/RECORD,,
         | 
| @@ -1,15 +0,0 @@ | |
| 1 | 
            -
            mkdocs_material_matlab/__init__.py,sha256=9pmrwWbkIyr0T7qvADbsz3OR5bB3rWb231e6JSnwA7o,106
         | 
| 2 | 
            -
            mkdocs_material_matlab/mkdocs_material_matlab.py,sha256=s7vI1lv6hD8s7kDHWBfYKgN6EcldyUstGYJ45sA-VWY,850
         | 
| 3 | 
            -
            mkdocs_material_matlab/css/style.css,sha256=iVTPIKljgvK899jEQylD7yu9yjKfrVE_4GLaITjhk4g,132
         | 
| 4 | 
            -
            mkdocstrings_handlers/matlab/__init__.py,sha256=7UCCosKn8S38xgJQQy9_1P2oMyPVsTeDkcLPVIoDneU,1000
         | 
| 5 | 
            -
            mkdocstrings_handlers/matlab/collect.py,sha256=JAcYih8LMU9jDgxuyqR86p6zdp5qYJNxVnE3x9c529U,27440
         | 
| 6 | 
            -
            mkdocstrings_handlers/matlab/enums.py,sha256=lr3wLlhPxyBym3O7Rt0cLUZYqPCz6wQ2PYBibLKLTek,982
         | 
| 7 | 
            -
            mkdocstrings_handlers/matlab/handler.py,sha256=k7TEv2lj8wzD9kSaN78yTBAvl6Y8ZqZiyKSzoCc2uEs,18344
         | 
| 8 | 
            -
            mkdocstrings_handlers/matlab/models.py,sha256=YmPE9NKsPJ4GBp6es--0yH6uH8BZLPC8xMOh1QHCmY4,18109
         | 
| 9 | 
            -
            mkdocstrings_handlers/matlab/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 10 | 
            -
            mkdocstrings_handlers/matlab/treesitter.py,sha256=e2rfMPFaprJ6XEPH8xk2i-DKBOY_9UNWFQWPX2R7U98,21756
         | 
| 11 | 
            -
            mkdocstrings_matlab-0.5.0.dist-info/METADATA,sha256=3JCGvP6la7GZdx70e3QZyscYs_eWelan_vt7B5SwZyc,4521
         | 
| 12 | 
            -
            mkdocstrings_matlab-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         | 
| 13 | 
            -
            mkdocstrings_matlab-0.5.0.dist-info/entry_points.txt,sha256=qUZFuB2TKh7KPlg4dR2npfbNgNExw6O6j1vF276PtPw,92
         | 
| 14 | 
            -
            mkdocstrings_matlab-0.5.0.dist-info/licenses/LICENSE,sha256=TZQpwBuA3KLH56--XDAY2Qwo9gGdxeTITYhMOylmYhg,743
         | 
| 15 | 
            -
            mkdocstrings_matlab-0.5.0.dist-info/RECORD,,
         | 
| 
            File without changes
         | 
    
        {mkdocstrings_matlab-0.5.0.dist-info → mkdocstrings_matlab-0.7.0.dist-info}/entry_points.txt
    RENAMED
    
    | 
            File without changes
         | 
    
        {mkdocstrings_matlab-0.5.0.dist-info → mkdocstrings_matlab-0.7.0.dist-info}/licenses/LICENSE
    RENAMED
    
    | 
            File without changes
         |