Skip to content

Commit f201c88

Browse files
committed
Merge branch 'main' into bartosz/skip-local-inventory
2 parents 57cc437 + 17f71ba commit f201c88

File tree

5 files changed

+56
-50
lines changed

5 files changed

+56
-50
lines changed

docs/usage/configuration/members.md

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -519,50 +519,6 @@ def function_d():
519519
////
520520
///
521521

522-
523-
[](){#option-show_attribute_values}
524-
## `show_attribute_values`
525-
526-
- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
527-
<!-- - **:octicons-project-template-24: Template :material-null:** (contained in [`class.html`][class template]) -->
528-
529-
Show initial values of attributes in classes.
530-
531-
```yaml title="in mkdocs.yml (global configuration)"
532-
plugins:
533-
- mkdocstrings:
534-
handlers:
535-
python:
536-
options:
537-
show_attribute_values: true
538-
```
539-
540-
```md title="or in docs/some_page.md (local configuration)"
541-
::: path.to.object
542-
options:
543-
show_attribute_values: true
544-
```
545-
546-
```python title="package/module.py"
547-
class SomeClass:
548-
def __init__(self):
549-
self.some_attr = 1
550-
```
551-
552-
/// admonition | Preview
553-
type: preview
554-
555-
//// tab | With attribute values visible
556-
<h2><code>SomeClass</code></h2>
557-
<p>some_attr = 1</p>
558-
////
559-
560-
//// tab | With attribute values hidden
561-
<h2><code>SomeClass</code></h2>
562-
<p>some_attr</p>
563-
////
564-
///
565-
566522
[](){#option-show_submodules}
567523
## `show_submodules`
568524

docs/usage/configuration/signatures.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,49 @@ function(param1, param2=None)
483483
////
484484
///
485485

486+
[](){#option-show_attribute_values}
487+
## `show_attribute_values`
488+
489+
- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
490+
<!-- - **:octicons-project-template-24: Template :material-null:** (contained in [`class.html`][class template]) -->
491+
492+
Show initial values of attributes in classes.
493+
494+
```yaml title="in mkdocs.yml (global configuration)"
495+
plugins:
496+
- mkdocstrings:
497+
handlers:
498+
python:
499+
options:
500+
show_attribute_values: true
501+
```
502+
503+
```md title="or in docs/some_page.md (local configuration)"
504+
::: path.to.object
505+
options:
506+
show_attribute_values: true
507+
```
508+
509+
```python title="package/module.py"
510+
class SomeClass:
511+
def __init__(self):
512+
self.some_attr = 1
513+
```
514+
515+
/// admonition | Preview
516+
type: preview
517+
518+
//// tab | With attribute values visible
519+
<h2><code>SomeClass</code></h2>
520+
<p>some_attr = 1</p>
521+
////
522+
523+
//// tab | With attribute values hidden
524+
<h2><code>SomeClass</code></h2>
525+
<p>some_attr</p>
526+
////
527+
///
528+
486529
[](){#option-show_overloads}
487530
## `show_overloads`
488531

docs/usage/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,11 @@ plugins:
150150
[__all__]: https://docs.python.org/3/tutorial/modules.html#importing-from-a-package
151151

152152
[](){#setting-locale}
153-
#### `locale`
153+
#### ~~`locale`~~
154154

155-
The locale to use when translating template strings. The translation system is not fully ready yet, so we don't recommend setting the option for now.
155+
**Deprecated.** Use mkdocstrings' own `locale` setting.
156+
157+
~~The locale to use when translating template strings.~~
156158

157159
[](){#setting-paths}
158160
#### `paths`

src/mkdocstrings_handlers/python/_internal/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ class PythonInputOptions:
625625
show_attribute_values: Annotated[
626626
bool,
627627
_Field(
628-
group="members",
628+
group="signatures",
629629
description="Show initial values of attributes in classes.",
630630
),
631631
] = True
@@ -1043,7 +1043,9 @@ class PythonInputConfig:
10431043

10441044
locale: Annotated[
10451045
str | None,
1046-
_Field(description="The locale to use when translating template strings."),
1046+
_Field(
1047+
description="Deprecated. Use mkdocstrings' own `locale` setting instead. The locale to use when translating template strings.",
1048+
),
10471049
] = None
10481050

10491051
@classmethod

src/mkdocstrings_handlers/python/_internal/handler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,13 @@ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem:
278278

279279
return doc_object
280280

281-
def render(self, data: CollectorItem, options: PythonOptions) -> str:
281+
def render(self, data: CollectorItem, options: PythonOptions, locale: str | None = None) -> str:
282282
"""Render the collected data.
283283
284284
Parameters:
285285
data: The collected data.
286286
options: The options to use for rendering.
287+
locale: The locale to use for rendering (default is "en").
287288
288289
Returns:
289290
The rendered data (HTML).
@@ -300,7 +301,8 @@ def render(self, data: CollectorItem, options: PythonOptions) -> str:
300301
# than as an item in a dictionary.
301302
"heading_level": options.heading_level,
302303
"root": True,
303-
"locale": self.config.locale,
304+
# YORE: Bump 2: Regex-replace ` or .+` with ` or "en",` within line.
305+
"locale": locale or self.config.locale,
304306
},
305307
)
306308

@@ -401,6 +403,7 @@ def get_handler(
401403
Parameters:
402404
handler_config: The handler configuration.
403405
tool_config: The tool (SSG) configuration.
406+
**kwargs: Additional arguments to pass to the handler.
404407
405408
Returns:
406409
An instance of `PythonHandler`.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy