mkdocstrings-matlab 0.9.7__py3-none-any.whl → 1.0.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.
Files changed (45) hide show
  1. mkdocstrings_handlers/matlab/__init__.py +26 -3
  2. mkdocstrings_handlers/matlab/config.py +885 -0
  3. mkdocstrings_handlers/matlab/handler.py +155 -296
  4. mkdocstrings_handlers/matlab/logger.py +111 -0
  5. mkdocstrings_handlers/matlab/rendering.py +818 -0
  6. mkdocstrings_handlers/matlab/templates/material/attributes.html.jinja +25 -0
  7. mkdocstrings_handlers/matlab/templates/material/backlinks.html.jinja +17 -0
  8. mkdocstrings_handlers/matlab/templates/material/children.html.jinja +70 -62
  9. mkdocstrings_handlers/matlab/templates/material/class.html.jinja +236 -0
  10. mkdocstrings_handlers/matlab/templates/material/docstring/admonition.html.jinja +20 -0
  11. mkdocstrings_handlers/matlab/templates/material/docstring/classes.html.jinja +85 -0
  12. mkdocstrings_handlers/matlab/templates/material/docstring/examples.html.jinja +27 -0
  13. mkdocstrings_handlers/matlab/templates/material/docstring/functions.html.jinja +91 -0
  14. mkdocstrings_handlers/matlab/templates/material/docstring/input_arguments.html.jinja +171 -0
  15. mkdocstrings_handlers/matlab/templates/material/docstring/name_value_arguments.html.jinja +166 -0
  16. mkdocstrings_handlers/matlab/templates/material/docstring/namespaces.html.jinja +5 -6
  17. mkdocstrings_handlers/matlab/templates/material/docstring/output_arguments.html.jinja +152 -0
  18. mkdocstrings_handlers/matlab/templates/material/docstring/properties.html.jinja +25 -26
  19. mkdocstrings_handlers/matlab/templates/material/docstring.html.jinja +53 -0
  20. mkdocstrings_handlers/matlab/templates/material/expression.html.jinja +55 -0
  21. mkdocstrings_handlers/matlab/templates/material/folder.html.jinja +31 -39
  22. mkdocstrings_handlers/matlab/templates/material/function.html.jinja +148 -0
  23. mkdocstrings_handlers/matlab/templates/material/language.html.jinja +18 -0
  24. mkdocstrings_handlers/matlab/templates/material/languages/en.html.jinja +38 -0
  25. mkdocstrings_handlers/matlab/templates/material/languages/ja.html.jinja +38 -0
  26. mkdocstrings_handlers/matlab/templates/material/languages/zh.html.jinja +38 -0
  27. mkdocstrings_handlers/matlab/templates/material/namespace.html.jinja +32 -38
  28. mkdocstrings_handlers/matlab/templates/material/property.html.jinja +39 -35
  29. mkdocstrings_handlers/matlab/templates/material/script.html.jinja +3 -25
  30. mkdocstrings_handlers/matlab/templates/material/signature.html.jinja +105 -0
  31. mkdocstrings_handlers/matlab/templates/material/style.css +179 -4
  32. mkdocstrings_handlers/matlab/templates/material/summary/classes.html.jinja +25 -0
  33. mkdocstrings_handlers/matlab/templates/material/summary/functions.html.jinja +25 -0
  34. mkdocstrings_handlers/matlab/templates/material/summary/namespaces.html.jinja +17 -13
  35. mkdocstrings_handlers/matlab/templates/material/summary/properties.html.jinja +17 -13
  36. mkdocstrings_handlers/matlab/templates/material/summary.html.jinja +6 -6
  37. {mkdocstrings_matlab-0.9.7.dist-info → mkdocstrings_matlab-1.0.0.dist-info}/METADATA +17 -19
  38. mkdocstrings_matlab-1.0.0.dist-info/RECORD +41 -0
  39. mkdocstrings_handlers/matlab/collect.py +0 -783
  40. mkdocstrings_handlers/matlab/enums.py +0 -54
  41. mkdocstrings_handlers/matlab/models.py +0 -633
  42. mkdocstrings_handlers/matlab/treesitter.py +0 -707
  43. mkdocstrings_matlab-0.9.7.dist-info/RECORD +0 -22
  44. {mkdocstrings_matlab-0.9.7.dist-info → mkdocstrings_matlab-1.0.0.dist-info}/WHEEL +0 -0
  45. {mkdocstrings_matlab-0.9.7.dist-info → mkdocstrings_matlab-1.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,54 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class Kind(str, Enum):
5
- """
6
- An enumeration representing different kinds of MATLAB code elements.
7
- This enumeration is a subclass of the Griffe `Kind` enumeration, and extends it with additional values.
8
- """
9
-
10
- MODULE = "module"
11
- """Modules."""
12
- CLASS = "class"
13
- """Classes."""
14
- FUNCTION = "function"
15
- """Functions and methods."""
16
- ATTRIBUTE = "attribute"
17
- """Attributes and properties."""
18
- ALIAS = "alias"
19
- """Aliases (imported objects)."""
20
- SCRIPT = "script"
21
-
22
-
23
- class ParameterKind(str, Enum):
24
- """
25
- An enumeration representing different kinds of function parameters.
26
-
27
- Attributes:
28
- positional (str): Positional-only parameter.
29
- optional (str): Optional parameter.
30
- keyword_only (str): Keyword-only parameter.
31
- var_keyword (str): Variadic keyword parameter.
32
- """
33
-
34
- positional_only = "positional-only"
35
- optional = "optional"
36
- keyword_only = "keyword-only"
37
- var_keyword = "variadic keyword"
38
-
39
-
40
- class AccessEnum(str, Enum):
41
- """
42
- An enumeration representing different access levels for MATLAB code elements.
43
-
44
- Attributes:
45
- public (str): Represents public access level.
46
- protected (str): Represents protected access level.
47
- private (str): Represents private access level.
48
- immutable (str): Represents immutable access level.
49
- """
50
-
51
- public = "public"
52
- protected = "protected"
53
- private = "private"
54
- immutable = "immutable"
@@ -1,633 +0,0 @@
1
- """Classes to represent MATLAB objects and their properties."""
2
-
3
- from typing import Any, TYPE_CHECKING, Callable
4
- from functools import cached_property
5
- from pathlib import Path
6
- from griffe import (
7
- Alias,
8
- Attribute,
9
- Function as GriffeFunction,
10
- Class as GriffeClass,
11
- Docstring as GriffeDocstring,
12
- DocstringSection,
13
- DocstringSectionText,
14
- Module,
15
- Object,
16
- Parameters as GriffeParameters,
17
- Parameter as GriffeParameter,
18
- )
19
-
20
- from mkdocstrings_handlers.matlab.enums import Kind, AccessEnum, ParameterKind
21
-
22
- if TYPE_CHECKING:
23
- from mkdocstrings_handlers.matlab.collect import PathCollection
24
-
25
- __all__ = [
26
- "Attribute",
27
- "Class",
28
- "Classfolder",
29
- "Function",
30
- "MatlabObject",
31
- "MatlabMixin",
32
- "Module",
33
- "Docstring",
34
- "DocstringSectionText",
35
- "Namespace",
36
- "Parameters",
37
- "Parameter",
38
- "Property",
39
- "Script",
40
- ]
41
-
42
-
43
- class Docstring(GriffeDocstring):
44
- """
45
- A class to represent a docstring with additional sections.
46
-
47
- This class extends the GriffeDocstring class to include extra sections
48
- that can be added to the parsed docstring.
49
-
50
- Attributes:
51
- _suffixes (list[DocstringSection]): A list to store additional docstring sections.
52
-
53
- Methods:
54
- parsed: Returns the parsed docstring sections combined with extra sections.
55
- _parsed: Parses the docstring into structured data.
56
- """
57
-
58
- def __init__(self, *args: Any, **kwargs: Any) -> None:
59
- """
60
- Initializes the Docstring object.
61
-
62
- Args:
63
- *args (Any): Variable length argument list.
64
- **kwargs (Any): Arbitrary keyword arguments.
65
- """
66
- super().__init__(*args, **kwargs)
67
- self._prefixes: list[DocstringSection] = []
68
- self._suffixes: list[DocstringSection] = []
69
-
70
- @property
71
- def parsed(self) -> list[DocstringSection]:
72
- """
73
- The docstring sections, parsed into structured data.
74
-
75
- Returns:
76
- list[DocstringSection]: The combined list of parsed and extra docstring sections.
77
- """
78
- return self._prefixes + self._parsed + self._suffixes
79
-
80
- @cached_property
81
- def _parsed(self) -> list[DocstringSection]:
82
- """
83
- Parses the docstring into structured data.
84
-
85
- Returns:
86
- list[DocstringSection]: The parsed docstring sections.
87
- """
88
- return self.parse()
89
-
90
-
91
- class _ParentGrabber:
92
- """
93
- A callable class that wraps a function to grab a parent MatlabObject.
94
-
95
- Attributes:
96
- _grabber (Callable[[], MatlabObject]): A callable that returns a MatlabObject.
97
-
98
- Methods:
99
- __call__(): Calls the grabber function and returns a MatlabObject.
100
- """
101
-
102
- def __init__(self, grabber: "Callable[[], MatlabMixin | None]") -> None:
103
- """
104
- Initializes the _ParentGrabber with a grabber function.
105
-
106
- Args:
107
- grabber (Callable[[], MatlabObject]): A function that returns a MatlabObject.
108
- """
109
- self._grabber = grabber
110
-
111
- @property
112
- def parent(self) -> "MatlabMixin | None":
113
- """
114
- Calls the grabber function and returns a MatlabObject.
115
-
116
- Returns:
117
- MatlabObject: The MatlabObject returned by the grabber function.
118
- """
119
- return self._grabber()
120
-
121
-
122
- class MatlabObject(Object):
123
- """
124
- Represents a Matlab object with associated docstring, path collection, and parent object.
125
-
126
- Attributes:
127
- path_collection (PathCollection | None): The collection of paths related to the Matlab object.
128
- """
129
-
130
- def __init__(
131
- self,
132
- *args,
133
- path_collection: "PathCollection | None" = None,
134
- **kwargs,
135
- ) -> None:
136
- """
137
- Initialize the object with the given parameters.
138
-
139
- Args:
140
- *args: Variable length argument list.
141
- path_collection (PathCollection | None): The collection of paths related to the object.
142
- **kwargs: Arbitrary keyword arguments.
143
- """
144
- self.path_collection: "PathCollection | None" = path_collection
145
- lines_collection = (
146
- path_collection.lines_collection if path_collection is not None else None
147
- )
148
- super().__init__(*args, lines_collection=lines_collection, **kwargs)
149
-
150
- @property
151
- def namespaces(self) -> dict[str, "Namespace"]:
152
- return {}
153
-
154
- @property
155
- def scripts(self) -> dict[str, "Script"]:
156
- return {
157
- name: member
158
- for name, member in self.all_members.items()
159
- if member.kind is Kind.SCRIPT
160
- } # type: ignore[misc]
161
-
162
- @property
163
- def is_script(self) -> bool:
164
- return False
165
-
166
- @property
167
- def is_namespace(self) -> bool:
168
- return False
169
-
170
- @property
171
- def is_folder(self) -> bool:
172
- return False
173
-
174
- @property
175
- def canonical_path(self) -> str:
176
- """
177
- The full dotted path of this object.
178
-
179
- Returns:
180
- str: The canonical path of the object.
181
- """
182
- if self.parent is None:
183
- return self.name
184
-
185
- if isinstance(self.parent, MatlabObject):
186
- parent = self.parent
187
- else:
188
- parent = getattr(self.parent, "model", self.parent)
189
-
190
- if isinstance(parent, Classfolder) and self.name == parent.name:
191
- if parent.parent is None:
192
- return self.name
193
- else:
194
- return f"{parent.parent.canonical_path}.{self.name}"
195
- else:
196
- return f"{parent.canonical_path}.{self.name}" if parent else self.name
197
-
198
-
199
- class PathMixin(Object):
200
- """
201
- A mixin class that provides a filepath attribute and related functionality.
202
-
203
- Attributes:
204
- filepath (Path | None): The file path associated with the object. It can be None if no file path is provided.
205
- """
206
-
207
- def __init__(self, *args: Any, filepath: Path | None = None, **kwargs: Any) -> None:
208
- super().__init__(*args, **kwargs)
209
- self._filepath: Path | None = filepath
210
-
211
- @property
212
- def filepath(self) -> Path | None:
213
- return self._filepath
214
-
215
- def __repr__(self) -> str:
216
- return f"{self.__class__.__name__}({self.name})"
217
-
218
-
219
- class MatlabMixin(Object):
220
- def __init__(
221
- self,
222
- *args: Any,
223
- parent: "Class | Classfolder | Namespace | None" = None,
224
- docstring: Docstring | None = None,
225
- **kwargs: Any,
226
- ):
227
- super().__init__(*args, **kwargs)
228
- self._parent: "Class | Classfolder | Namespace | _ParentGrabber | None" = parent
229
- self._docstring: Docstring | None = docstring
230
-
231
- @property
232
- def parent(self) -> Object | None:
233
- if isinstance(self._parent, MatlabMixin):
234
- return self._parent
235
- elif isinstance(self._parent, _ParentGrabber):
236
- return self._parent.parent
237
- else:
238
- return None
239
-
240
- @parent.setter
241
- def parent(self, value):
242
- if value is not None:
243
- self._parent = value
244
-
245
- @property
246
- def docstring(self) -> Docstring | None:
247
- return self._docstring
248
-
249
- @docstring.setter
250
- def docstring(self, value: Docstring | None):
251
- if value is not None:
252
- self._docstring = value
253
-
254
-
255
- class Parameter(MatlabMixin, GriffeParameter, MatlabObject):
256
- """
257
- Represents a parameter in a MATLAB object.
258
-
259
- Inherits from:
260
- MatlabObject: Base class for MATLAB objects.
261
- GriffeParameter: Base class for parameters.
262
-
263
- Attributes:
264
- kind (ParameterKind | None): The kind of the parameter, which can be of type ParameterKind or None.
265
- """
266
-
267
- def __init__(
268
- self, *args: Any, kind: ParameterKind | None = None, **kwargs: Any
269
- ) -> None:
270
- super().__init__(*args, **kwargs)
271
- self.kind: ParameterKind | None = kind
272
-
273
-
274
- class Parameters(MatlabMixin, GriffeParameters, MatlabObject):
275
- """
276
- A class to represent a collection of parameters.
277
-
278
- Inherits from:
279
- MatlabObject: Base class for MATLAB objects.
280
- GriffeParameters: Base class for handling parameters.
281
- """
282
-
283
- def __init__(self, *parameters: Parameter, **kwargs: Any) -> None:
284
- super().__init__(**kwargs)
285
- self._params: list[Parameter] = list(parameters)
286
-
287
-
288
- class Script(MatlabMixin, PathMixin, MatlabObject):
289
- """
290
- A class representing a MATLAB script.
291
-
292
- This class inherits from `PathMixin` and `MatlabObject` to provide
293
- functionality specific to MATLAB scripts.
294
- """
295
-
296
- kind = Kind.SCRIPT # type: ignore
297
-
298
- def __init__(self, *args: Any, **kwargs: Any) -> None:
299
- super().__init__(*args, **kwargs)
300
- self.extra["mkdocstrings"] = {"template": "script.html.jinja"}
301
-
302
- @property
303
- def is_script(self) -> bool:
304
- return True
305
-
306
-
307
- class Class(MatlabMixin, PathMixin, GriffeClass, MatlabObject):
308
- """
309
- Represents a MATLAB class with additional properties and methods for handling
310
- MATLAB-specific features.
311
-
312
- This class extends `PathMixin`, `MatlabObject`, and `GriffeClass` to provide
313
- additional functionality for handling MATLAB class properties such as
314
- abstract, hidden, and sealed attributes. It also provides methods to retrieve
315
- parameters, inherited members, and labels.
316
-
317
- Attributes:
318
- abstract (bool): Indicates if the class is abstract.
319
- hidden (bool): Indicates if the class is hidden.
320
- sealed (bool): Indicates if the class is sealed.
321
-
322
- Args:
323
- *args (Any): Variable length argument list.
324
- Abstract (bool, optional): Indicates if the class is abstract
325
- Hidden (bool, optional): Indicates if the class is hidden
326
- Sealed (bool, optional): Indicates if the class is sealed
327
- """
328
-
329
- def __init__(
330
- self,
331
- *args: Any,
332
- Abstract: bool = False,
333
- Hidden: bool = False,
334
- Sealed: bool = False,
335
- **kwargs: Any,
336
- ) -> None:
337
- super().__init__(*args, **kwargs)
338
- self.Abstract: bool = Abstract
339
- self.Hidden: bool = Hidden
340
- self.Sealed: bool = Sealed
341
- self._inherited_members: dict[str, MatlabObject] | None = None
342
-
343
- @property
344
- def parameters(self) -> Parameters:
345
- """
346
- Retrieve the parameters of the class by grabbing its constructor.
347
-
348
- Returns:
349
- Parameters: The parameters of the function if the current member is a function,
350
- otherwise an empty Parameters object.
351
- """
352
- try:
353
- member = self.all_members.get(self.name)
354
- if isinstance(member, Function):
355
- return member.parameters
356
- return Parameters()
357
- except KeyError:
358
- return Parameters()
359
-
360
- @property
361
- def inherited_members(self) -> dict[str, MatlabObject]:
362
- """
363
- Retrieve a dictionary of inherited members from base classes.
364
-
365
- This method iterates over the base classes in reverse order, resolves their models,
366
- and collects members that are not already present in the current object's members.
367
-
368
- Returns:
369
- dict[str, MatlabObject]: A dictionary where the keys are member names and the values are the corresponding MatlabObject instances.
370
- """
371
- if self._inherited_members is not None:
372
- return self._inherited_members
373
-
374
- inherited_members = {}
375
- for base in reversed(self.bases):
376
- model = (
377
- self.path_collection.resolve(str(base))
378
- if self.path_collection
379
- else None
380
- )
381
- if model is None:
382
- # TODO Perhaps issue a warning here?
383
- continue
384
-
385
- for name, member in model.members.items():
386
- if name not in self.members:
387
- inherited_members[name] = Alias(
388
- name, target=member, parent=self, inherited=True
389
- )
390
-
391
- self._inherited_members = inherited_members
392
- return inherited_members
393
-
394
- @property
395
- def labels(self) -> set[str]:
396
- labels = set()
397
- if self.Abstract:
398
- labels.add("Abstract")
399
- if self.Hidden:
400
- labels.add("Hidden")
401
- if self.Sealed:
402
- labels.add("Sealed")
403
- return labels
404
-
405
- @labels.setter
406
- def labels(self, *args):
407
- pass
408
-
409
- @property
410
- def canonical_path(self) -> str:
411
- if isinstance(self.parent, Classfolder):
412
- return self.parent.canonical_path
413
- else:
414
- return super().canonical_path
415
-
416
-
417
- class Classfolder(Class):
418
- """
419
- A class representing a MATLAB classfolder
420
- """
421
-
422
- pass
423
-
424
-
425
- class Property(MatlabMixin, Attribute, MatlabObject):
426
- def __init__(
427
- self,
428
- *args: Any,
429
- AbortSet: bool = False,
430
- Abstract: bool = False,
431
- Constant: bool = False,
432
- Dependent: bool = False,
433
- GetObservable: bool = False,
434
- Hidden: bool = False,
435
- NonCopyable: bool = False,
436
- SetObservable: bool = False,
437
- Transient: bool = False,
438
- WeakHandle: bool = False,
439
- Access: AccessEnum = AccessEnum.public,
440
- GetAccess: AccessEnum = AccessEnum.public,
441
- SetAccess: AccessEnum = AccessEnum.public,
442
- **kwargs: Any,
443
- ) -> None:
444
- super().__init__(*args, **kwargs)
445
- self.AbortSet: bool = AbortSet
446
- self.Abstract: bool = Abstract
447
- self.Constant: bool = Constant
448
- self.Dependent: bool = Dependent
449
- self.GetObservable: bool = GetObservable
450
- self.Hidden: bool = Hidden
451
- self.NonCopyable: bool = NonCopyable
452
- self.SetObservable: bool = SetObservable
453
- self.Transient: bool = Transient
454
- self.WeakHandle: bool = WeakHandle
455
- self.Access = Access
456
- self.GetAccess: AccessEnum = GetAccess
457
- self.SetAccess: AccessEnum = SetAccess
458
- self.getter: Function | None = None
459
-
460
- self.extra["mkdocstrings"] = {"template": "property.html.jinja"}
461
-
462
- @property
463
- def Private(self) -> bool:
464
- private = self.Access != AccessEnum.public
465
- get_private = self.GetAccess != AccessEnum.public
466
- return private or get_private
467
-
468
- @property
469
- def is_private(self) -> bool:
470
- return self.Private or self.Hidden
471
-
472
- @property
473
- def labels(self) -> set[str]:
474
- labels = set()
475
- for attr in [
476
- "AbortSet",
477
- "Abstract",
478
- "Constant",
479
- "Dependent",
480
- "GetObservable",
481
- "Hidden",
482
- "NonCopyable",
483
- "SetObservable",
484
- "Transient",
485
- "WeakHandle",
486
- ]:
487
- if getattr(self, attr):
488
- labels.add(attr)
489
- for attr in ["Access", "GetAccess", "SetAccess"]:
490
- if getattr(self, attr) != AccessEnum.public:
491
- labels.add(f"{attr}={getattr(self, attr).value}")
492
- return labels
493
-
494
- @labels.setter
495
- def labels(self, *args):
496
- pass
497
-
498
-
499
- class Function(MatlabMixin, PathMixin, GriffeFunction, MatlabObject):
500
- """
501
- Represents a MATLAB function with various attributes and properties.
502
-
503
- Attributes:
504
- parameters (Parameters): The parameters of the function.
505
- returns (Parameters | None): The return parameters of the function.
506
- access (AccessEnum): The access level of the function.
507
- static (bool): Indicates if the function is static.
508
- abstract (bool): Indicates if the function is abstract.
509
- sealed (bool): Indicates if the function is sealed.
510
- hidden (bool): Indicates if the function is hidden.
511
- _is_setter (bool): Indicates if the function is a setter.
512
- _is_getter (bool): Indicates if the function is a getter.
513
-
514
- Args:
515
- *args (Any): Variable length argument list.
516
- returns (Parameters | None, optional): The return parameters of the function. Defaults to None.
517
- Abstract (bool, optional): Indicates if the function is abstract. Defaults to False.
518
- Access (AccessEnum, optional): The access level of the function. Defaults to AccessEnum.public.
519
- Hidden (bool, optional): Indicates if the function is hidden. Defaults to False.
520
- Sealed (bool, optional): Indicates if the function is sealed. Defaults to False.
521
- Static (bool, optional): Indicates if the function is static. Defaults to False.
522
- setter (bool, optional): Indicates if the function is a setter. Defaults to False.
523
- getter (bool, optional): Indicates if the function is a getter. Defaults to False.
524
- """
525
-
526
- def __init__(
527
- self,
528
- *args: Any,
529
- returns: Parameters | None = None,
530
- Abstract: bool = False,
531
- Access: AccessEnum = AccessEnum.public,
532
- Hidden: bool = False,
533
- Sealed: bool = False,
534
- Static: bool = False,
535
- setter: bool = False,
536
- getter: bool = False,
537
- **kwargs: Any,
538
- ) -> None:
539
- super().__init__(*args, **kwargs)
540
- self.parameters: Parameters = Parameters()
541
- self.returns: Parameters | None = returns
542
- self.Access: AccessEnum = Access
543
- self.Static: bool = Static
544
- self.Abstract: bool = Abstract
545
- self.Sealed: bool = Sealed
546
- self.Hidden: bool = Hidden
547
- self._is_setter: bool = setter
548
- self._is_getter: bool = getter
549
-
550
- @property
551
- def Private(self) -> bool:
552
- return self.Access != AccessEnum.public and self.Access != AccessEnum.immutable
553
-
554
- @property
555
- def is_private(self) -> bool:
556
- return self.Private or self.Hidden
557
-
558
- @property
559
- def labels(self) -> set[str]:
560
- labels = set()
561
- for attr in ["Abstract", "Hidden", "Sealed", "Static"]:
562
- if getattr(self, attr):
563
- labels.add(attr)
564
- if self.Access != AccessEnum.public:
565
- labels.add(f"Access={self.Access.value}")
566
- return labels
567
-
568
- @labels.setter
569
- def labels(self, *args):
570
- pass
571
-
572
-
573
- class Folder(MatlabMixin, PathMixin, Module, MatlabObject):
574
- """
575
- A class representing a Folder in a MATLAB project.
576
-
577
- Inherits from:
578
- - MatlabMixin: A mixin class providing MATLAB-specific functionality.
579
- - PathMixin: A mixin class providing path-related functionality.
580
- - Module: A class representing a module.
581
- - MatlabObject: A base class for MATLAB objects.
582
- """
583
-
584
- def __init__(self, *args: Any, **kwargs: Any) -> None:
585
- super().__init__(*args, **kwargs)
586
- self.extra["mkdocstrings"] = {"template": "folder.html.jinja"}
587
-
588
- def __repr__(self) -> str:
589
- return f"Folder({self.path!r})"
590
-
591
- @property
592
- def namespaces(self) -> dict[str, "Namespace"]:
593
- return {
594
- name: member
595
- for name, member in self.members.items()
596
- if isinstance(member, Namespace)
597
- }
598
-
599
- @property
600
- def is_folder(self) -> bool:
601
- return True
602
-
603
-
604
- class Namespace(MatlabMixin, PathMixin, Module, MatlabObject):
605
- """
606
- A class representing a namespace in a MATLAB project.
607
-
608
- Inherits from:
609
- - MatlabMixin: A mixin class providing MATLAB-specific functionality.
610
- - PathMixin: A mixin class providing path-related functionality.
611
- - Module: A class representing a module.
612
- - MatlabObject: A base class for MATLAB objects.
613
- """
614
-
615
- def __init__(self, *args: Any, **kwargs: Any) -> None:
616
- super().__init__(*args, **kwargs)
617
- self._access: AccessEnum = AccessEnum.public
618
- self.extra["mkdocstrings"] = {"template": "namespace.html.jinja"}
619
-
620
- def __repr__(self) -> str:
621
- return f"Namespace({self.path!r})"
622
-
623
- @property
624
- def is_internal(self) -> bool:
625
- return (
626
- any(part == "+internal" for part in self.filepath.parts)
627
- if self.filepath
628
- else False
629
- )
630
-
631
- @property
632
- def is_namespace(self) -> bool:
633
- return True