A Python handler for mkdocstrings.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

PrintOKClass docstring.
+__init__Examples:
+ +```pycon +>>> PrintOK() +ok +``` +//// + +//// tab | Keep init summary and doctest flags +PrintOKClass docstring.
+__init__Initialize the instance.
+Examples:
+ +```pycon +>>> PrintOK() # doctest: +NORMALIZE_WHITESPACE +ok +``` +//// +/// + +[](){#option-docstring_section_style} +## `docstring_section_style` + +- **:octicons-package-24: Type [`str`][] :material-equal: `"table"`{ title="default value" }** + + +The style used to render docstring sections. + +A section is a block of text that has a special meaning in a docstring. +There are sections for documenting attributes of an object, +parameters of a function, exceptions raised by a function, +the return value of a function, etc. + +Sections are parsed as structured data and can therefore be rendered +in different ways. Possible values: + +- `"table"`: a simple table, usually with type, name and description columns +- `"list"`: a simple list, akin to what you get with the [ReadTheDocs Sphinx theme]{ .external } +- `"spacy"`: a poor implementation of the amazing tables in [Spacy's documentation]{ .external } + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + docstring_section_style: table +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + docstring_section_style: list +``` + +/// admonition | Preview + type: preview + +//// tab | Table +Tables work well when you have lots of items with short names, type annotations, descriptions, etc.. +With longer strings, the columns risk getting squished horizontally. +In that case, the Spacy tables can help. + +**Parameters:** + +**Type** | **Name** | **Description** | **Default** +---------- | ----------- | ------------------------ | ----------- +[`int`][] | `threshold` | Threshold for something. | *required* +[`bool`][] | `flag` | Enable something. | `False` + +**Other Parameters:** + +**Type** | **Name** | **Description** | **Default** +---------- | ----------- | ------------------------ | ----------- +list [int \| float ] | `gravity_forces` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | *required*
+VacuumType \| Literal ["regular"] | `vacuum_type` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | `VacuumType.PLASMA`
+////
+
+//// tab | List
+Lists work well whatever the length of names, type annotations, descriptions, etc.
+
+**Parameters:**
+
+- `threshold` ([`int`][]) — Threshold for something.
+- `flag` ([`bool`][]) — Enable something.
+
+**Other Parameters:**
+
+- `gravity_forces` (list [int \| float ]) — Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+- `vacuum_type` (VacuumType \| Literal ["regular"]) — Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+////
+
+//// tab | Spacy
+Spacy tables work better than regular tables with longer names, type annotations, descriptions, etc.,
+by reserving more horizontal space on the second column.
+
+**Parameters:**
+
+**Name** | **Description**
+----------- | ---------------
+`threshold` | Threshold for something.False
+
+**Other Parameters:**
+
+**Name** | **Description**
+----------- | ---------------
+`gravity_forces` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.list [int \| float ] DEFAULT: required
+`vacuum_type` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.VacuumType \| Literal ["regular"] DEFAULT: VacuumType.PLASMA
+////
+///
+
+[](){#option-merge_init_into_class}
+## `merge_init_into_class`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+
+Whether to merge the `__init__` method into the class' signature and docstring.
+
+By default, only the class name is rendered in headings.
+When merging, the `__init__` method parameters are added after the class name,
+like a signature, and the `__init__` method docstring is appended to the class' docstring.
+This option is well used in combination with the `ignore_init_summary` [docstring option][docstring_options],
+to discard the first line of the `__init__` docstring which is not often useful.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ docstring_options:
+ ignore_init_summary: false
+ merge_init_into_class: false
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ docstring_options:
+ ignore_init_summary: true
+ merge_init_into_class: true
+```
+
+```python
+class Thing:
+ """A class for things."""
+
+ def __init__(self, value: int = 0):
+ """Initialize a thing.
+
+ Parameters:
+ value: The thing's value.
+ """
+ self.value = value
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | Merged, summary discarded
+Thing(value=0)Class docstring.
+Parameters:
+ +**Type** | **Name** | **Description** | **Default** +--------- | -------- | ------------------ | ----------- +[`int`][] | `value` | The thing's value. | `0` +//// + +//// tab | Unmerged, summary kept +ThingClass docstring.
+__init__(value=0)Initialize a thing.
+Parameters:
+ +**Type** | **Name** | **Description** | **Default** +--------- | -------- | ------------------ | ----------- +[`int`][] | `value` | The thing's value. | `0` +//// +/// + +[](){#option-relative_crossrefs} +## `relative_crossrefs` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Whether to enable the relative-crossref syntax. + +The relative-crossref syntax lets you reference the current object or its parent by prefixing a crossref identifier with dots. For example, to cross-reference the current object's `name` member, you can write `[link to name attribute][.name]`. The "current object" is the object containing the docstring being rendered. + + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + relative_crossrefs: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + relative_crossrefs: true +``` + +/// admonition | Examples + type: preview + +```python title="pkg/module.py" +"""Summary. + +- Link to [`module`][.]. +- Link to [`module_attribute`][.module_attribute]. +- Link to [`Class`][.Class]. +- Link to [`class_attribute`][.Class.class_attribute]. +- Link to [`instance_attribute`][.Class.instance_attribute]. +- Link to [`method`][.Class.method]. +""" + +module_attribute = 0 +"""Summary. + +- Link to [`module`][..]. +- Link to [`module_attribute`][.]. +- Link to [`Class`][..Class]. +- Link to [`class_attribute`][..Class.class_attribute]. +- Link to [`instance_attribute`][..Class.instance_attribute]. +- Link to [`method`][..Class.method]. +""" + +class Class: + """Summary. + + - Link to [`module`][..]. + - Link to [`module_attribute`][..module_attribute]. + - Link to [`Class`][.]. + - Link to [`class_attribute`][.class_attribute]. + - Link to [`instance_attribute`][.instance_attribute]. + - Link to [`method`][.method]. + """ + + class_attribute = 0 + """Summary. + + - Link to [`module`][...]. + - Link to [`module_attribute`][...module_attribute]. + - Link to [`Class`][..]. + - Link to [`class_attribute`][.]. + - Link to [`instance_attribute`][..instance_attribute]. + - Link to [`method`][..method]. + """ + + def __init__(self): + """Summary. + + - Link to [`module`][...]. + - Link to [`module_attribute`][...module_attribute]. + - Link to [`Class`][..]. + - Link to [`class_attribute`][..class_attribute]. + - Link to [`instance_attribute`][..instance_attribute]. + - Link to [`method`][..method]. + """ + self.instance_attribute = 0 + """Summary. + + - Link to [`module`][...]. + - Link to [`module_attribute`][...module_attribute]. + - Link to [`Class`][..]. + - Link to [`class_attribute`][..class_attribute]. + - Link to [`instance_attribute`][.]. + - Link to [`method`][..method]. + """ + + def method(self): + """Summary. + + - Link to [`module`][...]. + - Link to [`module_attribute`][...module_attribute]. + - Link to [`Class`][..]. + - Link to [`class_attribute`][..class_attribute]. + - Link to [`instance_attribute`][..instance_attribute]. + - Link to [`method`][.]. + """ +``` + +/// + +INFO: **There is an alternative, third-party Python handler that handles relative references: [mkdocstrings-python-xref](https://github.com/analog-garage/mkdocstrings-python-xref).** + +[](){#option-scoped_crossrefs} +## `scoped_crossrefs` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Whether to enable scoped cross-references. + +With scoped cross-references, you can write identifiers as if you wanted to access them from the current object's scope. The scoping rules do not exactly match Python's: you can reference members and siblings too, without prefixing with `self.` or `cls.`. + +The following order is applied when resolving a name in a given scope: + +1. member of the current object +2. parent class +3. repeat 1-2 within parent's scope + +In practice, it means that the name is first looked up in members, then it is compared against the parent name (only if it's a class), then it is looked up in siblings. It continues climbing up the object tree until there's no parent, in which case it raises a name resolution error. + +Cross-referencing an imported object will directly link to this object if the objects inventory of the project it comes from was [loaded][inventories]. You won't be able to cross-reference it within your own documentation with scoped references, if you happen to be rendering this external object too. In that case, you can use an absolute reference or a [relative][relative_crossrefs] one instead. + +Another limitation is that you won't be able to reference an external package if its name can be resolved in the current object's scope. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + scoped_crossrefs: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + scoped_crossrefs: true +``` + +/// admonition | Examples + type: preview + +```python title="pkg/module.py" +"""Summary. + +- Link to [`module_attribute`][module_attribute]. +- Link to [`Class`][Class]. +- Link to [`class_attribute`][Class.class_attribute]. +- Link to [`instance_attribute`][Class.instance_attribute]. +- Link to [`method`][Class.method]. +""" + +module_attribute = 0 +"""Summary. + +- Link to [`Class`][Class]. +- Link to [`class_attribute`][Class.class_attribute]. +- Link to [`instance_attribute`][Class.instance_attribute]. +- Link to [`method`][Class.method]. +""" + +class Class: + """Summary. + + - Link to [`module_attribute`][module_attribute]. + - Link to [`class_attribute`][class_attribute]. + - Link to [`instance_attribute`][instance_attribute]. + - Link to [`method`][method]. + """ + + class_attribute = 0 + """Summary. + + - Link to [`module_attribute`][module_attribute]. + - Link to [`Class`][Class]. + - Link to [`instance_attribute`][instance_attribute]. + - Link to [`method`][method]. + """ + + def __init__(self): + """Summary. + + - Link to [`module_attribute`][module_attribute]. + - Link to [`Class`][Class]. + - Link to [`class_attribute`][class_attribute]. + - Link to [`instance_attribute`][instance_attribute]. + - Link to [`method`][method]. + """ + self.instance_attribute = 0 + """Summary. + + - Link to [`module_attribute`][module_attribute]. + - Link to [`Class`][Class]. + - Link to [`class_attribute`][class_attribute]. + - Link to [`method`][method]. + """ + + def method(self): + """Summary. + + - Link to [`module_attribute`][module_attribute]. + - Link to [`Class`][Class]. + - Link to [`class_attribute`][class_attribute]. + - Link to [`instance_attribute`][instance_attribute]. + """ +``` + +/// + +[](){#option-show_if_no_docstring} +## `show_if_no_docstring` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the object heading even if it has no docstring or children with docstrings. + +Without an explicit list of [`members`][], members are selected based on [`filters`][], +and then filtered again to keep only those with docstrings. Checking if a member has a docstring +is done recursively: if at least one of its direct or indirect members (lower in the tree) +has a docstring, the member is rendered. If the member does not have a docstring, +and none of its members have a docstring, it is excluded. + +With this option you can tell the Python handler to skip the docstring check. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_if_no_docstring: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_if_no_docstring: true +``` + +```python +def function_without_docstring(): + ... + + +def function_with_docstring(): + """Hello.""" + + +class ClassWithoutDocstring: + def method_without_docstring(self): + ... + + def method_with_docstring(self): + """Hello.""" +``` + +/// admonition | Preview + type: preview + +//// tab | Show +function_without_docstringfunction_with_docstringHello.
+ClassWithoutDocstringmethod_without_docstringmethod_with_docstringHello.
+//// + +//// tab | Don't show +function_with_docstringHello.
+ClassWithoutDocstringmethod_with_docstringHello.
+//// +/// + +[](){#option-show_docstring_attributes} +## `show_docstring_attributes` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Attributes" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_attributes: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_attributes: false +``` + +```python +class Class: + """Summary. + + Attributes: + attr: Some attribute. + """ + + attr: int = 1 +``` + +/// admonition | Preview + type: preview + +//// tab | With attributes +ClassSummary.
+Attributes:
+ +**Type** | **Name** | **Description** +--------- | -------- | --------------- +[`int`][] | `attr` | Some attribute. +//// + +//// tab | Without attributes +ClassSummary.
+//// +/// + +[](){#option-show_docstring_functions} +## `show_docstring_functions` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Functions" or "Methods" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_functions: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_functions: false +``` + +```python +"""Summary. + +Functions: + foo: Some function. +""" + + +def foo(): + ... + + +class Class: + """Summary. + + Methods: + bar: Some method. + """ + + def bar(self): + ... +``` + +/// admonition | Preview + type: preview + +//// tab | With functions +Summary.
+Functions:
+ +**Name** | **Description** +-------- | --------------- +`foo` | Some function. + +ClassSummary.
+Methods:
+ +**Name** | **Description** +-------- | --------------- +`bar` | Some method. +//// + +//// tab | Without functions +Summary.
+ClassSummary.
+//// +/// + +[](){#option-show_docstring_classes} +## `show_docstring_classes` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Classes" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_classes: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_classes: false +``` + +```python +"""Summary. + +Classes: + Class: Some class. +""" + + +class Class: + """Summary.""" +``` + +/// admonition | Preview + type: preview + +//// tab | With classes +Summary.
+Classes:
+ +**Name** | **Description** +-------- | --------------- +`Class` | Some class. + +ClassSummary.
+//// + +//// tab | Without classes +Summary.
+ClassSummary.
+//// +/// + +[](){#option-show_docstring_type_aliases} +## `show_docstring_type_aliases` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + +Whether to render the "Type Aliases" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_type_aliases: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_type_aliases: false +``` + +```python +"""Summary. + +Type Aliases: + TypeAlias: Some type alias. +""" + + +type TypeAlias = int +"""Summary.""" +``` + +/// admonition | Preview + type: preview + +//// tab | With type_aliases +Summary.
+Type Aliases:
+ +**Name** | **Description** +------------ | ---------------- +`TypeAlias` | Some type alias. + +TypeAliasSummary.
+//// + +//// tab | Without classes +Summary.
+TypeAliasSummary.
+//// +/// + +[](){#option-show_docstring_modules} +## `show_docstring_modules` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Modules" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_modules: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_modules: false +``` + +```tree +module/ + __init__.py + submodule.py +``` + +```python title="module/__init__.py" +"""Summary. + +Modules: + submodule: Some module. +""" +``` + +/// admonition | Preview + type: preview + +//// tab | With modules +Summary.
+Modules:
+ +**Name** | **Description** +----------- | --------------- +`submodule` | Some module. + +//// + +//// tab | Without modules +Summary.
+//// +/// + +[](){#option-show_docstring_description} +## `show_docstring_description` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the textual blocks (including admonitions) of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_description: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_description: false +``` + +```python +class Class: + """Summary. + + Long description. + + Warning: Deprecated + Stop using this class. + + Attributes: + attr: Some attribute. + """ + + attr: int = 1 +``` + +/// admonition | Preview + type: preview + +//// tab | With description blocks +ClassSummary.
+Long description.
+Stop using this class.
Attributes:
+ +**Type** | **Name** | **Description** +--------- | -------- | --------------- +[`int`][] | `attr` | Some attribute. +//// + +//// tab | Without description blocks +ClassAttributes:
+ +**Type** | **Name** | **Description** +--------- | -------- | --------------- +[`int`][] | `attr` | Some attribute. +//// +/// + +[](){#option-show_docstring_examples} +## `show_docstring_examples` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Examples" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_examples: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_examples: false +``` + +```python +def print_hello(): + """Print hello. + + Examples: + >>> print("hello") + hello + """ + print("hello") +``` + +/// admonition | Preview + type: preview + +//// tab | With examples +print_helloPrint hello.
+Examples:
+ +```pycon +>>> print("hello") +hello +``` +//// + +//// tab | Without examples +print_helloPrint hello.
+//// +/// + +[](){#option-show_docstring_other_parameters} +## `show_docstring_other_parameters` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Other Parameters" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_other_parameters: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_other_parameters: false +``` + +```python +def do_something(**kwargs): + """Do something. + + Other parameters: + whatever (int): Some integer. + """ +``` + +/// admonition | Preview + type: preview + +//// tab | With other parameters +do_somethingDo something.
+Other parameters:
+ +**Type** | **Name** | **Description** +--------- | ---------- | --------------- +[`int`][] | `whatever` | Some integer. +//// + +//// tab | Without other parameters +do_somethingDo something.
+//// +/// + +[](){#option-show_docstring_parameters} +## `show_docstring_parameters` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Parameters" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_parameters: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_parameters: false +``` + +```python +def do_something(whatever: int = 0): + """Do something. + + Parameters: + whatever: Some integer. + """ +``` + +/// admonition | Preview + type: preview + +//// tab | With parameters +do_somethingDo something.
+Parameters:
+ +**Type** | **Name** | **Description** | **Default** +--------- | ---------- | --------------- | ----------- +[`int`][] | `whatever` | Some integer. | `0` +//// + +//// tab | Without parameters +do_somethingDo something.
+//// +/// + +[](){#option-show_docstring_raises} +## `show_docstring_raises` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Raises" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_raises: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_raises: false +``` + +```python +def raise_runtime_error(): + """Raise a runtime error. + + Raises: + RuntimeError: Not good. + """ + raise RuntimeError +``` + +/// admonition | Preview + type: preview + +//// tab | With exceptions +raise_runtime_errorRaise a runtime error.
+Raises:
+ +**Type** | **Description** +------------------ | --------------- +[`RuntimeError`][] | Not good. +//// + +//// tab | Without exceptions +raise_runtime_errorRaise a runtime error.
+//// +/// + +[](){#option-show_docstring_receives} +## `show_docstring_receives` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Receives" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_receives: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_receives: false +``` + +```python +def iter_skip( + iterable: Iterable[T], + initial_skip: int = 0, +) -> Generator[T, int, None]: + """Iterate and skip elements. + + Receives: + skip: Number of elements to skip. + """ + skip = initial_skip + for element in iterable: + if skip or 0 > 0: + skip -= 1 + else: + skip = yield element +``` + +/// admonition | Preview + type: preview + +//// tab | With received values +iter_skipIterate and skip elements.
+Receives:
+ +**Type** | **Description** +--------- | --------------- +[`int`][] | Number of elements to skip. +//// + +//// tab | Without received values +iter_skipIterate and skip elements.
+//// +/// + +[](){#option-show_docstring_returns} +## `show_docstring_returns` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Returns" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_returns: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_returns: false +``` + +```python +def rand() -> int: + """Return a random number. + + Returns: + A random number. + """ + return random.randint(0, 1000) +``` + +/// admonition | Preview + type: preview + +//// tab | With return value +randReturn a random number.
+Returns:
+ +**Type** | **Description** +--------- | --------------- +[`int`][] | A random number. +//// + +//// tab | Without return value +randReturn a random number.
+//// +/// + +[](){#option-show_docstring_type_parameters} +## `show_docstring_type_parameters` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Type Parameters" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_type_parameters: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_type_parameters: false +``` + +```python +class AClass[X: (int, str) = str]: + """Represents something. + + Type Parameters: + X: Something. + """ +``` + +/// admonition | Preview + type: preview + +//// tab | With parameters +AClassRepresents something.
+Type Parameters:
+ +**Name** | **Bound or Constraints** | **Description** | **Default** +---------- | ------------------------ | --------------- | ----------- +`whatever` | `(int, str)` | Something. | `str` +//// + +//// tab | Without parameters +AClassRepresents something.
+//// +/// + +[](){#option-show_docstring_warns} +## `show_docstring_warns` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Warns" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_warns: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_warns: false +``` + +```python +def warn(): + """Warn user. + + Warns: + UserWarning: When this is inappropriate. + """ + warnings.warn(UserWarning("This is inappropriate")) +``` + +/// admonition | Preview + type: preview + +//// tab | With warnings +warnWarn user.
+Warns:
+ +**Type** | **Description** +----------------- | --------------- +[`UserWarning`][] | When this is inappropriate. +//// + +//// tab | Without warnings +warnWarn user.
+//// +/// + +[](){#option-show_docstring_yields} +## `show_docstring_yields` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Yields" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_yields: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_yields: false +``` + +```python +def iter_skip( + iterable: Iterable[T], + initial_skip: int = 0, +) -> Generator[T, int, None]: + """Iterate and skip elements. + + Yields: + Elements of the iterable. + """ + skip = initial_skip + for element in iterable: + if skip or 0 > 0: + skip -= 1 + else: + skip = yield element +``` + +/// admonition | Preview + type: preview + +//// tab | With yielded values +iter_skipIterate and skip elements.
+Yields:
+ +**Type** | **Description** +--------- | --------------- +`T` | Elements of the iterable. +//// + +//// tab | Without yielded values +iter_skipIterate and skip elements.
+//// +/// diff --git a/docs/usage/configuration/general.md b/docs/usage/configuration/general.md new file mode 100644 index 00000000..921f3b27 --- /dev/null +++ b/docs/usage/configuration/general.md @@ -0,0 +1,687 @@ +# General options + +[](){#option-allow_inspection} +## `allow_inspection` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to allow inspecting modules (importing them) +when it is not possible to visit them (parse their source code). + +When loading data for a given package, [Griffe] discovers every Python module, +compiled or not, and inspects or visits them accordingly. + +If you have compiled modules but also provide stubs for them, +you might want to disable the inspection of these modules, +because inspection picks up many more members, +and sometimes the collected data is inaccurate +(depending on the tool that was used to compile the module) +or too low-level/technical for API documentation. + +See also [`force_inspection`](#force_inspection). + +WARNING: **Packages are loaded only once.** When mkdocstrings-python collects data from a Python package (thanks to [Griffe](https://mkdocstrings.github.io/griffe/)), it collects *the entire package* and *caches it*. Next time an object from the same package is rendered, the package is retrieved from the cache and not collected again. The `allow_inspection` option will therefore only have an effect the first time a package is collected, and will do nothing for objects rendered afterwards. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + allow_inspection: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.object + options: + allow_inspection: false +``` + +/// admonition | Preview + type: preview + +//// tab | With inspection +SomeClassDocstring of the class.
+__eq__Method docstring.
+__weakref__Method docstring.
+documented_methodMethod docstring.
+//// + +//// tab | Without inspection +SomeClassDocstring of the class.
+documented_methodMethod docstring.
+//// +/// + +[](){#option-backlinks} +## `backlinks` + +- **:octicons-package-24: TypeLiteral ["flat", "tree", False] :material-equal: `False`{ title="default value" }**
+
+The `backlinks` option enables rendering of backlinks within your API documentation.
+
+When an arbitrary section of your documentation links to an API symbol, this link will be collected as a backlink, and rendered below your API symbol. In short, the API symbol will link back to the section that links to it. Such backlinks will help your users navigate the documentation, as they will immediately which functions return a specific symbol, or where a specific symbol is accepted as parameter, etc..
+
+Each backlink is a list of breadcrumbs that represent the navigation, from the root page down to the given section.
+
+The available styles for rendering backlinks are **`flat`** and **`tree`**.
+
+- **`flat`** will render backlinks as a single-layer list. This can lead to repetition of breadcrumbs.
+- **`tree`** will combine backlinks into a tree, to remove repetition of breadcrumbs.
+
+WARNING: **Global-only option.** For now, the option only works when set globally in `mkdocs.yml`.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ backlinks: tree
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | Flat
+
+////
+
+//// tab | Tree
+
+////
+///
+
+[](){#option-extensions}
+## `extensions`
+
+- **:octicons-package-24: Type list [str | dict [str , dict [str , Any ]]] :material-equal: `[]`{ title="default value" }**
+
+
+The `extensions` option lets you enable [Griffe extensions](https://mkdocstrings.github.io/griffe/extensions/), which enhance or modify the data collected from Python sources (or compiled modules).
+
+Elements in the list can be strings or dictionaries.
+
+Strings denote the path to an extension module, like `griffe_typingdoc`, or to an extension class directly, like `griffe_typingdoc.TypingDocExtension`. When using a module path, all extensions within that module will be loaded and enabled. Strings can also be the path to a Python module, and a class name separated with `:`, like `scripts/griffe_extensions.py` or `scripts/griffe_extensions.py:MyExtension`.
+
+Dictionaries have a single key, which is the module/class path (as a dot-separated qualifier or file path and colon-separated class name, like above), and its value is another dictionary specifying options that will be passed when to class constructors when instantiating extensions.
+
+WARNING: **Packages are loaded only once.** When mkdocstrings-python collects data from a Python package (thanks to [Griffe](https://mkdocstrings.github.io/griffe/)), it collects *the entire package* and *caches it*. Next time an object from the same package is rendered, the package is retrieved from the cache and not collected again. Only the extensions specified the first time the package is loaded will be used. You cannot use a different set of extensions for specific objects rendered afterwards, and you cannot deactivate extensions for objects rendered afterwards either.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ extensions:
+ - griffe_sphinx
+ - griffe_pydantic: {schema: true}
+ - scripts/exts.py:DynamicDocstrings:
+ paths: [mypkg.mymod.myobj]
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: your_package.your_module.your_func
+ options:
+ extensions:
+ - griffe_typingdoc
+```
+
+[](){#option-extra}
+## `extra`
+
+- **:octicons-package-24: Type [`dict`][] :material-equal: `{}`{ title="default value" }**
+
+
+The `extra` option lets you inject additional variables into the Jinja context used when rendering templates. You can then use this extra context in your [overridden templates][templates].
+
+Local `extra` options will be merged into the global `extra` option:
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ extra:
+ hello: world
+```
+
+```md title="in docs/some_page.md (local configuration)"
+::: your_package.your_module.your_func
+ options:
+ extra:
+ foo: bar
+```
+
+...will inject both `hello` and `foo` into the Jinja context when rendering `your_package.your_module.your_func`.
+
+> WARNING: Previously, extra options were supported directly under the `options` key.
+>
+> ```yaml
+> plugins:
+> - mkdocstrings:
+> handlers:
+> python:
+> options:
+> hello: world
+> ```
+>
+> Now that we introduced optional validation of options and automatic JSON schema generation thanks to Pydantic, we require extra options to be put under `options.extra`. Extra options directly under `options` are still supported, but deprecated, and will emit deprecation warnings. Support will be removed in a future version of mkdocstrings-python.
+
+[](){#option-find_stubs_package}
+## `find_stubs_package`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+
+When looking for documentation specified in [autodoc instructions][autodoc syntax] (`::: identifier`), also look for
+the stubs package as defined in [PEP 561](https://peps.python.org/pep-0561/) if it exists. This is useful when
+most of your documentation is separately provided by such a package and not inline in your main package.
+
+WARNING: **Packages are loaded only once.** When mkdocstrings-python collects data from a Python package (thanks to [Griffe](https://mkdocstrings.github.io/griffe/)), it collects *the entire package* and *caches it*. Next time an object from the same package is rendered, the package is retrieved from the cache and not collected again. The `find_stubs_package` option will therefore only have an effect the first time a package is collected, and will do nothing for objects rendered afterwards.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ find_stubs_package: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: your_package.your_module.your_func
+ options:
+ find_stubs_package: true
+```
+
+```python title="your_package/your_module.py"
+
+def your_func(a, b):
+ # Function code
+ ...
+
+# rest of your code
+```
+
+```python title="your_package-stubs/your_module.pyi"
+
+def your_func(a: int, b: str):
+ """
+ your_funcFunction docstring
+//// + +//// tab | Without find_stubs_package +your_funclist [str ] | None :material-equal: `None`{ title="default value" }**
+
+
+Pre-load modules that are not specified directly in [autodoc instructions][autodoc syntax] (`::: identifier`).
+It is useful when you want to render documentation for a particular member of an object,
+and this member is imported from another package than its parent.
+
+For an imported member to be rendered,
+you need to add it to the [`__all__`][__all__] attribute of the importing module.
+The package from which the imported object originates must be accessible to the handler
+(see [Finding modules](../index.md#finding-modules)).
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ preload_modules:
+ - their_package
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: your_package.your_module
+ options:
+ preload_modules:
+ - their_package
+```
+
+```python title="your_package/your_module.py"
+from their_package.their_module import their_object
+
+__all__ = ["their_object"]
+
+# rest of your code
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With preloaded modules
+your_moduleDocstring of your module.
+their_objectDocstring of their object.
+//// + +//// tab | Without preloaded modules +your_moduleDocstring of your module.
+//// +/// + +[](){#option-show_bases} +## `show_bases` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Show the base classes of a class. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_bases: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.object + options: + show_bases: false +``` + +/// admonition | Preview + type: preview + +//// tab | With bases +SomeClass()Bases: SomeBaseClass
Docstring of the class.
+//// + +//// tab | Without bases +SomeClass()Docstring of the class.
+//// +/// + +[](){#option-show_inheritance_diagram} +## `show_inheritance_diagram` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the inheritance diagram of a class using [Mermaid](https://mermaid.js.org/). + +With this option enabled, an inheritance diagram (as a flowchart) +will be displayed after a class signature. +Each node will act as a cross-reference +and will bring you to the relevant class' documentation +when clicking on it. + +It should work out of the box with [Material for MkDocs][]. +For other themes, you must include Mermaid's Javascript code manually: + +```yaml title="mkdocs.yml" +extra_javascript: +- https://unpkg.com/mermaid@10.9.0/dist/mermaid.min.js +``` + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_inheritance_diagram: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.object + options: + show_inheritance_diagram: false +``` + +/// admonition | Preview + type: preview + +With the following classes: + +```python +class SuperAbstract: + """Super abstract class.""" +class Mixin1: + """Mixin 1.""" +class Abstract(SuperAbstract, Mixin1): + """Abstract class.""" +class Mixin2A: + """Mixin 2A.""" +class Mixin2B(Mixin2A): + """Mixin 2B.""" +class Concrete(Abstract, Mixin2B): + """Concrete class.""" +class SuperConcrete(Concrete): + """Super concrete class.""" +``` + +The diagram for `SuperConcrete` will look like this: + +```mermaid +flowchart TD +SuperConcrete[SuperConcrete] +Concrete[Concrete] +Abstract[Abstract] +SuperAbstract[SuperAbstract] +Mixin1[Mixin1] +Mixin2B[Mixin2B] +Mixin2A[Mixin2A] + +Concrete --> SuperConcrete +Abstract --> Concrete +SuperAbstract --> Abstract +Mixin1 --> Abstract +Mixin2B --> Concrete +Mixin2A --> Mixin2B +``` + +*Nodes are not clickable in this example +because these classes do not exist in our documentation.* +/// + +[](){#option-show_source} +## `show_source` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Show the source code of this object. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_source: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.object + options: + show_source: false +``` + +/// admonition | Preview + type: preview + +//// tab | With source +some_function()Docstring of the function.
+ +///// details | Source code in `package/module.py` + type: quote + +```python linenums="1" +def some_function(): + ... +``` +///// +//// + +//// tab | Without source +some_function()Docstring of the function.
+//// +/// + +[](){#option-skip_local_inventory} +## `skip_local_inventory` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Whether to skip registering symbols in the objects inventory. + +With this option enabled, re-rendering docstrings for objects from external inventories is possible with their cross-references pointing to the original external inventory, not local. Similarly, it becomes possible to render the same symbol several times in the same documentation, with only one canonical location being used for cross-references (preventing confusion in mkdocs-autorefs). + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + skip_local_inventory: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + skip_local_inventory: true +``` + +/// admonition | Preview + type: preview + + +//// tab | Without `skip_local_inventory` + +```md exec="on" +::: bisect.bisect_left + options: + heading_level: 3 + skip_local_inventory: false + show_docstring_description: false +``` + +Notice how [`bisect.bisect_left`][] now points to the section above. + +//// + +//// tab | With `skip_local_inventory` + +```md exec="on" +::: bisect.bisect_right + inventories: + - https://docs.python.org/3/objects.inv + options: + heading_level: 3 + skip_local_inventory: true + show_docstring_description: false +``` + +Notice how [`bisect.bisect_right`][] points to the original Python documentation. + +//// +/// diff --git a/docs/usage/configuration/headings.md b/docs/usage/configuration/headings.md new file mode 100644 index 00000000..593b6fb0 --- /dev/null +++ b/docs/usage/configuration/headings.md @@ -0,0 +1,810 @@ +# Headings options + +[](){#option-heading} +## `heading` + +- **:octicons-package-24: Type [`str`][] :material-equal: `""`{ title="default value" }** + + +A custom string to use as the heading of the root object (i.e. the object specified directly after the identifier `:::`). This will override the default heading generated by the plugin. See also the [`toc_label` option][option-toc_label]. + +WARNING: **Not advised to be used as a global configuration option.** This option is not advised to be used as a global configuration option, as it will override the default heading for all objects. It is recommended to use it only in specific cases where you want to override the heading for a specific object. + +```md title="in docs/some_page.md (local configuration)" +::: path.to.module + options: + heading: "My fancy module" +``` + +[](){#option-heading_level} +## `heading_level` + +- **:octicons-package-24: Type [`int`][] :material-equal: `2`{ title="default value" }** + + +The initial heading level to use. + +When injecting documentation for an object, +the object itself and its members are rendered. +For each layer of objects, we increase the heading level by 1. + +The initial heading level will be used for the first layer. +If you set it to 3, then headings will start with `module (3)Docstring of the module.
+ClassA (4)Docstring of class A.
+ClassB (4)Docstring of class B.
+method_1 (5)Docstring of the method.
+//// + +//// tab | With level 3, without root heading +Docstring of the module.
+ClassA (3)Docstring of class A.
+ClassB (3)Docstring of class B.
+method_1 (4)Docstring of the method.
+//// +/// + +[](){#option-parameter_headings} +## `parameter_headings` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Whether to render headings for function/method parameters. + +With this option enabled, each function/method parameter +(including parameters of `__init__` methods merged in their parent class +with the [`merge_init_into_class`][] option) +gets a permalink, an entry in the Table of Contents, +and an entry in the generated objects inventory (unless [`skip_local_inventory`][] is enabled). +The permalink and inventory entry allow cross-references +from internal and external pages. + +The identifier used in the permalink and inventory is of the following form: +`path.to.function(param_name)`. To manually cross-reference a parameter, +you can therefore use this Markdown syntax: + +```md +- Class parameter: [`param`][package.module.Class(param)] +- Method parameter: [`param`][package.module.Class.method(param)] +- Function parameter: [`param`][package.module.function(param)] +- Variadic positional parameters: [`*args`][package.module.function(*args)] +- Variadic keyword parameters: [`**kwargs`][package.module.function(**kwargs)] +``` + +Enabling this option along with [`signature_crossrefs`][] will automatically +render cross-references to parameters in class/function/method signatures +and attributes values. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + parameter_headings: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + parameter_headings: true +``` + +/// admonition | Preview: Cross-references + type: preview + +```md exec="on" +::: package.get_version + options: + heading_level: 3 + parameter_headings: true + docstring_section_style: list + +::: package.current_version + options: + heading_level: 3 + line_length: 100 +``` + +/// + +/// admonition | Preview: Parameter sections + type: preview + +//// tab | Table style +```md exec="on" +::: package.get_version + options: + heading_level: 3 + show_root_heading: false + show_root_toc_entry: false + parameter_headings: true + docstring_section_style: table + show_docstring_returns: false + show_docstring_description: false +``` +//// + +//// tab | List style +```md exec="on" +::: package.get_version + options: + heading_level: 3 + show_root_heading: false + show_root_toc_entry: false + parameter_headings: true + docstring_section_style: list + show_docstring_returns: false + show_docstring_description: false +``` +//// + +//// tab | Spacy style +```md exec="on" +::: package.get_version + options: + heading_level: 3 + show_root_heading: false + show_root_toc_entry: false + parameter_headings: true + docstring_section_style: spacy + show_docstring_returns: false + show_docstring_description: false +``` +//// +/// + +/// admonition | Preview: Table of contents (with symbol types) + type: preview + + get_version dist
+
+To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+
+///
+
+[](){#option-show_root_heading}
+## `show_root_heading`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+
+Show the heading of the object at the root of the documentation tree
+(i.e. the object referenced by the identifier after `:::`).
+
+It is pretty common to inject documentation for one module per page,
+especially when following our [automatic reference pages recipe][autopages recipe].
+Since each page already has a title, usually being the module's name,
+we can spare one heading level by not showing the heading for the module itself
+(heading levels are limited to 6 by the HTML specification).
+
+Sparing that extra level can be helpful when your objects tree is deeply nested
+(e.g. method in a class in a class in a module).
+If your objects tree is not deeply nested, and you are injecting documentation
+for many different objects on a single page, it might be preferable to render
+the heading of each object.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ show_root_heading: false
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.ClassA
+ options:
+ show_root_heading: true
+
+::: path.to.ClassB
+ options:
+ show_root_heading: true
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With root heading
+ClassA (2)Docstring of class A.
+method_a1 (3)Docstring of the method.
+ClassB (2)Docstring of class B.
+method_b1 (3)Docstring of the method.
+//// + +//// tab | Without root heading +Docstring of class A.
+method_a1 (2)Docstring of the method.
+Docstring of class B.
+method_b1 (2)Docstring of the method.
+//// +/// + +[](){#option-show_root_toc_entry} +## `show_root_toc_entry` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +If the root heading is not shown, at least add a ToC entry for it. + +If you inject documentation for an object in the middle of a page, +after long paragraphs, and without showing the [root heading][show_root_heading], +then you will not be able to link to this particular object +as it won't have a permalink and will be "lost" in the middle of text. +In that case, it is useful to add a hidden anchor to the document, +which will also appear in the table of contents. + +In other cases, you might want to disable the entry to avoid polluting the ToC. +It is not possible to show the root heading *and* hide the ToC entry. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_root_toc_entry: true +``` + +```md title="or in docs/some_page.md (local configuration)" +## Some heading + +Lots of text. + +::: path.to.object + options: + show_root_toc_entry: false + +## Other heading. + +More text. +``` + +/// admonition | Preview + type: preview + +//// tab | With ToC entry +**Table of contents** +[Some heading](#permalink-to-some-heading){ title="#permalink-to-some-heading" } +[`object`](#permalink-to-object){ title="#permalink-to-object" } +[Other heading](#permalink-to-other-heading){ title="#permalink-to-other-heading" } +//// + +//// tab | Without ToC entry +**Table of contents** +[Some heading](#permalink-to-some-heading){ title="#permalink-to-some-heading" } +[Other heading](#permalink-to-other-heading){ title="#permalink-to-other-heading" } +//// +/// + +[](){#option-show_root_full_path} +## `show_root_full_path` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Show the full Python path for the root object heading. + +The path of a Python object is the dot-separated list of names +under which it is accessible, for example `package.module.Class.method`. + +With this option you can choose to show the full path of the object +you inject documentation for, or just its name. This option impacts +only the object you specify, not its members. For members, see the two +other options [`show_root_members_full_path`][] +and [`show_object_full_path`][]. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_root_full_path: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.module.Class.method + options: + show_root_full_path: false +``` + +/// admonition | Preview + type: preview + +//// tab | With root full path +package.module.Class.methodDocstring of the method.
+//// + +//// tab | Without root full path +methodDocstring of the method.
+//// +/// + +[](){#option-show_root_members_full_path} +## `show_root_members_full_path` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the full Python path of the root members. + +This option does the same thing as [`show_root_full_path`][], +but for direct members of the root object instead of the root object itself. + +To show the full path for every member recursively, +see [`show_object_full_path`][]. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_root_members_full_path: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.module + options: + show_root_members_full_path: false +``` + +/// admonition | Preview + type: preview + +//// tab | With members full path +Docstring of the module.
+package.module.ClassDocstring of the class.
+methodDocstring of the method.
+//// + +//// tab | Without members full path +Docstring of the module.
+ClassDocstring of the class.
+methodDocstring of the method.
+//// +/// + +[](){#option-show_object_full_path} +## `show_object_full_path` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the full Python path of every object. + +Same as for [`show_root_members_full_path`][], +but for every member, recursively. This option takes precedence over +[`show_root_members_full_path`][]: + +`show_root_members_full_path` | `show_object_full_path` | Direct root members path +----------------------------- | ----------------------- | ------------------------ +False | False | Name only +False | True | Full +True | False | Full +True | True | Full + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_object_full_path: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.module + options: + show_object_full_path: false +``` + +/// admonition | Preview + type: preview + +//// tab | With objects full path +Docstring of the module.
+package.module.ClassDocstring of the class.
+package.module.Class.methodDocstring of the method.
+//// + +//// tab | Without objects full path +Docstring of the module.
+ClassDocstring of the class.
+methodDocstring of the method.
+//// +/// + +[](){#option-show_category_heading} +## `show_category_heading` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +When [grouped by categories][group_by_category], show a heading for each category. +These category headings will appear in the table of contents, +allowing you to link to them using their permalinks. + +WARNING: **Not recommended with deeply nested objects.** +When injecting documentation for deeply nested objects, +you'll quickly run out of heading levels, and the objects +at the bottom of the tree risk all getting documented +using H6 headings, which might decrease the readability +of your API docs. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + group_by_category: true + show_category_heading: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.module + options: + group_by_category: true + show_category_heading: false +``` + +/// admonition | Preview + type: preview + +//// tab | With category headings +Docstring of the module.
+module_attribute (3)Docstring of the module attribute.
+Class (3)Docstring of the class.
+class_attribute (5)Docstring of the class attribute.
+method (5)Docstring of the method.
+//// + +//// tab | Without category headings +Docstring of the module.
+module_attribute (2)Docstring of the module attribute.
+Class (2)Docstring of the class.
+class_attribute (3)Docstring of the class attribute.
+method (3)Docstring of the method.
+//// +/// + +[](){#option-show_symbol_type_heading} +## `show_symbol_type_heading` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the symbol type in headings. + +This option will prefix headings with +,
+,
+,
+ or
+ types.
+See also [`show_symbol_type_toc`][show_symbol_type_toc].
+
+To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ show_symbol_type_heading: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: package.module
+ options:
+ show_symbol_type_heading: false
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With symbol type in headings
+ moduleDocstring of the module.
+ attributeDocstring of the module attribute.
+ functionDocstring of the function.
+ ClassDocstring of the class.
+ methodDocstring of the method.
+//// + +//// tab | Without symbol type in headings +moduleDocstring of the module.
+attributeDocstring of the module attribute.
+functionDocstring of the function.
+ClassDocstring of the class.
+methodDocstring of the method.
+//// +/// + +[](){#option-show_symbol_type_toc} +## `show_symbol_type_toc` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the symbol type in the Table of Contents. + +This option will prefix items in the ToC with +,
+,
+,
+ or
+ types.
+See also [`show_symbol_type_heading`][show_symbol_type_heading].
+
+To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ show_symbol_type_toc: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: package.module
+ options:
+ show_symbol_type_toc: false
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With symbol type in ToC
+ module attribute function Class
+ method mutate U
+
+To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+
+///
diff --git a/docs/usage/configuration/members.md b/docs/usage/configuration/members.md
new file mode 100644
index 00000000..53d955fa
--- /dev/null
+++ b/docs/usage/configuration/members.md
@@ -0,0 +1,711 @@
+# Members options
+
+[](){#option-members}
+## `members`
+
+- **:octicons-package-24: Type list [str ] |
+ bool | None :material-equal: `None`{ title="default value" }**
+
+
+An explicit list of members to render.
+
+Only members declared in this list will be rendered.
+A member without a docstring will still be rendered,
+even if [`show_if_no_docstring`][] is set to false.
+
+The members will be rendered in the specified order,
+regardless of the value of [`members_order`][].
+**Note that members will still be grouped by category,
+according to the [`group_by_category`][] option.**
+
+Passing a falsy value (`no`, `false` in YAML) or an empty list (`[]`)
+will tell the Python handler not to render any member.
+Passing a truthy value (`yes`, `true` in YAML)
+will tell the Python handler to render every member.
+
+Any given value, except for an explicit `None` (`null` in YAML)
+will tell the handler to ignore [`filters`][] for the object's members.
+Filters will still be applied to the next layers of members (grand-children).
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ members:
+ - hello # (1)
+```
+
+1. :warning: Most of the time it won't make sense to use this option at the global level.
+
+```md title="or in docs/some_page.md (local configuration)"
+::: package.module
+ options:
+ members:
+ - ThisClass
+ - this_function
+```
+
+```python title="package/module.py"
+"""Module docstring."""
+
+
+def this_function():
+ """Function docstring."""
+
+
+class ThisClass:
+ """Class docstring."""
+
+ def method(self):
+ """Method docstring."""
+
+
+this_attribute = 0
+"""Attribute docstring."""
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With `members: true`
+Module docstring.
+this_functionFunction docstring.
+ThisClassClass docstring.
+methodMethod docstring.
+this_attributeAttribute docstring.
+//// + +//// tab | With `members: false` or `members: []` +Module docstring.
+//// + +//// tab | With `members: [ThisClass]` +Module docstring.
+ThisClassClass docstring.
+methodMethod docstring.
+//// +/// + +INFO: **The default behavior (with unspecified `members` or `members: null`) is to use [`filters`][].** + +[](){#option-inherited_members} +## `inherited_members` + +- **:octicons-package-24: Typelist [str ] |
+ bool :material-equal: `False`{ title="default value" }**
+
+
+An explicit list of inherited members (for classes) to render.
+
+Inherited members are always fetched from classes that are in the same package
+as the currently rendered class. To fetch members inherited from base classes,
+themselves coming from external packages, use the [`preload_modules`][preload_modules] option.
+For example, if your class inherits from Pydantic's `BaseModel`, and you want to render
+`BaseModel`'s methods in your class, use `preload_modules: [pydantic]`.
+The `pydantic` package must be available in the current environment.
+
+Passing a falsy value (`no`, `false` in YAML) or an empty list (`[]`)
+will tell the Python handler not to render any inherited member.
+Passing a truthy value (`yes`, `true` in YAML)
+will tell the Python handler to render every inherited member.
+
+When all inherited members are selected with `inherited_members: true`,
+it is possible to specify both members and inherited members in the `members` list:
+
+```yaml
+inherited_members: true
+members:
+- inherited_member_a
+- inherited_member_b
+- member_x
+- member_y
+```
+
+The alternative is not supported:
+
+```yaml
+inherited_members:
+- inherited_member_a
+- inherited_member_b
+members:
+- member_x
+- member_y
+```
+
+...because it would make members ordering ambiguous/unspecified.
+
+You can render inherited members *only* by setting `inherited_members: true`
+(or a list of inherited members) and setting `members: false`:
+
+```yaml
+inherited_members: true
+members: false
+```
+
+```yaml
+inherited_members:
+- inherited_member_a
+- inherited_member_b
+members: false
+```
+
+You can render *all declared members* and all or specific inherited members
+by leaving `members` as null (default):
+
+```yaml
+inherited_members:
+- inherited_member_a
+- inherited_member_b
+# members: null # (1)
+```
+
+1. In this case, only declared members will be subject
+to further filtering with [`filters`][filters] and [`docstrings`][show_if_no_docstring].
+
+```yaml
+inherited_members: true # (1)
+# members: null
+```
+
+1. In this case, both declared and inherited members will be subject
+to further filtering with [`filters`][filters] and [`docstrings`][show_if_no_docstring].
+
+You can render *all declared members* and all or specific inherited members,
+avoiding further filtering with [`filters`][filters] and [`docstrings`][show_if_no_docstring]
+by setting `members: true`:
+
+```yaml
+inherited_members: true
+members: true
+```
+
+```yaml
+inherited_members:
+- inherited_member_a
+- inherited_member_b
+members: true
+```
+
+The general rule is that declared or inherited members specified in lists
+are never filtered out.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ inherited_members: false
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: package.module
+ options:
+ inherited_members: true
+```
+
+```python title="package/module.py"
+"""Module docstring."""
+
+
+class Base:
+ """Base class."""
+
+ def base(self):
+ """Base method."""
+
+
+class Main(Base):
+ """Main class."""
+
+ def main(self):
+ """Main method."""
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With inherited members
+Module docstring.
+BaseBase class.
+baseBase method.
+MainMain class.
+baseBase method.
+mainMain method.
+//// + +//// tab | Without inherited members +Module docstring.
+BaseBase class.
+baseBase method.
+MainMain class.
+mainMain method.
+//// + +/// + +[](){#option-members_order} +## `members_order` + +- **:octicons-package-24: Type `str | list[str]` :material-equal: `"alphabetical"`{ title="default value" }** + + +The members ordering to use. Possible values: + +- `__all__`: Order according to `__all__` attributes. Since classes do not define `__all__` attributes, you can specify a second ordering method by using a list. +- `alphabetical`: Order by the members names. +- `source`: Order members as they appear in the source file. + +The order applies for all members, recursively. +The order will be ignored for members that are explicitely sorted using the [`members`][] option. +**Note that members will still be grouped by category, +according to the [`group_by_category`][] option.** + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + members_order: alphabetical +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.module + options: + members_order: source +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.module + options: + members_order: [__all__, source] +``` + +```python title="package/module.py" +"""Module docstring.""" + + +def function_b(): + """Function a.""" + + +def function_a(): + """Function b.""" + + +def function_c(): + """Function c.""" +``` + +/// admonition | Preview + type: preview + +//// tab | With alphabetical order +Module docstring.
+function_aFunction a.
+function_bFunction b.
+function_cFunction c.
+//// + +//// tab | With source order +Module docstring.
+function_bFunction b.
+function_aFunction a.
+function_cFunction c.
+//// +/// + +[](){#option-filters} +## `filters` + +- **:octicons-package-24: Typelist [str ] | Literal ["public"] | None :material-equal: `["!^_[^_]"]`{ title="default value" }**
+
+
+A list of filters, or `"public"`.
+
+**Filtering methods**
+
+[](){#option-filters-public}
+
+The `public` filtering method will include only public objects: those added to the `__all__` attribute of modules, or not starting with a single underscore. Special methods and attributes ("dunder" methods/attributes, starting and ending with two underscores), like `__init__`, `__call__`, `__mult__`, etc., are always considered public.
+
+**List of filters**
+
+Filters are regular expressions. These regular expressions are evaluated by Python
+and so must match the syntax supported by the [`re`][] module.
+A filter starting with `!` (negative filter) will exclude matching objects instead of including them.
+
+The default value (`["!^_[^_]"]`) means: *render every object, except those
+starting with one underscore, unless they start with two underscores*.
+It means that an object whose name is `hello`, `__hello`, or `__hello__`
+will be rendered, but not one whose name is `_hello`.
+
+Each filter takes precedence over the previous one. This allows for fine-grain
+selection of objects by adding more specific filters. For example, you can
+start by unselecting objects that start with `_`, and add a second filter
+that re-select objects that start with `__`. The default filters can
+therefore be rewritten like this:
+
+```yaml
+filters:
+- "!^_"
+- "^__"
+```
+
+If there are no negative filters, the handler considers that everything
+is **unselected** first, and then selects things based on your positive filters.
+If there is at least one negative filter, the handler considers that everything
+is **selected** first, and then re-selects/unselects things based on your other filters.
+In short, `filters: ["a"]` means *"keep ***nothing*** except names containing `a`"*, while
+`filters: ["!a"]` means *"keep ***everything*** except names containing `a`"*.
+
+An empty list of filters tells the Python handler to render every object.
+The [`members`][] option takes precedence over filters
+(filters will still be applied recursively to lower members in the hierarchy).
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ filters:
+ - "!^_[^_]"
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: package.module
+ options:
+ filters: public
+```
+
+```python title="package/module.py"
+def hello():
+ ...
+
+
+def _world():
+ ...
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With `filters: []`
+Module docstring.
+helloFunction docstring.
+_worldFunction docstring.
+//// + +//// tab | With `filters: ["hello"]` +Module docstring.
+helloFunction docstring.
+//// + +//// tab | With `filters: ["!hello"]` +Module docstring.
+_worldFunction docstring.
+//// +/// + +/// admonition | Common filters + type: tip + +Here are some common filters that you might to want to use. + +- `["!^_"]`: exclude all private/protected/special objects +- `["!^_", "^__init__$"]`: same as above, but keep `__init__` methods +- `["!^_[^_]"]`: exclude all private/protected objects, keep special ones (default filters) +/// + +[](){#option-group_by_category} +## `group_by_category` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Group the object members by categories: attributes, classes, functions, and modules. + +Members within a same category will be ordered according to the [`members_order`][] option. +You can use the [`show_category_heading`][] option to also render a heading for each category. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + group_by_category: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.module + options: + group_by_category: false +``` + +```python title="package/module.py" +def function_a(): + ... + + +class ClassB: + ... + + +attribute_C = 0 + + +def function_d(): + ... +``` + +/// admonition | Preview + type: preview + +//// tab | With category grouping +Module docstring.
+attribute_cAttribute docstring.
+ClassBClass docstring.
+function_aFunction docstring.
+function_dFunction docstring.
+//// + +//// tab | Without category grouping +Module docstring.
+function_aFunction docstring.
+ClassBClass docstring.
+attribute_cAttribute docstring.
+function_dFunction docstring.
+//// +/// + +[](){#option-show_submodules} +## `show_submodules` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +When rendering a module, show its submodules recursively. + +This is false by default, because most of the time we render only one module per page, +and when rendering a package (a tree of modules and their members) on a single page, +we quickly run out of [heading levels][heading_level]. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_submodules: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: package.subpackage + options: + show_submodules: false +``` + +```tree title="package" +package + __init__.py + subpackage + __init__.py + submodule.py +``` + +/// admonition | Preview + type: preview + +//// tab | With submodules +Subpackage docstring.
+subpackage_memberMember docstring.
+submoduleSubmodule docstring.
+submodule_memberMember docstring.
+//// + +//// tab | Without submodules +Subpackage docstring.
+subpackage_memberMember docstring.
+//// +/// + +[](){#option-summary} +## `summary` + +- **:octicons-package-24: Typebool | dict [str , bool ] :material-equal: `False`{ title="default value" }**
+
+
+Whether to render summaries of modules, classes, functions (methods) and attributes.
+
+This option accepts a boolean (`yes`, `true`, `no`, `false` in YAML)
+or a dictionary with one or more of the following keys: `attributes`, `functions`, `classes`, `modules`, `type_aliases`,
+with booleans as values. Class methods summary is (de)activated with the `functions` key.
+By default, `summary` is false, and by extension all values are false.
+
+Examples:
+
+```yaml
+summary: true
+```
+
+```yaml
+summary: false
+```
+
+```yaml
+summary:
+ attributes: false
+ functions: true
+ modules: false
+```
+
+Summaries will be rendered as the corresponding docstring sections.
+For example, the summary for attributes will be rendered as an Attributes docstring section.
+The section will be rendered in accordance with the [`docstring_section_style`][] option.
+If the objects appearing in the summary are also rendered on the page
+(or somewhere else on the site), their name will automatically link to their rendered documentation.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ summary: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ summary: false
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With all summaries
+```
+::: path.to.module.MyClass
+ options:
+ summary: true
+```
+Class docstring.
+Methods:
+Attributes:
+Class docstring.
+Methods:
+
+ some_attr:
+ int
+
+instance-attribute
+////
+
+//// tab | Without labels
+
+ some_attr:
+ int
+
+////
+///
diff --git a/docs/usage/configuration/signatures.md b/docs/usage/configuration/signatures.md
new file mode 100644
index 00000000..109362e3
--- /dev/null
+++ b/docs/usage/configuration/signatures.md
@@ -0,0 +1,701 @@
+# Signatures options
+
+[](){#option-annotations_path}
+## `annotations_path`
+
+- **:octicons-package-24: Type [`str`][] :material-equal: `"brief"`{ title="default value" }**
+
+
+The verbosity for annotations path.
+
+Possible values:
+
+- `brief` (recommended): render only the last component of each type path, not their full paths.
+ For example, it will render `Sequence[Path]` and not `typing.Sequence[pathlib.Path]`.
+ Brief annotations will cross-reference the right object anyway,
+ and show the full path in a tooltip when hovering them.
+- `source`: render annotations as written in the source. For example if you imported `typing` as `t`,
+ it will render `typing.Sequence` as `t.Sequence`. Each part will cross-reference the relevant object:
+ `t` will link to the `typing` module and `Sequence` will link to the `Sequence` type.
+- `full`: render annotations with their full path (the opposite of brief).
+ For example if you import `Sequence` and `Pattern` from `typing` and annoate something using
+ `Sequence[Pattern]`, it will render as `typing.Sequence[typing.Pattern]`, with each part
+ cross-referencing the corresponding object.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ annotations_path: brief
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ annotations_path: source
+```
+
+
+/// admonition | Preview
+ type: preview
+
+//// tab | Brief annotations
+```python
+import markdown
+import markupsafe
+
+
+def convert(text: str, md: markdown.Markdown) -> markupsafe.Markup:
+ """Convert text to Markdown.
+
+ Parameters:
+ text: The text to convert.
+ md: A Markdown instance.
+
+ Returns:
+ Converted markup.
+ """
+ return markupsafe.Markup(md.convert(text))
+```
+
+convert(text, md)Convert text to Markdown.
+Parameters:
+ +**Type** | **Description** | **Default** +---------- | ------------------------ | ----------- +[`str`][] | The text to convert. | *required* +[`Markdown`](#ref-to-markdown){ .external title="markdown.Markdown" } | A Markdown instance. | *required* + +Returns:
+ +**Type** | **Name** | **Description** +---------- | ----------- | --------------- +[`Markup`](#ref-to-markup){ .external title="markupsafe.Markup" } | `text` | Converted markup. +//// + +//// tab | Source annotations +```python +import markdown +from markupsafe import Markup + + +def convert(text: str, md: markdown.Markdown) -> Markup: + """Convert text to Markdown. + + Parameters: + text: The text to convert. + md: A Markdown instance. + + Returns: + Converted markup. + """ + return Markup(md.convert(text)) +``` + +convert(text, md)Convert text to Markdown.
+Parameters:
+ +**Type** | **Description** | **Default** +---------- | ------------------------ | ----------- +[`str`][] | The text to convert. | *required* +markdown.Markdown | A Markdown instance. | *required*
+
+Returns:
+ +**Type** | **Name** | **Description** +---------- | ----------- | --------------- +[`Markup`](#ref-to-markup){ .external title="markupsafe.Markup" } | `text` | Converted markup. +//// + +//// tab | Full annotations +```python +from markdown import Markdown +from markupsafe import Markup + + +def convert(text: str, md: Markdown) -> Markup: + """Convert text to Markdown. + + Parameters: + text: The text to convert. + md: A Markdown instance. + + Returns: + Converted markup. + """ + return Markup(md.convert(text)) +``` + +convert(text, md)Convert text to Markdown.
+Parameters:
+ +**Type** | **Description** | **Default** +---------- | ------------------------ | ----------- +[`str`][] | The text to convert. | *required* +markdown.Markdown | A Markdown instance. | *required*
+
+Returns:
+ +**Type** | **Name** | **Description** +---------- | ----------- | --------------- +markupsafe.Markup | `text` | Converted markup.
+////
+///
+
+[](){#option-line_length}
+## `line_length`
+
+- **:octicons-package-24: Type [`int`][] :material-equal: `60`{ title="default value" }**
+
+
+Maximum line length when formatting code/signatures.
+
+When separating signatures from headings with the [`separate_signature`][] option,
+the Python handler will try to format the signatures using a formatter and
+the specified line length.
+
+The handler will automatically try to format using :
+
+1. [Black]
+2. [Ruff]
+
+If a formatter is not found, the handler issues an INFO log once.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ separate_signature: true
+ line_length: 60
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ separate_signature: true
+ line_length: 80
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | Line length 60
+long_function_name(
+ long_parameter_1="hello",
+ long_parameter_2="world",
+)
+////
+
+//// tab | Line length 80
+long_function_name(long_parameter_1="hello", long_parameter_2="world")
+////
+///
+
+[](){#option-modernize_annotations}
+## `modernize_annotations`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+
+Modernize annotations with latest features and PEPs of the Python language.
+
+The Python language keeps evolving, and often library developers
+must continue to support a few minor versions of Python.
+Therefore they cannot use some features that were introduced
+in the latest versions.
+
+Yet this doesn't mean they can't enjoy latest features in their docs:
+Griffe allows to "modernize" expressions, for example
+by replacing `typing.Union` with [PEP 604][pep-604] type unions `|`.
+Thanks to this, mkdocstrings' Python handler
+can automatically transform type annotations into their modern equivalent.
+This improves consistency in your docs, and shows users
+how to use your code with the latest features of the language.
+
+[pep-604]: https://peps.python.org/pep-0604/
+
+Modernizations applied:
+
+- `typing.Dict[A, B]` becomes `dict[A, B]`
+- `typing.List[A]` becomes `list[A]`
+- `typing.Set[A]` becomes `set[A]`
+- `typing.Tuple[A]` becomes `tuple[A]`
+- `typing.Union[A, B]` becomes `A | B`
+- `typing.Optional[A]` becomes `A | None`
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ modernize_annotations: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.object
+ options:
+ modernize_annotations: false
+```
+
+/// admonition | Preview
+ type: preview
+
+```python
+--8<-- "docs/snippets/package/modern.py"
+```
+
+//// tab | Unchanged annotations
+
+```md exec="on"
+::: package.modern.example
+ options:
+ modernize_annotations: false
+ show_symbol_type_heading: false
+ show_labels: false
+```
+
+////
+
+//// tab | Modernized annotations
+
+```md exec="on"
+::: package.modern.example
+ options:
+ modernize_annotations: true
+ show_symbol_type_heading: false
+ show_labels: false
+```
+
+////
+
+///
+
+[](){#option-overloads_only}
+## `overloads_only`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+Whether to hide the implementation signature if the overloads are shown with [`show_overloads`][].
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ overloads_only: false
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ overloads_only: true
+```
+
+/// admonition | Preview
+ type: preview
+//// tab | With overloads only
+function(param1, param2=None)Function docstring.
+//// + +//// tab | Without signature +functionFunction docstring.
+//// +/// + +[](){#option-show_signature_annotations} +## `show_signature_annotations` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the type annotations in methods and functions signatures. + +Since the heading can become quite long when annotations are rendered, +it is usually best to [separate the signature][separate_signature] from the heading. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + separate_signature: true + show_signature_annotations: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + separate_signature: true + show_signature_annotations: false +``` + +/// admonition | Preview + type: preview + +//// tab | With signature annotations +Function docstring.
+//// + +//// tab | Without signature annotations +Function docstring.
+//// +/// + +[](){#option-show_signature_type_parameters} +## `show_signature_type_parameters` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Show the type parameters in generic classes, methods, functions and type aliases +signatures. + +Since the heading can become quite long when type parameters are rendered, it is +usually best to [separate the signature][separate_signature] from the heading. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + separate_signature: true + show_signature_annotations: true + show_signature_type_parameters: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + separate_signature: true + show_signature_annotations: true + show_signature_type_parameters: false +``` + +/// admonition | Preview + type: preview + +//// tab | With signature type parameters +Function docstring.
+//// + +//// tab | Without signature type parameters +Function docstring.
+//// +/// + +[](){#option-separate_signature} +## `separate_signature` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Whether to put the whole signature in a code block below the heading. + +When separating signatures from headings, +the Python handler will try to format the signatures using a formatter and +the specified [line length][line_length]. + +The handler will automatically try to format using : + +1. [Black] +2. [Ruff] + +If a formatter is not found, the handler issues an INFO log once. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + separate_signature: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + separate_signature: true +``` + +/// admonition | Preview + type: preview + +//// tab | With separate signature +Function docstring.
+//// + +//// tab | Without separate signature +function(param1, param2=None)Function docstring.
+//// +/// + +[](){#option-show_attribute_values} +## `show_attribute_values` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Show initial values of attributes in classes. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_attribute_values: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.object + options: + show_attribute_values: true +``` + +```python title="package/module.py" +class SomeClass: + def __init__(self): + self.some_attr = 1 +``` + +/// admonition | Preview + type: preview + +//// tab | With attribute values visible +SomeClasssome_attr = 1
+//// + +//// tab | With attribute values hidden +SomeClasssome_attr
+//// +/// + +[](){#option-show_overloads} +## `show_overloads` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + +Whether to render function / method overloads. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_overloads: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_overloads: false +``` + +/// admonition | Preview + type: preview +//// tab | With overloads +Function docstring.
+//// + +//// tab | Without signature cross-references +do_format_code(code: str, line_length: int) -> str
+Function docstring.
+//// +/// + +[](){#option-unwrap_annotated} +## `unwrap_annotated` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Whether to unwrap [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated){ .external } +types to show only the type without the annotations. + +For example, unwrapping `Annotated[int, Gt(10)]` will render `int`. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + unwrap_annotated: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + unwrap_annotated: true +``` diff --git a/docs/usage/customization.md b/docs/usage/customization.md new file mode 100644 index 00000000..d1e66b31 --- /dev/null +++ b/docs/usage/customization.md @@ -0,0 +1,496 @@ +# Customization + +It is possible to customize the output of the generated documentation with CSS +and/or by overriding templates. + +## CSS classes + +Our templates add [CSS](https://www.w3schools.com/Css/) classes to many HTML elements +to make it possible for users to customize the resulting look and feel. + +To add CSS rules and style mkdocstrings' output, +put them in a CSS file in your docs folder, for example in `docs/css/mkdocstrings.css`, +and reference this file in [MkDocs' `extra_css` configuration option](https://www.mkdocs.org/user-guide/configuration/#extra_css): + +```yaml title="mkdocs.yml" +extra_css: +- css/mkdocstrings.css +``` + +Example: + +```css title="docs/css/mkdocstrings.css" +.doc-section-title { + font-weight: bold; +} +``` + +The following CSS classes are used in the generated HTML: + +- `doc`: on all the following elements +- `doc-children`: on `div`s containing the children of an object +- `doc-object`: on `div`s containing an object + - `doc-attribute`: on `div`s containing an attribute + - `doc-class`: on `div`s containing a class + - `doc-function`: on `div`s containing a function + - `doc-module`: on `div`s containing a module + - `doc-type_alias`: on `div`s containing a type alias +- `doc-heading`: on objects headings + - `doc-object-name`: on `span`s wrapping objects names/paths in the heading + - `doc-KIND-name`: as above, specific to the kind of object (module, class, function, attribute, type_alias) +- `doc-contents`: on `div`s wrapping the docstring then the children (if any) + - `first`: same, but only on the root object's contents `div` +- `doc-labels`: on `span`s wrapping the object's labels + - `doc-label`: on `small` elements containing a label + - `doc-label-LABEL`: same, where `LABEL` is replaced by the actual label +- `doc-section-title`: on section titles (depend on the [selected style for section rendering][docstring_style]) +- `doc-section-item`: on section items (depend on the [selected style for section rendering][docstring_style]) +- `doc-md-description`: on `div`s containing HTML descriptions converted from Markdown docstrings +- `doc-symbol`: on `code` tags of symbol types + - `doc-symbol-heading`: on symbol types in headings + - `doc-symbol-toc`: on symbol types in the ToC + - `doc-symbol-KIND`: specific to the kind of object (`module`, `class`, `function`, `method`, `attribute`, `type_alias`) + +/// admonition | Example with colorful labels + type: example + +//// tab | CSS +```css +.doc-label { border-radius: 15px; padding: 2px 8px; font-weight: bold; } +.doc-label-special { background-color: #3330E4; color: white; } +.doc-label-private { background-color: #F637EC; color: white; } +.doc-label-property { background-color: #FBB454; color: black; } +.doc-label-read-only { background-color: #FAEA48; color: black; } +``` +//// + +//// tab | Result + ++ special + private + property + read-only +
+ +//// + +/// + +## Symbol types + +### Colors + +You can customize the colors of the symbol types +(see [`show_symbol_type_heading`][show_symbol_type_heading] and [`show_symbol_type_toc`][show_symbol_type_toc]) +by overriding the values of our CSS variables, for example: + +```css title="docs/css/mkdocstrings.css" +[data-md-color-scheme="default"] { + --doc-symbol-parameter-fg-color: #df50af; + --doc-symbol-type_parameter-fg-color: #df50af; + --doc-symbol-attribute-fg-color: #0079ff; + --doc-symbol-function-fg-color: #00dfa2; + --doc-symbol-method-fg-color: #00dfa2; + --doc-symbol-class-fg-color: #d1b619; + --doc-symbol-type_alias-fg-color: #d1b619; + --doc-symbol-module-fg-color: #ff0060; + + --doc-symbol-parameter-bg-color: #df50af1a; + --doc-symbol-type_parameter-bg-color: #df50af1a; + --doc-symbol-attribute-bg-color: #0079ff1a; + --doc-symbol-function-bg-color: #00dfa21a; + --doc-symbol-method-bg-color: #00dfa21a; + --doc-symbol-class-bg-color: #d1b6191a; + --doc-symbol-type_alias-bg-color: #d1b6191a; + --doc-symbol-module-bg-color: #ff00601a; +} + +[data-md-color-scheme="slate"] { + --doc-symbol-parameter-fg-color: #ffa8cc; + --doc-symbol-type_parameter-fg-color: #ffa8cc; + --doc-symbol-attribute-fg-color: #963fb8; + --doc-symbol-function-fg-color: #6d67e4; + --doc-symbol-method-fg-color: #6d67e4; + --doc-symbol-class-fg-color: #46c2cb; + --doc-symbol-type_alias-fg-color: #46c2cb; + --doc-symbol-module-fg-color: #f2f7a1; + + --doc-symbol-parameter-bg-color: #ffa8cc1a; + --doc-symbol-type_parameter-bg-color: #ffa8cc1a; + --doc-symbol-attribute-bg-color: #963fb81a; + --doc-symbol-function-bg-color: #6d67e41a; + --doc-symbol-method-bg-color: #6d67e41a; + --doc-symbol-class-bg-color: #46c2cb1a; + --doc-symbol-type_alias-bg-color: #46c2cb1a; + --doc-symbol-module-bg-color: #f2f7a11a; +} +``` + +The `[data-md-color-scheme="*"]` selectors work with the [Material for MkDocs] theme. +If you are using another theme, adapt the selectors to this theme +if it supports light and dark themes, +otherwise just override the variables at root level: + +```css title="docs/css/mkdocstrings.css" +:root { + --doc-symbol-parameter-fg-color: #df50af; + --doc-symbol-type_parameter-fg-color: #df50af; + --doc-symbol-attribute-fg-color: #0079ff; + --doc-symbol-function-fg-color: #00dfa2; + --doc-symbol-method-fg-color: #00dfa2; + --doc-symbol-class-fg-color: #d1b619; + --doc-symbol-type_alias-fg-color: #d1b619; + --doc-symbol-module-fg-color: #ff0060; + + --doc-symbol-parameter-bg-color: #df50af1a; + --doc-symbol-type_parameter-bg-color: #df50af1a; + --doc-symbol-attribute-bg-color: #0079ff1a; + --doc-symbol-function-bg-color: #00dfa21a; + --doc-symbol-method-bg-color: #00dfa21a; + --doc-symbol-class-bg-color: #d1b6191a; + --doc-symbol-type_alias-bg-color: #d1b6191a; + --doc-symbol-module-bg-color: #ff00601a; +} +``` + +/// admonition | Preview + type: preview + +
+ Try cycling through the themes to see the colors for each theme:
+
+
+
+
+
+
+
{text}"
- return Markup(text).format(**variables)
-
-
-def _keep_object(name, filters):
- keep = None
- rules = set()
- for regex, exclude in filters:
- rules.add(exclude)
- if regex.search(name):
- keep = not exclude
- if keep is None:
- if rules == {False}: # noqa: WPS531
- # only included stuff, no match = reject
- return False
- # only excluded stuff, or included and excluded stuff, no match = keep
- return True
- return keep
-
-
-def do_filter_objects(
- objects_dictionary: dict[str, Object | Alias],
- filters: list[tuple[bool, Pattern]] | None = None,
- members_list: list[str] | None = None,
- keep_no_docstrings: bool = True,
-) -> list[Object | Alias]:
- """Filter a dictionary of objects based on their docstrings.
-
- Parameters:
- objects_dictionary: The dictionary of objects.
- filters: Filters to apply, based on members' names.
- Each element is a tuple: a pattern, and a boolean indicating whether
- to reject the object if the pattern matches.
- members_list: An optional, explicit list of members to keep.
- When given and empty, return an empty list.
- When given and not empty, ignore filters and docstrings presence/absence.
- keep_no_docstrings: Whether to keep objects with no/empty docstrings (recursive check).
-
- Returns:
- A list of objects.
- """
- if members_list is not None:
- if not members_list:
- return []
- return [obj for obj in objects_dictionary.values() if obj.name in set(members_list)]
- objects = list(objects_dictionary.values())
- if filters:
- objects = [obj for obj in objects if _keep_object(obj.name, filters)]
- if keep_no_docstrings:
- return objects
- return [obj for obj in objects if obj.has_docstrings]
-
-
-@lru_cache(maxsize=1)
-def _get_black_formatter():
- try:
- from black import Mode, format_str
- except ModuleNotFoundError:
- logger.warning("Formatting signatures requires Black to be installed.")
- return lambda text, _: text
-
- def formatter(code, line_length): # noqa: WPS430
- mode = Mode(line_length=line_length)
- return format_str(code, mode=mode)
-
- return formatter
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
deleted file mode 100644
index 019e7fae..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
+++ /dev/null
@@ -1,69 +0,0 @@
-{{ log.debug("Rendering " + attribute.path) }}
-
- '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the attribute.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ attribute_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ attribute_name }}{% if attribute.annotation and config.show_signature_annotations %}: {{ attribute.annotation }}{% endif %}
+ {% if config.show_attribute_values and attribute.value %} = {{ attribute.value }}{% endif %}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the attribute.
+ -#}
+ {% with labels = attribute.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the attribute.
+ -#}
+ {% if config.separate_signature %}
+ {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs, show_value=config.show_attribute_values) %}
+ {{ attribute.name }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="data" if attribute.parent.kind.value == "module" else "attr",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute_name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+ {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}
- {% endif %}
-
- {% with labels = class.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
-
- {% endfilter %}
-
- {% if config.separate_signature and config.merge_init_into_class %}
- {% if "__init__" in class.members %}
- {% with function = class.members["__init__"] %}
- {% filter highlight(language="python", inline=False) %}
- {% filter format_signature(config.line_length) %}
- {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}
- {% include "signature.html" with context %}
- {% endfilter %}
- {% endfilter %}
- {% endwith %}
- {% endif %}
- {% endif %}
-
- {% else %}
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
- role="class",
- id=html_id,
- toc_label=class.path if config.show_root_full_path else class.name,
- hidden=True) %}
- {% endfilter %}
- {% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
-
- Bases: {% for expression in class.bases -%}
- {% include "expression.html" with context %}{% if not loop.last %}, {% endif %}
- {% endfor -%}
-
{{ class.relative_filepath }}{{ class.relative_filepath }} '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the class.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ class_name }}
+ {% elif config.merge_init_into_class and "__init__" in all_members %}
+ {% with function = all_members["__init__"] %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ class_name -}}
+ {%- with obj = function -%}
+ {%- include "type_parameters.html.jinja" with context -%}
+ {%- endwith -%}
+ {%- include "signature.html.jinja" with context -%}
+ {% endfilter %}
+ {% endwith %}
+ {% else %}
+ {# TODO: Maybe render type parameters here. #}
+ {{ class_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the class.
+ -#}
+ {% with labels = class.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the class.
+ Overloads of the `__init__` method are rendered if `merge_init_into_class` is enabled.
+ The actual `__init__` method signature is only rendered if `separate_signature` is also enabled.
+
+ If the class is generic, but the `__init__` method isn't or `merge_init_into_class` is disabled,
+ the class signature is rendered if `separate_signature` and `show_signature_type_parameters` are enabled.
+
+ If the `__init__` method or any overloads are generic, they are rendered as methods if
+ `merge_init_into_class`, `separate_signature` and `show_signature_type_parameters` are enabled.
+ -#}
+ {% if config.merge_init_into_class and "__init__" in all_members %}
+ {% with function = all_members["__init__"] %}
+ {% if function.overloads and config.show_overloads %}
+ '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ Bases: {% for expression in class.bases -%}
+
+ {%- with backlink_type = "subclassed-by" -%}
+ {%- include "expression.html.jinja" with context -%}
+ {%- endwith -%}
+ {% if not loop.last %}, {% endif %}
+ {% endfor -%}
+
+ flowchart {{ config.inheritance_diagram_direction }}
+ {{ class.path }}[{{ class.name }}]
+ {% for base in class.mro() %}
+ {{ base.path }}[{{ base.name }}]
+ {% endfor %}
+
+ {{ edges(class) | safe }}
+
+ click {{ class.path }} href "" "{{ class.path }}"
+ {% for base in class.mro() %}
+ click {{ base.path }} href "" "{{ base.path }}"
+ {% endfor %}
+
+
+ {% endif %}
+ {% endblock inheritance_diagram %}
+
+ {% block docstring scoped %}
+ {#- Docstring block.
+
+ This block renders the docstring for the class.
+ -#}
+ {% with docstring_sections = class.docstring.parsed %}
+ {% include "docstring.html.jinja" with context %}
+ {% endwith %}
+ {% if config.merge_init_into_class %}
+ {# We don't want to merge the inherited `__init__` method docstring into the class docstring #}
+ {# if such inherited method was not selected through `inherited_members`. #}
+ {% with check_members = all_members if (config.inherited_members is true or (config.inherited_members is iterable and "__init__" in config.inherited_members)) else class.members %}
+ {% if "__init__" in check_members and check_members["__init__"].has_docstring %}
+ {% with function = check_members["__init__"] %}
+ {% with obj = function, docstring_sections = function.docstring.parsed %}
+ {% include "docstring.html.jinja" with context %}
+ {% endwith %}
+ {% endwith %}
+ {% endif %}
+ {% endwith %}
+ {% endif %}
+ {% endblock docstring %}
+
+ {% if config.backlinks %}
+
+ {%- if init.relative_filepath.is_absolute() -%}
+ {{ init.relative_package_filepath }}
+ {%- else -%}
+ {{ init.relative_filepath }}
+ {%- endif -%}
+
+ {%- if class.relative_filepath.is_absolute() -%}
+ {{ class.relative_package_filepath }}
+ {%- else -%}
+ {{ class.relative_filepath }}
+ {%- endif -%}
+ {{ section.title or "Attributes:" }}
-| Name | -Type | -Description | -
|---|---|---|
{{ attribute.name }} |
-
- {% if attribute.annotation %}
- {% with expression = attribute.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ attribute.description|convert_markdown(heading_level, html_id) }} | -
{{ section.title or "Attributes:" }}
-{% include "expression.html" with context %})
- {% endwith %}
- {% endif %}
- – {{ attribute.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "ATTRIBUTE").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
{{ attribute.name }} |
-
- {{ attribute.description|convert_markdown(heading_level, html_id) }}
-
- {% if attribute.annotation %}
-
- TYPE:
- {% with expression = attribute.annotation %}
- |
-
{{ section.title or lang.t("Attributes:") }}
+| {{ lang.t("Name") }} | +{{ lang.t("Type") }} | +{{ lang.t("Description") }} | +
|---|---|---|
|
+
+ {% if attribute.annotation %}
+ {% with expression = attribute.annotation %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Attributes:") }}
+{{ attribute.name }}
+ {% if attribute.annotation %}
+ {% with expression = attribute.annotation %}
+ ({% include "expression.html.jinja" with context %})
+ {% endwith %}
+ {% endif %}
+ –
+ | {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
|
+
+
+ {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+
+ {% if attribute.annotation %}
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = attribute.annotation %}
+ |
+
{{ section.title or lang.t("Classes:") }}
+| {{ lang.t("Name") }} | +{{ lang.t("Description") }} | +
|---|---|
|
+
+
+ {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Classes:") }}
+{{ class.name }}
+ –
+ | {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
|
+
+
+ {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or "Examples:" }}
-{% for section_type, sub_section in section.value %} - {% if section_type.value == "text" %} - {{ sub_section|convert_markdown(heading_level, html_id) }} - {% elif section_type.value == "examples" %} - {{ sub_section|highlight(language="pycon", linenums=False) }} - {% endif %} -{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja new file mode 100644 index 00000000..32360f7d --- /dev/null +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja @@ -0,0 +1,28 @@ +{#- Template for "Examples" sections in docstrings. + +This template renders a list of documented examples. +It alternates between rendering text and code examples. + +Context: + section (griffe.DocstringSectionAttributes): The section to render. +-#} + +{% block logs scoped %} + {#- Logging block. + + This block can be used to log debug messages, deprecation messages, warnings, etc. + -#} + {{ log.debug("Rendering examples section") }} +{% endblock logs %} + +{% import "language.html.jinja" as lang with context %} +{#- Language module providing the `t` translation method. -#} + +{{ section.title or lang.t("Examples:") }}
+{% for section_type, sub_section in section.value %} + {% if section_type.value == "text" %} + {{ sub_section|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }} + {% elif section_type.value == "examples" %} + {{ sub_section|highlight(language="pycon") }} + {% endif %} +{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja new file mode 100644 index 00000000..afec8f60 --- /dev/null +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja @@ -0,0 +1,92 @@ +{#- Template for "Functions" sections in docstrings. + +This template renders a list of documented functions in the format +specified with the [`docstring_section_style`][] configuration option. + +Context: + section (griffe.DocstringSectionAttributes): The section to render. +-#} + +{% block logs scoped %} + {#- Logging block. + + This block can be used to log debug messages, deprecation messages, warnings, etc. + -#} + {{ log.debug("Rendering functions section") }} +{% endblock logs %} + +{% import "language.html.jinja" as lang with context %} +{#- Language module providing the `t` translation method. -#} + +{% if config.docstring_section_style == "table" %} + {% block table_style scoped %} + {#- Block for the `table` section style. -#} +{{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+| {{ lang.t("Name") }} | +{{ lang.t("Description") }} | +
|---|---|
|
+
+
+ {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+{{ function.name }}
+ –
+ | {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
|
+
+
+ {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Modules:") }}
+| {{ lang.t("Name") }} | +{{ lang.t("Description") }} | +
|---|---|
|
+
+
+ {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Modules:") }}
+{{ module.name }}
+ –
+ | {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
|
+
+
+ {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or "Other Parameters:" }}
-| Name | -Type | -Description | -
|---|---|---|
{{ parameter.name }} |
-
- {% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ parameter.description|convert_markdown(heading_level, html_id) }} | -
{{ section.title or "Other Parameters:" }}
-{% include "expression.html" with context %})
- {% endwith %}
- {% endif %}
- – {{ parameter.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "PARAMETER").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
{{ parameter.name }} |
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
- {% if parameter.annotation %}
-
- TYPE:
- {% with expression = parameter.annotation %}
- |
-
{{ section.title or lang.t("Other Parameters:") }}
+| {{ lang.t("Name") }} | +{{ lang.t("Type") }} | +{{ lang.t("Description") }} | +
|---|---|---|
{{ parameter.name }} |
+
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Other Parameters:") }}
+{{ parameter.name }}
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ ({% include "expression.html.jinja" with context %})
+ {% endwith %}
+ {% endif %}
+ –
+ | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
{{ parameter.name }} |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+
+ {% if parameter.annotation %}
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ |
+
{{ section.title or "Parameters:" }}
-| Name | -Type | -Description | -Default | -
|---|---|---|---|
{{ parameter.name }} |
-
- {% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ parameter.description|convert_markdown(heading_level, html_id) }} | -
- {% if parameter.default %}
- {% with expression = parameter.default %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% else %}
- required
- {% endif %}
- |
-
{{ section.title or "Parameters:" }}
-{% include "expression.html" with context %})
- {% endwith %}
- {% endif %}
- – {{ parameter.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "PARAMETER").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
{{ parameter.name }} |
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
- {% if parameter.annotation %}
-
- TYPE:
- {% with expression = parameter.annotation %}
- |
-
{{ section.title or lang.t("Parameters:") }}
+| {{ lang.t("Name") }} | +{{ lang.t("Type") }} | +{{ lang.t("Description") }} | +{{ lang.t("Default") }} | +
|---|---|---|---|
+ {% if config.parameter_headings %}
+ {% filter heading(
+ heading_level + 1,
+ role="param",
+ id=html_id ~ "(" ~ parameter.name ~ ")",
+ class="doc doc-heading doc-heading-parameter",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {{ parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ parameter.name }}
+ {% endif %}
+ |
+
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
+ {% if parameter.default %}
+ {% with expression = parameter.default, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% else %}
+ {{ lang.t("required") }}
+ {% endif %}
+ |
+
{{ section.title or lang.t("Parameters:") }}
+ '|safe if config.show_symbol_type_toc else '') + parameter.name,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {{ parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ parameter.name }}
+ {% endif %}
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ ({% include "expression.html.jinja" with context %}
+ {%- if parameter.default %}, {{ lang.t("default:") }}
+ {% with expression = parameter.default, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %})
+ {% endwith %}
+ {% endif %}
+ –
+ | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
+ {% if config.parameter_headings %}
+ {% filter heading(
+ heading_level + 1,
+ role="param",
+ id=html_id ~ "(" ~ parameter.name ~ ")",
+ class="doc doc-heading doc-heading-parameter",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {{ parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ parameter.name }}
+ {% endif %}
+ |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+
+ {% if parameter.annotation %}
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ |
+
{{ section.title or "Raises:" }}
-| Type | -Description | -
|---|---|
- {% if raises.annotation %}
- {% with expression = raises.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ raises.description|convert_markdown(heading_level, html_id) }} | -
{{ section.title or "Raises:" }}
-{% include "expression.html" with context %}
- {% endwith %}
- –
- {% endif %}
- {{ raises.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "RAISES").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
-
- {% with expression = raises.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- |
- - {{ raises.description|convert_markdown(heading_level, html_id) }} - | -
{{ section.title or lang.t("Raises:") }}
+| {{ lang.t("Type") }} | +{{ lang.t("Description") }} | +
|---|---|
+ {% if raises.annotation %}
+ {% with expression = raises.annotation, backlink_type = "raised-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ raises.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ lang.t(section.title) or lang.t("Raises:") }}
+{% include "expression.html.jinja" with context %}
+ {% endwith %}
+ –
+ {% endif %}
+ | {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
+
+ {% with expression = raises.annotation, backlink_type = "raised-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+
+ |
+
+
+ {{ raises.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or "Receives:" }}
-| Name | {% endif %} -Type | -Description | -
|---|---|---|
{% if receives.name %}{{ receives.name }}{% endif %} | {% endif %}
-
- {% if receives.annotation %}
- {% with expression = receives.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ receives.description|convert_markdown(heading_level, html_id) }} | -
{{ section.title or "Receives:" }}
-{% include "expression.html" with context %}
- {% if receives.name %}){% endif %}
- {% endwith %}
- {% endif %}
- – {{ receives.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "RECEIVES").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
- {% if receives.name %}
- {{ receives.name }}
- {% elif receives.annotation %}
-
- {% with expression = receives.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
- {{ receives.description|convert_markdown(heading_level, html_id) }}
- {% if receives.name and receives.annotation %}
-
-
- TYPE:
- {% with expression = receives.annotation %}
- |
-
{{ section.title or lang.t("Receives:") }}
+| {{ lang.t("Name") }} | {% endif %} +{{ lang.t("Type") }} | +{{ lang.t("Description") }} | +
|---|---|---|
{% if receives.name %}{{ receives.name }}{% endif %} | {% endif %}
+
+ {% if receives.annotation %}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Receives:") }}
+{{ receives.name }}{% endif %}
+ {% if receives.annotation %}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
+ {% if receives.name %} ({% endif %}
+ {% include "expression.html.jinja" with context %}
+ {% if receives.name %}){% endif %}
+ {% endwith %}
+ {% endif %}
+ –
+ | {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
+ {% if receives.name %}
+ {{ receives.name }}
+ {% elif receives.annotation %}
+
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+
+ {% endif %}
+ |
+
+
+ {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ {% if receives.name and receives.annotation %}
+
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
+ |
+
{{ section.title or "Returns:" }}
-| Name | {% endif %} -Type | -Description | -
|---|---|---|
{% if returns.name %}{{ returns.name }}{% endif %} | {% endif %}
-
- {% if returns.annotation %}
- {% with expression = returns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ returns.description|convert_markdown(heading_level, html_id) }} | -
{{ section.title or "Returns:" }}
-{% include "expression.html" with context %}
- {% if returns.name %}){% endif %}
- {% endwith %}
- {% endif %}
- – {{ returns.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "RETURNS").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
- {% if returns.name %}
- {{ returns.name }}
- {% elif returns.annotation %}
-
- {% with expression = returns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
- {{ returns.description|convert_markdown(heading_level, html_id) }}
- {% if returns.name and returns.annotation %}
-
-
- TYPE:
- {% with expression = returns.annotation %}
- |
-
{{ section.title or lang.t("Returns:") }}
+| {{ lang.t("Name") }} | {% endif %} +{{ lang.t("Type") }} | +{{ lang.t("Description") }} | +
|---|---|---|
{% if returns.name %}{{ returns.name }}{% endif %} | {% endif %}
+
+ {% if returns.annotation %}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ returns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Returns:") }}
+{{ returns.name }}{% endif %}
+ {% if returns.annotation %}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
+ {% if returns.name %} ({% endif %}
+ {% include "expression.html.jinja" with context %}
+ {% if returns.name %}){% endif %}
+ {% endwith %}
+ {% endif %}
+ –
+ | {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION").upper() }} | +
|---|---|
+ {% if returns.name %}
+ {{ returns.name }}
+ {% elif returns.annotation %}
+
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+
+ {% endif %}
+ |
+
+
+ {{ returns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ {% if returns.name and returns.annotation %}
+
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
+ |
+
{{ section.title or lang.t("Type Aliases:") }}
+| {{ lang.t("Name") }} | +{{ lang.t("Description") }} | +
|---|---|
|
+
+
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Type Aliases:") }}
+{{ type_alias.name }}
+ –
+ | {{ (section.title or lang.t("TYPE ALIAS")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
|
+
+
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
+ + {{ section.title or lang.t(("Class " if obj.is_class else "Init " if obj.is_init_method else "") ~ "Type Parameters:") }} + +
+| {{ lang.t("Name") }} | +{{ lang.t("Bound or Constraints") }} | +{{ lang.t("Description") }} | +{{ lang.t("Default") }} | +
|---|---|---|---|
+ {% if config.type_parameter_headings %}
+ {% filter heading(
+ heading_level + 1,
+ role="typeparam",
+ id=obj.path ~ "[" ~ type_parameter.name ~ "]",
+ class="doc doc-heading doc-heading-type_parameter",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_parameter.name,
+ ) %}
+ {{ type_parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ type_parameter.name }}
+ {% endif %}
+ |
+
+ {% if type_parameter.annotation %}
+ {% with expression = type_parameter.annotation %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ type_parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
+ {% if type_parameter.default %}
+ {% with expression = type_parameter.default %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% else %}
+ {{ lang.t("required") }}
+ {% endif %}
+ |
+
+ + {{ section.title or lang.t(("Class " if obj.is_class else "Init " if obj.is_init_method else "") ~ "Type Parameters:") }} + +
+ '|safe if config.show_symbol_type_toc else '') + type_parameter.name,
+ ) %}
+ {{ type_parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ type_parameter.name }}
+ {% endif %}
+ {%- if type_parameter.bound or type_parameter.constraints or type_parameter.default -%}
+ (
+ {%- endif -%}
+ {%- if type_parameter.bound -%}
+ {%- with expression = type_parameter.bound -%}
+ {% include "expression.html.jinja" with context %}
+ {%- endwith -%}
+ {%- if type_parameter.default %}, {% endif -%}
+ {%- elif type_parameter.constraints -%}
+ {%- for expression in type_parameter.constraints -%}
+ {% include "expression.html.jinja" with context %}
+ {%- if not loop.last %}, {% endif -%}
+ {%- endfor -%}
+ {%- if type_parameter.default %}, {% endif -%}
+ {%- endif -%}
+ {%- if type_parameter.default -%}
+ {{ lang.t("default:") }}
+ {% with expression = type_parameter.default %}
+ {% include "expression.html.jinja" with context %}
+ {%- endwith -%}
+ {%- endif -%}
+ {%- if type_parameter.constraints or type_parameter.default -%}
+ )
+ {% endif -%}
+ –
+ | + + {{ (section.title or lang.t(("CLASS " if obj.is_class else "INIT " if obj.is_init_method else "") ~ "TYPE PARAMETER")).rstrip(":").upper() }} + + | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
+ {% if config.type_parameter_headings %}
+ {% filter heading(
+ heading_level + 1,
+ role="typeparam",
+ id=obj.path ~ "[" ~ type_parameter.name ~ "]",
+ class="doc doc-heading doc-heading-type_parameter",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_parameter.name,
+ ) %}
+ {{ type_parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ type_parameter.name }}
+ {% endif %}
+ |
+
+
+ {{ type_parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+
+ {% if type_parameter.constraints %}
+
+ {{ lang.t("CONSTRAINTS:") }}
+ {% for constraint in type_parameter.constraints -%}
+ {%- with expression = constraint -%}
+ |
+
{{ section.title or "Warns:" }}
-| Type | -Description | -
|---|---|
- {% if warns.annotation %}
- {% with expression = warns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ warns.description|convert_markdown(heading_level, html_id) }} | -
{{ section.title or "Warns:" }}
-{% include "expression.html" with context %}
- {% endwith %}
- –
- {% endif %}
- {{ warns.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "WARNS").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
-
- {% with expression = warns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- |
- - {{ warns.description|convert_markdown(heading_level, html_id) }} - | -
{{ section.title or lang.t("Warns:") }}
+| {{ lang.t("Type") }} | +{{ lang.t("Description") }} | +
|---|---|
+ {% if warns.annotation %}
+ {% with expression = warns.annotation, backlink_type = "emitted-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Warns:") }}
+{% include "expression.html.jinja" with context %}
+ {% endwith %}
+ –
+ {% endif %}
+ | {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
+
+ {% with expression = warns.annotation, backlink_type = "emitted-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+
+ |
+
+
+ {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or "Yields:" }}
-| Name | {% endif %} -Type | -Description | -
|---|---|---|
{% if yields.name %}{{ yields.name }}{% endif %} | {% endif %}
-
- {% if yields.annotation %}
- {% with expression = yields.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
- {{ yields.description|convert_markdown(heading_level, html_id) }} | -
{{ section.title or "Yields:" }}
-{% include "expression.html" with context %}
- {% if yields.name %}){% endif %}
- {% endwith %}
- {% endif %}
- – {{ yields.description|convert_markdown(heading_level, html_id) }}
- | {{ (section.title or "YIELDS").rstrip(":").upper() }} | -DESCRIPTION | -
|---|---|
- {% if yields.name %}
- {{ yields.name }}
- {% elif yields.annotation %}
-
- {% with expression = yields.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
- {{ yields.description|convert_markdown(heading_level, html_id) }}
- {% if yields.name and yields.annotation %}
-
-
- TYPE:
- {% with expression = yields.annotation %}
- |
-
{{ section.title or lang.t("Yields:") }}
+| {{ lang.t("Name") }} | {% endif %} +{{ lang.t("Type") }} | +{{ lang.t("Description") }} | +
|---|---|---|
{% if yields.name %}{{ yields.name }}{% endif %} | {% endif %}
+
+ {% if yields.annotation %}
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ yields.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ |
+
{{ section.title or lang.t("Yields:") }}
+{{ yields.name }}{% endif %}
+ {% if yields.annotation %}
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
+ {% if yields.name %} ({% endif %}
+ {% include "expression.html.jinja" with context %}
+ {% if yields.name %}){% endif %}
+ {% endwith %}
+ {% endif %}
+ –
+ | {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} | +{{ lang.t("DESCRIPTION") }} | +
|---|---|
+ {% if yields.name %}
+ {{ yields.name }}
+ {% elif yields.annotation %}
+
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+
+ {% endif %}
+ |
+
+
+ {{ yields.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+ {% if yields.name and yields.annotation %}
+
+
+ {{ lang.t("TYPE:") }}:
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
+ |
+
{{ function.relative_filepath }} ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the function.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ function_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) -%}
+ {{ function_name }}
+ {%- include "type_parameters.html.jinja" with context -%}
+ {%- include "signature.html.jinja" with context -%}
+ {%- endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the function.
+ -#}
+ {% with labels = function.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the function,
+ as well as its overloaded signatures if any.
+ -#}
+ {% if function.overloads and config.show_overloads %}
+ ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ {%- if function.relative_filepath.is_absolute() -%}
+ {{ function.relative_package_filepath }}
+ {%- else -%}
+ {{ function.relative_filepath }}
+ {%- endif -%}
+ {{ label }}
- {% endfor %}
-
-{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html.jinja
new file mode 100644
index 00000000..bbd3a7c1
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html.jinja
@@ -0,0 +1,25 @@
+{#- Template for object labels.
+
+Labels are additional information that can be displayed alongside an object.
+Example labels include "property", "writable" or "cached" for properties,
+"classmethod" or "staticmethod" for methods, etc.
+
+Context:
+ labels (list): The list of labels to render.
+ config (dict): The configuration options.
+-#}
+
+{% if config.show_labels and labels %}
+ {% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+ {{ log.debug("Rendering labels") }}
+ {% endblock logs %}
+
+ {% for label in labels|sort %}
+ {{ label }}
+ {% endfor %}
+
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
new file mode 100644
index 00000000..31ecfdd6
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
@@ -0,0 +1,18 @@
+{#- Import translation macros for the given language and fallback language. -#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+{% endblock logs %}
+
+{% set lang_pth = "languages/" ~ locale ~ ".html.jinja" %}
+{% if lang_pth is existing_template %}
+ {% import lang_pth as lang %}
+ {% import "languages/en.html.jinja" as fallback %}
+ {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
+{% else %}
+ {% import "languages/en.html.jinja" as lang %}
+ {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
new file mode 100644
index 00000000..d2bbba03
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
@@ -0,0 +1,61 @@
+{#- Macro for English translations. -#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+{% endblock logs %}
+
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "ATTRIBUTE",
+ "Attributes": "Attributes",
+ "Attributes:": "Attributes:",
+ "BOUND:": "BOUND:",
+ "Bound or Constraints": "Bound or Constraints",
+ "Classes": "Classes",
+ "Classes:": "Classes:",
+ "Class Type Parameters:": "Class Type Parameters:",
+ "CLASS TYPE PARAMETER": "CLASS TYPE PARAMETER",
+ "CLASS": "CLASS",
+ "CONSTRAINTS:": "CONSTRAINTS:",
+ "DEFAULT:": "DEFAULT:",
+ "Default": "Default",
+ "default:": "default:",
+ "DESCRIPTION": "DESCRIPTION",
+ "Description": "Description",
+ "Examples:": "Examples:",
+ "Functions": "Functions",
+ "Functions:": "Functions:",
+ "FUNCTION": "FUNCTION",
+ "Init Type Parameters:": "Init Type Parameters:",
+ "INIT TYPE PARAMETER": "INIT TYPE PARAMETER",
+ "Methods:": "Methods:",
+ "METHOD": "METHOD",
+ "Modules": "Modules",
+ "Modules:": "Modules:",
+ "MODULE": "MODULE",
+ "Name": "Name",
+ "Other Parameters:": "Other Parameters:",
+ "PARAMETER": "PARAMETER",
+ "Parameters:": "Parameters:",
+ "RAISES": "RAISES",
+ "Raises:" : "Raises:",
+ "RECEIVES": "RECEIVES",
+ "Receives:": "Receives:",
+ "required": "required",
+ "RETURNS": "RETURNS",
+ "Returns:": "Returns:",
+ "Source code in": "Source code in",
+ "TYPE:": "TYPE:",
+ "Type": "Type",
+ "Type Aliases": "Type Aliases",
+ "Type Aliases:": "Type Aliases:",
+ "TYPE ALIAS": "TYPE ALIAS",
+ "Type Parameters:": "Type Parameters:",
+ "TYPE PARAMETER": "TYPE PARAMETER",
+ "WARNS": "WARNS",
+ "Warns:": "Warns:",
+ "YIELDS": "YIELDS",
+ "Yields:": "Yields:",
+}[key] }}{% endmacro %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
new file mode 100644
index 00000000..840da89c
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
@@ -0,0 +1,61 @@
+{#- Macro for Japanese translations. -#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+{% endblock logs %}
+
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes": "属性",
+ "Attributes:": "属性:",
+ "BOUND:": "境界:",
+ "Bound or Constraints": "境界や制約",
+ "Classes": "クラス",
+ "Classes:": "クラス:",
+ "Class Type Parameters:": "Class Type Parameters:",
+ "CLASS TYPE PARAMETER": "CLASS TYPE PARAMETER",
+ "CLASS": "クラス",
+ "CONSTRAINTS:": "制約:",
+ "DEFAULT:": "デフォルト:",
+ "Default": "デフォルト",
+ "default:": "デフォルト:",
+ "DESCRIPTION": "デスクリプション",
+ "Description": "デスクリプション",
+ "Examples:": "例:",
+ "Functions": "関数",
+ "Functions:": "関数:",
+ "FUNCTION": "関数",
+ "Init Type Parameters:": "Init Type Parameters:",
+ "INIT TYPE PARAMETER": "INIT TYPE PARAMETER",
+ "Methods:": "メソッド:",
+ "METHOD": "メソッド",
+ "Modules": "モジュール",
+ "Modules:": "モジュール:",
+ "MODULE": "モジュール",
+ "Name": "名前",
+ "Other Parameters:": "他の引数:",
+ "PARAMETER": "引数",
+ "Parameters:": "引数:",
+ "RAISES": "発生",
+ "Raises:" : "発生:",
+ "RECEIVES": "取得",
+ "Receives:": "取得:",
+ "required": "必須",
+ "RETURNS": "戻り値",
+ "Returns:": "戻り値:",
+ "Source code in": "ソースコード位置:",
+ "TYPE:": "タイプ:",
+ "Type": "タイプ",
+ "Type Aliases": "型エイリアス",
+ "Type Aliases:": "型エイリアス:",
+ "TYPE ALIAS": "型エイリアス",
+ "Type Parameters:": "型パラメータ:",
+ "TYPE PARAMETER": "型パラメータ",
+ "WARNS": "警告",
+ "Warns:": "警告:",
+ "YIELDS": "返す",
+ "Yields:": "返す:",
+}[key] }}{% endmacro %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
new file mode 100644
index 00000000..53888779
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
@@ -0,0 +1,61 @@
+{#- Macro for Chinese translations. -#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+{% endblock logs %}
+
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes": "属性",
+ "Attributes:": "属性:",
+ "BOUND:": "边界:",
+ "Bound or Constraints": "边界或约束",
+ "Classes": "类",
+ "Classes:": "类:",
+ "Class Type Parameters:": "Class Type Parameters:",
+ "CLASS TYPE PARAMETER": "CLASS TYPE PARAMETER",
+ "CLASS": "类",
+ "CONSTRAINTS:": "约束:",
+ "DEFAULT:": "默认:",
+ "Default": "默认",
+ "default:": "默认:",
+ "DESCRIPTION": "描述",
+ "Description": "描述",
+ "Examples:": "示例:",
+ "Functions": "函数",
+ "Functions:": "函数:",
+ "FUNCTION": "函数",
+ "Init Type Parameters:": "Init Type Parameters:",
+ "INIT TYPE PARAMETER": "INIT TYPE PARAMETER",
+ "Methods:": "方法:",
+ "METHOD": "方法",
+ "Modules": "模块",
+ "Modules:": "模块:",
+ "MODULE": "模块",
+ "Name": "名称",
+ "Other Parameters:": "其他参数:",
+ "PARAMETER": "参数",
+ "Parameters:": "参数:",
+ "RAISES": "引发",
+ "Raises:" : "引发:",
+ "Receives:": "接收:",
+ "RECEIVES": "接收",
+ "required": "必需",
+ "RETURNS": "返回",
+ "Returns:": "返回:",
+ "Source code in": "源代码位于:",
+ "TYPE:": "类型:",
+ "Type": "类型",
+ "Type Aliases": "类型别名",
+ "Type Aliases:": "类型别名:",
+ "TYPE ALIAS": "类型别名",
+ "Type Parameters:": "类型形参:",
+ "TYPE PARAMETER": "类型形参",
+ "Warns:": "警告:",
+ "WARNS": "警告",
+ "YIELDS": "产生",
+ "Yields:": "产生:",
+}[key] }}{% endmacro %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
deleted file mode 100644
index 8e14d354..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html
+++ /dev/null
@@ -1,63 +0,0 @@
-{{ log.debug("Rendering " + module.path) }}
-
-{{ module_name }}
- {% endif %}
- {% endwith %}
-
- {% with labels = module.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
-
- {% endfilter %}
-
- {% else %}
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
- role="module",
- id=html_id,
- toc_label=module.path if config.show_root_full_path else module.name,
- hidden=True) %}
- {% endfilter %}
- {% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
- '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the module.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ module_name }}
+ {% else %}
+ {{ module_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the module.
+ -#}
+ {% with labels = module.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="module",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+ '|safe if config.show_symbol_type_toc else '') + type_alias.name,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the type alias.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.separate_signature %}
+ {{ type_alias_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ type_alias_name }}{% include "type_parameters.html.jinja" with context %} = {{ type_alias.value }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the type alias.
+ -#}
+ {% with labels = type_alias.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the type alias.
+ -#}
+ {% if config.separate_signature %}
+ {% filter format_type_alias(type_alias, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ type_alias.name }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="typealias",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_alias.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+ '|safe if config.show_symbol_type_toc else '') + class.name,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the class.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.separate_signature %}
+ {{ class_name }}
+ {% elif config.merge_init_into_class and "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ class_name }}{% include "signature.html.jinja" with context %}
+ {% endfilter %}
+ {% endwith %}
+ {% else %}
+ {{ class_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the class.
+ -#}
+ {% with labels = class.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the class.
+ -#}
+ {% if config.separate_signature and config.merge_init_into_class %}
+ {% if "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ class.name }}
+ {% endfilter %}
+ {% endwith %}
+ {% endif %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="class",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ Bases: {% for expression in class.bases -%}
+ {% include "expression.html.jinja" with context %}{% if not loop.last %}, {% endif %}
+ {% endfor -%}
+
+ {%- if init.relative_filepath.is_absolute() -%}
+ {{ init.relative_package_filepath }}
+ {%- else -%}
+ {{ init.relative_filepath }}
+ {%- endif -%}
+
+ {%- if class.relative_filepath.is_absolute() -%}
+ {{ class.relative_package_filepath }}
+ {%- else -%}
+ {{ class.relative_filepath }}
+ {%- endif -%}
+ | {{ section.title or lang.t("Attributes:") }} | +
+
|
+
|---|
| {{ section.title or lang.t("Other parameters:") }} | +
+
|
+
|---|
| {{ section.title or lang.t("Parameters:") }} | +
+
|
+
|---|
| {{ section.title or lang.t("Raises:") }} | +
+
|
+
|---|
| {{ section.title or lang.t("Receives:") }} | +
+
|
+
|---|
| {{ section.title or lang.t("Returns:") }} | +
+
|
+
|---|
| {{ section.title or lang.t("Warns:") }} | +
+
|
+
|---|
| {{ section.title or lang.t("Yields:") }} | +
+
|
+
|---|
| Exceptions: | -
-
|
-
|---|
| Keyword arguments: | -
-
|
-
|---|
| Parameters: | -
-
|
-
|---|
| Returns: | -
-
|
-
|---|
| Yields: | -
-
|
-
|---|
+ headings_package
+
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ members_package
+
+ + Docstring for the package. +
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+ Subclass
+
+
+ Bases:
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+ NestedClass
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ overloads_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ overloads_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+ foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+ foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
foo(a, b)
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ bar
+
+ .
+
foo(a, b)
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+ foo(a, b)
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ bar
+
+ .
+
foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+ foo(a, b)
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ overloads_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ overloads_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+ foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+ foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
foo(a, b)
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ bar
+
+ .
+
foo(a, b)
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
bar(a, b)
+
+
+ Docstring for
+
+ bar
+
+ .
+
foo(a: int, b: str) -> float
+
+ foo(a: str, b: int) -> None
+
+
+ Docstring for
+
+ foo
+
+ .
+
+ signature_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+ + Docstring for `Class. + + init + + . +
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ signature_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+ + Docstring for `Class. + + init + + . +
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ signature_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ :
+
+
+ int
+
+
+ ,
+
+
+ b
+
+
+ :
+
+
+ str
+
+
+ )
+
+
+ ->
+
+
+ None
+
+
+ + Docstring for `Class. + + init + + . +
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ :
+
+
+ int
+
+
+ ,
+
+
+ b
+
+
+ :
+
+
+ str
+
+
+ )
+
+
+ ->
+
+
+ None
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ :
+
+
+ int
+
+
+ ,
+
+
+ b
+
+
+ :
+
+
+ str
+
+
+ )
+
+
+ ->
+
+
+ None
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ signature_package
+
+
+ Class
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ :
+
+
+ int
+
+
+ ,
+
+
+ b
+
+
+ :
+
+
+ str
+
+
+ )
+
+
+ ->
+
+
+ None
+
+
+ + Docstring for `Class. + + init + + . +
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ :
+
+
+ int
+
+
+ ,
+
+
+ b
+
+
+ :
+
+
+ str
+
+
+ )
+
+
+ ->
+
+
+ None
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ :
+
+
+ int
+
+
+ ,
+
+
+ b
+
+
+ :
+
+
+ str
+
+
+ )
+
+
+ ->
+
+
+ None
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
__init__(a, b)
+
+ + Docstring for `Class. + + init + + . +
+method1(a, b)
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
module_function(a, b)
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
__init__(a, b)
+
+ + Docstring for `Class. + + init + + . +
+method1(a, b)
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
module_function(a, b)
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
__init__(a: int, b: str) -> None
+
+ + Docstring for `Class. + + init + + . +
+method1(a: int, b: str) -> None
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
module_function(a: int, b: str) -> None
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+ Docstring for
+
+ Class
+
+ .
+
__init__(a: int , b: str ) -> None
+
+ + Docstring for `Class. + + init + + . +
+method1(a: int , b: str ) -> None
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
module_function(a: int , b: str ) -> None
+
+
+ Docstring for
+
+ module_function
+
+ .
+
This is an example.
" in rendered assert "print" in rendered assert "Hello" in rendered + + +def test_expand_globs(tmp_path: Path, plugin: MkdocstringsPlugin) -> None: + """Assert globs are correctly expanded. + + Parameters: + tmp_path: Pytext fixture that creates a temporary directory. + """ + globbed_names = ( + "expanded_a", + "expanded_b", + "other_expanded_c", + "other_expanded_d", + ) + globbed_paths = [tmp_path.joinpath(globbed_name) for globbed_name in globbed_names] + for path in globbed_paths: + path.touch() + plugin.handlers._tool_config.config_file_path = str(tmp_path.joinpath("mkdocs.yml")) + handler: PythonHandler = plugin.handlers.get_handler("python", {"paths": ["*exp*"]}) # type: ignore[assignment] + for path in globbed_paths: + assert str(path) in handler._paths + + +def test_expand_globs_without_changing_directory(plugin: MkdocstringsPlugin) -> None: + """Assert globs are correctly expanded when we are already in the right directory.""" + plugin.handlers._tool_config.config_file_path = "mkdocs.yml" + handler: PythonHandler = plugin.handlers.get_handler("python", {"paths": ["*.md"]}) # type: ignore[assignment] + for path in list(glob(os.path.abspath(".") + "/*.md")): + assert path in handler._paths + + +@pytest.mark.parametrize( + ("expect_change", "extension"), + [ + (True, "extension.py"), + (True, "extension.py:SomeExtension"), + (True, "path/to/extension.py"), + (True, "path/to/extension.py:SomeExtension"), + (True, {"extension.py": {"option": "value"}}), + (True, {"extension.py:SomeExtension": {"option": "value"}}), + (True, {"path/to/extension.py": {"option": "value"}}), + (True, {"path/to/extension.py:SomeExtension": {"option": "value"}}), + # True because OS path normalization. + (True, "/absolute/path/to/extension.py"), + (True, "/absolute/path/to/extension.py:SomeExtension"), + (True, {"/absolute/path/to/extension.py": {"option": "value"}}), + (True, {"/absolute/path/to/extension.py:SomeExtension": {"option": "value"}}), + (False, "dot.notation.path.to.extension"), + (False, "dot.notation.path.to.pyextension"), + (False, {"dot.notation.path.to.extension": {"option": "value"}}), + (False, {"dot.notation.path.to.pyextension": {"option": "value"}}), + ], +) +def test_extension_paths( + tmp_path: Path, + expect_change: bool, + extension: str | dict, + plugin: MkdocstringsPlugin, +) -> None: + """Assert extension paths are resolved relative to config file.""" + plugin.handlers._tool_config.config_file_path = str(tmp_path.joinpath("mkdocs.yml")) + handler: PythonHandler = plugin.handlers.get_handler("python") # type: ignore[assignment] + normalized = handler.normalize_extension_paths([extension])[0] + if expect_change: + if isinstance(normalized, str) and isinstance(extension, str): + assert normalized == str(tmp_path.joinpath(extension)) + elif isinstance(normalized, dict) and isinstance(extension, dict): + pth, options = next(iter(extension.items())) + assert normalized == {str(tmp_path.joinpath(pth)): options} + else: + raise ValueError("Normalization must not change extension items type") + else: + assert normalized == extension + + +def test_rendering_object_source_without_lineno(handler: PythonHandler) -> None: + """Test rendering objects without a line number.""" + code = dedent( + """ + '''Module docstring.''' + + class Class: + '''Class docstring.''' + + def function(self): + '''Function docstring.''' + + attribute = 0 + '''Attribute docstring.''' + """, + ) + with temporary_visited_module(code) as module: + module["Class"].lineno = None + module["Class.function"].lineno = None + module["attribute"].lineno = None + assert handler.render(module, PythonOptions(show_source=True)) + + +def test_give_precedence_to_user_paths() -> None: + """Assert user paths take precedence over default paths.""" + last_sys_path = sys.path[-1] + handler = PythonHandler( + theme="material", + custom_templates=None, + base_dir=Path("."), + config=PythonConfig.from_data(paths=[last_sys_path]), + mdx=[], + mdx_config={}, + ) + assert handler._paths[0] == last_sys_path + + +@pytest.mark.parametrize( + ("section", "code"), + [ + ( + "Attributes", + """ + class A: + '''Summary. + + Attributes: + x: X. + y: Y. + ''' + x: int = 0 + '''X.''' + y: int = 0 + '''Y.''' + """, + ), + ( + "Methods", + """ + class A: + '''Summary. + + Methods: + x: X. + y: Y. + ''' + def x(self): ... + '''X.''' + def y(self): ... + '''Y.''' + """, + ), + ( + "Functions", + """ + '''Summary. + + Functions: + x: X. + y: Y. + ''' + def x(): ... + '''X.''' + def y(): ... + '''Y.''' + """, + ), + ( + "Classes", + """ + '''Summary. + + Classes: + A: A. + B: B. + ''' + class A: ... + '''A.''' + class B: ... + '''B.''' + """, + ), + ( + "Modules", + """ + '''Summary. + + Modules: + a: A. + b: B. + ''' + """, + ), + ], +) +def test_deduplicate_summary_sections(handler: PythonHandler, section: str, code: str) -> None: + """Assert summary sections are deduplicated.""" + summary_section = section.lower() + summary_section = "functions" if summary_section == "methods" else summary_section + with temporary_visited_module(code, docstring_parser="google") as module: + if summary_section == "modules": + module.set_member("a", Module("A", docstring=Docstring("A."))) + module.set_member("b", Module("B", docstring=Docstring("B."))) + html = handler.render( + module, + handler.get_options( + { + "summary": {summary_section: True}, + "show_source": False, + "show_submodules": True, + }, + ), + ) + assert html.count(f"{section}:") == 1 + + +def test_inheriting_self_from_parent_class(handler: PythonHandler) -> None: + """Inspect self only once when inheriting it from parent class.""" + with temporary_inspected_module( + """ + class A: ... + class B(A): ... + A.B = B + """, + ) as module: + # Assert no recusrion error. + handler.render( + module, + handler.get_options({"inherited_members": True}), + ) + + +def test_specifying_inventory_base_url(handler: PythonHandler) -> None: + """Assert that the handler renders inventory URLs using the specified base_url.""" + # Update handler config to include an inventory with a base URL + base_url = "https://docs.com/my_library" + inventory = Inventory(url="https://example.com/objects.inv", base_url=base_url) + handler.config = replace(handler.config, inventories=[inventory]) + + # Mock inventory bytes + item_name = "my_library.my_module.MyClass" + mocked_inventory = mkdocstrings.Inventory() + mocked_inventory.register( + name=item_name, + domain="py", + role="class", + uri=f"api-reference/#{item_name}", + dispname=item_name, + ) + mocked_bytes = BytesIO(mocked_inventory.format_sphinx()) + + # Get inventory URL and config + url, config = handler.get_inventory_urls()[0] + + # Load the mocked inventory + _, item_url = next(handler.load_inventory(mocked_bytes, url, **config)) + + # Assert the URL is based on the provided base URL + msg = "Expected inventory URL to start with base_url" + assert item_url.startswith(base_url), msg diff --git a/tests/test_rendering.py b/tests/test_rendering.py index 533eaf34..2616610f 100644 --- a/tests/test_rendering.py +++ b/tests/test_rendering.py @@ -1,24 +1,65 @@ """Tests for the `rendering` module.""" +from __future__ import annotations + import re from dataclasses import dataclass +from typing import TYPE_CHECKING, Any, Callable import pytest +from griffe import ModulesCollection, temporary_visited_module -from mkdocstrings_handlers.python import rendering +from mkdocstrings_handlers.python._internal import rendering +if TYPE_CHECKING: + from markupsafe import Markup -def test_format_code_and_signature(): - """Assert code and signatures can be Black-formatted.""" - assert rendering.do_format_code("print('Hello')", 100) - assert rendering.do_format_code('print("Hello")', 100) - assert rendering.do_format_signature("(param: str = 'hello') -> 'Class'", 100) - assert rendering.do_format_signature('(param: str = "hello") -> "Class"', 100) + +@pytest.mark.parametrize( + "code", + [ + "print('Hello')", + "aaaaa(bbbbb, ccccc=1) + ddddd.eeeee[ffff] or {ggggg: hhhhh, iiiii: jjjjj}", + ], +) +@pytest.mark.parametrize( + "formatter", + [ + rendering._get_black_formatter(), + rendering._get_ruff_formatter(), + rendering._get_formatter(), + ], +) +def test_format_code(code: str, formatter: Callable[[str, int], str]) -> None: + """Assert code can be formatted. + + Parameters: + code: Code to format. + """ + for length in (5, 100): + assert formatter(code, length) + + +@pytest.mark.parametrize( + ("name", "signature"), + [("Class.method", "(param: str = 'hello') -> 'OtherClass'")], +) +def test_format_signature(name: Markup, signature: str) -> None: + """Assert signatures can be formatted. + + Parameters: + signature: Signature to format. + """ + for length in (5, 100): + assert rendering._format_signature(name, signature, length) @dataclass class _FakeObject: name: str + inherited: bool = False + parent: None = None + is_alias: bool = False @pytest.mark.parametrize( @@ -28,7 +69,7 @@ class _FakeObject: (["aa", "ab", "ac", "da"], {"members_list": ["aa", "ab"]}, {"aa", "ab"}), ], ) -def test_filter_objects(names, filter_params, expected_names): +def test_filter_objects(names: list[str], filter_params: dict[str, Any], expected_names: set[str]) -> None: """Assert the objects filter works correctly. Parameters: @@ -37,6 +78,99 @@ def test_filter_objects(names, filter_params, expected_names): expected_names: Names expected to be kept. """ objects = {name: _FakeObject(name) for name in names} - filtered = rendering.do_filter_objects(objects, **filter_params) + filtered = rendering.do_filter_objects(objects, **filter_params) # type: ignore[arg-type] filtered_names = {obj.name for obj in filtered} assert set(filtered_names) == set(expected_names) + + +@pytest.mark.parametrize( + ("members", "inherited_members", "expected_names"), + [ + (True, True, {"base", "main"}), + (True, False, {"main"}), + (True, ["base"], {"base", "main"}), + (True, [], {"main"}), + (False, True, {"base"}), + (False, False, set()), + (False, ["base"], {"base"}), + (False, [], set()), + ([], True, {"base"}), + ([], False, set()), + ([], ["base"], {"base"}), + ([], [], set()), + (None, True, {"base", "main"}), + (None, False, {"main"}), + (None, ["base"], {"base", "main"}), + (None, [], {"main"}), + (["base"], True, {"base"}), + (["base"], False, set()), + (["base"], ["base"], {"base"}), + (["base"], [], set()), + (["main"], True, {"main"}), + (["main"], False, {"main"}), + (["main"], ["base"], {"base", "main"}), + (["main"], [], {"main"}), + ], +) +def test_filter_inherited_members( + members: bool | list[str] | None, + inherited_members: bool | list[str], + expected_names: list[str], +) -> None: + """Test inherited members filtering. + + Parameters: + members: Members option (parametrized). + inherited_members: Inherited members option (parametrized). + expected_names: The expected result as a list of member names. + """ + collection = ModulesCollection() + with temporary_visited_module( + """ + class Base: + def base(self): ... + + class Main(Base): + def main(self): ... + """, + modules_collection=collection, + ) as module: + collection["module"] = module + objects = module["Main"].all_members + filtered = rendering.do_filter_objects(objects, members_list=members, inherited_members=inherited_members) + names = {obj.name for obj in filtered} + assert names == expected_names + + +@pytest.mark.parametrize( + ("order", "members_list", "expected_names"), + [ + ("alphabetical", None, ["a", "b", "c"]), + ("source", None, ["c", "b", "a"]), + ("alphabetical", ["c", "b"], ["c", "b"]), + ("source", ["a", "c"], ["a", "c"]), + ("alphabetical", [], ["a", "b", "c"]), + ("source", [], ["c", "b", "a"]), + ("alphabetical", True, ["a", "b", "c"]), + ("source", False, ["c", "b", "a"]), + ], +) +def test_ordering_members(order: rendering.Order, members_list: list[str | None], expected_names: list[str]) -> None: + """Assert the objects are correctly ordered. + + Parameters: + order: The order to use (alphabetical or source). + members_list: The user specified members list. + expected_names: The expected ordered list of object names. + """ + + class Obj: + def __init__(self, name: str, lineno: int | None = None, *, is_alias: bool = False) -> None: + self.name = name + self.lineno = lineno + self.alias_lineno = lineno + self.is_alias = is_alias + + members = [Obj("a", 10, is_alias=True), Obj("b", 9, is_alias=False), Obj("c", 8, is_alias=True)] + ordered = rendering.do_order_members(members, order, members_list) # type: ignore[arg-type] + assert [obj.name for obj in ordered] == expected_names diff --git a/tests/test_themes.py b/tests/test_themes.py index b1e7d5d5..5a7e9038 100644 --- a/tests/test_themes.py +++ b/tests/test_themes.py @@ -1,9 +1,14 @@ """Tests for the different themes we claim to support.""" -import sys +from __future__ import annotations + +from typing import TYPE_CHECKING import pytest +if TYPE_CHECKING: + from mkdocstrings_handlers.python import PythonHandler + @pytest.mark.parametrize( "plugin", @@ -15,26 +20,20 @@ indirect=["plugin"], ) @pytest.mark.parametrize( - "module", + "identifier", [ - "mkdocstrings.extension", - "mkdocstrings.inventory", - "mkdocstrings.loggers", - "mkdocstrings.plugin", - "mkdocstrings.handlers.base", - "mkdocstrings.handlers.rendering", - "mkdocstrings_handlers.python", + "mkdocstrings_handlers.python._internal.config", + "mkdocstrings_handlers.python._internal.handler", + "mkdocstrings_handlers.python._internal.rendering", ], ) -@pytest.mark.skipif(sys.version_info < (3, 7), reason="material is not installed on Python 3.6") -def test_render_themes_templates_python(module, plugin): +def test_render_themes_templates_python(identifier: str, handler: PythonHandler) -> None: """Test rendering of a given theme's templates. Parameters: - module: Parametrized argument. - plugin: Pytest fixture: [tests.conftest.fixture_plugin][]. + identifier: Parametrized identifier. + handler: Python handler (fixture). """ - handler = plugin.handlers.get_handler("python") - handler._update_env(plugin.md, plugin.handlers._config) # noqa: WPS437 - data = handler.collect(module, {}) - handler.render(data, {}) + options = handler.get_options({}) + data = handler.collect(identifier, options) + handler.render(data, options)