Files
test/source/blender/python/intern
Sybren A. Stüvel 494b041585 Python: Improve bpy.data.user_map() argument documentation
Update the call signature in the docstring so that it is clear that the
arguments to `bpy.data.user_map()` are all optional:

```
.. method:: user_map(*, subset=None, key_types=None, value_types=None)
```

This is important for Python stubs that are generated from the
docstrings; see https://github.com/michaelgold/buildbpy/issues/3.

This change feels a bit weird, as the function behaves differently
depending on whether the arguments are there or not. For example,
`subset=None` is not actually valid, as it should be a dictionary and
the function will raise a `TypeError`. But documenting `subset=dict()`
is also incorrect, because explicitly passing that will make the
function behave differently: it reports an empty dictionary, instead of
reporting everything. The same goes for the other parameters.

A better approach (IMO) would be to either add "empty dict/set means
'everything'" logic, or to allow `None` values for these parameters so
that the documented call can actually be made.

Note that this is the case for other calls as well, such as
`bpy.data.file_path_map()`. As such, I don't want to address this in
this commit; this is just for making the docstring reflect the optional
nature of the parameters.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/144933
2025-08-25 11:53:23 +02:00
..