From 3bcfb151c18079103978f31092f8378a27d9900a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 3 Nov 2024 15:42:19 +1100 Subject: [PATCH] PyDoc: use Python's type annotation syntax for doc-strings Replace plain-text type information with the type syntax used for Python's type annotations as it's more concise, especially for callbacks which often didn't include useful type information. Note that this change only applies to inline doc-strings, generated doc-strings from RNA need to be updated separately. Details: - Many minor corrections were made when "list" was incorrectly used instead of "sequence". - Some type information wasn't defined in the doc-strings and has been added. - Verbose type info would benefit from support for type aliases. --- doc/python_api/rst_from_bmesh_opdefines.py | 5 +- doc/python_api/sphinx_doc_gen_monkeypatch.py | 2 +- scripts/modules/addon_utils.py | 18 +- scripts/modules/bl_app_template_utils.py | 4 +- .../autocomplete/complete_calltip.py | 4 +- .../autocomplete/complete_import.py | 6 +- .../autocomplete/complete_namespace.py | 2 +- .../autocomplete/intellisense.py | 4 +- scripts/modules/bpy/path.py | 64 +++---- scripts/modules/bpy/utils/__init__.py | 80 ++++----- scripts/modules/bpy_extras/anim_utils.py | 12 +- scripts/modules/bpy_extras/bmesh_utils.py | 2 +- scripts/modules/bpy_extras/image_utils.py | 8 +- scripts/modules/bpy_extras/io_utils.py | 43 ++--- scripts/modules/bpy_extras/mesh_utils.py | 33 ++-- scripts/modules/bpy_extras/object_utils.py | 6 +- scripts/modules/bpy_extras/view3d_utils.py | 8 +- scripts/modules/bpy_types.py | 36 ++-- scripts/modules/gpu_extras/batch.py | 4 +- scripts/modules/gpu_extras/presets.py | 10 +- scripts/modules/rna_info.py | 2 +- .../bl_operators/bone_selection_sets.py | 10 +- .../startup/bl_operators/uvcalc_transform.py | 10 +- scripts/startup/bl_ui/generic_ui_list.py | 2 +- .../intern/python/BPy_ContextFunctions.cpp | 2 +- .../freestyle/intern/python/BPy_Freestyle.cpp | 4 +- .../intern/python/BPy_FrsMaterial.cpp | 13 +- .../freestyle/intern/python/BPy_FrsNoise.cpp | 8 +- .../intern/python/BPy_IntegrationType.cpp | 2 +- .../freestyle/intern/python/BPy_Operators.cpp | 2 +- .../intern/python/BPy_StrokeAttribute.cpp | 6 +- .../intern/python/Interface0D/BPy_SVertex.cpp | 2 +- .../python/Interface1D/BPy_FrsCurve.cpp | 4 +- .../Iterator/BPy_ChainPredicateIterator.cpp | 2 +- .../Iterator/BPy_ChainSilhouetteIterator.cpp | 2 +- .../python/Iterator/BPy_ChainingIterator.cpp | 4 +- .../python/Iterator/BPy_ViewEdgeIterator.cpp | 2 +- .../BPy_GetOccludersF0D.cpp | 2 +- .../BPy_GetOccludeeF1D.cpp | 2 +- .../BPy_GetOccludersF1D.cpp | 2 +- .../BPy_GetShapeF1D.cpp | 2 +- source/blender/python/bmesh/bmesh_py_api.cc | 4 +- source/blender/python/bmesh/bmesh_py_types.cc | 88 ++++----- .../python/bmesh/bmesh_py_types_customdata.cc | 16 +- .../python/bmesh/bmesh_py_types_meshdata.cc | 18 +- source/blender/python/bmesh/bmesh_py_utils.cc | 22 +-- source/blender/python/generic/blf_py_api.cc | 12 +- .../blender/python/generic/idprop_py_api.cc | 7 +- source/blender/python/generic/imbuf_py_api.cc | 14 +- source/blender/python/gpu/gpu_py_buffer.cc | 2 +- .../blender/python/gpu/gpu_py_capabilities.cc | 2 +- source/blender/python/gpu/gpu_py_element.cc | 2 +- .../blender/python/gpu/gpu_py_framebuffer.cc | 13 +- source/blender/python/gpu/gpu_py_matrix.cc | 8 +- source/blender/python/gpu/gpu_py_offscreen.cc | 6 +- source/blender/python/gpu/gpu_py_shader.cc | 10 +- .../python/gpu/gpu_py_shader_create_info.cc | 7 +- source/blender/python/gpu/gpu_py_state.cc | 2 +- source/blender/python/gpu/gpu_py_texture.cc | 12 +- .../python/gpu/gpu_py_vertex_buffer.cc | 7 +- source/blender/python/intern/bpy.cc | 45 +++-- source/blender/python/intern/bpy_app_icons.cc | 10 +- .../blender/python/intern/bpy_app_timers.cc | 6 +- .../python/intern/bpy_app_translations.cc | 32 ++-- .../blender/python/intern/bpy_library_load.cc | 2 +- .../python/intern/bpy_library_write.cc | 8 +- source/blender/python/intern/bpy_msgbus.cc | 14 +- source/blender/python/intern/bpy_props.cc | 170 ++++++++++-------- source/blender/python/intern/bpy_rna.cc | 50 +++--- source/blender/python/intern/bpy_rna_anim.cc | 22 +-- .../blender/python/intern/bpy_rna_context.cc | 4 +- source/blender/python/intern/bpy_rna_data.cc | 2 +- source/blender/python/intern/bpy_rna_gizmo.cc | 19 +- .../python/intern/bpy_rna_id_collection.cc | 17 +- .../blender/python/intern/bpy_rna_operator.cc | 2 +- source/blender/python/intern/bpy_rna_text.cc | 4 +- .../python/intern/bpy_rna_types_capi.cc | 12 +- .../python/intern/bpy_utils_previews.cc | 10 +- .../blender/python/intern/bpy_utils_units.cc | 12 +- source/blender/python/mathutils/mathutils.cc | 7 +- .../python/mathutils/mathutils_Color.cc | 4 +- .../python/mathutils/mathutils_Euler.cc | 10 +- .../python/mathutils/mathutils_Matrix.cc | 44 ++--- .../python/mathutils/mathutils_Quaternion.cc | 15 +- .../python/mathutils/mathutils_Vector.cc | 26 +-- .../python/mathutils/mathutils_bvhtree.cc | 16 +- .../python/mathutils/mathutils_geometry.cc | 96 +++++----- .../python/mathutils/mathutils_interpolate.cc | 9 +- .../python/mathutils/mathutils_kdtree.cc | 28 +-- .../python/mathutils/mathutils_noise.cc | 14 +- 90 files changed, 722 insertions(+), 676 deletions(-) diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py index 4619af6b8e1..ca12410854a 100644 --- a/doc/python_api/rst_from_bmesh_opdefines.py +++ b/doc/python_api/rst_from_bmesh_opdefines.py @@ -416,7 +416,10 @@ def main(): fw(" **type** {:s}\n".format(tp)) fw("\n") - fw(" :rtype: dict with string keys\n") + # TODO: Any is not quite correct here, + # the exact type depends on output args used by BMesh. + # This should really be a type alias. + fw(" :rtype: dict[str, Any]\n") fw("\n\n") diff --git a/doc/python_api/sphinx_doc_gen_monkeypatch.py b/doc/python_api/sphinx_doc_gen_monkeypatch.py index f8814283d66..c8098efa175 100644 --- a/doc/python_api/sphinx_doc_gen_monkeypatch.py +++ b/doc/python_api/sphinx_doc_gen_monkeypatch.py @@ -7,7 +7,7 @@ bpy_types_Operator_bl_property__doc__ = ( The name of a property to use as this operators primary property. Currently this is only used to select the default property when expanding an operator into a menu. -:type: string +:type: str """) diff --git a/scripts/modules/addon_utils.py b/scripts/modules/addon_utils.py index efdb8f7e949..4ad11bb66e1 100644 --- a/scripts/modules/addon_utils.py +++ b/scripts/modules/addon_utils.py @@ -248,9 +248,9 @@ def check(module_name): Returns the loaded state of the addon. :arg module_name: The name of the addon and module. - :type module_name: string + :type module_name: str :return: (loaded_default, loaded_state) - :rtype: tuple of booleans + :rtype: tuple[bool, bool] """ import sys loaded_default = module_name in _preferences.addons @@ -309,15 +309,15 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non Enables an addon by name. :arg module_name: the name of the addon and module. - :type module_name: string + :type module_name: str :arg default_set: Set the user-preference. :type default_set: bool :arg persistent: Ensure the addon is enabled for the entire session (after loading new files). :type persistent: bool :arg handle_error: Called in the case of an error, taking an exception argument. - :type handle_error: function + :type handle_error: Callable[[Exception], None] | None :return: the loaded module or None on failure. - :rtype: module + :rtype: ModuleType """ import os @@ -511,11 +511,11 @@ def disable(module_name, *, default_set=False, handle_error=None): Disables an addon by name. :arg module_name: The name of the addon and module. - :type module_name: string + :type module_name: str :arg default_set: Set the user-preference. :type default_set: bool :arg handle_error: Called in the case of an error, taking an exception argument. - :type handle_error: function + :type handle_error: Callable[[Exception], None] | None """ import sys @@ -1381,9 +1381,9 @@ def _extension_module_name_decompose(package): Returns the repository module name and the extensions ID from an extensions module name (``__package__``). :arg module_name: The extensions module name. - :type module_name: string + :type module_name: str :return: (repo_module_name, extension_id) - :rtype: tuple of strings + :rtype: tuple[str, str] """ if not package.startswith(_ext_base_pkg_idname_with_dot): raise ValueError("The \"package\" does not name an extension") diff --git a/scripts/modules/bl_app_template_utils.py b/scripts/modules/bl_app_template_utils.py index 5d841106220..eccca8c1463 100644 --- a/scripts/modules/bl_app_template_utils.py +++ b/scripts/modules/bl_app_template_utils.py @@ -84,10 +84,10 @@ def _disable(template_id, *, handle_error=None): Disables a template by name. :arg template_id: The name of the template and module. - :type template_id: string + :type template_id: str :arg handle_error: Called in the case of an error, taking an exception argument. - :type handle_error: function + :type handle_error: Callable[[Exception], None] | None """ if handle_error is None: diff --git a/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py b/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py index 93e7b9a7b9f..f229b50d4b6 100644 --- a/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py +++ b/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py @@ -138,9 +138,9 @@ def complete(line, cursor, namespace): :arg cursor: current character position :type cursor: int :arg namespace: namespace - :type namespace: dict + :type namespace: dict[str, Any] :returns: (matches, world, scrollback) - :rtype: (list of str, str, str) + :rtype: tuple[str, str, str] >>> import os >>> complete('os.path.isdir(', 14, {'os': os})[-1] diff --git a/scripts/modules/bl_console_utils/autocomplete/complete_import.py b/scripts/modules/bl_console_utils/autocomplete/complete_import.py index 269ab1d7145..c88ae64e7f7 100644 --- a/scripts/modules/bl_console_utils/autocomplete/complete_import.py +++ b/scripts/modules/bl_console_utils/autocomplete/complete_import.py @@ -40,7 +40,7 @@ def get_root_modules(): folders of the python-path. :returns: modules - :rtype: list + :rtype: list[ModuleType] """ global ROOT_MODULES modules = [] @@ -80,7 +80,7 @@ def module_list(path): :arg path: folder path :type path: str :returns: modules - :rtype: list + :rtype: list[ModuleType] """ if os.path.isdir(path): @@ -117,7 +117,7 @@ def complete(line): :type line: str :returns: list of completion possibilities - :rtype: list + :rtype: list[str] >>> complete('import weak') ['weakref'] diff --git a/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py b/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py index faecb5ca0a2..fc7293e2b75 100644 --- a/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py +++ b/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py @@ -32,7 +32,7 @@ def complete_names(word, namespace): :arg word: word to be completed :type word: str :arg namespace: namespace - :type namespace: dict + :type namespace: dict[str, Any] :returns: completion matches :rtype: list of str diff --git a/scripts/modules/bl_console_utils/autocomplete/intellisense.py b/scripts/modules/bl_console_utils/autocomplete/intellisense.py index e819b86eb2d..bca07d5579e 100644 --- a/scripts/modules/bl_console_utils/autocomplete/intellisense.py +++ b/scripts/modules/bl_console_utils/autocomplete/intellisense.py @@ -54,7 +54,7 @@ def complete(line, cursor, namespace, private): :arg private: whether private variables should be listed :type private: bool :returns: list of completions, word - :rtype: list, str + :rtype: tuple[list[str], str] >>> complete('re.sr', 5, {'re': re}) (['re.sre_compile', 're.sre_parse'], 're.sr') @@ -89,7 +89,7 @@ def expand(line, cursor, namespace, *, private=True): :arg cursor: current character position :type cursor: int :arg namespace: namespace - :type namespace: dict + :type namespace: dict[str, Any] :arg private: whether private variables should be listed :type private: bool :returns: diff --git a/scripts/modules/bpy/path.py b/scripts/modules/bpy/path.py index 0722e59a313..b4a4e58b143 100644 --- a/scripts/modules/bpy/path.py +++ b/scripts/modules/bpy/path.py @@ -47,12 +47,12 @@ def abspath(path, *, start=None, library=None): :arg start: Relative to this path, when not set the current filename is used. - :type start: string or bytes + :type start: str | bytes :arg library: The library this path is from. This is only included for convenience, when the library is not None its path replaces *start*. :type library: :class:`bpy.types.Library` :return: The absolute path. - :rtype: string + :rtype: str """ if isinstance(path, bytes): if path.startswith(b"//"): @@ -83,12 +83,12 @@ def relpath(path, *, start=None): Returns the path relative to the current blend file using the "//" prefix. :arg path: An absolute path. - :type path: string or bytes + :type path: str | bytes :arg start: Relative to this path, when not set the current filename is used. - :type start: string or bytes + :type start: str | bytes :return: The relative path. - :rtype: string + :rtype: str """ if isinstance(path, bytes): if not path.startswith(b"//"): @@ -110,9 +110,9 @@ def is_subdir(path, directory): Both paths must be absolute. :arg path: An absolute path. - :type path: string or bytes + :type path: str | bytes :return: Whether or not the path is a subdirectory. - :rtype: boolean + :rtype: bool """ from os.path import normpath, normcase, sep path = normpath(normcase(path)) @@ -134,11 +134,11 @@ def clean_name(name, *, replace="_"): or the *replace* argument if defined. :arg name: The path name. - :type name: string or bytes + :type name: str | bytes :arg replace: The replacement for non-valid characters. - :type replace: string + :type replace: str :return: The cleaned name. - :rtype: string + :rtype: str """ if replace != "_": @@ -206,13 +206,13 @@ def display_name(name, *, has_ext=True, title_case=True): Intended for use with filenames and module names. :arg name: The name to be used for displaying the user interface. - :type name: string + :type name: str :arg has_ext: Remove file extension from name. - :type has_ext: boolean + :type has_ext: bool :arg title_case: Convert lowercase names to title case. - :type title_case: boolean + :type title_case: bool :return: The display string. - :rtype: string + :rtype: str """ if has_ext: @@ -239,9 +239,9 @@ def display_name_to_filepath(name): which aren't supported in a filepath. :arg name: The display name to convert. - :type name: string + :type name: str :return: The file path. - :rtype: string + :rtype: str """ for disp_value, file_value in _display_name_literals.items(): name = name.replace(disp_value, file_value) @@ -254,9 +254,9 @@ def display_name_from_filepath(name): ensured to be utf8 compatible. :arg name: The file path to convert. - :type name: string + :type name: str :return: The display name. - :rtype: string + :rtype: str """ name = _os.path.splitext(basename(name))[0] @@ -270,9 +270,9 @@ def resolve_ncase(path): returning a string with the path if found else return the original path. :arg path: The path name to resolve. - :type path: string + :type path: str :return: The resolved path. - :rtype: string + :rtype: str """ def _ncase_path_found(path): @@ -335,14 +335,14 @@ def ensure_ext(filepath, ext, *, case_sensitive=False): Return the path with the extension added if it is not already set. :arg filepath: The file path. - :type filepath: string + :type filepath: str :arg ext: The extension to check for, can be a compound extension. Should start with a dot, such as '.blend' or '.tar.gz'. - :type ext: string + :type ext: str :arg case_sensitive: Check for matching case when comparing extensions. - :type case_sensitive: boolean + :type case_sensitive: bool :return: The file path with the given extension. - :rtype: string + :rtype: str """ if case_sensitive: @@ -360,13 +360,13 @@ def module_names(path, *, recursive=False, package=""): Return a list of modules which can be imported from *path*. :arg path: a directory to scan. - :type path: string + :type path: str :arg recursive: Also return submodule names for packages. :type recursive: bool :arg package: Optional string, used as the prefix for module names (without the trailing "."). - :type package: string + :type package: str :return: a list of string pairs (module_name, module_file). - :rtype: list of strings + :rtype: list[str] """ from os.path import join, isfile @@ -404,7 +404,7 @@ def basename(path): Use for Windows compatibility. :return: The base name of the given path. - :rtype: string + :rtype: str """ return _os.path.basename(path[2:] if path[:2] in {"//", b"//"} else path) @@ -414,9 +414,9 @@ def native_pathsep(path): Replace the path separator with the systems native ``os.sep``. :arg path: The path to replace. - :type path: string + :type path: str :return: The path with system native separators. - :rtype: string + :rtype: str """ if type(path) is str: if _os.sep == "/": @@ -443,9 +443,9 @@ def reduce_dirs(dirs): (Useful for recursive path searching). :arg dirs: Sequence of directory paths. - :type dirs: sequence of strings + :type dirs: Sequence[str] :return: A unique list of paths. - :rtype: list of strings + :rtype: list[str] """ dirs = list({_os.path.normpath(_os.path.abspath(d)) for d in dirs}) dirs.sort(key=lambda d: len(d)) diff --git a/scripts/modules/bpy/utils/__init__.py b/scripts/modules/bpy/utils/__init__.py index df5609c5c3d..63c850b8cee 100644 --- a/scripts/modules/bpy/utils/__init__.py +++ b/scripts/modules/bpy/utils/__init__.py @@ -91,9 +91,9 @@ def execfile(filepath, *, mod=None): Execute a file path as a Python script. :arg filepath: Path of the script to execute. - :type filepath: string + :type filepath: str :arg mod: Optional cached module, the result of a previous execution. - :type mod: Module or None + :type mod: ModuleType | None :return: The module which can be passed back in as ``mod``. :rtype: ModuleType """ @@ -177,12 +177,12 @@ def modules_from_path(path, loaded_modules): Load all modules in a path and return them as a list. :arg path: this path is scanned for scripts and packages. - :type path: string + :type path: str :arg loaded_modules: already loaded module names, files matching these names will be ignored. - :type loaded_modules: set + :type loaded_modules: set[ModuleType] :return: all loaded modules. - :rtype: list + :rtype: list[ModuleType] """ modules = [] @@ -409,7 +409,7 @@ def script_paths(*, subdir=None, user_pref=True, check_all=False, use_user=True, Returns a list of valid script paths. :arg subdir: Optional subdir. - :type subdir: string + :type subdir: str :arg user_pref: Include the user preference script paths. :type user_pref: bool :arg check_all: Include local, user and system paths rather just the paths Blender uses. @@ -419,7 +419,7 @@ def script_paths(*, subdir=None, user_pref=True, check_all=False, use_user=True, :arg use_system_environment: Include BLENDER_SYSTEM_SCRIPTS variable path :type use_system_environment: bool :return: script paths. - :rtype: list + :rtype: list[str] """ if check_all or use_user: @@ -500,9 +500,9 @@ def app_template_paths(*, path=None): Returns valid application template paths. :arg path: Optional subdir. - :type path: string - :return: app template paths. - :rtype: generator + :type path: str + :return: App template paths. + :rtype: Iterator[str] """ subdir_args = (path,) if path is not None else () # Note: keep in sync with: Blender's 'BKE_appdir_app_template_any'. @@ -528,9 +528,9 @@ def preset_paths(subdir): Returns a list of paths for a specific preset. :arg subdir: preset subdirectory (must not be an absolute path). - :type subdir: string - :return: script paths. - :rtype: list + :type subdir: str + :return: Script paths. + :rtype: list[str] """ dirs = [] for path in script_paths(subdir="presets"): @@ -566,7 +566,7 @@ def register_preset_path(path): When the ``__init__.py`` is in the same location as a ``presets`` directory. For example an operators preset would be located under: ``presets/operator/{operator.id}/`` where ``operator.id`` is the ``bl_idname`` of the operator. - :type path: string + :type path: str :return: success :rtype: bool """ @@ -585,7 +585,7 @@ def unregister_preset_path(path): :arg path: preset directory (must be an absolute path). This must match the registered path exactly. - :type path: string + :type path: str :return: success :rtype: bool """ @@ -677,9 +677,9 @@ def smpte_from_seconds(time, *, fps=None, fps_base=None): If *fps* and *fps_base* are not given the current scene is used. :arg time: time in seconds. - :type time: int, float or ``datetime.timedelta``. + :type time: int | float | datetime.timedelta :return: the frame string. - :rtype: string + :rtype: str """ return smpte_from_frame( @@ -697,9 +697,9 @@ def smpte_from_frame(frame, *, fps=None, fps_base=None): If *fps* and *fps_base* are not given the current scene is used. :arg frame: frame number. - :type frame: int or float. + :type frame: int | float :return: the frame string. - :rtype: string + :rtype: str """ if fps is None: @@ -730,7 +730,7 @@ def time_from_frame(frame, *, fps=None, fps_base=None): If *fps* and *fps_base* are not given the current scene is used. :arg frame: number. - :type frame: int or float. + :type frame: int | float :return: the time in seconds. :rtype: datetime.timedelta """ @@ -756,9 +756,9 @@ def time_to_frame(time, *, fps=None, fps_base=None): If *fps* and *fps_base* are not given the current scene is used. :arg time: time in seconds. - :type time: number or a ``datetime.timedelta`` object - :return: the frame. - :rtype: float + :type time: float | int | datetime.timedelta + :return: The frame. + :rtype: float | int | datetime.timedelta """ if fps is None: @@ -859,13 +859,13 @@ def user_resource(resource_type, *, path="", create=False): Return a user resource path (normally from the users home directory). :arg resource_type: Resource type in ['DATAFILES', 'CONFIG', 'SCRIPTS', 'EXTENSIONS']. - :type resource_type: string + :type resource_type: str :arg path: Optional subdirectory. - :type path: string + :type path: str :arg create: Treat the path as a directory and create it if its not existing. - :type create: boolean + :type create: bool :return: a path. - :rtype: string + :rtype: str """ target_path = _user_resource(resource_type, path=path) @@ -901,13 +901,13 @@ def extension_path_user(package, *, path="", create=False): to the repository (typically "System" repositories). :arg package: The ``__package__`` of the extension. - :type package: string + :type package: str :arg path: Optional subdirectory. - :type path: string + :type path: str :arg create: Treat the path as a directory and create it if its not existing. - :type create: boolean + :type create: bool :return: a path. - :rtype: string + :rtype: str """ from addon_utils import _extension_module_name_decompose @@ -965,11 +965,11 @@ def register_submodule_factory(module_name, submodule_names): unregistered in reverse order. :arg module_name: The module name, typically ``__name__``. - :type module_name: string + :type module_name: str :arg submodule_names: List of submodule names to load and unload. - :type submodule_names: list of strings + :type submodule_names: list[str] :return: register and unregister functions. - :rtype: tuple pair of functions + :rtype: tuple[Callable[[], None], Callable[[], None]] """ module = None @@ -1002,9 +1002,9 @@ def register_tool(tool_cls, *, after=None, separator=False, group=False): Register a tool in the toolbar. :arg tool_cls: A tool subclass. - :type tool_cls: :class:`bpy.types.WorkSpaceTool` subclass. + :type tool_cls: :class:`bpy.types.WorkSpaceTool` :arg after: Optional identifiers this tool will be added after. - :type after: collection of strings or None. + :type after: Sequence[str] | None :arg separator: When true, add a separator before this tool. :type separator: bool :arg group: When true, add a new nested group of tools. @@ -1317,15 +1317,15 @@ def make_rna_paths(struct_name, prop_name, enum_name): Create RNA "paths" from given names. :arg struct_name: Name of a RNA struct (like e.g. "Scene"). - :type struct_name: string + :type struct_name: str :arg prop_name: Name of a RNA struct's property. - :type prop_name: string + :type prop_name: str :arg enum_name: Name of a RNA enum identifier. - :type enum_name: string + :type enum_name: str :return: A triple of three "RNA paths" (most_complete_path, "struct.prop", "struct.prop:'enum'"). If no enum_name is given, the third element will always be void. - :rtype: tuple of strings + :rtype: tuple[str, str, str] """ src = src_rna = src_enum = "" if struct_name: diff --git a/scripts/modules/bpy_extras/anim_utils.py b/scripts/modules/bpy_extras/anim_utils.py index e9c10f43fbe..9b5899a8b60 100644 --- a/scripts/modules/bpy_extras/anim_utils.py +++ b/scripts/modules/bpy_extras/anim_utils.py @@ -87,13 +87,13 @@ def bake_action( :type obj: :class:`bpy.types.Object` :arg action: An action to bake the data into, or None for a new action to be created. - :type action: :class:`bpy.types.Action` or None + :type action: :class:`bpy.types.Action` | None :arg frames: Frames to bake. - :type frames: iterable of int + :type frames: int :arg bake_options: Options for baking. :type bake_options: :class:`anim_utils.BakeOptions` - :return: an action or None - :rtype: :class:`bpy.types.Action` + :return: Action or None. + :rtype: :class:`bpy.types.Action` | None """ if not (bake_options.do_pose or bake_options.do_object): return None @@ -121,7 +121,7 @@ def bake_action_objects( :type bake_options: :class:`anim_utils.BakeOptions` :return: A sequence of Action or None types (aligned with `object_action_pairs`) - :rtype: sequence of :class:`bpy.types.Action` + :rtype: Sequence[:class:`bpy.types.Action`] """ if not (bake_options.do_pose or bake_options.do_object): return [] @@ -180,7 +180,7 @@ def bake_action_iter( :type obj: :class:`bpy.types.Object` :arg action: An action to bake the data into, or None for a new action to be created. - :type action: :class:`bpy.types.Action` or None + :type action: :class:`bpy.types.Action` | None :arg bake_options: Boolean options of what to include into the action bake. :type bake_options: :class:`anim_utils.BakeOptions` diff --git a/scripts/modules/bpy_extras/bmesh_utils.py b/scripts/modules/bpy_extras/bmesh_utils.py index 5c3cbc2c547..e8251c47cf5 100644 --- a/scripts/modules/bpy_extras/bmesh_utils.py +++ b/scripts/modules/bpy_extras/bmesh_utils.py @@ -25,7 +25,7 @@ def bmesh_linked_uv_islands(bm, uv_layer): :arg uv_layer: the UV layer to source UVs from. :type bmesh: :class:`BMLayerItem` :return: list of lists containing polygon indices - :rtype: list + :rtype: list[list[int]] """ result = [] diff --git a/scripts/modules/bpy_extras/image_utils.py b/scripts/modules/bpy_extras/image_utils.py index 2b331b01112..7ad0523f055 100644 --- a/scripts/modules/bpy_extras/image_utils.py +++ b/scripts/modules/bpy_extras/image_utils.py @@ -26,10 +26,10 @@ def load_image( :arg filepath: The image filename If a path precedes it, this will be searched as well. - :type filepath: string + :type filepath: str :arg dirname: is the directory where the image may be located - any file at the end will be ignored. - :type dirname: string + :type dirname: str :arg place_holder: if True a new place holder image will be created. this is useful so later you can relink the image to its original data. :type place_holder: bool @@ -46,7 +46,7 @@ def load_image( For formats blender can read, simply return the path that is given. :type convert_callback: function :arg relpath: If not None, make the file relative to this path. - :type relpath: None or string + :type relpath: str | None :arg check_existing: If true, returns already loaded image datablock if possible (based on file path). @@ -56,7 +56,7 @@ def load_image( is also enabled). :type force_reload: bool :return: an image or None - :rtype: :class:`bpy.types.Image` + :rtype: :class:`bpy.types.Image` | None """ import os import bpy diff --git a/scripts/modules/bpy_extras/io_utils.py b/scripts/modules/bpy_extras/io_utils.py index 1ade6c42410..ec5d8b0b273 100644 --- a/scripts/modules/bpy_extras/io_utils.py +++ b/scripts/modules/bpy_extras/io_utils.py @@ -331,11 +331,11 @@ def axis_conversion_ensure(operator, forward_attr, up_attr): :arg operator: the operator to access axis attributes from. :type operator: :class:`bpy.types.Operator` :arg forward_attr: attribute storing the forward axis - :type forward_attr: string + :type forward_attr: str :arg up_attr: attribute storing the up axis - :type up_attr: string + :type up_attr: str :return: True if the value was modified. - :rtype: boolean + :rtype: bool """ def validate(axis_forward, axis_up): if axis_forward[-1] == axis_up[-1]: @@ -362,10 +362,10 @@ def create_derived_objects(depsgraph, objects): :arg depsgraph: The evaluated depsgraph. :type depsgraph: :class:`bpy.types.Depsgraph` :arg objects: A sequencer of objects. - :type objects: sequence of :class:`bpy.types.Object` - :return: A dictionary where each key is an object from `objects`, - values are lists of (:class:`bpy.types.Object`, :class:`mathutils.Matrix`) tuples representing instances. - :rtype: dict + :type objects: Sequence[:class:`bpy.types.Object`] + :return: A dictionary where each key is an object from ``objects``, + values are lists of (object, matrix) tuples representing instances. + :rtype: dict[:class:`bpy.types.Object`, list[tuple[:class:`bpy.types.Object`, :class:`mathutils.Matrix`]]] """ result = {} for ob in objects: @@ -463,25 +463,25 @@ def path_reference( :arg filepath: the file path to return, supporting blenders relative '//' prefix. - :type filepath: string + :type filepath: str :arg base_src: the directory the *filepath* is relative too (normally the blend file). - :type base_src: string + :type base_src: str :arg base_dst: the directory the *filepath* will be referenced from (normally the export path). - :type base_dst: string + :type base_dst: str :arg mode: the method used get the path in ['AUTO', 'ABSOLUTE', 'RELATIVE', 'MATCH', 'STRIP', 'COPY'] - :type mode: string + :type mode: str :arg copy_subdir: the subdirectory of *base_dst* to use when mode='COPY'. - :type copy_subdir: string + :type copy_subdir: str :arg copy_set: collect from/to pairs when mode='COPY', pass to *path_reference_copy* when exporting is done. - :type copy_set: set + :type copy_set: set[tuple[str, str]] :arg library: The library this path is relative to. - :type library: :class:`bpy.types.Library` or None + :type library: :class:`bpy.types.Library` | None :return: the new filepath. - :rtype: string + :rtype: str """ import os is_relative = filepath.startswith("//") @@ -528,9 +528,9 @@ def path_reference_copy(copy_set, report=print): Execute copying files of path_reference :arg copy_set: set of (from, to) pairs to copy. - :type copy_set: set + :type copy_set: set[tuple[str, str]] :arg report: function used for reporting warnings, takes a string argument. - :type report: function + :type report: Callable[[str], None] """ if not copy_set: return @@ -564,12 +564,13 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."): Helper function for storing unique names which may have special characters stripped and restricted to a maximum length. - :arg key: unique item this name belongs to, name_dict[key] will be reused + :arg key: Unique item this name belongs to, name_dict[key] will be reused when available. This can be the object, mesh, material, etc instance itself. - :type key: any hashable object associated with the *name*. + Any hashable object associated with the *name*. + :type key: Any :arg name: The name used to create a unique value in *name_dict*. - :type name: string + :type name: str :arg name_dict: This is used to cache namespace to ensure no collisions occur, this should be an empty dict initially and only modified by this function. @@ -578,7 +579,7 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."): :type clean_func: function :arg sep: Separator to use when between the name and a number when a duplicate name is found. - :type sep: string + :type sep: str """ name_new = name_dict.get(key) if name_new is None: diff --git a/scripts/modules/bpy_extras/mesh_utils.py b/scripts/modules/bpy_extras/mesh_utils.py index 2cfee71f86e..b819b84a631 100644 --- a/scripts/modules/bpy_extras/mesh_utils.py +++ b/scripts/modules/bpy_extras/mesh_utils.py @@ -20,7 +20,7 @@ def mesh_linked_uv_islands(mesh): :arg mesh: the mesh used to group with. :type mesh: :class:`bpy.types.Mesh` :return: list of lists containing polygon indices - :rtype: list + :rtype: list[list[int]] """ if mesh.polygons and not mesh.uv_layers.active.data: @@ -84,12 +84,12 @@ def mesh_linked_uv_islands(mesh): def mesh_linked_triangles(mesh): """ Splits the mesh into connected triangles, use this for separating cubes from - other mesh elements within 1 mesh datablock. + other mesh elements within 1 mesh data-block. :arg mesh: the mesh used to group with. :type mesh: :class:`bpy.types.Mesh` - :return: lists of lists containing triangles. - :rtype: list + :return: Lists of lists containing triangles. + :rtype: list[list[:class:`bpy.types.MeshLoopTriangle`]] """ # Build vert face connectivity @@ -139,9 +139,8 @@ def mesh_linked_triangles(mesh): def edge_face_count_dict(mesh): """ - :return: dict of edge keys with their value set to the number of - faces using each edge. - :rtype: dict + :return: Dictionary of edge keys with their value set to the number of faces using each edge. + :rtype: dict[tuple[int, int], int] """ face_edge_count = {} @@ -161,7 +160,7 @@ def edge_face_count_dict(mesh): def edge_face_count(mesh): """ :return: list face users for each item in mesh.edges. - :rtype: list + :rtype: list[int] """ edge_face_count = edge_face_count_dict(mesh) get = dict.get @@ -237,12 +236,12 @@ def ngon_tessellate(from_data, indices, fix_loops=True, debug_print=True): index lists. Designed to be used for importers that need indices for an ngon to create from existing verts. - :arg from_data: either a mesh, or a list/tuple of vectors. - :type from_data: list or :class:`bpy.types.Mesh` + :arg from_data: Either a mesh, or a list/tuple of 3D vectors. + :type from_data: :class:`bpy.types.Mesh` | list[Sequence[float]] | tuple[Sequence[float]] :arg indices: a list of indices to use this list is the ordered closed poly-line to fill, and can be a subset of the data given. - :type indices: list + :type indices: list[int] :arg fix_loops: If this is enabled poly-lines that use loops to make multiple poly-lines are dealt with correctly. @@ -428,12 +427,12 @@ def triangle_random_points(num_points, loop_triangles): """ Generates a list of random points over mesh loop triangles. - :arg num_points: the number of random points to generate on each triangle. - :type int: - :arg loop_triangles: list of the triangles to generate points on. - :type loop_triangles: :class:`bpy.types.MeshLoopTriangle`, sequence - :return: list of random points over all triangles. - :rtype: list + :arg num_points: The number of random points to generate on each triangle. + :type num_points: int + :arg loop_triangles: Sequence of the triangles to generate points on. + :type loop_triangles: Sequence[:class:`bpy.types.MeshLoopTriangle`] + :return: List of random points over all triangles. + :rtype: list[:class:`mathutils.Vector`] """ from random import random diff --git a/scripts/modules/bpy_extras/object_utils.py b/scripts/modules/bpy_extras/object_utils.py index 1567fbb5b2e..e83d016d6ca 100644 --- a/scripts/modules/bpy_extras/object_utils.py +++ b/scripts/modules/bpy_extras/object_utils.py @@ -89,12 +89,12 @@ def object_data_add(context, obdata, operator=None, name=None): :arg context: The context to use. :type context: :class:`bpy.types.Context` - :arg obdata: the data used for the new object. - :type obdata: valid object data type or None. + :arg obdata: Valid object data to used for the new object or None. + :type obdata: :class:`bpy.types.ID` | None :arg operator: The operator, checked for location and rotation properties. :type operator: :class:`bpy.types.Operator` :arg name: Optional name - :type name: string + :type name: str :return: the newly created object in the scene. :rtype: :class:`bpy.types.Object` """ diff --git a/scripts/modules/bpy_extras/view3d_utils.py b/scripts/modules/bpy_extras/view3d_utils.py index c37e288c855..61a84003924 100644 --- a/scripts/modules/bpy_extras/view3d_utils.py +++ b/scripts/modules/bpy_extras/view3d_utils.py @@ -66,12 +66,12 @@ def region_2d_to_origin_3d(region, rv3d, coord, *, clamp=None): :type region: :class:`bpy.types.Region` :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. :type rv3d: :class:`bpy.types.RegionView3D` - :arg coord: 2d coordinates relative to the region; + :arg coord: 2D coordinates relative to the region; (event.mouse_region_x, event.mouse_region_y) for example. - :type coord: 2d vector + :type coord: Sequence[float] :arg clamp: Clamp the maximum far-clip value used. (negative value will move the offset away from the view_location) - :type clamp: float or None + :type clamp: float | None :return: The origin of the viewpoint in 3d space. :rtype: :class:`mathutils.Vector` """ @@ -164,7 +164,7 @@ def location_3d_to_region_2d(region, rv3d, coord, *, default=None): :arg default: Return this value if ``coord`` is behind the origin of a perspective view. :return: 2d location - :rtype: :class:`mathutils.Vector` or ``default`` argument. + :rtype: :class:`mathutils.Vector` | Any """ from mathutils import Vector diff --git a/scripts/modules/bpy_types.py b/scripts/modules/bpy_types.py index ef9c751c617..8a1ee23dee3 100644 --- a/scripts/modules/bpy_types.py +++ b/scripts/modules/bpy_types.py @@ -25,9 +25,9 @@ class Context(_StructRNA): Returns the property from the path, raise an exception when not found. :arg path: patch which this property resolves. - :type path: string + :type path: str :arg coerce: optional argument, when True, the property will be converted into its Python representation. - :type coerce: boolean + :type coerce: bool """ # This is a convenience wrapper around `_StructRNA.path_resolve` which doesn't support accessing context members. # Without this wrapper many users were writing `exec("context.{:s}".format(data_path))` which is a security @@ -606,7 +606,7 @@ class Mesh(_types.ID): float triplets each representing (X, Y, Z) eg: [(0.0, 1.0, 0.5), ...]. - :type vertices: iterable object + :type vertices: Iterable[Sequence[float]] :arg edges: int pairs, each pair contains two indices to the @@ -614,13 +614,13 @@ class Mesh(_types.ID): When an empty iterable is passed in, the edges are inferred from the polygons. - :type edges: iterable object + :type edges: Iterable[Sequence[int]] :arg faces: iterator of faces, each faces contains three or more indices to the *vertices* argument. eg: [(5, 6, 8, 9), (1, 2, 3), ...] - :type faces: iterable object + :type faces: Iterable[Sequence[int]] .. warning:: @@ -855,7 +855,7 @@ class Gizmo(_StructRNA): Draw a shape created form :class:`Gizmo.draw_custom_shape`. :arg shape: The cached shape to draw. - :type shape: Undefined. + :type shape: Any :arg matrix: 4x4 matrix, when not given :class:`Gizmo.matrix_world` is used. :type matrix: :class:`mathutils.Matrix` :arg select_id: The selection id. @@ -896,11 +896,11 @@ class Gizmo(_StructRNA): Create a new shape that can be passed to :class:`Gizmo.draw_custom_shape`. :arg type: The type of shape to create in (POINTS, LINES, TRIS, LINE_STRIP). - :type type: string - :arg verts: Coordinates. - :type verts: sequence of 2D or 3D coordinates. - :return: The newly created shape. - :rtype: Undefined (it may change). + :type type: str + :arg verts: Sequence of 2D or 3D coordinates. + :type verts: Sequence[Sequence[float]] + :return: The newly created shape (the return type make change). + :rtype: Any """ import gpu from gpu.types import ( @@ -972,7 +972,7 @@ class Macro(_StructRNA): Append an operator to a registered macro class. :arg operator: Identifier of the operator. This does not have to be defined when this function is called. - :type operator: string + :type operator: str :return: The operator macro for property access. :rtype: :class:`OperatorMacro` """ @@ -1113,20 +1113,20 @@ class Menu(_StructRNA, _GenericUI, metaclass=_RNAMeta): Populate a menu from a list of paths. :arg searchpaths: Paths to scan. - :type searchpaths: sequence of strings. + :type searchpaths: Sequence[str] :arg operator: The operator id to use with each file. - :type operator: string + :type operator: str :arg prop_filepath: Optional operator filepath property (defaults to "filepath"). - :type prop_filepath: string + :type prop_filepath: str :arg props_default: Properties to assign to each operator. - :type props_default: dict + :type props_default: dict[str, Any] :arg filter_ext: Optional callback that takes the file extensions. Returning false excludes the file from the list. - :type filter_ext: Callable that takes a string and returns a bool. + :type filter_ext: Callable[[str], bool] | None :arg display_name: Optional callback that takes the full path, returns the name to display. - :type display_name: Callable that takes a string and returns a string. + :type display_name: Callable[[str], str] """ layout = self.layout diff --git a/scripts/modules/gpu_extras/batch.py b/scripts/modules/gpu_extras/batch.py index 0408a3db2af..c19bf443524 100644 --- a/scripts/modules/gpu_extras/batch.py +++ b/scripts/modules/gpu_extras/batch.py @@ -16,7 +16,9 @@ def batch_for_shader(shader, type, content, *, indices=None): :arg type: "'POINTS', 'LINES', 'TRIS' or 'LINES_ADJ'". :type type: str :arg content: Maps the name of the shader attribute with the data to fill the vertex buffer. - :type content: dict + For the dictionary values see documentation for :class:`gpu.types.GPUVertBuf.attr_fill` data argument. + :type content: dict[str, Buffer | Sequence[float] | Sequence[int] | \ +Sequence[Sequence[float]] | Sequence[Sequence[int]]] :return: compatible batch :rtype: :class:`gpu.types.GPUBatch` """ diff --git a/scripts/modules/gpu_extras/presets.py b/scripts/modules/gpu_extras/presets.py index a23fd9dc76b..ca256a98e7a 100644 --- a/scripts/modules/gpu_extras/presets.py +++ b/scripts/modules/gpu_extras/presets.py @@ -6,16 +6,16 @@ def draw_circle_2d(position, color, radius, *, segments=None): """ Draw a circle. - :arg position: Position where the circle will be drawn. - :type position: 2D Vector - :arg color: Color of the circle. To use transparency GL_BLEND has to be enabled. - :type color: tuple containing RGBA values + :arg position: 2D position where the circle will be drawn. + :type position: Sequence[float] + :arg color: Color of the circle (RGBA). To use transparency GL_BLEND has to be enabled. + :type color: Sequence[float] :arg radius: Radius of the circle. :type radius: float :arg segments: How many segments will be used to draw the circle. Higher values give better results but the drawing will take longer. If None or not specified, an automatic value will be calculated. - :type segments: int or None + :type segments: int | None """ from math import sin, cos, pi, ceil, acos import gpu diff --git a/scripts/modules/rna_info.py b/scripts/modules/rna_info.py index f5d72297be4..45e068a2148 100644 --- a/scripts/modules/rna_info.py +++ b/scripts/modules/rna_info.py @@ -381,7 +381,7 @@ class InfoPropertyRNA: """ :arg enum_descr_override: Optionally override items for enum. Otherwise expand the literal items. - :type enum_descr_override: string or None when unset. + :type enum_descr_override: str | None """ type_str = "" if self.fixed_type is None: diff --git a/scripts/startup/bl_operators/bone_selection_sets.py b/scripts/startup/bl_operators/bone_selection_sets.py index 2adbd8ce7f9..029edacb0c5 100644 --- a/scripts/startup/bl_operators/bone_selection_sets.py +++ b/scripts/startup/bl_operators/bone_selection_sets.py @@ -310,11 +310,11 @@ class POSE_OT_selection_set_paste(_PoseModeOnlyMixin, Operator): def _uniqify(name, other_names): """ :arg name: The name to make unique. - :type name: string + :type name: str :arg other_names: The name to make unique. - :type other_names: string + :type other_names: str :return: Return a unique name with ``.xxx`` suffix if necessary. - :rtype: string + :rtype: str Example usage: @@ -362,7 +362,7 @@ def _to_json(context): plus any with the is_selected checkbox on. :return: The selection as JSON data. - :rtype: string + :rtype: str """ import json @@ -382,7 +382,7 @@ def _from_json(context, as_json): """Add the selection sets (one or more) from JSON to the current rig. :arg as_json: The JSON contents to load. - :type as_json: string + :type as_json: str """ import json diff --git a/scripts/startup/bl_operators/uvcalc_transform.py b/scripts/startup/bl_operators/uvcalc_transform.py index 67f3edb7ebf..88d21a55540 100644 --- a/scripts/startup/bl_operators/uvcalc_transform.py +++ b/scripts/startup/bl_operators/uvcalc_transform.py @@ -58,7 +58,7 @@ def is_island_uv_selected(island, uv_layer, any_edge): Returns True if the island is UV selected. :arg island: list of faces to query. - :type island: sequence of :class:`BMFace`. + :type island: Sequence[:class:`BMFace`] :arg uv_layer: the UV layer to source UVs from. :type bmesh: :class:`BMLayerItem` :arg any_edge: use edge selection instead of vertex selection. @@ -77,10 +77,10 @@ def island_uv_bounds(island, uv_layer): The UV bounds of UV island. :arg island: list of faces to query. - :type island: sequence of :class:`BMFace`. + :type island: Sequence[:class:`BMFace`] :arg uv_layer: the UV layer to source UVs from. :return: U-min, V-min, U-max, V-max. - :rtype: list + :rtype: list[float] """ minmax = [1e30, 1e30, -1e30, -1e30] for face in island: @@ -98,10 +98,10 @@ def island_uv_bounds_center(island, uv_layer): The UV bounds center of UV island. :arg island: list of faces to query. - :type island: sequence of :class:`BMFace`. + :type island: Sequence[:class:`BMFace`] :arg uv_layer: the UV layer to source UVs from. :return: U, V center. - :rtype: tuple + :rtype: tuple[float, float] """ minmax = island_uv_bounds(island, uv_layer) return ( diff --git a/scripts/startup/bl_ui/generic_ui_list.py b/scripts/startup/bl_ui/generic_ui_list.py index 48253ca4a16..8f4f1561d56 100644 --- a/scripts/startup/bl_ui/generic_ui_list.py +++ b/scripts/startup/bl_ui/generic_ui_list.py @@ -63,7 +63,7 @@ def draw_ui_list( :type menu_class_name: str :returns: The right side column. - :rtype: :class:`UILayout`. + :rtype: :class:`UILayout` Additional keyword arguments are passed to :class:`UIList.template_list`. """ diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index c628b14dce7..1e59923714d 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -76,7 +76,7 @@ PyDoc_STRVAR( " Returns the border.\n" "\n" " :return: A tuple of 4 numbers (xmin, ymin, xmax, ymax).\n" - " :rtype: tuple\n"); + " :rtype: tuple[int, int, int, int]\n"); static PyObject *ContextFunctions_get_border(PyObject * /*self*/) { diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 724fa92edf5..adfc5949a9b 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -150,11 +150,11 @@ PyDoc_STRVAR( " :arg type: Ramp blend type.\n" " :type type: int\n" " :arg color1: 1st color.\n" - " :type color1: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :type color1: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n" " :arg fac: Blend factor.\n" " :type fac: float\n" " :arg color2: 1st color.\n" - " :type color2: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :type color2: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n" " :return: Blended color in RGB format.\n" " :rtype: :class:`mathutils.Vector`\n"); diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index 747b0dc9077..65004abe986 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -55,15 +55,18 @@ PyDoc_STRVAR( " :arg brother: A Material object to be used as a copy constructor.\n" " :type brother: :class:`Material`\n" " :arg line: The line color.\n" - " :type line: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :type line: :class:`mathutils.Vector` | tuple[float, float, float, float] | list[float]\n" " :arg diffuse: The diffuse color.\n" - " :type diffuse: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :type diffuse: \n" " :arg ambient: The ambient color.\n" - " :type ambient: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :type ambient: :class:`mathutils.Vector` | tuple[float, float, float, float] | " + "list[float]\n" " :arg specular: The specular color.\n" - " :type specular: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :type specular: :class:`mathutils.Vector` | tuple[float, float, float, float] | " + "list[float]\n" " :arg emission: The emissive color.\n" - " :type emission: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :type emission: :class:`mathutils.Vector` | tuple[float, float, float, float] | " + "list[float]\n" " :arg shininess: The shininess coefficient.\n" " :type shininess: float\n" " :arg priority: The line color priority.\n" diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index fe3a42c0297..0d9a1d9bc3d 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -144,7 +144,7 @@ PyDoc_STRVAR( " Returns a noise value for a 2D element.\n" "\n" " :arg v: Two-dimensional sample point.\n" - " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n" + " :type v: :class:`mathutils.Vector` | tuple[float, float] | list[float]\n" " :arg freq: Noise frequency.\n" " :type freq: float\n" " :arg amp: Amplitude.\n" @@ -182,7 +182,7 @@ PyDoc_STRVAR( " Returns a noise value for a 3D element.\n" "\n" " :arg v: Three-dimensional sample point.\n" - " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :type v: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n" " :arg freq: Noise frequency.\n" " :type freq: float\n" " :arg amp: Amplitude.\n" @@ -243,7 +243,7 @@ PyDoc_STRVAR( " Returns a smooth noise value for a 2D element.\n" "\n" " :arg v: Two-dimensional sample point.\n" - " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n" + " :type v: :class:`mathutils.Vector` | tuple[float, float] | list[float]\n" " :return: A smooth noise value.\n" " :rtype: float"); @@ -273,7 +273,7 @@ PyDoc_STRVAR( " Returns a smooth noise value for a 3D element.\n" "\n" " :arg v: Three-dimensional sample point.\n" - " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :type v: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n" " :return: A smooth noise value.\n" " :rtype: float"); diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index a9bedfdab4c..eafeaf77aab 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -51,7 +51,7 @@ PyDoc_STRVAR( " value type is float if func is of the :class:`UnaryFunction0DDouble`\n" " or :class:`UnaryFunction0DFloat` type, and int if func is of the\n" " :class:`UnaryFunction0DUnsigned` type.\n" - " :rtype: int or float"); + " :rtype: int | float"); static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 791a3fbb4f6..b673ae48493 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -527,7 +527,7 @@ PyDoc_STRVAR( " transform as a stroke.\n" " :type pred: :class:`UnaryPredicate1D`\n" " :arg shaders: The list of shaders used to shade the strokes.\n" - " :type shaders: list of :class:`StrokeShader`"); + " :type shaders: list[:class:`StrokeShader`]"); static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 2d2cff43b61..8a7ffeb9f09 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -342,7 +342,7 @@ PyDoc_STRVAR( " :arg name: The name of the attribute.\n" " :type name: str\n" " :arg value: The attribute value.\n" - " :type value: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"); + " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n"); static PyObject *StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, @@ -376,8 +376,8 @@ PyDoc_STRVAR( "\n" " :arg name: The name of the attribute.\n" " :type name: str\n" - " :arg value: The attribute value.\n" - " :type value: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"); + " :arg value: The attribute value as a 3D vector.\n" + " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n"); static PyObject *StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index fbc8d9dacf9..a0c94f0a155 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -86,7 +86,7 @@ PyDoc_STRVAR( " is already in the set, nothing changes.\n" "\n" " :arg normal: A three-dimensional vector.\n" - " :type normal: :class:`mathutils.Vector`, list or tuple of 3 real numbers"); + " :type normal: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]"); static PyObject *SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index bec5f24548b..6cae94e64ed 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -80,7 +80,7 @@ PyDoc_STRVAR( " Adds a single vertex at the end of the Curve.\n" "\n" " :arg vertex: A vertex object.\n" - " :type vertex: :class:`SVertex` or :class:`CurvePoint`"); + " :type vertex: :class:`SVertex` | :class:`CurvePoint`"); static PyObject *FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { @@ -112,7 +112,7 @@ PyDoc_STRVAR( " Adds a single vertex at the front of the Curve.\n" "\n" " :arg vertex: A vertex object.\n" - " :type vertex: :class:`SVertex` or :class:`CurvePoint`"); + " :type vertex: :class:`SVertex` | :class:`CurvePoint`"); static PyObject *FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp index 53bb9f2cbe6..2fcbdd748b2 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp @@ -62,7 +62,7 @@ PyDoc_STRVAR( " already been chained must be ignored ot not.\n" " :type restrict_to_unvisited: bool\n" " :arg begin: The ViewEdge from where to start the iteration.\n" - " :type begin: :class:`freestyle.types.ViewEdge` or None\n" + " :type begin: :class:`freestyle.types.ViewEdge` | None\n" " :arg orientation: If true, we'll look for the next ViewEdge among\n" " the ViewEdges that surround the ending ViewVertex of begin. If\n" " false, we'll search over the ViewEdges surrounding the ending\n" diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp index 2943b174a97..c7382046435 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp @@ -49,7 +49,7 @@ PyDoc_STRVAR( " to stay within the set of selected ViewEdges or not.\n" " :type restrict_to_selection: bool\n" " :arg begin: The ViewEdge from where to start the iteration.\n" - " :type begin: :class:`freestyle.types.ViewEdge` or None\n" + " :type begin: :class:`freestyle.types.ViewEdge` | None\n" " :arg orientation: If true, we'll look for the next ViewEdge among\n" " the ViewEdges that surround the ending ViewVertex of begin. If\n" " false, we'll search over the ViewEdges surrounding the ending\n" diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index f99c7f3f74b..b34ed534804 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -51,7 +51,7 @@ PyDoc_STRVAR( " already been chained must be ignored ot not.\n" " :type restrict_to_unvisited: bool\n" " :arg begin: The ViewEdge from which to start the chain.\n" - " :type begin: :class:`ViewEdge` or None\n" + " :type begin: :class:`ViewEdge` | None\n" " :arg orientation: The direction to follow to explore the graph. If\n" " true, the direction indicated by the first ViewEdge is used.\n" " :type orientation: bool\n" @@ -146,7 +146,7 @@ PyDoc_STRVAR( " restriction rules by only iterating over the valid ViewEdges.\n" " :type it: :class:`AdjacencyIterator`\n" " :return: Returns the next ViewEdge to follow, or None if chaining ends.\n" - " :rtype: :class:`ViewEdge` or None"); + " :rtype: :class:`ViewEdge` | None"); static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self, PyObject *args, diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index 64a3f9f560e..ed3c7a8a4ab 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -38,7 +38,7 @@ PyDoc_STRVAR( " orientation or the copy constructor.\n" "\n" " :arg begin: The ViewEdge from where to start the iteration.\n" - " :type begin: :class:`ViewEdge` or None\n" + " :type begin: :class:`ViewEdge` | None\n" " :arg orientation: If true, we'll look for the next ViewEdge among\n" " the ViewEdges that surround the ending ViewVertex of begin. If\n" " false, we'll search over the ViewEdges surrounding the ending\n" diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp index d1b2f012967..e435760699f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp @@ -39,7 +39,7 @@ PyDoc_STRVAR( " :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: A list of ViewShape objects occluding the pointed\n" " Interface0D.\n" - " :rtype: list of :class:`freestyle.types.ViewShape`\n"); + " :rtype: list[:class:`freestyle.types.ViewShape`]\n"); static int GetOccludersF0D___init__(BPy_GetOccludersF0D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp index f4c93e01b5e..0af7b96fda3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp @@ -39,7 +39,7 @@ PyDoc_STRVAR( " :arg inter: An Interface1D object.\n" " :type inter: :class:`freestyle.types.Interface1D`\n" " :return: A list of occluded shapes covered by the Interface1D.\n" - " :rtype: list of :class:`freestyle.types.ViewShape`\n"); + " :rtype: list[:class:`freestyle.types.ViewShape`]\n"); static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp index 2fbbc38c12b..50aeca0d6a9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp @@ -39,7 +39,7 @@ PyDoc_STRVAR( " :arg inter: An Interface1D object.\n" " :type inter: :class:`freestyle.types.Interface1D`\n" " :return: A list of occluding shapes that cover the Interface1D.\n" - " :rtype: list of :class:`freestyle.types.ViewShape`\n"); + " :rtype: list[:class:`freestyle.types.ViewShape`]\n"); static int GetOccludersF1D___init__(BPy_GetOccludersF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp index 7a7112a57aa..69b73c56b7e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp @@ -39,7 +39,7 @@ PyDoc_STRVAR( " :arg inter: An Interface1D object.\n" " :type inter: :class:`freestyle.types.Interface1D`\n" " :return: A list of shapes covered by the Interface1D.\n" - " :rtype: list of :class:`freestyle.types.ViewShape`\n"); + " :rtype: list[:class:`freestyle.types.ViewShape`]\n"); static int GetShapeF1D___init__(BPy_GetShapeF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/python/bmesh/bmesh_py_api.cc b/source/blender/python/bmesh/bmesh_py_api.cc index 36ea413e110..049e32ed6c7 100644 --- a/source/blender/python/bmesh/bmesh_py_api.cc +++ b/source/blender/python/bmesh/bmesh_py_api.cc @@ -106,9 +106,9 @@ PyDoc_STRVAR( " :arg mesh: The editmode mesh.\n" " :type mesh: :class:`bpy.types.Mesh`\n" " :arg loop_triangles: Option to recalculate n-gon tessellation.\n" - " :type loop_triangles: boolean\n" + " :type loop_triangles: bool\n" " :arg destructive: Use when geometry has been added or removed.\n" - " :type destructive: boolean\n"); + " :type destructive: bool\n"); static PyObject *bpy_bm_update_edit_mesh(PyObject * /*self*/, PyObject *args, PyObject *kw) { static const char *kwlist[] = {"mesh", "loop_triangles", "destructive", nullptr}; diff --git a/source/blender/python/bmesh/bmesh_py_types.cc b/source/blender/python/bmesh/bmesh_py_types.cc index 77a3bc1959c..ea6bb4d811c 100644 --- a/source/blender/python/bmesh/bmesh_py_types.cc +++ b/source/blender/python/bmesh/bmesh_py_types.cc @@ -94,31 +94,31 @@ PyDoc_STRVAR( bpy_bm_elem_select_doc, "Selected state of this element.\n" "\n" - ":type: boolean"); + ":type: bool"); PyDoc_STRVAR( /* Wrap. */ bpy_bm_elem_hide_doc, "Hidden state of this element.\n" "\n" - ":type: boolean"); + ":type: bool"); PyDoc_STRVAR( /* Wrap. */ bpy_bm_elem_tag_doc, "Generic attribute scripts can use for own logic\n" "\n" - ":type: boolean"); + ":type: bool"); PyDoc_STRVAR( /* Wrap. */ bpy_bm_elem_smooth_doc, "Smooth state of this element.\n" "\n" - ":type: boolean"); + ":type: bool"); PyDoc_STRVAR( /* Wrap. */ bpy_bm_elem_seam_doc, "Seam for UV unwrapping.\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag) { @@ -314,7 +314,7 @@ PyDoc_STRVAR( bpy_bm_is_valid_doc, "True when this element is valid (hasn't been removed).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bm_is_valid_get(BPy_BMGeneric *self, void * /*closure*/) { return PyBool_FromLong(BPY_BM_IS_VALID(self)); @@ -323,7 +323,7 @@ static PyObject *bpy_bm_is_valid_get(BPy_BMGeneric *self, void * /*closure*/) PyDoc_STRVAR(bpy_bmesh_is_wrapped_doc, "True when this mesh is owned by blender (typically the editmode BMesh).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmesh_is_wrapped_get(BPy_BMesh *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -437,7 +437,7 @@ PyDoc_STRVAR( bpy_bmvert_is_manifold_doc, "True when this vertex is manifold (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmvert_is_manifold_get(BPy_BMVert *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -449,7 +449,7 @@ PyDoc_STRVAR( bpy_bmvert_is_wire_doc, "True when this vertex is not connected to any faces (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmvert_is_wire_get(BPy_BMVert *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -459,7 +459,7 @@ static PyObject *bpy_bmvert_is_wire_get(BPy_BMVert *self, void * /*closure*/) PyDoc_STRVAR(bpy_bmvert_is_boundary_doc, "True when this vertex is connected to boundary edges (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmvert_is_boundary_get(BPy_BMVert *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -474,7 +474,7 @@ PyDoc_STRVAR( bpy_bmedge_is_manifold_doc, "True when this edge is manifold (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmedge_is_manifold_get(BPy_BMEdge *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -487,7 +487,7 @@ PyDoc_STRVAR( "True when this edge is manifold, between two faces with the same winding " "(read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmedge_is_contiguous_get(BPy_BMEdge *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -499,7 +499,7 @@ PyDoc_STRVAR( bpy_bmedge_is_convex_doc, "True when this edge joins two convex faces, depends on a valid face normal (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmedge_is_convex_get(BPy_BMEdge *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -511,7 +511,7 @@ PyDoc_STRVAR( bpy_bmedge_is_wire_doc, "True when this edge is not connected to any faces (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmedge_is_wire_get(BPy_BMEdge *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -523,7 +523,7 @@ PyDoc_STRVAR( bpy_bmedge_is_boundary_doc, "True when this edge is at the boundary of a face (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmedge_is_boundary_get(BPy_BMEdge *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -678,7 +678,7 @@ PyDoc_STRVAR( "True when this loop is at the convex corner of a face, depends on a valid face " "normal (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmloop_is_convex_get(BPy_BMLoop *self, void * /*closure*/) { BPY_BM_CHECK_OBJ(self); @@ -1253,11 +1253,11 @@ PyDoc_STRVAR( " :type object: :class:`Object`\n" " :type depsgraph: :class:`Depsgraph`\n" " :arg cage: Get the mesh as a deformed cage.\n" - " :type cage: boolean\n" + " :type cage: bool\n" " :arg face_normals: Calculate face normals.\n" - " :type face_normals: boolean\n" + " :type face_normals: bool\n" " :arg vertex_normals: Calculate vertex normals.\n" - " :type vertex_normals: boolean\n"); + " :type vertex_normals: bool\n"); static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject *kw) { static const char *kwlist[] = { @@ -1357,10 +1357,10 @@ PyDoc_STRVAR( "\n" " :arg mesh: The mesh data to load.\n" " :type mesh: :class:`Mesh`\n" - " :type face_normals: boolean\n" - " :type vertex_normals: boolean\n" + " :type face_normals: bool\n" + " :type vertex_normals: bool\n" " :arg use_shape_key: Use the locations from a shape key.\n" - " :type use_shape_key: boolean\n" + " :type use_shape_key: bool\n" " :arg shape_key_index: The shape key index to use.\n" " :type shape_key_index: int\n" "\n" @@ -1437,7 +1437,7 @@ PyDoc_STRVAR( " Flush selection, independent of the current selection mode.\n" "\n" " :arg select: flush selection or de-selected elements.\n" - " :type select: boolean\n"); + " :type select: bool\n"); static PyObject *bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value) { int param; @@ -1485,11 +1485,11 @@ PyDoc_STRVAR( "\n" " Transform the mesh (optionally filtering flagged data only).\n" "\n" - " :arg matrix: transform matrix.\n" - " :type matrix: 4x4 :class:`mathutils.Matrix`\n" + " :arg matrix: 4x4x transform matrix.\n" + " :type matrix: :class:`mathutils.Matrix`\n" " :arg filter: set of values in " BPY_BM_HFLAG_ALL_STR ".\n" - " :type filter: set\n"); + " :type filter: set[str]\n"); static PyObject *bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject *kw) { static const char *kwlist[] = {"matrix", "filter", nullptr}; @@ -1578,7 +1578,7 @@ PyDoc_STRVAR( " Calculate triangle tessellation from quads/ngons.\n" "\n" " :return: The triangulated faces.\n" - " :rtype: list of :class:`BMLoop` tuples\n"); + " :rtype: list[tuple[:class:`BMLoop`, :class:`BMLoop`, :class:`BMLoop`]]\n"); static PyObject *bpy_bmesh_calc_loop_triangles(BPy_BMElem *self) { BMesh *bm; @@ -1617,7 +1617,7 @@ PyDoc_STRVAR( "state of associated geometry.\n" "\n" " :arg select: Select or de-select.\n" - " :type select: boolean\n" + " :type select: bool\n" "\n" " .. note::\n" "\n" @@ -1650,7 +1650,7 @@ PyDoc_STRVAR( "hide state of associated geometry.\n" "\n" " :arg hide: Hidden or visible.\n" - " :type hide: boolean\n"); + " :type hide: bool\n"); static PyObject *bpy_bm_elem_hide_set(BPy_BMElem *self, PyObject *value) { int param; @@ -1739,7 +1739,7 @@ PyDoc_STRVAR( " Interpolate the customdata from a vert between 2 other verts.\n" "\n" " :arg vert_pair: The verts between which to interpolate data from.\n" - " :type vert_pair: pair of :class:`BMVert`\n" + " :type vert_pair: Sequence[:class:`BMVert`]\n" " :type fac: float\n"); static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *args) { @@ -1815,7 +1815,7 @@ PyDoc_STRVAR( "\n" " :arg fallback: return this when the vert doesn't have 2 edges\n" " (instead of raising a :exc:`ValueError`).\n" - " :type fallback: any\n" + " :type fallback: Any\n" " :return: Angle between edges in radians.\n" " :rtype: float\n"); static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self, PyObject *args) @@ -1908,7 +1908,7 @@ PyDoc_STRVAR( "\n" " :arg fallback: return this when the edge doesn't have 2 faces\n" " (instead of raising a :exc:`ValueError`).\n" - " :type fallback: any\n" + " :type fallback: Any\n" " :return: The angle between 2 connected faces in radians.\n" " :rtype: float\n"); static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self, PyObject *args) @@ -1948,7 +1948,7 @@ PyDoc_STRVAR( "\n" " :arg fallback: return this when the edge doesn't have 2 faces\n" " (instead of raising a :exc:`ValueError`).\n" - " :type fallback: any\n" + " :type fallback: Any\n" " :return: The angle between 2 connected faces in radians (negative for concave join).\n" " :rtype: float\n"); static PyObject *bpy_bmedge_calc_face_angle_signed(BPy_BMEdge *self, PyObject *args) @@ -2019,7 +2019,7 @@ PyDoc_STRVAR( " :arg vert: a vert in this edge.\n" " :type vert: :class:`BMVert`\n" " :return: The edges other vert.\n" - " :rtype: :class:`BMVert` or None\n"); + " :rtype: :class:`BMVert` | None\n"); static PyObject *bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value) { BMVert *other; @@ -2076,7 +2076,7 @@ PyDoc_STRVAR( " :arg face: The face to interpolate data from.\n" " :type face: :class:`BMFace`\n" " :arg vert: When True, also copy vertex data.\n" - " :type vert: boolean\n"); + " :type vert: bool\n"); static PyObject *bpy_bmface_copy_from_face_interp(BPy_BMFace *self, PyObject *args) { BPy_BMFace *py_face = nullptr; @@ -2111,9 +2111,9 @@ PyDoc_STRVAR( " Make a copy of this face.\n" "\n" " :arg verts: When set, the faces verts will be duplicated too.\n" - " :type verts: boolean\n" + " :type verts: bool\n" " :arg edges: When set, the faces edges will be duplicated too.\n" - " :type edges: boolean\n" + " :type edges: bool\n" " :return: The newly created face.\n" " :rtype: :class:`BMFace`\n"); static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw) @@ -2354,9 +2354,9 @@ PyDoc_STRVAR( " :arg face: The face to interpolate data from.\n" " :type face: :class:`BMFace`\n" " :arg vert: When enabled, interpolate the loops vertex data (optional).\n" - " :type vert: boolean\n" + " :type vert: bool\n" " :arg multires: When enabled, interpolate the loops multires data (optional).\n" - " :type multires: boolean\n"); + " :type multires: bool\n"); static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args) { BPy_BMFace *py_face = nullptr; @@ -2508,7 +2508,7 @@ PyDoc_STRVAR( " Create a new edge from a given pair of verts.\n" "\n" " :arg verts: Vertex pair.\n" - " :type verts: pair of :class:`BMVert`\n" + " :type verts: Sequence[:class:`BMVert`]\n" " :arg example: Existing edge to initialize settings (optional argument).\n" " :type example: :class:`BMEdge`\n" " :return: The newly created edge.\n" @@ -2584,7 +2584,7 @@ PyDoc_STRVAR( " Create a new face from a given set of verts.\n" "\n" " :arg verts: Sequence of 3 or more verts.\n" - " :type verts: sequence of :class:`BMVert`\n" + " :type verts: Sequence[:class:`BMVert`]\n" " :arg example: Existing face to initialize settings (optional argument).\n" " :type example: :class:`BMFace`\n" " :return: The newly created face.\n" @@ -2741,7 +2741,7 @@ PyDoc_STRVAR( " Return an edge which uses the **verts** passed.\n" "\n" " :arg verts: Sequence of verts.\n" - " :type verts: sequence of :class:`BMVert`\n" + " :type verts: Sequence[:class:`BMVert`]\n" " :arg fallback: Return this value if nothing is found.\n" " :return: The edge found or None\n" " :rtype: :class:`BMEdge`\n"); @@ -2789,7 +2789,7 @@ PyDoc_STRVAR( " Return a face which uses the **verts** passed.\n" "\n" " :arg verts: Sequence of verts.\n" - " :type verts: sequence of :class:`BMVert`\n" + " :type verts: Sequence[:class:`BMVert`]\n" " :arg fallback: Return this value if nothing is found.\n" " :return: The face found or None\n" " :rtype: :class:`BMFace`\n"); @@ -2916,7 +2916,7 @@ PyDoc_STRVAR( "that.\n" "\n" " :arg key: The key that sets the ordering of the elements.\n" - " :type key: :function: returning a number\n" + " :type key: Callable[[:class:`BMVert` | :class:`BMEdge` | :class:`BMFace`], int] | None\n" " :arg reverse: Reverse the order of the elements\n" " :type reverse: bool\n" "\n" diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.cc b/source/blender/python/bmesh/bmesh_py_types_customdata.cc index fb843c048a5..a05b6bb2541 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.cc +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.cc @@ -182,7 +182,7 @@ static PyObject *bpy_bmlayercollection_active_get(BPy_BMLayerItem *self, void * PyDoc_STRVAR(bpy_bmlayercollection_is_singleton_doc, "True if there can exists only one layer of this type (read-only).\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmlayercollection_is_singleton_get(BPy_BMLayerItem *self, void * /*flag*/) { BPY_BM_CHECK_OBJ(self); @@ -195,7 +195,7 @@ PyDoc_STRVAR( bpy_bmlayercollection_name_doc, "The layers unique name (read-only).\n" "\n" - ":type: string"); + ":type: str"); static PyObject *bpy_bmlayeritem_name_get(BPy_BMLayerItem *self, void * /*flag*/) { CustomDataLayer *layer; @@ -506,7 +506,7 @@ PyDoc_STRVAR( " Create a new layer\n" "\n" " :arg name: Optional name argument (will be made unique).\n" - " :type name: string\n" + " :type name: str\n" " :return: The newly created layer.\n" " :rtype: :class:`BMLayerItem`\n"); static PyObject *bpy_bmlayercollection_new(BPy_BMLayerCollection *self, PyObject *args) @@ -593,7 +593,7 @@ PyDoc_STRVAR( " (matching Python's dict.keys() functionality).\n" "\n" " :return: the identifiers for each member of this collection.\n" - " :rtype: list of strings\n"); + " :rtype: list[str]\n"); static PyObject *bpy_bmlayercollection_keys(BPy_BMLayerCollection *self) { PyObject *ret; @@ -630,7 +630,7 @@ PyDoc_STRVAR( " (matching Python's dict.items() functionality).\n" "\n" " :return: (key, value) pairs for each member of this collection.\n" - " :rtype: list of tuples\n"); + " :rtype: list[tuple[str, :class:`BMLayerItem`]]\n"); static PyObject *bpy_bmlayercollection_items(BPy_BMLayerCollection *self) { PyObject *ret; @@ -667,7 +667,7 @@ PyDoc_STRVAR( " (matching Python's dict.values() functionality).\n" "\n" " :return: the members of this collection.\n" - " :rtype: list\n"); + " :rtype: list[:class:`BMLayerItem`]\n"); static PyObject *bpy_bmlayercollection_values(BPy_BMLayerCollection *self) { PyObject *ret; @@ -701,10 +701,10 @@ PyDoc_STRVAR( " when not found (matches Python's dictionary function of the same name).\n" "\n" " :arg key: The key associated with the layer.\n" - " :type key: string\n" + " :type key: str\n" " :arg default: Optional argument for the value to return if\n" " *key* is not found.\n" - " :type default: Undefined\n"); + " :type default: Any\n"); static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject *args) { const char *key; diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.cc b/source/blender/python/bmesh/bmesh_py_types_meshdata.cc index 5a47ed8969b..98c6529c73c 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.cc +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.cc @@ -85,19 +85,19 @@ PyDoc_STRVAR( bpy_bmloopuv_pin_uv_doc, "UV pin state.\n" "\n" - ":type: boolean"); + ":type: bool"); PyDoc_STRVAR( /* Wrap. */ bpy_bmloopuv_select_doc, "UV select state.\n" "\n" - ":type: boolean"); + ":type: bool"); PyDoc_STRVAR( /* Wrap. */ bpy_bmloopuv_select_edge_doc, "UV edge select state.\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmloopuv_pin_uv_get(BPy_BMLoopUV *self, void * /*closure*/) { @@ -284,13 +284,13 @@ PyDoc_STRVAR( bpy_bmvertskin_flag__use_root_doc, "Use as root vertex. Setting this flag does not clear other roots in the same mesh island.\n" "\n" - ":type: boolean"); + ":type: bool"); PyDoc_STRVAR( /* Wrap. */ bpy_bmvertskin_flag__use_loose_doc, "Use loose vertex.\n" "\n" - ":type: boolean"); + ":type: bool"); static PyObject *bpy_bmvertskin_flag_get(BPy_BMVertSkin *self, void *flag_p) { @@ -637,7 +637,7 @@ PyDoc_STRVAR( " (matching Python's dict.keys() functionality).\n" "\n" " :return: the deform group this vertex uses\n" - " :rtype: list of ints\n"); + " :rtype: list[int]\n"); static PyObject *bpy_bmdeformvert_keys(BPy_BMDeformVert *self) { PyObject *ret; @@ -661,7 +661,7 @@ PyDoc_STRVAR( " (matching Python's dict.values() functionality).\n" "\n" " :return: The weights that influence this vertex\n" - " :rtype: list of floats\n"); + " :rtype: list[float]\n"); static PyObject *bpy_bmdeformvert_values(BPy_BMDeformVert *self) { PyObject *ret; @@ -685,7 +685,7 @@ PyDoc_STRVAR( " (matching Python's dict.items() functionality).\n" "\n" " :return: (key, value) pairs for each deform weight of this vertex.\n" - " :rtype: list of tuples\n"); + " :rtype: list[tuple[int, float]]\n"); static PyObject *bpy_bmdeformvert_items(BPy_BMDeformVert *self) { PyObject *ret; @@ -715,7 +715,7 @@ PyDoc_STRVAR( " :type key: int\n" " :arg default: Optional argument for the value to return if\n" " *key* is not found.\n" - " :type default: Undefined\n"); + " :type default: Any\n"); static PyObject *bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args) { int key; diff --git a/source/blender/python/bmesh/bmesh_py_utils.cc b/source/blender/python/bmesh/bmesh_py_utils.cc index 1eaf5e3cf9e..b186e4fd52f 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.cc +++ b/source/blender/python/bmesh/bmesh_py_utils.cc @@ -163,7 +163,7 @@ PyDoc_STRVAR( " :arg vert: The vert to be dissolved.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :return: True when the vertex dissolve is successful.\n" - " :rtype: boolean\n"); + " :rtype: bool\n"); static PyObject *bpy_bm_utils_vert_dissolve(PyObject * /*self*/, PyObject *args) { BPy_BMVert *py_vert; @@ -250,7 +250,7 @@ PyDoc_STRVAR( " :arg edges: The edges to separated.\n" " :type edges: :class:`bmesh.types.BMEdge`\n" " :return: The newly separated verts (including the vertex passed).\n" - " :rtype: tuple of :class:`bmesh.types.BMVert`\n"); + " :rtype: tuple[:class:`bmesh.types.BMVert`, ...]\n"); static PyObject *bpy_bm_utils_vert_separate(PyObject * /*self*/, PyObject *args) { BPy_BMVert *py_vert; @@ -312,7 +312,7 @@ PyDoc_STRVAR( " :arg fac: The point on the edge where the new vert will be created [0 - 1].\n" " :type fac: float\n" " :return: The newly created (edge, vert) pair.\n" - " :rtype: tuple\n"); + " :rtype: tuple[:class:`bmesh.types.BMEdge`, :class:`bmesh.types.BMVert`]\n"); static PyObject *bpy_bm_utils_edge_split(PyObject * /*self*/, PyObject *args) { BPy_BMEdge *py_edge; @@ -366,7 +366,7 @@ PyDoc_STRVAR( " :arg edge: The edge to rotate.\n" " :type edge: :class:`bmesh.types.BMEdge`\n" " :arg ccw: When True the edge will be rotated counter clockwise.\n" - " :type ccw: boolean\n" + " :type ccw: bool\n" " :return: The newly rotated edge.\n" " :rtype: :class:`bmesh.types.BMEdge`\n"); static PyObject *bpy_bm_utils_edge_rotate(PyObject * /*self*/, PyObject *args) @@ -409,15 +409,15 @@ PyDoc_STRVAR( " :type vert_a: :class:`bmesh.types.BMVert`\n" " :arg vert_b: Second vertex to cut in the face (face must contain the vert).\n" " :type vert_b: :class:`bmesh.types.BMVert`\n" - " :arg coords: Optional argument to define points in between *vert_a* and *vert_b*.\n" - " :type coords: sequence of float triplets\n" + " :arg coords: Optional sequence of 3D points in between *vert_a* and *vert_b*.\n" + " :type coords: Sequence[Sequence[float]]\n" " :arg use_exist: .Use an existing edge if it exists (Only used when *coords* argument is " "empty or omitted)\n" - " :type use_exist: boolean\n" + " :type use_exist: bool\n" " :arg example: Newly created edge will copy settings from this one.\n" " :type example: :class:`bmesh.types.BMEdge`\n" " :return: The newly created face or None on failure.\n" - " :rtype: (:class:`bmesh.types.BMFace`, :class:`bmesh.types.BMLoop`) pair\n"); + " :rtype: tuple[:class:`bmesh.types.BMFace`, :class:`bmesh.types.BMLoop`]\n"); static PyObject *bpy_bm_utils_face_split(PyObject * /*self*/, PyObject *args, PyObject *kw) { static const char *kwlist[] = { @@ -544,9 +544,9 @@ PyDoc_STRVAR( " :arg face: The face to split.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg edgenet: Sequence of edges.\n" - " :type edgenet: :class:`bmesh.types.BMEdge`\n" + " :type edgenet: Sequence[:class:`bmesh.types.BMEdge`]\n" " :return: The newly created faces.\n" - " :rtype: tuple of :class:`bmesh.types.BMFace`\n" + " :rtype: tuple[:class:`bmesh.types.BMFace`, ...]\n" "\n" " .. note::\n" "\n" @@ -621,7 +621,7 @@ PyDoc_STRVAR( " :arg faces: Sequence of faces.\n" " :type faces: :class:`bmesh.types.BMFace`\n" " :arg remove: Remove the edges and vertices between the faces.\n" - " :type remove: boolean\n" + " :type remove: bool\n" " :return: The newly created face or None on failure.\n" " :rtype: :class:`bmesh.types.BMFace`\n"); static PyObject *bpy_bm_utils_face_join(PyObject * /*self*/, PyObject *args) diff --git a/source/blender/python/generic/blf_py_api.cc b/source/blender/python/generic/blf_py_api.cc index e3764244694..349ad68a021 100644 --- a/source/blender/python/generic/blf_py_api.cc +++ b/source/blender/python/generic/blf_py_api.cc @@ -150,7 +150,7 @@ PyDoc_STRVAR( "font use 0.\n" " :type fontid: int\n" " :arg text: the text to draw.\n" - " :type text: string\n"); + " :type text: str\n"); static PyObject *py_blf_draw(PyObject * /*self*/, PyObject *args) { const char *text; @@ -177,9 +177,9 @@ PyDoc_STRVAR( "font use 0.\n" " :type fontid: int\n" " :arg text: the text to draw.\n" - " :type text: string\n" + " :type text: str\n" " :return: the width and height of the text.\n" - " :rtype: tuple of 2 floats\n"); + " :rtype: tuple[float, float]\n"); static PyObject *py_blf_dimensions(PyObject * /*self*/, PyObject *args) { const char *text; @@ -408,9 +408,9 @@ PyDoc_STRVAR( " Load a new font.\n" "\n" " :arg filepath: the filepath of the font.\n" - " :type filepath: string or bytes\n" + " :type filepath: str | bytes\n" " :return: the new font's fontid or -1 if there was an error.\n" - " :rtype: integer\n"); + " :rtype: int\n"); static PyObject *py_blf_load(PyObject * /*self*/, PyObject *args) { PyC_UnicodeAsBytesAndSize_Data filepath_data = {nullptr}; @@ -436,7 +436,7 @@ PyDoc_STRVAR( " Unload an existing font.\n" "\n" " :arg filepath: the filepath of the font.\n" - " :type filepath: string or bytes\n"); + " :type filepath: str | bytes\n"); static PyObject *py_blf_unload(PyObject * /*self*/, PyObject *args) { PyC_UnicodeAsBytesAndSize_Data filepath_data = {nullptr}; diff --git a/source/blender/python/generic/idprop_py_api.cc b/source/blender/python/generic/idprop_py_api.cc index 28f0e26102d..498cae7ba13 100644 --- a/source/blender/python/generic/idprop_py_api.cc +++ b/source/blender/python/generic/idprop_py_api.cc @@ -1682,9 +1682,9 @@ PyDoc_STRVAR( " :raises KeyError: When the item doesn't exist.\n" "\n" " :arg key: Name of item to remove.\n" - " :type key: string\n" + " :type key: str\n" " :arg default: Value to return when key isn't found, otherwise raise an exception.\n" - " :type default: Undefined\n"); + " :type default: Any\n"); static PyObject *BPy_IDGroup_pop(BPy_IDProperty *self, PyObject *args) { IDProperty *idprop; @@ -1884,7 +1884,8 @@ PyDoc_STRVAR( " Update key, values.\n" "\n" " :arg other: Updates the values in the group with this.\n" - " :type other: :class:`IDPropertyGroup` or dict\n"); + /* TODO: replace `Any` with an alias for all types an ID property can use. */ + " :type other: :class:`IDPropertyGroup` | dict[str, Any]\n"); static PyObject *BPy_IDGroup_update(BPy_IDProperty *self, PyObject *value) { PyObject *pkey, *pval; diff --git a/source/blender/python/generic/imbuf_py_api.cc b/source/blender/python/generic/imbuf_py_api.cc index 10e574cde91..3b50d79c753 100644 --- a/source/blender/python/generic/imbuf_py_api.cc +++ b/source/blender/python/generic/imbuf_py_api.cc @@ -79,7 +79,7 @@ PyDoc_STRVAR( " Resize the image.\n" "\n" " :arg size: New size.\n" - " :type size: pair of ints\n" + " :type size: tuple[int, int]\n" " :arg method: Method of resizing ('FAST', 'BILINEAR')\n" " :type method: str\n"); static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw) @@ -136,9 +136,9 @@ PyDoc_STRVAR( " Crop the image.\n" "\n" " :arg min: X, Y minimum.\n" - " :type min: pair of ints\n" + " :type min: tuple[int, int]\n" " :arg max: X, Y maximum.\n" - " :type max: pair of ints\n"); + " :type max: tuple[int, int]\n"); static PyObject *py_imbuf_crop(Py_ImBuf *self, PyObject *args, PyObject *kw) { PY_IMBUF_CHECK_OBJ(self); @@ -296,7 +296,7 @@ PyDoc_STRVAR( py_imbuf_filepath_doc, "filepath associated with this image.\n" "\n" - ":type: string"); + ":type: str"); static PyObject *py_imbuf_filepath_get(Py_ImBuf *self, void * /*closure*/) { PY_IMBUF_CHECK_OBJ(self); @@ -472,7 +472,7 @@ PyDoc_STRVAR( " Load a new image.\n" "\n" " :arg size: The size of the image in pixels.\n" - " :type size: pair of ints\n" + " :type size: tuple[int, int]\n" " :return: the newly loaded image.\n" " :rtype: :class:`ImBuf`\n"); static PyObject *M_imbuf_new(PyObject * /*self*/, PyObject *args, PyObject *kw) @@ -537,7 +537,7 @@ PyDoc_STRVAR( " Load an image from a file.\n" "\n" " :arg filepath: the filepath of the image.\n" - " :type filepath: string or bytes\n" + " :type filepath: str | bytes\n" " :return: the newly loaded image.\n" " :rtype: :class:`ImBuf`\n"); static PyObject *M_imbuf_load(PyObject * /*self*/, PyObject *args, PyObject *kw) @@ -584,7 +584,7 @@ PyDoc_STRVAR( " :arg image: the image to write.\n" " :type image: :class:`ImBuf`\n" " :arg filepath: Optional filepath of the image (fallback to the images file path).\n" - " :type filepath: string, bytes or NoneType\n"); + " :type filepath: str | bytes | None\n"); static PyObject *M_imbuf_write(PyObject * /*self*/, PyObject *args, PyObject *kw) { Py_ImBuf *py_imb; diff --git a/source/blender/python/gpu/gpu_py_buffer.cc b/source/blender/python/gpu/gpu_py_buffer.cc index f9800b8d400..15615211156 100644 --- a/source/blender/python/gpu/gpu_py_buffer.cc +++ b/source/blender/python/gpu/gpu_py_buffer.cc @@ -684,7 +684,7 @@ PyDoc_STRVAR( " :arg dimensions: Array describing the dimensions.\n" " :type dimensions: int\n" " :arg data: Optional data array.\n" - " :type data: sequence\n"); + " :type data: Buffer | Sequence[float] | Sequence[int]\n"); PyTypeObject BPyGPU_BufferType = { /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0) /*tp_name*/ "Buffer", diff --git a/source/blender/python/gpu/gpu_py_capabilities.cc b/source/blender/python/gpu/gpu_py_capabilities.cc index 61a2396d955..86289d06e9a 100644 --- a/source/blender/python/gpu/gpu_py_capabilities.cc +++ b/source/blender/python/gpu/gpu_py_capabilities.cc @@ -247,7 +247,7 @@ PyDoc_STRVAR( " Get supported extensions in the current context.\n" "\n" " :return: Extensions.\n" - " :rtype: tuple of string\n"); + " :rtype: tuple[str]\n"); static PyObject *pygpu_extensions_get(PyObject * /*self*/) { BPYGPU_IS_INIT_OR_ERROR_OBJ; diff --git a/source/blender/python/gpu/gpu_py_element.cc b/source/blender/python/gpu/gpu_py_element.cc index 6a81ac58069..0ebd8d769cb 100644 --- a/source/blender/python/gpu/gpu_py_element.cc +++ b/source/blender/python/gpu/gpu_py_element.cc @@ -189,7 +189,7 @@ PyDoc_STRVAR( " :arg seq: Indices this index buffer will contain.\n" " Whether a 1D or 2D sequence is required depends on the type.\n" " Optionally the sequence can support the buffer protocol.\n" - " :type seq: 1D or 2D sequence\n"); + " :type seq: Buffer | Sequence[int] | Sequence[Sequence[int]]\n"); PyTypeObject BPyGPUIndexBuf_Type = { /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0) /*tp_name*/ "GPUIndexBuf", diff --git a/source/blender/python/gpu/gpu_py_framebuffer.cc b/source/blender/python/gpu/gpu_py_framebuffer.cc index 3ed5e1c0e65..77832f2e2ef 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.cc +++ b/source/blender/python/gpu/gpu_py_framebuffer.cc @@ -413,8 +413,8 @@ PyDoc_STRVAR( " Fill color, depth and stencil textures with specific value.\n" " Common values: color=(0.0, 0.0, 0.0, 1.0), depth=1.0, stencil=0.\n" "\n" - " :arg color: float sequence each representing ``(r, g, b, a)``.\n" - " :type color: sequence of 3 or 4 floats\n" + " :arg color: Sequence of 3 or 4 floats representing ``(r, g, b, a)``.\n" + " :type color: Sequence[float]\n" " :arg depth: depth value.\n" " :type depth: float\n" " :arg stencil: stencil value.\n" @@ -774,6 +774,8 @@ static PyMethodDef pygpu_framebuffer__tp_methods[] = { # pragma GCC diagnostic pop #endif +/* Ideally type aliases would de-duplicate: `GPUTexture | dict[str, int | GPUTexture]` + * in this doc-string. */ PyDoc_STRVAR( /* Wrap. */ pygpu_framebuffer__tp_doc, @@ -786,10 +788,13 @@ PyDoc_STRVAR( "\n" " :arg depth_slot: GPUTexture to attach or a `dict` containing keywords: " "'texture', 'layer' and 'mip'.\n" - " :type depth_slot: :class:`gpu.types.GPUTexture`, dict or Nonetype\n" + " :type depth_slot: :class:`gpu.types.GPUTexture` | dict[] | None\n" " :arg color_slots: Tuple where each item can be a GPUTexture or a `dict` " "containing keywords: 'texture', 'layer' and 'mip'.\n" - " :type color_slots: tuple or Nonetype\n"); + " :type color_slots: :class:`gpu.types.GPUTexture` | " + "dict[str, int | :class:`gpu.types.GPUTexture`] | " + "Sequence[:class:`gpu.types.GPUTexture` | dict[str, int | :class:`gpu.types.GPUTexture`]] | " + "None\n"); PyTypeObject BPyGPUFrameBuffer_Type = { /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0) /*tp_name*/ "GPUFrameBuffer", diff --git a/source/blender/python/gpu/gpu_py_matrix.cc b/source/blender/python/gpu/gpu_py_matrix.cc index be01c92c621..3e34ee4114b 100644 --- a/source/blender/python/gpu/gpu_py_matrix.cc +++ b/source/blender/python/gpu/gpu_py_matrix.cc @@ -370,8 +370,8 @@ PyDoc_STRVAR( "\n" " Scale the current stack matrix.\n" "\n" - " :arg scale: Scale the current stack matrix.\n" - " :type scale: sequence of 2 or 3 floats\n"); + " :arg scale: Scale the current stack matrix with 2 or 3 floats.\n" + " :type scale: Sequence[float]\n"); static PyObject *pygpu_matrix_scale(PyObject * /*self*/, PyObject *value) { BPYGPU_IS_INIT_OR_ERROR_OBJ; @@ -419,8 +419,8 @@ PyDoc_STRVAR( "\n" " Scale the current stack matrix.\n" "\n" - " :arg offset: Translate the current stack matrix.\n" - " :type offset: sequence of 2 or 3 floats\n"); + " :arg offset: Translate the current stack matrix with 2 or 3 floats.\n" + " :type offset: Sequence[float]\n"); static PyObject *pygpu_matrix_translate(PyObject * /*self*/, PyObject *value) { float offset[3]; diff --git a/source/blender/python/gpu/gpu_py_offscreen.cc b/source/blender/python/gpu/gpu_py_offscreen.cc index b732633079b..db6cdf329c4 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.cc +++ b/source/blender/python/gpu/gpu_py_offscreen.cc @@ -322,7 +322,7 @@ PyDoc_STRVAR( pygpu_offscreen_width_doc, "Width of the texture.\n" "\n" - ":type: `int`"); + ":type: int"); static PyObject *pygpu_offscreen_width_get(BPyGPUOffScreen *self, void * /*type*/) { BPY_GPU_OFFSCREEN_CHECK_OBJ(self); @@ -334,7 +334,7 @@ PyDoc_STRVAR( pygpu_offscreen_height_doc, "Height of the texture.\n" "\n" - ":type: `int`"); + ":type: int"); static PyObject *pygpu_offscreen_height_get(BPyGPUOffScreen *self, void * /*type*/) { BPY_GPU_OFFSCREEN_CHECK_OBJ(self); @@ -346,7 +346,7 @@ PyDoc_STRVAR( pygpu_offscreen_color_texture_doc, "OpenGL bindcode for the color texture.\n" "\n" - ":type: `int`"); + ":type: int"); static PyObject *pygpu_offscreen_color_texture_get(BPyGPUOffScreen *self, void * /*type*/) { BPY_GPU_OFFSCREEN_CHECK_OBJ(self); diff --git a/source/blender/python/gpu/gpu_py_shader.cc b/source/blender/python/gpu/gpu_py_shader.cc index bf21a971f2a..ce0021e94df 100644 --- a/source/blender/python/gpu/gpu_py_shader.cc +++ b/source/blender/python/gpu/gpu_py_shader.cc @@ -261,7 +261,7 @@ PyDoc_STRVAR( " :arg location: Location of the uniform variable to be modified.\n" " :type location: int\n" " :arg buffer: The data that should be set. Can support the buffer protocol.\n" - " :type buffer: sequence of floats\n" + " :type buffer: Sequence[float]\n" " :arg length: Size of the uniform data type:\n" "\n" " - 1: float\n" @@ -331,7 +331,7 @@ PyDoc_STRVAR( " :arg name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg value: Value that will be used to update the specified uniform variable.\n" - " :type value: bool or sequence of bools\n"); + " :type value: bool | Sequence[bool]\n"); static PyObject *pygpu_shader_uniform_bool(BPyGPUShader *self, PyObject *args) { const char *error_prefix = "GPUShader.uniform_bool"; @@ -406,7 +406,7 @@ PyDoc_STRVAR( " :arg name: Name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg value: Value that will be used to update the specified uniform variable.\n" - " :type value: single number or sequence of floats\n"); + " :type value: float | Sequence[float]\n"); static PyObject *pygpu_shader_uniform_float(BPyGPUShader *self, PyObject *args) { const char *error_prefix = "GPUShader.uniform_float"; @@ -478,7 +478,7 @@ PyDoc_STRVAR( " :arg name: name of the uniform variable whose value is to be changed.\n" " :type name: str\n" " :arg seq: Value that will be used to update the specified uniform variable.\n" - " :type seq: sequence of ints\n"); + " :type seq: Sequence[int]\n"); static PyObject *pygpu_shader_uniform_int(BPyGPUShader *self, PyObject *args) { const char *error_prefix = "GPUShader.uniform_int"; @@ -689,7 +689,7 @@ PyDoc_STRVAR( " Information about the attributes used in the Shader.\n" "\n" " :return: tuples containing information about the attributes in order (name, type)\n" - " :rtype: tuple\n"); + " :rtype: tuple[tuple[str, str | None], ...]\n"); static PyObject *pygpu_shader_attrs_info_get(BPyGPUShader *self, PyObject * /*arg*/) { uint attr_len = GPU_shader_get_attribute_len(self->shader); diff --git a/source/blender/python/gpu/gpu_py_shader_create_info.cc b/source/blender/python/gpu/gpu_py_shader_create_info.cc index fd3e83e4330..f548194d46c 100644 --- a/source/blender/python/gpu/gpu_py_shader_create_info.cc +++ b/source/blender/python/gpu/gpu_py_shader_create_info.cc @@ -692,7 +692,7 @@ PyDoc_STRVAR( "read or written. Possible values are:\n" "" PYDOC_QUALIFIERS "" - " :type qualifiers: set\n"); + " :type qualifiers: set[str]\n"); static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds) @@ -891,9 +891,8 @@ PyDoc_STRVAR( " :type type: str\n" " :arg name: Name of the constant.\n" " :type name: str\n" - " :arg size: If not zero, indicates that the constant is an array with the " - "specified size.\n" - " :type size: uint\n"); + " :arg size: If not zero, indicates that the constant is an array with the specified size.\n" + " :type size: int\n"); static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/python/gpu/gpu_py_state.cc b/source/blender/python/gpu/gpu_py_state.cc index 0afe7333d44..47861bafa62 100644 --- a/source/blender/python/gpu/gpu_py_state.cc +++ b/source/blender/python/gpu/gpu_py_state.cc @@ -301,7 +301,7 @@ PyDoc_STRVAR( " (x, y, xsize, ysize).\n" " x, y: lower left corner of the scissor rectangle, in pixels.\n" " xsize, ysize: width and height of the scissor rectangle.\n" - " :rtype: tuple(int, int, int, int)\n"); + " :rtype: tuple[int, int, int, int]\n"); static PyObject *pygpu_state_scissor_get(PyObject * /*self*/, PyObject * /*args*/) { BPYGPU_IS_INIT_OR_ERROR_OBJ; diff --git a/source/blender/python/gpu/gpu_py_texture.cc b/source/blender/python/gpu/gpu_py_texture.cc index 55e533d4e16..7bbde330085 100644 --- a/source/blender/python/gpu/gpu_py_texture.cc +++ b/source/blender/python/gpu/gpu_py_texture.cc @@ -295,7 +295,7 @@ PyDoc_STRVAR( pygpu_texture_width_doc, "Width of the texture.\n" "\n" - ":type: `int`"); + ":type: int"); static PyObject *pygpu_texture_width_get(BPyGPUTexture *self, void * /*type*/) { BPYGPU_TEXTURE_CHECK_OBJ(self); @@ -307,7 +307,7 @@ PyDoc_STRVAR( pygpu_texture_height_doc, "Height of the texture.\n" "\n" - ":type: `int`"); + ":type: int"); static PyObject *pygpu_texture_height_get(BPyGPUTexture *self, void * /*type*/) { BPYGPU_TEXTURE_CHECK_OBJ(self); @@ -319,7 +319,7 @@ PyDoc_STRVAR( pygpu_texture_format_doc, "Format of the texture.\n" "\n" - ":type: `str`"); + ":type: str"); static PyObject *pygpu_texture_format_get(BPyGPUTexture *self, void * /*type*/) { BPYGPU_TEXTURE_CHECK_OBJ(self); @@ -337,8 +337,8 @@ PyDoc_STRVAR( " :arg format: The format that describes the content of a single item.\n" " Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n" " :type format: str\n" - " :arg value: sequence each representing the value to fill.\n" - " :type value: sequence of 1, 2, 3 or 4 values\n"); + " :arg value: Sequence each representing the value to fill. Sizes 1..4 are supported.\n" + " :type value: Sequence[float]\n"); static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObject *kwds) { BPYGPU_TEXTURE_CHECK_OBJ(self); @@ -540,7 +540,7 @@ PyDoc_STRVAR( " This object gives access to off GPU textures.\n" "\n" " :arg size: Dimensions of the texture 1D, 2D, 3D or cubemap.\n" - " :type size: tuple or int\n" + " :type size: int | Sequence[int]\n" " :arg layers: Number of layers in texture array or number of cubemaps in cubemap array\n" " :type layers: int\n" " :arg is_cubemap: Indicates the creation of a cubemap texture.\n" diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.cc b/source/blender/python/gpu/gpu_py_vertex_buffer.cc index 19af8e3e096..f4032a52a0b 100644 --- a/source/blender/python/gpu/gpu_py_vertex_buffer.cc +++ b/source/blender/python/gpu/gpu_py_vertex_buffer.cc @@ -270,9 +270,10 @@ PyDoc_STRVAR( " Insert data into the buffer for a single attribute.\n" "\n" " :arg id: Either the name or the id of the attribute.\n" - " :type id: int or str\n" - " :arg data: Sequence of data that should be stored in the buffer\n" - " :type data: sequence of floats, ints, vectors or matrices\n"); + " :type id: int | str\n" + " :arg data: Buffer or sequence of data that should be stored in the buffer\n" + " :type data: Buffer | " + "Sequence[float] | Sequence[int] | Sequence[Sequence[float]] | Sequence[Sequence[int]]\n"); static PyObject *pygpu_vertbuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds) { PyObject *data; diff --git a/source/blender/python/intern/bpy.cc b/source/blender/python/intern/bpy.cc index e96fea6623a..7d6a08f0094 100644 --- a/source/blender/python/intern/bpy.cc +++ b/source/blender/python/intern/bpy.cc @@ -69,7 +69,7 @@ PyDoc_STRVAR( " Return 2 paths to blender scripts directories.\n" "\n" " :return: (system, user) strings will be empty when not found.\n" - " :rtype: tuple of strings\n"); + " :rtype: tuple[str, str]\n"); static PyObject *bpy_script_paths(PyObject * /*self*/) { PyObject *ret = PyTuple_New(2); @@ -105,13 +105,13 @@ PyDoc_STRVAR( " Returns a list of paths to external files referenced by the loaded .blend file.\n" "\n" " :arg absolute: When true the paths returned are made absolute.\n" - " :type absolute: boolean\n" + " :type absolute: bool\n" " :arg packed: When true skip file paths for packed data.\n" - " :type packed: boolean\n" + " :type packed: bool\n" " :arg local: When true skip linked library paths.\n" - " :type local: boolean\n" + " :type local: bool\n" " :return: path list.\n" - " :rtype: list of strings\n"); + " :rtype: list[str]\n"); static PyObject *bpy_blend_paths(PyObject * /*self*/, PyObject *args, PyObject *kw) { eBPathForeachFlag flag = eBPathForeachFlag(0); @@ -176,11 +176,11 @@ PyDoc_STRVAR( " mirroring bone names.\n" "\n" " :arg name: Bone name to flip.\n" - " :type name: string\n" + " :type name: str\n" " :arg strip_digits: Whether to remove ``.###`` suffix.\n" " :type strip_digits: bool\n" " :return: The flipped name.\n" - " :rtype: string\n"); + " :rtype: str\n"); static PyObject *bpy_flip_name(PyObject * /*self*/, PyObject *args, PyObject *kw) { const char *name_src = nullptr; @@ -267,9 +267,9 @@ PyDoc_STRVAR( " Return a system resource path.\n" "\n" " :arg type: string in ['DATAFILES', 'SCRIPTS', 'EXTENSIONS', 'PYTHON'].\n" - " :type type: string\n" + " :type type: str\n" " :arg path: Optional subdirectory.\n" - " :type path: string or bytes\n"); + " :type path: str | bytes\n"); static PyObject *bpy_system_resource(PyObject * /*self*/, PyObject *args, PyObject *kw) { const PyC_StringEnumItems type_items[] = { @@ -318,13 +318,13 @@ PyDoc_STRVAR( " Return the base path for storing system files.\n" "\n" " :arg type: string in ['USER', 'LOCAL', 'SYSTEM'].\n" - " :type type: string\n" + " :type type: str\n" " :arg major: major version, defaults to current.\n" " :type major: int\n" " :arg minor: minor version, defaults to current.\n" - " :type minor: string\n" + " :type minor: str\n" " :return: the resource path (not necessarily existing).\n" - " :rtype: string\n"); + " :rtype: str\n"); static PyObject *bpy_resource_path(PyObject * /*self*/, PyObject *args, PyObject *kw) { const PyC_StringEnumItems type_items[] = { @@ -371,7 +371,7 @@ PyDoc_STRVAR( " :arg code: The code to test.\n" " :type code: code\n" " :arg namespace: The namespace of values which are allowed.\n" - " :type namespace: dict\n" + " :type namespace: dict[str, Any]\n" " :arg verbose: Print the reason for considering insecure to the ``stderr``.\n" " :type verbose: bool\n" " :return: True when the script is considered trusted.\n" @@ -415,9 +415,9 @@ PyDoc_STRVAR( " Simple string escaping function used for animation paths.\n" "\n" " :arg string: text\n" - " :type string: string\n" + " :type string: str\n" " :return: The escaped string.\n" - " :rtype: string\n"); + " :rtype: str\n"); static PyObject *bpy_escape_identifier(PyObject * /*self*/, PyObject *value) { Py_ssize_t value_str_len; @@ -455,9 +455,9 @@ PyDoc_STRVAR( " This performs the reverse of `escape_identifier`.\n" "\n" " :arg string: text\n" - " :type string: string\n" + " :type string: str\n" " :return: The un-escaped string.\n" - " :rtype: string\n"); + " :rtype: str\n"); static PyObject *bpy_unescape_identifier(PyObject * /*self*/, PyObject *value) { Py_ssize_t value_str_len; @@ -505,7 +505,7 @@ PyDoc_STRVAR( ".. function:: context_members()\n" "\n" " :return: A dict where the key is the context and the value is a tuple of it's members.\n" - " :rtype: dict\n"); + " :rtype: dict[str, tuple[str]]\n"); static PyObject *bpy_context_members(PyObject * /*self*/) { @@ -552,9 +552,8 @@ PyDoc_STRVAR( bpy_rna_enum_items_static_doc, ".. function:: rna_enum_items_static()\n" "\n" - " :return: A dict where the key the name of the enum, the value is a tuple of " - ":class:`bpy.types.EnumPropertyItem`.\n" - " :rtype: dict of \n"); + " :return: A dict where the key the name of the enum, the value is a tuple of enum items.\n" + " :rtype: dict[str, tuple[:class:`bpy.types.EnumPropertyItem`]]\n"); static PyObject *bpy_rna_enum_items_static(PyObject * /*self*/) { #define DEF_ENUM(id) {STRINGIFY(id), id}, @@ -588,7 +587,7 @@ PyDoc_STRVAR( ".. function:: _ghost_backend()\n" "\n" " :return: An identifier for the GHOST back-end.\n" - " :rtype: string\n"); + " :rtype: str\n"); static PyObject *bpy_ghost_backend(PyObject * /*self*/) { return PyUnicode_FromString(WM_ghost_backend()); @@ -607,7 +606,7 @@ PyDoc_STRVAR( ".. function:: _wm_capabilities()\n" "\n" " :return: A dictionary of capabilities (string keys, boolean values).\n" - " :rtype: dict\n"); + " :rtype: dict[str, bool]\n"); static PyObject *bpy_wm_capabilities(PyObject *self) { static _Py_Identifier PyId_capabilities = {"_wm_capabilities_", -1}; diff --git a/source/blender/python/intern/bpy_app_icons.cc b/source/blender/python/intern/bpy_app_icons.cc index d4983bf1cea..f1da38e2100 100644 --- a/source/blender/python/intern/bpy_app_icons.cc +++ b/source/blender/python/intern/bpy_app_icons.cc @@ -30,11 +30,11 @@ PyDoc_STRVAR( " Create a new icon from triangle geometry.\n" "\n" " :arg range: Pair of ints.\n" - " :type range: tuple.\n" + " :type range: tuple[int, int]\n" " :arg coords: Sequence of bytes (6 floats for one triangle) for (X, Y) coordinates.\n" - " :type coords: byte sequence.\n" - " :arg colors: Sequence of ints (12 for one triangles) for RGBA.\n" - " :type colors: byte sequence.\n" + " :type coords: bytes\n" + " :arg colors: Sequence of bytes (12 for one triangles) for RGBA.\n" + " :type colors: bytes\n" " :return: Unique icon value (pass to interface ``icon_value`` argument).\n" " :rtype: int\n"); static PyObject *bpy_app_icons_new_triangles(PyObject * /*self*/, PyObject *args, PyObject *kw) @@ -97,7 +97,7 @@ PyDoc_STRVAR( " Create a new icon from triangle geometry.\n" "\n" " :arg filepath: File path.\n" - " :type filepath: string or bytes.\n" + " :type filepath: str | bytes.\n" " :return: Unique icon value (pass to interface ``icon_value`` argument).\n" " :rtype: int\n"); static PyObject *bpy_app_icons_new_triangles_from_file(PyObject * /*self*/, diff --git a/source/blender/python/intern/bpy_app_timers.cc b/source/blender/python/intern/bpy_app_timers.cc index a8bbe9b53ed..656d063381c 100644 --- a/source/blender/python/intern/bpy_app_timers.cc +++ b/source/blender/python/intern/bpy_app_timers.cc @@ -81,7 +81,7 @@ PyDoc_STRVAR( " ``functools.partial`` can be used to assign some parameters.\n" "\n" " :arg function: The function that should called.\n" - " :type function: Callable[[], Union[float, None]]\n" + " :type function: Callable[[], float | None]\n" " :arg first_interval: Seconds until the callback should be called the first time.\n" " :type first_interval: float\n" " :arg persistent: Don't remove timer when a new file is loaded.\n" @@ -128,7 +128,7 @@ PyDoc_STRVAR( " Unregister timer.\n" "\n" " :arg function: Function to unregister.\n" - " :type function: Callable[[], Union[float, None]]\n"); + " :type function: Callable[[], float | None]\n"); static PyObject *bpy_app_timers_unregister(PyObject * /*self*/, PyObject *function) { if (!BLI_timer_unregister(intptr_t(function))) { @@ -146,7 +146,7 @@ PyDoc_STRVAR( " Check if this function is registered as a timer.\n" "\n" " :arg function: Function to check.\n" - " :type function: Callable[[], Union[float, None]]\n" + " :type function: Callable[[], float | None]\n" " :return: True when this function is registered, otherwise False.\n" " :rtype: bool\n"); static PyObject *bpy_app_timers_is_registered(PyObject * /*self*/, PyObject *function) diff --git a/source/blender/python/intern/bpy_app_translations.cc b/source/blender/python/intern/bpy_app_translations.cc index 1a2ceacf9f7..ee028169d2b 100644 --- a/source/blender/python/intern/bpy_app_translations.cc +++ b/source/blender/python/intern/bpy_app_translations.cc @@ -308,10 +308,10 @@ PyDoc_STRVAR( " Does nothing when Blender is built without internationalization support.\n" "\n" " :arg module_name: The name identifying the addon.\n" - " :type module_name: string\n" + " :type module_name: str\n" " :arg translations_dict: A dictionary built like that:\n" " ``{locale: {msg_key: msg_translation, ...}, ...}``\n" - " :type translations_dict: dict\n" + " :type translations_dict: dict[str, dict[str, str]]\n" "\n"); static PyObject *app_translations_py_messages_register(BlenderAppTranslations *self, PyObject *args, @@ -367,7 +367,7 @@ PyDoc_STRVAR( " Does nothing when Blender is built without internationalization support.\n" "\n" " :arg module_name: The name identifying the addon.\n" - " :type module_name: string\n" + " :type module_name: str\n" "\n"); static PyObject *app_translations_py_messages_unregister(BlenderAppTranslations *self, PyObject *args, @@ -602,9 +602,9 @@ PyDoc_STRVAR( "returns ``msgid``).\n" "\n" " :arg msgid: The string to translate.\n" - " :type msgid: string\n" + " :type msgid: str\n" " :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n" - " :type msgctxt: string or None\n" + " :type msgctxt: str | None\n" " :return: The translated string (or msgid if no translation was found).\n" "\n"); static PyObject *app_translations_pgettext(BlenderAppTranslations * /*self*/, @@ -624,9 +624,9 @@ PyDoc_STRVAR(app_translations_pgettext_n_doc, " See :func:`pgettext` notes.\n" "\n" " :arg msgid: The string to extract.\n" - " :type msgid: string\n" + " :type msgid: str\n" " :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n" - " :type msgctxt: string or None\n" + " :type msgctxt: str | None\n" " :return: The original string.\n" "\n"); static PyObject *app_translations_pgettext_n(BlenderAppTranslations * /*self*/, @@ -658,9 +658,9 @@ PyDoc_STRVAR( " See :func:`pgettext` notes.\n" "\n" " :arg msgid: The string to translate.\n" - " :type msgid: string\n" + " :type msgid: str\n" " :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n" - " :type msgctxt: string or None\n" + " :type msgctxt: str | None\n" " :return: The translated string (or msgid if no translation was found).\n" "\n"); static PyObject *app_translations_pgettext_iface(BlenderAppTranslations * /*self*/, @@ -682,9 +682,9 @@ PyDoc_STRVAR( " See :func:`pgettext` notes.\n" "\n" " :arg msgid: The string to translate.\n" - " :type msgid: string\n" + " :type msgid: str\n" " :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n" - " :type msgctxt: string or None\n" + " :type msgctxt: str | None\n" " :return: The translated string (or msgid if no translation was found).\n" "\n"); static PyObject *app_translations_pgettext_tip(BlenderAppTranslations * /*self*/, @@ -706,9 +706,9 @@ PyDoc_STRVAR( " See :func:`pgettext` notes.\n" "\n" " :arg msgid: The string to translate.\n" - " :type msgid: string\n" + " :type msgid: str\n" " :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n" - " :type msgctxt: string or None\n" + " :type msgctxt: str | None\n" " :return: The translated string (or msgid if no translation was found).\n" "\n"); static PyObject *app_translations_pgettext_rpt(BlenderAppTranslations * /*self*/, @@ -730,9 +730,9 @@ PyDoc_STRVAR( " See :func:`pgettext` notes.\n" "\n" " :arg msgid: The string to translate.\n" - " :type msgid: string\n" + " :type msgid: str\n" " :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n" - " :type msgctxt: string or None\n" + " :type msgctxt: str | None\n" " :return: The translated string (or ``msgid`` if no translation was found).\n" "\n"); static PyObject *app_translations_pgettext_data(BlenderAppTranslations * /*self*/, @@ -755,7 +755,7 @@ PyDoc_STRVAR( " For non-complete locales, missing elements will be None.\n" "\n" " :arg locale: The ISO locale string to explode.\n" - " :type msgid: string\n" + " :type msgid: str\n" " :return: A tuple ``(language, country, variant, language_country, language@variant)``.\n" "\n"); static PyObject *app_translations_locale_explode(BlenderAppTranslations * /*self*/, diff --git a/source/blender/python/intern/bpy_library_load.cc b/source/blender/python/intern/bpy_library_load.cc index 1850923a607..cac972de528 100644 --- a/source/blender/python/intern/bpy_library_load.cc +++ b/source/blender/python/intern/bpy_library_load.cc @@ -166,7 +166,7 @@ PyDoc_STRVAR( " Each object has attributes matching bpy.data which are lists of strings to be linked.\n" "\n" " :arg filepath: The path to a blend file.\n" - " :type filepath: string or bytes\n" + " :type filepath: str | bytes\n" " :arg link: When False reference to the original file is lost.\n" " :type link: bool\n" " :arg relative: When True the path is stored relative to the open blend file.\n" diff --git a/source/blender/python/intern/bpy_library_write.cc b/source/blender/python/intern/bpy_library_write.cc index d1c0b32ac07..b6308a3c02d 100644 --- a/source/blender/python/intern/bpy_library_write.cc +++ b/source/blender/python/intern/bpy_library_write.cc @@ -49,9 +49,9 @@ PyDoc_STRVAR( " Indirectly referenced data-blocks will be expanded and written too.\n" "\n" " :arg filepath: The path to write the blend-file.\n" - " :type filepath: string or bytes\n" - " :arg datablocks: set of data-blocks (:class:`bpy.types.ID` instances).\n" - " :type datablocks: set\n" + " :type filepath: str | bytes\n" + " :arg datablocks: set of data-blocks.\n" + " :type datablocks: set[:class:`bpy.types.ID`]\n" " :arg path_remap: Optionally remap paths when writing the file:\n" "\n" " - ``NONE`` No path manipulation (default).\n" @@ -59,7 +59,7 @@ PyDoc_STRVAR( " - ``RELATIVE_ALL`` Remap all paths to be relative to the new location.\n" " - ``ABSOLUTE`` Make all paths absolute on writing.\n" "\n" - " :type path_remap: string\n" + " :type path_remap: str\n" " :arg fake_user: When True, data-blocks will be written with fake-user flag enabled.\n" " :type fake_user: bool\n" " :arg compress: When True, write a compressed blend file.\n" diff --git a/source/blender/python/intern/bpy_msgbus.cc b/source/blender/python/intern/bpy_msgbus.cc index 46a4986c729..dfab20a2de7 100644 --- a/source/blender/python/intern/bpy_msgbus.cc +++ b/source/blender/python/intern/bpy_msgbus.cc @@ -37,10 +37,12 @@ " :arg key: Represents the type of data being subscribed to\n" \ "\n" \ " Arguments include\n" \ - " - :class:`bpy.types.Property` instance.\n" \ - " - :class:`bpy.types.Struct` type.\n" \ - " - (:class:`bpy.types.Struct`, str) type and property name.\n" \ - " :type key: Multiple\n" + " - A property instance.\n" \ + " - A struct type.\n" \ + " - A tuple representing a (struct, property name) pair.\n" \ + " :type key: :class:`bpy.types.Property` | " \ + ":class:`bpy.types.Struct` | " \ + "tuple[:class:`bpy.types.Struct`, str]\n" /** * There are multiple ways we can get RNA from Python, @@ -198,12 +200,12 @@ PyDoc_STRVAR( " loaded, or can be cleared explicitly via :func:`bpy.msgbus.clear_by_owner`.\n" "\n" BPY_MSGBUS_RNA_MSGKEY_DOC " :arg owner: Handle for this subscription (compared by identity).\n" - " :type owner: Any type.\n" + " :type owner: Any\n" " :arg options: Change the behavior of the subscriber.\n" "\n" " - ``PERSISTENT`` when set, the subscriber will be kept when remapping ID data.\n" "\n" - " :type options: set of str.\n" + " :type options: set[str]\n" "\n" ".. note::\n" "\n" diff --git a/source/blender/python/intern/bpy_props.cc b/source/blender/python/intern/bpy_props.cc index da8fb4b1e2f..6307cbce26a 100644 --- a/source/blender/python/intern/bpy_props.cc +++ b/source/blender/python/intern/bpy_props.cc @@ -53,31 +53,31 @@ using blender::Array; #define BPY_PROPDEF_OPTIONS_DOC \ " :arg options: Enumerator in :ref:`rna_enum_property_flag_items`.\n" \ - " :type options: set\n" + " :type options: set[str]\n" #define BPY_PROPDEF_OPTIONS_ENUM_DOC \ " :arg options: Enumerator in :ref:`rna_enum_property_flag_enum_items`.\n" \ - " :type options: set\n" + " :type options: set[str]\n" #define BPY_PROPDEF_OPTIONS_OVERRIDE_DOC \ " :arg override: Enumerator in :ref:`rna_enum_property_override_flag_items`.\n" \ - " :type override: set\n" + " :type override: set[str]\n" #define BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC \ " :arg override: Enumerator in :ref:`rna_enum_property_override_flag_collection_items`.\n" \ - " :type override: set\n" + " :type override: set[str]\n" #define BPY_PROPDEF_SUBTYPE_STRING_DOC \ " :arg subtype: Enumerator in :ref:`rna_enum_property_subtype_string_items`.\n" \ - " :type subtype: string\n" + " :type subtype: str\n" #define BPY_PROPDEF_SUBTYPE_NUMBER_DOC \ " :arg subtype: Enumerator in :ref:`rna_enum_property_subtype_number_items`.\n" \ - " :type subtype: string\n" + " :type subtype: str\n" #define BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC \ " :arg subtype: Enumerator in :ref:`rna_enum_property_subtype_number_array_items`.\n" \ - " :type subtype: string\n" + " :type subtype: str\n" /** \} */ @@ -2648,40 +2648,49 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p) #define BPY_PROPDEF_NAME_DOC \ " :arg name: Name used in the user interface.\n" \ - " :type name: string\n" + " :type name: str\n" #define BPY_PROPDEF_DESC_DOC \ " :arg description: Text used for the tooltip and api documentation.\n" \ - " :type description: string\n" + " :type description: str\n" #define BPY_PROPDEF_CTXT_DOC \ " :arg translation_context: Text used as context to disambiguate translations.\n" \ - " :type translation_context: string\n" + " :type translation_context: str\n" #define BPY_PROPDEF_UNIT_DOC \ " :arg unit: Enumerator in :ref:`rna_enum_property_unit_items`.\n" \ - " :type unit: string\n" + " :type unit: str\n" -#define BPY_PROPDEF_NUM_MIN_DOC \ +#define BPY_PROPDEF_NUM_MIN_DOC_(ty) \ " :arg min: Hard minimum, trying to assign a value below will silently assign this minimum " \ - "instead.\n" + "instead.\n" \ + " :type min: " ty "\n" -#define BPY_PROPDEF_NUM_MAX_DOC \ +#define BPY_PROPDEF_NUM_MAX_DOC_(ty) \ " :arg max: Hard maximum, trying to assign a value above will silently assign this maximum " \ - "instead.\n" + "instead.\n" \ + " :type max: " ty "\n" -#define BPY_PROPDEF_NUM_SOFTMIN_DOC \ - " :arg soft_min: Soft minimum (>= *min*), user won't be able to drag the widget below this " \ - "value in the UI.\n" +#define BPY_PROPDEF_NUM_MINMAX_DOC(ty) BPY_PROPDEF_NUM_MIN_DOC_(ty) BPY_PROPDEF_NUM_MAX_DOC_(ty) -#define BPY_PROPDEF_NUM_SOFTMAX_DOC \ - " :arg soft_max: Soft maximum (<= *max*), user won't be able to drag the widget above this " \ - "value in the UI.\n" +#define BPY_PROPDEF_NUM_SOFT_MIN_DOC_(ty) \ + " :arg soft_min: Soft minimum (>= *min*), " \ + "user won't be able to drag the widget below this value in the UI.\n" \ + " :type soft_min: " ty "\n" + +#define BPY_PROPDEF_NUM_SOFT_MAX_DOC_(ty) \ + " :arg soft_max: Soft maximum (<= *max*), " \ + "user won't be able to drag the widget above this value in the UI.\n" \ + " :type soft_max: " ty "\n" + +#define BPY_PROPDEF_NUM_SOFT_MINMAX_DOC(ty) \ + BPY_PROPDEF_NUM_SOFT_MIN_DOC_(ty) BPY_PROPDEF_NUM_SOFT_MAX_DOC_(ty) #define BPY_PROPDEF_VECSIZE_DOC \ " :arg size: Vector dimensions in [1, " STRINGIFY(PYRNA_STACK_ARRAY) "]. " \ "An int sequence can be used to define multi-dimension arrays.\n" \ -" :type size: int or int sequence\n" +" :type size: int | Sequence[int]\n" #define BPY_PROPDEF_INT_STEP_DOC \ " :arg step: Step of increment/decrement in UI, in [1, 100], defaults to 1 (WARNING: unused " \ @@ -2703,23 +2712,25 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p) " :arg update: Function to be called when this value is modified,\n" \ " This function must take 2 values (self, context) and return None.\n" \ " *Warning* there are no safety checks to avoid infinite recursion.\n" \ - " :type update: function\n" + " :type update: Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.Context`], " \ + "None]\n" #define BPY_PROPDEF_POLL_DOC \ " :arg poll: function to be called to determine whether an item is valid for this " \ "property.\n" \ " The function must take 2 values (self, object) and return Bool.\n" \ - " :type poll: function\n" + " :type poll: Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.bpy_struct`], " \ + "bool]\n" -#define BPY_PROPDEF_GET_DOC \ +#define BPY_PROPDEF_GET_DOC(ty) \ " :arg get: Function to be called when this value is 'read',\n" \ " This function must take 1 value (self) and return the value of the property.\n" \ - " :type get: function\n" + " :type get: Callable[[:class:`bpy.types.bpy_struct`], " ty "]\n" -#define BPY_PROPDEF_SET_DOC \ +#define BPY_PROPDEF_SET_DOC(ty) \ " :arg set: Function to be called when this value is 'written',\n" \ " This function must take 2 values (self, value) and return None.\n" \ - " :type set: function\n" + " :type set: Callable[[:class:`bpy.types.bpy_struct`, " ty "], None]\n" #define BPY_PROPDEF_SEARCH_DOC \ " :arg search: Function to be called to show candidates for this string (shown in the UI).\n" \ @@ -2729,7 +2740,9 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p) " - A single string (representing a candidate to display).\n" \ " - A tuple-pair of strings, where the first is a candidate and the second\n" \ " is additional information about the candidate.\n" \ - " :type search: function\n" \ + " :type search: Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.Context`, str], " \ + "Iterable[str | tuple[str, str]]" \ + "]\n" \ " :arg search_options: Set of strings in:\n" \ "\n" \ " - 'SORT' sorts the resulting items.\n" \ @@ -2737,19 +2750,19 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p) " **WARNING** disabling this flag causes the search callback to run on redraw,\n" \ " so only disable this flag if it's not likely to cause performance issues.\n" \ "\n" \ - " :type search_options: set\n" + " :type search_options: set[str]\n" #define BPY_PROPDEF_POINTER_TYPE_DOC \ - " :arg type: A subclass of :class:`bpy.types.PropertyGroup` or :class:`bpy.types.ID`.\n" \ - " :type type: class\n" + " :arg type: A subclass of a property group or ID types.\n" \ + " :type type: :class:`bpy.types.PropertyGroup` | :class:`bpy.types.ID`\n" #define BPY_PROPDEF_COLLECTION_TYPE_DOC \ - " :arg type: A subclass of :class:`bpy.types.PropertyGroup`.\n" \ - " :type type: class\n" + " :arg type: A subclass of a property group.\n" \ + " :type type: :class:`bpy.types.PropertyGroup`\n" #define BPY_PROPDEF_TAGS_DOC \ " :arg tags: Enumerator of tags that are defined by parent class.\n" \ - " :type tags: set\n" + " :type tags: set[str]\n" #if 0 static int bpy_struct_id_used(StructRNA *srna, char *identifier) @@ -2790,7 +2803,7 @@ PyDoc_STRVAR( " Returns a new boolean property definition.\n" "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC - BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("bool") BPY_PROPDEF_SET_DOC("bool")); static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -2943,9 +2956,10 @@ PyDoc_STRVAR( " Returns a new vector boolean property definition.\n" "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: sequence of booleans the length of *size*.\n" - " :type default: sequence\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC + " :type default: Sequence[bool]\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC - BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("Sequence[bool]") + BPY_PROPDEF_SET_DOC("tuple[bool]")); static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3131,12 +3145,11 @@ PyDoc_STRVAR( "set=None)\n" "\n" " Returns a new int property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_NUM_MIN_DOC - " :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC - " :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC - " :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC - BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC - BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC + BPY_PROPDEF_NUM_MINMAX_DOC("int") BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("int") + BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC + BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UPDATE_DOC + BPY_PROPDEF_GET_DOC("int") BPY_PROPDEF_SET_DOC("int")); static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3311,13 +3324,12 @@ PyDoc_STRVAR( " Returns a new vector int property definition.\n" "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: sequence of ints the length of *size*.\n" - " :type default: sequence\n" BPY_PROPDEF_NUM_MIN_DOC - " :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC - " :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC - " :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC - BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC - BPY_PROPDEF_VECSIZE_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC - BPY_PROPDEF_SET_DOC); + " :type default: Sequence[int]\n" BPY_PROPDEF_NUM_MINMAX_DOC("int") + BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("int") + BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC + BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC + BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("Sequence[int]") + BPY_PROPDEF_SET_DOC("tuple[int]")); static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3510,14 +3522,12 @@ PyDoc_STRVAR( "set=None)\n" "\n" " Returns a new float (single precision) property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_NUM_MIN_DOC - " :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC - " :type max: float\n" BPY_PROPDEF_NUM_SOFTMIN_DOC - " :type soft_min: float\n" BPY_PROPDEF_NUM_SOFTMAX_DOC - " :type soft_max: float\n" BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC - BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC - BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_UPDATE_DOC - BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_NUM_MINMAX_DOC( + "float") BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("float") + BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC BPY_PROPDEF_OPTIONS_DOC + BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC + BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("float") + BPY_PROPDEF_SET_DOC("float")); static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3691,15 +3701,14 @@ PyDoc_STRVAR( "\n" " Returns a new vector float property definition.\n" "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC - " :arg default: sequence of floats the length of *size*.\n" - " :type default: sequence\n" BPY_PROPDEF_NUM_MIN_DOC - " :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC - " :type max: float\n" BPY_PROPDEF_NUM_SOFTMIN_DOC - " :type soft_min: float\n" BPY_PROPDEF_NUM_SOFTMAX_DOC - " :type soft_max: float\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC - BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC - BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_VECSIZE_DOC - BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + " :arg default: Sequence of floats the length of *size*.\n" + " :type default: Sequence[float]\n" BPY_PROPDEF_NUM_MINMAX_DOC( + "float") BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("float") + BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC + BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC + BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_VECSIZE_DOC + BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("Sequence[float]") + BPY_PROPDEF_SET_DOC("tuple[float]")); static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3907,11 +3916,11 @@ PyDoc_STRVAR( " Returns a new string property definition.\n" "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: initializer string.\n" - " :type default: string\n" + " :type default: str\n" " :arg maxlen: maximum length of the string.\n" " :type maxlen: int\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_STRING_DOC BPY_PROPDEF_UPDATE_DOC - BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC BPY_PROPDEF_SEARCH_DOC); + BPY_PROPDEF_GET_DOC("str") BPY_PROPDEF_SET_DOC("str") BPY_PROPDEF_SEARCH_DOC); static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -4115,17 +4124,28 @@ PyDoc_STRVAR( " Python must keep a reference to the strings returned by the callback or Blender\n" " will misbehave or even crash." "\n" - " :type items: sequence of string tuples or a function\n" BPY_PROPDEF_NAME_DOC - BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC + " :type items: Sequence[" + "tuple[str, str, str] | " + "tuple[str, str, str, int] | " + "tuple[str, str, str, int, int] | " + "None] | " + "Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.Context` | None], " + /* NOTE(@ideasman42): a type alias would be useful here (same as above). */ + "Sequence[" + "tuple[str, str, str] | " + "tuple[str, str, str, int] | " + "tuple[str, str, str, int, int] | " + "None]" + "]\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: The default value for this enum, a string from the identifiers used in " "*items*, or integer matching an item number.\n" " If the *ENUM_FLAG* option is used this must be a set of such string identifiers " "instead.\n" " WARNING: Strings cannot be specified for dynamic enums\n" " (i.e. if a callback function is given as *items* parameter).\n" - " :type default: string, integer or set\n" BPY_PROPDEF_OPTIONS_ENUM_DOC + " :type default: str | int | set[str]\n" BPY_PROPDEF_OPTIONS_ENUM_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_UPDATE_DOC - BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + BPY_PROPDEF_GET_DOC("int") BPY_PROPDEF_SET_DOC("int")); static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -4640,7 +4660,7 @@ PyDoc_STRVAR( " :arg cls: The class containing the property (must be a positional argument).\n" " :type cls: type\n" " :arg attr: Property name (must be passed as a keyword).\n" - " :type attr: string\n" + " :type attr: str\n" "\n" ".. note:: Typically this function doesn't need to be accessed directly.\n" " Instead use ``del cls.attr``\n"); diff --git a/source/blender/python/intern/bpy_rna.cc b/source/blender/python/intern/bpy_rna.cc index f8143710cc7..bc6866ee8f4 100644 --- a/source/blender/python/intern/bpy_rna.cc +++ b/source/blender/python/intern/bpy_rna.cc @@ -3645,9 +3645,9 @@ PyDoc_STRVAR( "\n" " In rare cases you may want to set this option to false.\n" "\n" - " :type ghost: boolean\n" + " :type ghost: bool\n" " :return: True when the property has been set.\n" - " :rtype: boolean\n"); + " :rtype: bool\n"); static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *args, PyObject *kw) { PropertyRNA *prop; @@ -3719,7 +3719,7 @@ PyDoc_STRVAR( " Check if a property is hidden.\n" "\n" " :return: True when the property is hidden.\n" - " :rtype: boolean\n"); + " :rtype: bool\n"); static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *args) { PropertyRNA *prop; @@ -3750,7 +3750,7 @@ PyDoc_STRVAR( " Check if a property is readonly.\n" "\n" " :return: True when the property is readonly (not writable).\n" - " :rtype: boolean\n"); + " :rtype: bool\n"); static PyObject *pyrna_struct_is_property_readonly(BPy_StructRNA *self, PyObject *args) { PropertyRNA *prop; @@ -3781,7 +3781,7 @@ PyDoc_STRVAR( " Check if a property is overridable.\n" "\n" " :return: True when the property is overridable.\n" - " :rtype: boolean\n"); + " :rtype: bool\n"); static PyObject *pyrna_struct_is_property_overridable_library(BPy_StructRNA *self, PyObject *args) { PropertyRNA *prop; @@ -3812,7 +3812,7 @@ PyDoc_STRVAR( " Define a property as overridable or not (only for custom properties!).\n" "\n" " :return: True when the overridable status of the property was successfully set.\n" - " :rtype: boolean\n"); + " :rtype: bool\n"); static PyObject *pyrna_struct_property_overridable_library_set(BPy_StructRNA *self, PyObject *args) { PropertyRNA *prop; @@ -3845,10 +3845,10 @@ PyDoc_STRVAR( " Returns the property from the path, raise an exception when not found.\n" "\n" " :arg path: path which this property resolves.\n" - " :type path: string\n" + " :type path: str\n" " :arg coerce: optional argument, when True, the property will be converted\n" " into its Python representation.\n" - " :type coerce: boolean\n"); + " :type coerce: bool\n"); static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args) { const char *path; @@ -3903,7 +3903,7 @@ PyDoc_STRVAR( "\n" " :arg property: Optional property name which can be used if the path is\n" " to a property of this object.\n" - " :type property: string\n" + " :type property: str\n" " :return: The path from :class:`bpy.types.bpy_struct.id_data`\n" " to this struct and property (when given).\n" " :rtype: str\n"); @@ -4046,7 +4046,7 @@ PyDoc_STRVAR( " such as textures can be changed at runtime.\n" "\n" " :return: a new instance of this object with the type initialized again.\n" - " :rtype: subclass of :class:`bpy.types.bpy_struct`\n"); + " :rtype: :class:`bpy.types.bpy_struct`\n"); static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { @@ -4099,7 +4099,7 @@ PyDoc_STRVAR( ".. classmethod:: bl_rna_get_subclass_py(id, default=None)\n" "\n" " :arg id: The RNA type identifier.\n" - " :type id: string\n" + " :type id: str\n" " :return: The class or default when not found.\n" " :rtype: type\n"); static PyObject *pyrna_struct_bl_rna_get_subclass_py(PyObject *cls, PyObject *args) @@ -4123,7 +4123,7 @@ PyDoc_STRVAR( ".. classmethod:: bl_rna_get_subclass(id, default=None)\n" "\n" " :arg id: The RNA type identifier.\n" - " :type id: string\n" + " :type id: str\n" " :return: The RNA type or default when not found.\n" " :rtype: :class:`bpy.types.Struct` subclass\n"); static PyObject *pyrna_struct_bl_rna_get_subclass(PyObject *cls, PyObject *args) @@ -5043,7 +5043,7 @@ PyDoc_STRVAR( " (matching Python's dict.keys() functionality).\n" "\n" " :return: the identifiers for each member of this collection.\n" - " :rtype: list of strings\n"); + " :rtype: list[str]\n"); static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self) { PyObject *ret = PyList_New(0); @@ -5075,7 +5075,7 @@ PyDoc_STRVAR( " (matching Python's dict.items() functionality).\n" "\n" " :return: (key, value) pairs for each member of this collection.\n" - " :rtype: list of tuples\n"); + " :rtype: list[tuple[str, :class:`bpy.types.bpy_struct`]]\n"); static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self) { PyObject *ret = PyList_New(0); @@ -5119,8 +5119,8 @@ PyDoc_STRVAR( " Return the values of collection\n" " (matching Python's dict.values() functionality).\n" "\n" - " :return: the members of this collection.\n" - " :rtype: list\n"); + " :return: The members of this collection.\n" + " :rtype: list[:class:`bpy.types.bpy_struct`]\n"); static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self) { /* Re-use slice. */ @@ -5136,10 +5136,10 @@ PyDoc_STRVAR( " when not found (matches Python's dictionary function of the same name).\n" "\n" " :arg key: The key associated with the custom property.\n" - " :type key: string\n" + " :type key: str\n" " :arg default: Optional argument for the value to return if\n" " *key* is not found.\n" - " :type default: Undefined\n" + " :type default: Any\n" "\n" BPY_DOC_ID_PROP_TYPE_NOTE); static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args) { @@ -5181,10 +5181,10 @@ PyDoc_STRVAR( " when not found (matches Python's dictionary function of the same name).\n" "\n" " :arg key: The key associated with the custom property.\n" - " :type key: string\n" + " :type key: str\n" " :arg default: Optional argument for the value to return if\n" " *key* is not found.\n" - " :type default: Undefined\n" + " :type default: Any\n" "\n" BPY_DOC_ID_PROP_TYPE_NOTE); static PyObject *pyrna_struct_pop(BPy_StructRNA *self, PyObject *args) { @@ -5254,10 +5254,10 @@ PyDoc_STRVAR( " (matches Python's dictionary function of the same name).\n" "\n" " :arg key: The identifier for the collection member.\n" - " :type key: string\n" + " :type key: str\n" " :arg default: Optional argument for the value to return if\n" " *key* is not found.\n" - " :type default: Undefined\n"); + " :type default: Any\n"); static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args) { PointerRNA newptr; @@ -5308,7 +5308,7 @@ PyDoc_STRVAR( " (matches Python's string find function of the same name).\n" "\n" " :arg key: The identifier for the collection member.\n" - " :type key: string\n" + " :type key: str\n" " :return: index of the key.\n" " :rtype: int\n"); static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key_ob) @@ -9142,7 +9142,7 @@ PyDoc_STRVAR( " :class:`bpy.types.Operator`, :class:`bpy.types.KeyingSetInfo`,\n" " :class:`bpy.types.RenderEngine`, :class:`bpy.types.AssetShelf`,\n" " :class:`bpy.types.FileHandler`\n" - " :type cls: class\n" + " :type cls: type\n" " :raises ValueError:\n" " if the class is not a subclass of a registerable blender class.\n" "\n" @@ -9327,7 +9327,7 @@ PyDoc_STRVAR( " :arg cls: Blender type class, \n" " see :mod:`bpy.utils.register_class` for classes which can \n" " be registered.\n" - " :type cls: class\n" + " :type cls: type\n" "\n" " .. note::\n" "\n" diff --git a/source/blender/python/intern/bpy_rna_anim.cc b/source/blender/python/intern/bpy_rna_anim.cc index 0fabc4f7f00..5de3de536a2 100644 --- a/source/blender/python/intern/bpy_rna_anim.cc +++ b/source/blender/python/intern/bpy_rna_anim.cc @@ -296,7 +296,7 @@ char pyrna_struct_keyframe_insert_doc[] = "necessary.\n" "\n" " :arg data_path: path to the property to key, analogous to the fcurve's data path.\n" - " :type data_path: string\n" + " :type data_path: str\n" " :arg index: array index of the property to key.\n" " Defaults to -1 which will key all indices or a single channel if the property is not " "an array.\n" @@ -319,12 +319,12 @@ char pyrna_struct_keyframe_insert_doc[] = " - ``INSERTKEY_AVAILABLE`` Only insert into already existing F-Curves.\n" " - ``INSERTKEY_CYCLE_AWARE`` Take cyclic extrapolation into account " "(Cycle-Aware Keying option).\n" - " :type options: set\n" + " :type options: set[str]\n" " :arg keytype: Type of the key: 'KEYFRAME', 'BREAKDOWN', 'MOVING_HOLD', 'EXTREME', " "'JITTER', or 'GENERATED'\n" - " :type keytype: string\n" + " :type keytype: str\n" " :return: Success of keyframe insertion.\n" - " :rtype: boolean\n"; + " :rtype: bool\n"; PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw) { using namespace blender::animrig; @@ -455,7 +455,7 @@ char pyrna_struct_keyframe_delete_doc[] = "\n" " :arg data_path: path to the property to remove a key, analogous to the fcurve's data " "path.\n" - " :type data_path: string\n" + " :type data_path: str\n" " :arg index: array index of the property to remove a key. Defaults to -1 removing all " "indices or a single channel if the property is not an array.\n" " :type index: int\n" @@ -465,7 +465,7 @@ char pyrna_struct_keyframe_delete_doc[] = "yet.\n" " :type group: str\n" " :return: Success of keyframe deletion.\n" - " :rtype: boolean\n"; + " :rtype: bool\n"; PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw) { /* args, pyrna_struct_keyframe_parse handles these */ @@ -575,12 +575,12 @@ char pyrna_struct_driver_add_doc[] = " Adds driver(s) to the given property\n" "\n" " :arg path: path to the property to drive, analogous to the fcurve's data path.\n" - " :type path: string\n" + " :type path: str\n" " :arg index: array index of the property drive. Defaults to -1 for all indices or a single " "channel if the property is not an array.\n" " :type index: int\n" - " :return: The driver(s) added.\n" - " :rtype: :class:`bpy.types.FCurve` or list if index is -1 with an array property.\n"; + " :return: The driver added or a list of drivers when index is -1.\n" + " :rtype: :class:`bpy.types.FCurve` | list[:class:`bpy.types.FCurve`]\n"; PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) { const char *path, *path_full; @@ -659,12 +659,12 @@ char pyrna_struct_driver_remove_doc[] = " Remove driver(s) from the given property\n" "\n" " :arg path: path to the property to drive, analogous to the fcurve's data path.\n" - " :type path: string\n" + " :type path: str\n" " :arg index: array index of the property drive. Defaults to -1 for all indices or a single " "channel if the property is not an array.\n" " :type index: int\n" " :return: Success of driver removal.\n" - " :rtype: boolean\n"; + " :rtype: bool\n"; PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args) { const char *path, *path_full; diff --git a/source/blender/python/intern/bpy_rna_context.cc b/source/blender/python/intern/bpy_rna_context.cc index 683e6bb8db4..28ee6d70913 100644 --- a/source/blender/python/intern/bpy_rna_context.cc +++ b/source/blender/python/intern/bpy_rna_context.cc @@ -567,6 +567,8 @@ static PyObject *bpy_context_temp_override_extract_known_args(const char *const return kwds_parse; } +/* NOTE(@ideasman42): `ContextTempOverride` isn't accessible from (without creating an instance), + * it should be exposed although it doesn't seem especially important either. */ PyDoc_STRVAR( /* Wrap. */ bpy_context_temp_override_doc, @@ -593,7 +595,7 @@ PyDoc_STRVAR( " :type region: :class:`bpy.types.Region`\n" " :arg keywords: Additional keywords override context members.\n" " :return: The context manager .\n" - " :rtype: context manager\n"); + " :rtype: ContextTempOverride\n"); static PyObject *bpy_context_temp_override(PyObject *self, PyObject *args, PyObject *kwds) { const PointerRNA *context_ptr = pyrna_struct_as_ptr(self, &RNA_Context); diff --git a/source/blender/python/intern/bpy_rna_data.cc b/source/blender/python/intern/bpy_rna_data.cc index 359b83f76d4..e8b8df7b317 100644 --- a/source/blender/python/intern/bpy_rna_data.cc +++ b/source/blender/python/intern/bpy_rna_data.cc @@ -135,7 +135,7 @@ PyDoc_STRVAR( "\n" " :arg filepath: The file path for the newly temporary data. " "When None, the path of the currently open file is used.\n" - " :type filepath: str, bytes or NoneType\n" + " :type filepath: str | bytes | None\n" "\n" " :return: Blend file data which is freed once the context exists.\n" " :rtype: :class:`bpy.types.BlendData`\n"); diff --git a/source/blender/python/intern/bpy_rna_gizmo.cc b/source/blender/python/intern/bpy_rna_gizmo.cc index 09d05e03ace..af7f798bc47 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.cc +++ b/source/blender/python/intern/bpy_rna_gizmo.cc @@ -322,12 +322,13 @@ PyDoc_STRVAR( " Assigns callbacks to a gizmos property.\n" "\n" " :arg target: Target property name.\n" - " :type target: string\n" + " :type target: str\n" " :arg get: Function that returns the value for this property (single value or sequence).\n" - " :type get: callable\n" + " :type get: Callable[[], float | Sequence[float]]\n" " :arg set: Function that takes a single value argument and applies it.\n" - " :type set: callable\n" - " :arg range: Function that returns a (min, max) tuple for gizmos that use a range.\n" + " :type set: Callable[[tuple[float, ...]], Any]\n" + " :arg range: Function that returns a (min, max) tuple for gizmos that use a range. " + "The returned value is not used.\n" " :type range: callable\n"); static PyObject *bpy_gizmo_target_set_handler(PyObject * /*self*/, PyObject *args, PyObject *kw) { @@ -439,9 +440,9 @@ PyDoc_STRVAR( " Get the value of this target property.\n" "\n" " :arg target: Target property name.\n" - " :type target: string\n" - " :return: The value of the target property.\n" - " :rtype: Single value or array based on the target type\n"); + " :type target: str\n" + " :return: The value of the target property as a value or array based on the target type.\n" + " :rtype: float | tuple[float, ...]\n"); static PyObject *bpy_gizmo_target_get_value(PyObject * /*self*/, PyObject *args, PyObject *kw) { struct { @@ -510,7 +511,7 @@ PyDoc_STRVAR( " Set the value of this target property.\n" "\n" " :arg target: Target property name.\n" - " :type target: string\n"); + " :type target: str\n"); static PyObject *bpy_gizmo_target_set_value(PyObject * /*self*/, PyObject *args, PyObject *kw) { struct { @@ -598,7 +599,7 @@ PyDoc_STRVAR( "\n" " :arg target: Target property name.\n" " :return: The range of this property (min, max).\n" - " :rtype: tuple pair.\n"); + " :rtype: tuple[float, float]\n"); static PyObject *bpy_gizmo_target_get_range(PyObject * /*self*/, PyObject *args, PyObject *kw) { struct { diff --git a/source/blender/python/intern/bpy_rna_id_collection.cc b/source/blender/python/intern/bpy_rna_id_collection.cc index 0be1862ecc3..82508bc25c0 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.cc +++ b/source/blender/python/intern/bpy_rna_id_collection.cc @@ -119,21 +119,20 @@ PyDoc_STRVAR( ".. method:: user_map(subset, key_types, value_types)\n" "\n" " Returns a mapping of all ID data-blocks in current ``bpy.data`` to a set of all " - "datablocks using them.\n" + "data-blocks using them.\n" "\n" " For list of valid set members for key_types & value_types, see: " ":class:`bpy.types.KeyingSetPath.id_type`.\n" "\n" " :arg subset: When passed, only these data-blocks and their users will be " "included as keys/values in the map.\n" - " :type subset: sequence\n" + " :type subset: Sequence[:class:`bpy.types.ID`]\n" " :arg key_types: Filter the keys mapped by ID types.\n" - " :type key_types: set of strings\n" + " :type key_types: set[str]\n" " :arg value_types: Filter the values in the set by ID types.\n" - " :type value_types: set of strings\n" - " :return: dictionary of :class:`bpy.types.ID` instances, with sets of ID's as " - "their values.\n" - " :rtype: dict\n"); + " :type value_types: set[str]\n" + " :return: dictionary that maps data-blocks ID's to their users.\n" + " :rtype: dict[:class:`bpy.types.ID`, set[:class:`bpy.types.ID`]]\n"); static PyObject *bpy_user_map(PyObject * /*self*/, PyObject *args, PyObject *kwds) { #if 0 /* If someone knows how to get a proper 'self' in that case... */ @@ -287,8 +286,8 @@ PyDoc_STRVAR( " ID collections), but less safe/versatile (it can break Blender, e.g. by removing " "all scenes...).\n" "\n" - " :arg ids: Iterables of IDs (types can be mixed).\n" - " :type subset: sequence\n"); + " :arg ids: Sequence of IDs (types can be mixed).\n" + " :type ids: Sequence[:class:`bpy.types.ID`]\n"); static PyObject *bpy_batch_remove(PyObject * /*self*/, PyObject *args, PyObject *kwds) { #if 0 /* If someone knows how to get a proper 'self' in that case... */ diff --git a/source/blender/python/intern/bpy_rna_operator.cc b/source/blender/python/intern/bpy_rna_operator.cc index eda7ee287af..513de046770 100644 --- a/source/blender/python/intern/bpy_rna_operator.cc +++ b/source/blender/python/intern/bpy_rna_operator.cc @@ -95,7 +95,7 @@ PyDoc_STRVAR( "additional user defined positional arguments are passed to the message function.\n" "\n" " :arg message: The message or a function that returns the message.\n" - " :type message: string or a callable that returns a string or None.\n"); + " :type message: str | Callable[[Any, ...], str | None]\n"); static PyObject *BPY_rna_operator_poll_message_set(PyObject * /*self*/, PyObject *args) { diff --git a/source/blender/python/intern/bpy_rna_text.cc b/source/blender/python/intern/bpy_rna_text.cc index 4f9fbf8b8f7..3ff45a99f8e 100644 --- a/source/blender/python/intern/bpy_rna_text.cc +++ b/source/blender/python/intern/bpy_rna_text.cc @@ -54,7 +54,7 @@ PyDoc_STRVAR( "((start_line, start_column), (end_line, end_column))\n" " The values match Python's slicing logic " "(negative values count backwards from the end, the end value is not inclusive).\n" - " :type range: Two pairs of ints\n" + " :type range: tuple[tuple[int, int], tuple[int, int]]\n" " :return: The specified region as a string.\n" " :rtype: str.\n"); /* Receive a Python Tuple as parameter to represent the region range. */ @@ -124,7 +124,7 @@ PyDoc_STRVAR( "((start_line, start_column), (end_line, end_column))\n" " The values match Python's slicing logic " "(negative values count backwards from the end, the end value is not inclusive).\n" - " :type range: Two pairs of ints\n"); + " :type range: tuple[tuple[int, int], tuple[int, int]]\n"); static PyObject *bpy_rna_region_from_string(PyObject *self, PyObject *args, PyObject *kwds) { BPy_StructRNA *pyrna = (BPy_StructRNA *)self; diff --git a/source/blender/python/intern/bpy_rna_types_capi.cc b/source/blender/python/intern/bpy_rna_types_capi.cc index 34644f272cf..063c0d0f4ca 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.cc +++ b/source/blender/python/intern/bpy_rna_types_capi.cc @@ -113,7 +113,7 @@ PyDoc_STRVAR( pyrna_WindowManager_clipboard_doc, "Clipboard text storage.\n" "\n" - ":type: string"); + ":type: str"); static PyObject *pyrna_WindowManager_clipboard_get(PyObject * /*self*/, void * /*flag*/) { int text_len = 0; @@ -158,9 +158,9 @@ PyDoc_STRVAR( " A function that will be called when the cursor is drawn.\n" " It gets the specified arguments as input with the mouse position (tuple) as last " "argument.\n" - " :type callback: function\n" + " :type callback: Callable[[Any, ..., tuple[int, int]], Any]\n" " :arg args: Arguments that will be passed to the callback.\n" - " :type args: tuple\n" + " :type args: tuple[Any, ...]\n" " :arg space_type: The space type the callback draws in; for example ``VIEW_3D``. " "(:class:`bpy.types.Space.type`)\n" " :type space_type: str\n" @@ -229,10 +229,10 @@ PyDoc_STRVAR( "\n" " :arg callback:\n" " A function that will be called when the region is drawn.\n" - " It gets the specified arguments as input.\n" - " :type callback: function\n" + " It gets the specified arguments as input, it's return value is ignored.\n" + " :type callback: Callable[[Any, ...], Any]\n" " :arg args: Arguments that will be passed to the callback.\n" - " :type args: tuple\n" + " :type args: tuple[Any, ...]\n" " :arg region_type: The region type the callback draws in; usually ``WINDOW``. " "(:class:`bpy.types.Region.type`)\n" " :type region_type: str\n" diff --git a/source/blender/python/intern/bpy_utils_previews.cc b/source/blender/python/intern/bpy_utils_previews.cc index bfef4bf26c6..5fad943a03e 100644 --- a/source/blender/python/intern/bpy_utils_previews.cc +++ b/source/blender/python/intern/bpy_utils_previews.cc @@ -40,7 +40,7 @@ PyDoc_STRVAR( " Generate a new empty preview.\n" "\n" " :arg name: The name (unique id) identifying the preview.\n" - " :type name: string\n" + " :type name: str\n" " :return: The Preview matching given name, or a new empty one.\n" " :rtype: :class:`bpy.types.ImagePreview`\n" /* This is only true when accessed via 'bpy.utils.previews.ImagePreviewCollection.load', @@ -69,12 +69,12 @@ PyDoc_STRVAR( " Generate a new preview from given file path.\n" "\n" " :arg name: The name (unique id) identifying the preview.\n" - " :type name: string\n" + " :type name: str\n" " :arg filepath: The file path to generate the preview from.\n" - " :type filepath: string or bytes\n" + " :type filepath: str | bytes\n" " :arg filetype: The type of file, needed to generate the preview in [" STR_SOURCE_TYPES "].\n" - " :type filetype: string\n" + " :type filetype: str\n" " :arg force_reload: If True, force running thumbnail manager even if preview already " "exists in cache.\n" " :type force_reload: bool\n" @@ -137,7 +137,7 @@ PyDoc_STRVAR( "\n" "\n" " :arg name: The name (unique id) identifying the preview.\n" - " :type name: string\n"); + " :type name: str\n"); static PyObject *bpy_utils_previews_release(PyObject * /*self*/, PyObject *args) { char *name; diff --git a/source/blender/python/intern/bpy_utils_units.cc b/source/blender/python/intern/bpy_utils_units.cc index 68eb19e46c2..6258c74a284 100644 --- a/source/blender/python/intern/bpy_utils_units.cc +++ b/source/blender/python/intern/bpy_utils_units.cc @@ -151,16 +151,16 @@ PyDoc_STRVAR( " Convert a given input string into a float value.\n" "\n" " :arg unit_system: The unit system, from :attr:`bpy.utils.units.systems`.\n" - " :type unit_system: string\n" + " :type unit_system: str\n" " :arg unit_category: The category of data we are converting (length, area, rotation, " "etc.),\n" " from :attr:`bpy.utils.units.categories`.\n" - " :type unit_category: string\n" + " :type unit_category: str\n" " :arg str_input: The string to convert to a float value.\n" - " :type str_input: string\n" + " :type str_input: str\n" " :arg str_ref_unit: A reference string from which to extract a default unit, if none is " "found in ``str_input``.\n" - " :type str_ref_unit: string or None\n" + " :type str_ref_unit: str | None\n" " :return: The converted/interpreted value.\n" " :rtype: float\n" " :raises ValueError: if conversion fails to generate a valid Python float value.\n"); @@ -236,11 +236,11 @@ PyDoc_STRVAR( " Convert a given input float value into a string with units.\n" "\n" " :arg unit_system: The unit system, from :attr:`bpy.utils.units.systems`.\n" - " :type unit_system: string\n" + " :type unit_system: str\n" " :arg unit_category: The category of data we are converting (length, area, " "rotation, etc.),\n" " from :attr:`bpy.utils.units.categories`.\n" - " :type unit_category: string\n" + " :type unit_category: str\n" " :arg value: The value to convert to a string.\n" " :type value: float\n" " :arg precision: Number of digits after the comma.\n" diff --git a/source/blender/python/mathutils/mathutils.cc b/source/blender/python/mathutils/mathutils.cc index f9f1c5a8ac7..fca69d6a7eb 100644 --- a/source/blender/python/mathutils/mathutils.cc +++ b/source/blender/python/mathutils/mathutils.cc @@ -623,21 +623,20 @@ PyObject *BaseMathObject_owner_get(BaseMathObject *self, void * /*closure*/) } char BaseMathObject_is_wrapped_doc[] = - "True when this object wraps external data (read-only).\n\n:type: boolean"; + "True when this object wraps external data (read-only).\n\n:type: bool"; PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void * /*closure*/) { return PyBool_FromLong((self->flag & BASE_MATH_FLAG_IS_WRAP) != 0); } char BaseMathObject_is_frozen_doc[] = - "True when this object has been frozen (read-only).\n\n:type: boolean"; + "True when this object has been frozen (read-only).\n\n:type: bool"; PyObject *BaseMathObject_is_frozen_get(BaseMathObject *self, void * /*closure*/) { return PyBool_FromLong((self->flag & BASE_MATH_FLAG_IS_FROZEN) != 0); } -char BaseMathObject_is_valid_doc[] = - "True when the owner of this data is valid.\n\n:type: boolean"; +char BaseMathObject_is_valid_doc[] = "True when the owner of this data is valid.\n\n:type: bool"; PyObject *BaseMathObject_is_valid_get(BaseMathObject *self, void * /*closure*/) { return PyBool_FromLong(BaseMath_CheckCallback(self) == 0); diff --git a/source/blender/python/mathutils/mathutils_Color.cc b/source/blender/python/mathutils/mathutils_Color.cc index 45c4980d79c..9d57f2dd436 100644 --- a/source/blender/python/mathutils/mathutils_Color.cc +++ b/source/blender/python/mathutils/mathutils_Color.cc @@ -1200,8 +1200,8 @@ PyDoc_STRVAR( " the OpenColorIO configuration. The notable exception is user interface theming colors, " " which are in sRGB color space.\n" "\n" - " :arg rgb: (r, g, b) color values\n" - " :type rgb: 3d vector\n"); + " :arg rgb: (red, green, blue) color values where (0, 0, 0) is black & (1, 1, 1) is white.\n" + " :type rgb: Sequence[float]\n"); PyTypeObject color_Type = { /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0) /*tp_name*/ "Color", diff --git a/source/blender/python/mathutils/mathutils_Euler.cc b/source/blender/python/mathutils/mathutils_Euler.cc index 6e6b4c8e256..131f7172135 100644 --- a/source/blender/python/mathutils/mathutils_Euler.cc +++ b/source/blender/python/mathutils/mathutils_Euler.cc @@ -214,7 +214,7 @@ PyDoc_STRVAR( " (no 720 degree pitches).\n" "\n" " :arg axis: single character in ['X, 'Y', 'Z'].\n" - " :type axis: string\n" + " :type axis: str\n" " :arg angle: angle in radians.\n" " :type angle: float\n"); static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args) @@ -255,7 +255,7 @@ PyDoc_STRVAR( " Rotates the euler by another mathutils value.\n" "\n" " :arg other: rotation component of mathutils value\n" - " :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"); + " :type other: :class:`Euler` | :class:`Quaternion` | :class:`Matrix`\n"); static PyObject *Euler_rotate(EulerObject *self, PyObject *value) { float self_rmat[3][3], other_rmat[3][3], rmat[3][3]; @@ -707,7 +707,7 @@ PyDoc_STRVAR( Euler_order_doc, "Euler rotation order.\n" "\n" - ":type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']"); + ":type: str in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']"); static PyObject *Euler_order_get(EulerObject *self, void * /*closure*/) { if (BaseMath_ReadCallback(self) == -1) { @@ -823,8 +823,8 @@ PyDoc_STRVAR( "\n" " .. seealso:: `Euler angles `__ on Wikipedia.\n" "\n" - " :arg angles: Three angles, in radians.\n" - " :type angles: 3d vector\n" + " :arg angles: (X, Y, Z) angles in radians.\n" + " :type angles: Sequence[float]\n" " :arg order: Optional order of the angles, a permutation of ``XYZ``.\n" " :type order: str\n"); PyTypeObject euler_Type = { diff --git a/source/blender/python/mathutils/mathutils_Matrix.cc b/source/blender/python/mathutils/mathutils_Matrix.cc index 292acfde086..296b6816c03 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.cc +++ b/source/blender/python/mathutils/mathutils_Matrix.cc @@ -692,7 +692,7 @@ PyDoc_STRVAR( " :type size: int\n" " :arg axis: a string in ['X', 'Y', 'Z'] or a 3D Vector Object\n" " (optional when size is 2).\n" - " :type axis: string or :class:`Vector`\n" + " :type axis: str | :class:`Vector`\n" " :return: A new rotation matrix.\n" " :rtype: :class:`Matrix`\n"); static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) @@ -928,7 +928,7 @@ PyDoc_STRVAR( " :arg axis: Can be any of the following: ['X', 'Y', 'XY', 'XZ', 'YZ'],\n" " where a single axis is for a 2D matrix.\n" " Or a vector for an arbitrary axis\n" - " :type axis: string or :class:`Vector`\n" + " :type axis: str | :class:`Vector`\n" " :arg size: The size of the projection matrix to construct [2, 4].\n" " :type size: int\n" " :return: A new projection matrix.\n" @@ -1049,12 +1049,13 @@ PyDoc_STRVAR( "\n" " :arg plane: Can be any of the following: ['X', 'Y', 'XY', 'XZ', 'YZ'],\n" " where a single axis is for a 2D matrix only.\n" - " :type plane: string\n" + " :type plane: str\n" " :arg size: The size of the shear matrix to construct [2, 4].\n" " :type size: int\n" - " :arg factor: The factor of shear to apply. For a 3 or 4 *size* matrix\n" - " pass a pair of floats corresponding with the *plane* axis.\n" - " :type factor: float or float pair\n" + " :arg factor: The factor of shear to apply. " + "For a 2 *size* matrix use a single float. " + "For a 3 or 4 *size* matrix pass a pair of floats corresponding with the *plane* axis.\n" + " :type factor: float | Sequence[float]\n" " :return: A new shear matrix.\n" " :rtype: :class:`Matrix`\n"); static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) @@ -1152,13 +1153,14 @@ PyDoc_STRVAR( " Any of the inputs may be replaced with None if not needed.\n" "\n" " :arg location: The translation component.\n" - " :type location: :class:`Vector` or None\n" - " :arg rotation: The rotation component.\n" - " :type rotation: 3x3 :class:`Matrix`, :class:`Quaternion`, :class:`Euler` or None\n" + " :type location: :class:`Vector` | None\n" + " :arg rotation: The rotation component as a " + "3x3 matrix, quaternion, euler or None for no rotation.\n" + " :type rotation: :class:`Matrix` | :class:`Quaternion` | :class:`Euler` | None\n" " :arg scale: The scale component.\n" - " :type scale: :class:`Vector` or None\n" - " :return: Combined transformation matrix. \n" - " :rtype: 4x4 :class:`Matrix`\n"); + " :type scale: :class:`Vector` | None\n" + " :return: Combined transformation as a 4x4 matrix. \n" + " :rtype: :class:`Matrix`\n"); static PyObject *C_Matrix_LocRotScale(PyObject *cls, PyObject *args) { PyObject *loc_obj, *rot_obj, *scale_obj; @@ -1297,7 +1299,7 @@ PyDoc_STRVAR( "\n" " :arg order: Optional rotation order argument in\n" " ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'].\n" - " :type order: string\n" + " :type order: str\n" " :arg euler_compat: Optional euler argument the new euler will be made\n" " compatible with (no axis flipping between them).\n" " Useful for converting a series of matrices to animation curves.\n" @@ -1695,9 +1697,9 @@ PyDoc_STRVAR( "\n" " :arg fallback: return this when the inverse can't be calculated\n" " (instead of raising a :exc:`ValueError`).\n" - " :type fallback: any\n" - " :return: the inverted matrix or fallback when given.\n" - " :rtype: :class:`Matrix`\n"); + " :type fallback: Any\n" + " :return: The inverted matrix or fallback when given.\n" + " :rtype: :class:`Matrix` | Any\n"); static PyObject *Matrix_inverted(MatrixObject *self, PyObject *args) { float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM]; @@ -1877,7 +1879,7 @@ PyDoc_STRVAR( " Rotates the matrix by another mathutils value.\n" "\n" " :arg other: rotation component of mathutils value\n" - " :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n" + " :type other: :class:`Euler` | :class:`Quaternion` | :class:`Matrix`\n" "\n" " .. note:: If any of the columns are not unit length this may not have desired results.\n"); static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value) @@ -1921,8 +1923,8 @@ PyDoc_STRVAR( "\n" " Return the translation, rotation, and scale components of this matrix.\n" "\n" - " :return: tuple of translation, rotation, and scale\n" - " :rtype: (:class:`Vector`, :class:`Quaternion`, :class:`Vector`)"); + " :return: Tuple of translation, rotation, and scale.\n" + " :rtype: tuple[:class:`Vector`, :class:`Quaternion`, :class:`Vector`]"); static PyObject *Matrix_decompose(MatrixObject *self) { PyObject *ret; @@ -3107,7 +3109,7 @@ PyDoc_STRVAR( Matrix_translation_doc, "The translation component of the matrix.\n" "\n" - ":type: Vector"); + ":type: :class:`Vector`"); static PyObject *Matrix_translation_get(MatrixObject *self, void * /*closure*/) { PyObject *ret; @@ -3457,7 +3459,7 @@ PyDoc_STRVAR( " matrices from 2x2 up to 4x4.\n" "\n" " :arg rows: Sequence of rows. When omitted, a 4x4 identity matrix is constructed.\n" - " :type rows: 2d number sequence\n"); + " :type rows: Sequence[Sequence[float]]\n"); PyTypeObject matrix_Type = { /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0) /*tp_name*/ "Matrix", diff --git a/source/blender/python/mathutils/mathutils_Quaternion.cc b/source/blender/python/mathutils/mathutils_Quaternion.cc index 4142e716323..462e099a722 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.cc +++ b/source/blender/python/mathutils/mathutils_Quaternion.cc @@ -173,7 +173,7 @@ PyDoc_STRVAR( "\n" " :arg order: Optional rotation order argument in\n" " ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'].\n" - " :type order: string\n" + " :type order: str\n" " :arg euler_compat: Optional euler argument the new euler will be made\n" " compatible with (no axis flipping between them).\n" " Useful for converting a series of matrices to animation curves.\n" @@ -270,8 +270,8 @@ PyDoc_STRVAR( "\n" " Return the axis, angle representation of the quaternion.\n" "\n" - " :return: axis, angle.\n" - " :rtype: (:class:`Vector`, float) pair\n"); + " :return: Axis, angle.\n" + " :rtype: tuple[:class:`Vector`, float]\n"); static PyObject *Quaternion_to_axis_angle(QuaternionObject *self) { PyObject *ret; @@ -309,9 +309,10 @@ PyDoc_STRVAR( " Split the rotation into a swing quaternion with the specified\n" " axis fixed at zero, and the remaining twist rotation angle.\n" "\n" - " :arg axis: twist axis as a string in ['X', 'Y', 'Z']\n" - " :return: swing, twist angle.\n" - " :rtype: (:class:`Quaternion`, float) pair\n"); + " :arg axis: Twist axis as a string in ['X', 'Y', 'Z'].\n" + " :type axis: str\n" + " :return: Swing, twist angle.\n" + " :rtype: tuple[:class:`Quaternion`, float]\n"); static PyObject *Quaternion_to_swing_twist(QuaternionObject *self, PyObject *axis_arg) { PyObject *ret; @@ -556,7 +557,7 @@ PyDoc_STRVAR( " Rotates the quaternion by another mathutils value.\n" "\n" " :arg other: rotation component of mathutils value\n" - " :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"); + " :type other: :class:`Euler` | :class:`Quaternion` | :class:`Matrix`\n"); static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value) { float self_rmat[3][3], other_rmat[3][3], rmat[3][3]; diff --git a/source/blender/python/mathutils/mathutils_Vector.cc b/source/blender/python/mathutils/mathutils_Vector.cc index dc1a3a948bb..0680ffaa2dc 100644 --- a/source/blender/python/mathutils/mathutils_Vector.cc +++ b/source/blender/python/mathutils/mathutils_Vector.cc @@ -764,7 +764,7 @@ PyDoc_STRVAR( " :arg precision: The number to round the value to in [-1, 21].\n" " :type precision: int\n" " :return: the values of the vector rounded by *precision*\n" - " :rtype: tuple\n"); + " :rtype: tuple[float]\n"); static PyObject *Vector_to_tuple(VectorObject *self, PyObject *args) { int ndigits = 0; @@ -805,9 +805,9 @@ PyDoc_STRVAR( " Return a quaternion rotation from the vector and the track and up axis.\n" "\n" " :arg track: Track axis in ['X', 'Y', 'Z', '-X', '-Y', '-Z'].\n" - " :type track: string\n" + " :type track: str\n" " :arg up: Up axis in ['X', 'Y', 'Z'].\n" - " :type up: string\n" + " :type up: str\n" " :return: rotation from the vector and the track and up axis.\n" " :rtype: :class:`Quaternion`\n"); static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) @@ -1031,8 +1031,8 @@ PyDoc_STRVAR( "\n" " :arg other: The other vector to perform the cross product with.\n" " :type other: :class:`Vector`\n" - " :return: The cross product.\n" - " :rtype: :class:`Vector` or float when 2D vectors are used\n" + " :return: The cross product as a vector or a float when 2D vectors are used.\n" + " :rtype: :class:`Vector` | float\n" "\n" " .. note:: both vectors must be 2D or 3D\n"); static PyObject *Vector_cross(VectorObject *self, PyObject *value) @@ -1121,9 +1121,9 @@ PyDoc_STRVAR( " :type other: :class:`Vector`\n" " :arg fallback: return this when the angle can't be calculated (zero length vector),\n" " (instead of raising a :exc:`ValueError`).\n" - " :type fallback: any\n" + " :type fallback: Any\n" " :return: angle in radians or fallback when given\n" - " :rtype: float\n"); + " :rtype: float | Any\n"); static PyObject *Vector_angle(VectorObject *self, PyObject *args) { const int vec_num = std::min(self->vec_num, 3); /* 4D angle makes no sense */ @@ -1194,9 +1194,9 @@ PyDoc_STRVAR( " :type other: :class:`Vector`\n" " :arg fallback: return this when the angle can't be calculated (zero length vector),\n" " (instead of raising a :exc:`ValueError`).\n" - " :type fallback: any\n" + " :type fallback: Any\n" " :return: angle in radians or fallback when given\n" - " :rtype: float\n"); + " :rtype: float | Any\n"); static PyObject *Vector_angle_signed(VectorObject *self, PyObject *args) { float tvec[2]; @@ -1400,7 +1400,7 @@ PyDoc_STRVAR( " :arg fallback: return this when the vector can't be calculated (zero length " "vector or direct opposites),\n" " (instead of raising a :exc:`ValueError`).\n" - " :type fallback: any\n" + " :type fallback: Any\n" " :return: The interpolated vector.\n" " :rtype: :class:`Vector`\n"); static PyObject *Vector_slerp(VectorObject *self, PyObject *args) @@ -1491,7 +1491,7 @@ PyDoc_STRVAR( " .. note:: 2D vectors are a special case that can only be rotated by a 2x2 matrix.\n" "\n" " :arg other: rotation component of mathutils value\n" - " :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"); + " :type other: :class:`Euler` | :class:`Quaternion` | :class:`Matrix`\n"); static PyObject *Vector_rotate(VectorObject *self, PyObject *value) { if (BaseMath_ReadCallback_ForWrite(self) == -1) { @@ -3405,8 +3405,8 @@ PyDoc_STRVAR( "\n" " This object gives access to Vectors in Blender.\n" "\n" - " :arg seq: Components of the vector, must be a sequence of at least two\n" - " :type seq: sequence of floats\n"); + " :arg seq: Components of the vector, must be a sequence of at least two.\n" + " :type seq: Sequence[float]\n"); PyTypeObject vector_Type = { /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0) /*tp_name*/ "Vector", diff --git a/source/blender/python/mathutils/mathutils_bvhtree.cc b/source/blender/python/mathutils/mathutils_bvhtree.cc index 0ed4112856c..a19e68df618 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.cc +++ b/source/blender/python/mathutils/mathutils_bvhtree.cc @@ -58,15 +58,13 @@ " :type distance: float\n" #define PYBVH_FIND_GENERIC_RETURN_DOC \ - " :return: Returns a tuple\n" \ - " (:class:`Vector` location, :class:`Vector` normal, int index, float distance),\n" \ + " :return: Returns a tuple: (position, normal, index, distance),\n" \ " Values will all be None if no hit is found.\n" \ - " :rtype: :class:`tuple`\n" + " :rtype: tuple[:class:`Vector` | None, :class:`Vector` | None, int | None, float | None]\n" #define PYBVH_FIND_GENERIC_RETURN_LIST_DOC \ - " :return: Returns a list of tuples\n" \ - " (:class:`Vector` location, :class:`Vector` normal, int index, float distance),\n" \ - " :rtype: :class:`list`\n" + " :return: Returns a list of tuples (position, normal, index, distance)\n" \ + " :rtype: list[tuple[:class:`Vector`, :class:`Vector`, int, float]]\n" #define PYBVH_FROM_GENERIC_EPSILON_DOC \ " :arg epsilon: Increase the threshold for detecting overlap and raycast hits.\n" \ @@ -559,7 +557,7 @@ PyDoc_STRVAR( " :type other_tree: :class:`BVHTree`\n" " :return: Returns a list of unique index pairs," " the first index referencing this tree, the second referencing the **other_tree**.\n" - " :rtype: :class:`list`\n"); + " :rtype: list[tuple[int, int]]\n"); static PyObject *py_bvhtree_overlap(PyBVHTree *self, PyBVHTree *other) { PyBVHTree_OverlapData data; @@ -642,9 +640,9 @@ PyDoc_STRVAR( " BVH tree constructed geometry passed in as arguments.\n" "\n" " :arg vertices: float triplets each representing ``(x, y, z)``\n" - " :type vertices: float triplet sequence\n" + " :type vertices: Sequence[Sequence[float]]\n" " :arg polygons: Sequence of polygons, each containing indices to the vertices argument.\n" - " :type polygons: Sequence of sequences containing ints\n" + " :type polygons: Sequence[Sequence[int]]\n" " :arg all_triangles: Use when all **polygons** are triangles for more efficient " "conversion.\n" " :type all_triangles: bool\n" PYBVH_FROM_GENERIC_EPSILON_DOC); diff --git a/source/blender/python/mathutils/mathutils_geometry.cc b/source/blender/python/mathutils/mathutils_geometry.cc index 4cd949680b1..31b40a17ca4 100644 --- a/source/blender/python/mathutils/mathutils_geometry.cc +++ b/source/blender/python/mathutils/mathutils_geometry.cc @@ -57,9 +57,9 @@ PyDoc_STRVAR( " :type orig: :class:`mathutils.Vector`\n" " :arg clip: When False, don't restrict the intersection to the area of the " "triangle, use the infinite plane defined by the triangle.\n" - " :type clip: boolean\n" + " :type clip: bool\n" " :return: The point of intersection or None if no intersection is found\n" - " :rtype: :class:`mathutils.Vector` or None\n"); + " :rtype: :class:`mathutils.Vector` | None\n"); static PyObject *M_Geometry_intersect_ray_tri(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_ray_tri"; @@ -165,7 +165,7 @@ PyDoc_STRVAR( " :arg v4: Second point of the second line\n" " :type v4: :class:`mathutils.Vector`\n" " :return: The intersection on each line or None when the lines are co-linear.\n" - " :rtype: tuple of :class:`mathutils.Vector`'s\n"); + " :rtype: tuple[:class:`mathutils.Vector`, :class:`mathutils.Vector`] | None\n"); static PyObject *M_Geometry_intersect_line_line(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_line_line"; @@ -244,7 +244,8 @@ PyDoc_STRVAR( " :arg radius_b: Radius of the second circle\n" " :type radius_b: float\n" " :return: 2 points on between intersecting circles or None when there is no intersection.\n" - " :rtype: tuple of :class:`mathutils.Vector`'s or None when there is no intersection\n"); + " :rtype: tuple[:class:`mathutils.Vector`, :class:`mathutils.Vector`] | tuple[None, " + "None]\n"); static PyObject *M_Geometry_intersect_sphere_sphere_2d(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_sphere_sphere_2d"; @@ -350,8 +351,8 @@ PyDoc_STRVAR( "\n" " Returns the normal of a 3D polygon.\n" "\n" - " :arg vectors: Vectors to calculate normals with\n" - " :type vectors: sequence of 3 or more 3d vector\n" + " :arg vectors: 3 or more vectors to calculate normals.\n" + " :type vectors: Sequence[Sequence[float]]\n" " :rtype: :class:`mathutils.Vector`\n"); static PyObject *M_Geometry_normal(PyObject * /*self*/, PyObject *args) { @@ -476,7 +477,7 @@ PyDoc_STRVAR( " :arg lineB_p2: Second point of the second line\n" " :type lineB_p2: :class:`mathutils.Vector`\n" " :return: The point of intersection or None when not found\n" - " :rtype: :class:`mathutils.Vector` or None\n"); + " :rtype: :class:`mathutils.Vector` | None\n"); static PyObject *M_Geometry_intersect_line_line_2d(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_line_line_2d"; @@ -519,7 +520,7 @@ PyDoc_STRVAR( " :arg plane_no: The direction the plane is facing\n" " :type plane_no: :class:`mathutils.Vector`\n" " :return: The point of intersection or None when not found\n" - " :rtype: :class:`mathutils.Vector` or None\n"); + " :rtype: :class:`mathutils.Vector` | None\n"); static PyObject *M_Geometry_intersect_line_plane(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_line_plane"; @@ -572,9 +573,10 @@ PyDoc_STRVAR( " :type plane_b_co: :class:`mathutils.Vector`\n" " :arg plane_b_no: Normal of the second plane\n" " :type plane_b_no: :class:`mathutils.Vector`\n" - " :return: The line of the intersection represented as a point and a vector\n" - " :rtype: tuple pair of :class:`mathutils.Vector` or None if the intersection can't be " - "calculated\n"); + " :return: The line of the intersection represented as a point and a vector or None if the " + "intersection can't be calculated\n" + " :rtype: tuple[:class:`mathutils.Vector`, :class:`mathutils.Vector`] | tuple[None, " + "None]\n"); static PyObject *M_Geometry_intersect_plane_plane(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_plane_plane"; @@ -645,7 +647,7 @@ PyDoc_STRVAR( " :type sphere_radius: float\n" " :return: The intersection points as a pair of vectors or None when there is no " "intersection\n" - " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n"); + " :rtype: tuple[:class:`mathutils.Vector` | None, :class:`mathutils.Vector` | None]\n"); static PyObject *M_Geometry_intersect_line_sphere(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_line_sphere"; @@ -736,7 +738,7 @@ PyDoc_STRVAR( " :type sphere_radius: float\n" " :return: The intersection points as a pair of vectors or None when there is no " "intersection\n" - " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n"); + " :rtype: tuple[:class:`mathutils.Vector` | None, :class:`mathutils.Vector` | None]\n"); static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_line_sphere_2d"; @@ -822,7 +824,7 @@ PyDoc_STRVAR( " :type line_p1: :class:`mathutils.Vector`\n" " :arg line_p1: Second point of the line\n" " :type line_p1: :class:`mathutils.Vector`\n" - " :rtype: (:class:`mathutils.Vector`, float)\n"); + " :rtype: tuple[:class:`mathutils.Vector`, float]\n"); static PyObject *M_Geometry_intersect_point_line(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_point_line"; @@ -873,7 +875,7 @@ PyDoc_STRVAR( " :arg tri_p3: Third point of the triangle\n" " :type tri_p3: :class:`mathutils.Vector`\n" " :return: Point on the triangles plane or None if its outside the triangle\n" - " :rtype: :class:`mathutils.Vector` or None\n"); + " :rtype: :class:`mathutils.Vector` | None\n"); static PyObject *M_Geometry_intersect_point_tri(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "intersect_point_tri"; @@ -1096,7 +1098,7 @@ PyDoc_STRVAR( " :arg tri_b3: target triangle vertex.\n" " :type tri_b3: :class:`mathutils.Vector`\n" " :return: The transformed point\n" - " :rtype: :class:`mathutils.Vector`'s\n"); + " :rtype: :class:`mathutils.Vector`\n"); static PyObject *M_Geometry_barycentric_transform(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "barycentric_transform"; @@ -1154,14 +1156,14 @@ PyDoc_STRVAR( "the planes used.\n" "\n" " :arg planes: List of planes (4D vectors).\n" - " :type planes: list of :class:`mathutils.Vector`\n" + " :type planes: list[:class:`mathutils.Vector`]\n" " :arg epsilon_coplanar: Epsilon value for interpreting plane pairs as co-plannar.\n" " :type epsilon_coplanar: float\n" " :arg epsilon_isect: Epsilon value for intersection.\n" " :type epsilon_isect: float\n" - " :return: two lists, once containing the vertices inside the planes, another " - "containing the plane indices used\n" - " :rtype: pair of lists\n"); + " :return: Two lists, once containing the 3D coordinates inside the planes, " + "another containing the plane indices used.\n" + " :rtype: tuple[list[:class:`mathutils.Vector`], list[int]]\n"); static PyObject *M_Geometry_points_in_planes(PyObject * /*self*/, PyObject *args) { PyObject *py_planes; @@ -1231,8 +1233,8 @@ PyDoc_STRVAR( " :type knot2: :class:`mathutils.Vector`\n" " :arg resolution: Number of points to return.\n" " :type resolution: int\n" - " :return: The interpolated points\n" - " :rtype: list of :class:`mathutils.Vector`'s\n"); + " :return: The interpolated points.\n" + " :rtype: list[:class:`mathutils.Vector`]\n"); static PyObject *M_Geometry_interpolate_bezier(PyObject * /*self*/, PyObject *args) { const char *error_prefix = "interpolate_bezier"; @@ -1281,14 +1283,16 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject * /*self*/, PyObject *ar PyDoc_STRVAR( /* Wrap. */ M_Geometry_tessellate_polygon_doc, - ".. function:: tessellate_polygon(veclist_list)\n" + ".. function:: tessellate_polygon(polylines)\n" "\n" " Takes a list of polylines (each point a pair or triplet of numbers) and returns " "the point indices for a polyline filled with triangles. Does not handle degenerate " "geometry (such as zero-length lines due to consecutive identical points).\n" "\n" - " :arg veclist_list: list of polylines\n" - " :rtype: list\n"); + " :arg polylines: Polygons where each polygon is a sequence of 2D or 3D points.\n" + " :type polylines: Sequence[Sequence[Sequence[float]]]" + " :return: A list of triangles.\n" + " :rtype: list[tuple[int, int, int]]\n"); /* PolyFill function, uses Blenders scan-fill to fill multiple poly lines. */ static PyObject *M_Geometry_tessellate_polygon(PyObject * /*self*/, PyObject *polyLineSeq) { @@ -1462,11 +1466,12 @@ PyDoc_STRVAR( "\n" " Returns a tuple with the width and height of the packed bounding box.\n" "\n" - " :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, " - "width, height, ...] other items are ignored.\n" - " :type boxes: list\n" - " :return: the width and height of the packed bounding box\n" - " :rtype: tuple, pair of floats\n"); + " :arg boxes: list of boxes, each box is a list where the first 4 items are " + "[X, Y, width, height, ...] other items are ignored. " + "The X & Y values in this list are modified to set the packed positions.\n" + " :type boxes: list[list[float, float, float, float, ...]]\n" + " :return: The width and height of the packed bounding box.\n" + " :rtype: tuple[float, float]\n"); static PyObject *M_Geometry_box_pack_2d(PyObject * /*self*/, PyObject *boxlist) { float tot_width = 0.0f, tot_height = 0.0f; @@ -1506,8 +1511,8 @@ PyDoc_STRVAR( "\n" " Returns an angle that best fits the points to an axis aligned rectangle\n" "\n" - " :arg points: list of 2d points.\n" - " :type points: list\n" + " :arg points: Sequence of 2D points.\n" + " :type points: Sequence[Sequence[float]]\n" " :return: angle\n" " :rtype: float\n"); static PyObject *M_Geometry_box_fit_2d(PyObject * /*self*/, PyObject *pointlist) @@ -1539,10 +1544,10 @@ PyDoc_STRVAR( "\n" " Returns a list of indices into the list given\n" "\n" - " :arg points: list of 2d points.\n" - " :type points: list\n" + " :arg points: Sequence of 2D points.\n" + " :type points: Sequence[Sequence[float]]\n" " :return: a list of indices\n" - " :rtype: list of ints\n"); + " :rtype: list[int]\n"); static PyObject *M_Geometry_convex_hull_2d(PyObject * /*self*/, PyObject *pointlist) { float(*points)[2]; @@ -1621,11 +1626,11 @@ PyDoc_STRVAR( " of the orig arrays, which may save some time.\n" "\n" " :arg vert_coords: Vertex coordinates (2d)\n" - " :type vert_coords: list of :class:`mathutils.Vector`\n" - " :arg edges: Edges, as pairs of indices in `vert_coords`\n" - " :type edges: list of (int, int)\n" + " :type vert_coords: Sequence[:class:`mathutils.Vector`]\n" + " :arg edges: Edges, as pairs of indices in ``vert_coords``\n" + " :type edges: Sequence[Sequence[int, int]]\n" " :arg faces: Faces, each sublist is a face, as indices in `vert_coords` (CCW oriented)\n" - " :type faces: list of list of int\n" + " :type faces: Sequence[Sequence[int]]\n" " :arg output_type: What output looks like. 0 => triangles with convex hull. " "1 => triangles inside constraints. " "2 => the input constraints, intersected. " @@ -1638,12 +1643,13 @@ PyDoc_STRVAR( " :arg need_ids: are the orig output arrays needed?\n" " :type need_args: bool\n" " :return: Output tuple, (vert_coords, edges, faces, orig_verts, orig_edges, orig_faces)\n" - " :rtype: (list of `mathutils.Vector`, " - "list of (int, int), " - "list of list of int, " - "list of list of int, " - "list of list of int, " - "list of list of int)\n" + " :rtype: tuple[" + "list[:class:`mathutils.Vector`], " + "list[tuple[int, int]], " + "list[list[int]], " + "list[list[int]], " + "list[list[int]], " + "list[list[int]]]\n" "\n"); static PyObject *M_Geometry_delaunay_2d_cdt(PyObject * /*self*/, PyObject *args) { diff --git a/source/blender/python/mathutils/mathutils_interpolate.cc b/source/blender/python/mathutils/mathutils_interpolate.cc index bc019c77e5b..f613a70e619 100644 --- a/source/blender/python/mathutils/mathutils_interpolate.cc +++ b/source/blender/python/mathutils/mathutils_interpolate.cc @@ -35,9 +35,12 @@ PyDoc_STRVAR( "\n" " Calculate barycentric weights for a point on a polygon.\n" "\n" - " :arg veclist: list of vectors\n" - " :arg pt: point" - " :rtype: list of per-vector weights\n"); + " :arg veclist: Sequence of 3D positions.\n" + " :type veclist: Sequence[Sequence[float]]\n" + " :arg pt: 2D or 3D position." + " :type pt: Sequence[float]" + " :return: list of per-vector weights.\n" + " :rtype: list[float]\n"); static PyObject *M_Interpolate_poly_3d_calc(PyObject * /*self*/, PyObject *args) { float fp[3]; diff --git a/source/blender/python/mathutils/mathutils_kdtree.cc b/source/blender/python/mathutils/mathutils_kdtree.cc index 3efa15da5f8..7adb59e07e6 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.cc +++ b/source/blender/python/mathutils/mathutils_kdtree.cc @@ -115,7 +115,7 @@ PyDoc_STRVAR( " Insert a point into the KDTree.\n" "\n" " :arg co: Point 3d position.\n" - " :type co: float triplet\n" + " :type co: Sequence[float]\n" " :arg index: The index of the point.\n" " :type index: int\n"); static PyObject *py_kdtree_insert(PyKDTree *self, PyObject *args, PyObject *kwargs) @@ -202,13 +202,13 @@ PyDoc_STRVAR( "\n" " Find nearest point to ``co``.\n" "\n" - " :arg co: 3d coordinates.\n" - " :type co: float triplet\n" + " :arg co: 3D coordinates.\n" + " :type co: Sequence[float]\n" " :arg filter: function which takes an index and returns True for indices to " "include in the search.\n" - " :type filter: callable\n" - " :return: Returns (:class:`Vector`, index, distance).\n" - " :rtype: :class:`tuple`\n"); + " :type filter: Callable[[int], bool]\n" + " :return: Returns (position, index, distance).\n" + " :rtype: tuple[:class:`Vector`, int, float]\n"); static PyObject *py_kdtree_find(PyKDTree *self, PyObject *args, PyObject *kwargs) { PyObject *py_co, *py_filter = nullptr; @@ -259,12 +259,12 @@ PyDoc_STRVAR( "\n" " Find nearest ``n`` points to ``co``.\n" "\n" - " :arg co: 3d coordinates.\n" - " :type co: float triplet\n" + " :arg co: 3D coordinates.\n" + " :type co: Sequence[float]\n" " :arg n: Number of points to find.\n" " :type n: int\n" - " :return: Returns a list of tuples (:class:`Vector`, index, distance).\n" - " :rtype: :class:`list`\n"); + " :return: Returns a list of tuples (position, index, distance).\n" + " :rtype: list[tuple[:class:`Vector`, int, float]]\n"); static PyObject *py_kdtree_find_n(PyKDTree *self, PyObject *args, PyObject *kwargs) { PyObject *py_list; @@ -315,12 +315,12 @@ PyDoc_STRVAR( "\n" " Find all points within ``radius`` of ``co``.\n" "\n" - " :arg co: 3d coordinates.\n" - " :type co: float triplet\n" + " :arg co: 3D coordinates.\n" + " :type co: Sequence[float]\n" " :arg radius: Distance to search for points.\n" " :type radius: float\n" - " :return: Returns a list of tuples (:class:`Vector`, index, distance).\n" - " :rtype: :class:`list`\n"); + " :return: Returns a list of tuples (position, index, distance).\n" + " :rtype: list[tuple[:class:`Vector`, int, float]]\n"); static PyObject *py_kdtree_find_range(PyKDTree *self, PyObject *args, PyObject *kwargs) { PyObject *py_list; diff --git a/source/blender/python/mathutils/mathutils_noise.cc b/source/blender/python/mathutils/mathutils_noise.cc index 9b6b2533fa9..b67977ee602 100644 --- a/source/blender/python/mathutils/mathutils_noise.cc +++ b/source/blender/python/mathutils/mathutils_noise.cc @@ -150,13 +150,13 @@ static float frand() "'VORONOI_F1', 'VORONOI_F2', " \ "'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " \ "'CELLNOISE'].\n" \ - " :type noise_basis: string\n" + " :type noise_basis: str\n" #define BPY_NOISE_METRIC_ENUM_DOC \ " :arg distance_metric: Enumerator in ['DISTANCE', 'DISTANCE_SQUARED', 'MANHATTAN', " \ "'CHEBYCHEV', " \ "'MINKOVSKY', 'MINKOVSKY_HALF', 'MINKOVSKY_FOUR'].\n" \ - " :type distance_metric: string\n" + " :type distance_metric: str\n" /* Noise basis enum */ #define DEFAULT_NOISE_TYPE TEX_STDPERLIN @@ -487,7 +487,7 @@ PyDoc_STRVAR( " :type octaves: int\n" " :arg hard: Specifies whether returned turbulence is hard (sharp transitions) or " "soft (smooth transitions).\n" - " :type hard: boolean\n" BPY_NOISE_BASIS_ENUM_DOC + " :type hard: bool\n" BPY_NOISE_BASIS_ENUM_DOC " :arg amplitude_scale: The amplitude scaling factor.\n" " :type amplitude_scale: float\n" " :arg frequency_scale: The frequency scaling factor\n" @@ -548,7 +548,7 @@ PyDoc_STRVAR( " :type octaves: int\n" " :arg hard: Specifies whether returned turbulence is hard (sharp transitions) or " "soft (smooth transitions).\n" - " :type hard: boolean\n" BPY_NOISE_BASIS_ENUM_DOC + " :type hard: bool\n" BPY_NOISE_BASIS_ENUM_DOC " :arg amplitude_scale: The amplitude scaling factor.\n" " :type amplitude_scale: float\n" " :arg frequency_scale: The frequency scaling factor\n" @@ -722,12 +722,12 @@ PyDoc_STRVAR( "'VORONOI_F1', 'VORONOI_F2', " "'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " "'CELLNOISE'].\n" - " :type noise_type1: string\n" + " :type noise_type1: str\n" " :arg noise_type2: Enumerator in ['BLENDER', 'PERLIN_ORIGINAL', 'PERLIN_NEW', " "'VORONOI_F1', 'VORONOI_F2', " "'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " "'CELLNOISE'].\n" - " :type noise_type2: string\n" + " :type noise_type2: str\n" " :return: The variable lacunarity noise value.\n" " :rtype: float\n"); static PyObject *M_Noise_variable_lacunarity(PyObject * /*self*/, PyObject *args, PyObject *kw) @@ -980,7 +980,7 @@ PyDoc_STRVAR( " :arg exponent: The exponent for Minkowski distance metric.\n" " :type exponent: float\n" " :return: A list of distances to the four closest features and their locations.\n" - " :rtype: list of four floats, list of four :class:`mathutils.Vector` types\n"); + " :rtype: list[list[float], list[:class:`mathutils.Vector`]]\n"); static PyObject *M_Noise_voronoi(PyObject * /*self*/, PyObject *args, PyObject *kw) { static const char *kwlist[] = {"", "distance_metric", "exponent", nullptr};