Cleanup: declare __all__ for many scripts in tools/

This commit is contained in:
Campbell Barton 2025-01-04 20:27:07 +11:00
parent 6f64d70e60
commit 5fe261c89d
61 changed files with 290 additions and 13 deletions

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import unittest
from check_utils import (

View file

@ -2,6 +2,9 @@
# SPDX-FileCopyrightText: 2023 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import unittest

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import unittest
from check_utils import (

View file

@ -4,6 +4,9 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Usage: ./check_release.py -- ../path/to/release/folder
__all__ = (
"main",
)
import unittest

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import os
from pathlib import Path
import re

View file

@ -3,6 +3,11 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"ScriptUnitTesting",
"parseArguments",
"sliceCommandLineArguments",
)
import unittest

View file

@ -14,6 +14,9 @@ You may pass the markdown text as an argument, e.g.
check_docs_code_layout.py --markdown=markdown.txt
"""
__all__ = (
"main",
)
import os
import argparse

View file

@ -2,6 +2,15 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"BUILD_DIR",
"IGNORE_CMAKE",
"IGNORE_SOURCE",
"IGNORE_SOURCE_MISSING",
"SOURCE_DIR",
"UTF8_CHECK",
)
import os
IGNORE_SOURCE = (

View file

@ -8,6 +8,10 @@ noted by the date which must be included with the *DEPRECATED* comment.
Once this date is past, the code should be removed.
"""
__all__ = (
"main",
)
import os
import datetime

View file

@ -8,6 +8,9 @@ this script updates XML themes once new settings are added
./blender.bin --background --python tools/check_source/check_descriptions.py
"""
__all__ = (
"main",
)
import bpy

View file

@ -14,6 +14,9 @@ Then restore the headers to their original state:
python3 check_header_duplicate.py --restore
"""
__all__ = (
"main",
)
import os
import sys

View file

@ -9,6 +9,10 @@ https://spdx.org/licenses/
This can be activated by calling "make check_licenses" from Blenders root directory.
"""
__all__ = (
"main",
)
import os
import argparse

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import os
from os.path import join

View file

@ -2,6 +2,12 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"PATHS",
"PATHS_EXCLUDE",
"SOURCE_DIR",
)
import os
from typing import (
Any,

View file

@ -13,6 +13,9 @@ Script for checking source code spelling.
Currently only python source is checked.
"""
__all__ = (
"main",
)
import os
import argparse

View file

@ -4,6 +4,15 @@
# these must be all lower case for comparisons
__all__ = (
"dict_custom",
"dict_ignore",
"dict_ignore_hyphenated_prefix",
"dict_ignore_hyphenated_suffix",
"directories_ignore",
"files_ignore",
)
dict_custom = {
# Added to newer versions of the dictionary,
# we can remove these when the updated word-lists have been applied to `aspell-en`.

View file

@ -5,6 +5,10 @@
# Checks for defines which aren't used anywhere.
__all__ = (
"main",
)
import os
import sys

View file

@ -13,6 +13,11 @@ Invocation:
... defines and includes are optional
"""
__all__ = (
"main",
)
import sys
# delay parsing functions until we need them
USE_LAZY_INIT = True
@ -380,9 +385,15 @@ def recursive_arg_sizes(node, ):
recursive_arg_sizes(c)
# cache function sizes
recursive_arg_sizes(tu.cursor)
_defs.update(defs_precalc)
def main() -> int:
# cache function sizes
recursive_arg_sizes(tu.cursor)
_defs.update(defs_precalc)
# --- second pass, check against def's
file_check_arg_sizes(tu)
# --- second pass, check against def's
file_check_arg_sizes(tu)
return 0
if __name__ == "__main__":
sys.exit(main)

View file

@ -13,6 +13,10 @@ cd {BUILD_DIR}
python ../blender/tools/check_source/static_check_clang.py --match=".*" --checks=struct_comments
"""
__all__ = (
"main",
)
import argparse
import os

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import project_source_info
import subprocess
import sys

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import project_source_info
import subprocess
import sys

View file

@ -21,6 +21,11 @@ To validate that things are registered correctly:
3. Run `info frame-filter` and check for `blender-frame-filters`.
'''
__all__ = (
# Not used externally but functions as a `main`.
"register",
)
import gdb
import functools
from contextlib import contextmanager
@ -675,4 +680,5 @@ def register():
gdb.frame_filters[frame_filter.name] = frame_filter
register()
if __name__ == "__main__":
register()

View file

@ -12,6 +12,10 @@ Example:
git_sort_commits.py < commits.txt
"""
__all__ = (
"main",
)
import sys
import os

View file

@ -10,6 +10,15 @@
# and https://pypi.org/project/blender-asset-tracer/
# -----------------------------------------------------------------------------
__all__ = (
"open_blend",
# Expose for `wrapper_type` argument to `open_blend`.
"BlendFile",
"BlendFileRaw",
)
import gzip
import logging
import os

View file

@ -5,6 +5,15 @@
# Simple module for inspecting GITEA users, pulls and issues.
__all__ = (
"git_username_detect",
"gitea_json_activities_get",
"gitea_json_issue_events_filter",
"gitea_json_issue_get",
"gitea_json_issues_search",
"gitea_user_get",
)
import datetime
import json
import urllib.error

View file

@ -10,6 +10,9 @@ Example usage:
python ./issues_module_listing.py --severity High
"""
__all__ = (
"main",
)
import argparse
import dataclasses

View file

@ -12,6 +12,9 @@ Example usage:
python ./issues_needing_info.py --username mano-wii
"""
__all__ = (
"main",
)
import argparse
import datetime

View file

@ -15,6 +15,10 @@ Example usage:
python ./weekly_report.py --username mano-wii
"""
__all__ = (
"main",
)
import argparse
import datetime

View file

@ -16,6 +16,9 @@ Piping from the standard-input is also supported:
The text is printed to the standard output.
"""
__all__ = (
"main",
)
import argparse
import multiprocessing

View file

@ -13,6 +13,10 @@ Example use a custom range:
authors_git_gen.py --source=/src/blender --range=SHA1..HEAD
"""
__all__ = (
"main",
)
# NOTE: this shares the basic structure with `credits_git_gen.py`,
# however details differ enough for them to be separate scripts.
# Improvements to this script may apply there too.

View file

@ -3,6 +3,11 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import subprocess
import os
from os.path import join

View file

@ -2,6 +2,12 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"PATHS",
"PATHS_EXCLUDE",
"SOURCE_DIR",
)
import os
from collections.abc import (

View file

@ -32,6 +32,10 @@ To check a .blend file instead of outputting its JSon version (use explicit -o o
./blend2json.py -c foo.blend
"""
__all__ = (
"main",
)
FILTER_DOC = """
Each generic filter is made of three arguments, the include/exclude toggle ('+'/'-'), a regex to match against the name

View file

@ -28,6 +28,9 @@ config = [
("rmb_action", ('TWEAK', 'FALLBACK_TOOL')),
]
"""
__all__ = (
"main",
)
import os
import sys

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import os
import subprocess
import sys

View file

@ -16,6 +16,10 @@ eg:
./tools/utils/blender_theme_as_c.py $(find ~/.config/blender -name "userpref.blend" | sort | tail -1)
"""
__all__ = (
"main",
)
C_SOURCE_HEADER = r'''/* SPDX-FileCopyrightText: 2018 Blender Authors
*

View file

@ -12,6 +12,10 @@ Example use a custom range:
credits_git_gen.py --source=/src/blender --range=SHA1..HEAD
"""
__all__ = (
"main",
)
# NOTE: this shares the basic structure with `credits_git_gen.py`,
# however details differ enough for them to be separate scripts.

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import argparse
import re
import shutil

View file

@ -11,6 +11,11 @@ Example use:
(gdb) source tools/utils/gdb_struct_repr_c99.py
(gdb) print_struct_c99 scene->toolsettings
'''
__all__ = (
"main",
)
import sys
class PrintStructC99(gdb.Command):
@ -46,10 +51,16 @@ class PrintStructC99(gdb.Command):
print(' ' * hs + '.' + rr_s[0] + '= ' + rr_rval)
print('Running GDB from: {:s}\n'.format(gdb.PYTHONDIR))
gdb.execute("set print pretty")
gdb.execute('set pagination off')
gdb.execute('set print repeats 0')
gdb.execute('set print elements unlimited')
# instantiate
PrintStructC99()
def main() -> int:
print('Running GDB from: {:s}\n'.format(gdb.PYTHONDIR))
gdb.execute("set print pretty")
gdb.execute('set pagination off')
gdb.execute('set print repeats 0')
gdb.execute('set print elements unlimited')
# instantiate
PrintStructC99()
return 0
if __name__ == "__main__":
sys.exit(main())

View file

@ -4,6 +4,13 @@
# Simple module for inspecting git commits
__all__ = (
"GitCommit",
"GitCommitIter",
"GitRepo",
)
import os
import subprocess
import datetime

View file

@ -12,6 +12,9 @@ Example usage:
./git_log_review_commits.py --source=../../.. --range=HEAD~40..HEAD --filter=BUGFIX
"""
__all__ = (
"main",
)
class _Getch:

View file

@ -29,6 +29,10 @@ To exclude all commits from some given files, by sha1 or by commit message (from
"""
__all__ = (
"main",
)
import os
import sys
import io

View file

@ -11,6 +11,10 @@
# * 403 Client Error: That means the token doesn't have the right scope.
# * 500 Server Error: The token is invalid.
__all__ = (
"main",
)
import logging
import os
import requests

View file

@ -6,6 +6,10 @@
# Created by Robert Wenzlaff (Det. Thorn).
# Oct. 30, 2003
__all__ = (
"main",
)
import sys
from tkinter import (
Button,

View file

@ -4,6 +4,9 @@
# Converts 32x32 XPM images written be the gimp to GL stipples
# takes XPM files as arguments, prints out C style definitions.
__all__ = (
"main",
)
import sys
import os

View file

@ -17,6 +17,10 @@ Example Use::
blender.bin -b --factory-startup my_shapes.blend --python make_shape_2d_from_blend.py
'''
__all__ = (
"main",
)
import bpy
import os

View file

@ -12,6 +12,10 @@ Example usage:
python3 tools/utils_api/bpy_introspect_ui.py
"""
__all__ = (
"main",
)
import sys
ModuleType = type(sys)

View file

@ -21,6 +21,10 @@ Usage:
wheel_cleanup.py <path/to/installed/bpy/directory>
"""
__all__ = (
"main",
)
import argparse
import re
import shutil

View file

@ -28,6 +28,10 @@ or added to the Blender UI translation table.
URL is the: url_manual_prefix + url_manual_mapping[#id]
'''
__all__ = (
"main",
)
import os
import argparse

View file

@ -15,6 +15,10 @@ Otherwise you may call this script directly, for example:
./tools/utils_maintenance/autopep8_format_paths.py --changed-only tests/python
"""
__all__ = (
"main",
)
import os
import sys

View file

@ -8,6 +8,10 @@
# --enable-event-simulate \
# --python tools/utils_maintenance/blender_menu_search_coverage.py
__all__ = (
"main",
)
import bpy
# Menu-ID -> class.

View file

@ -6,6 +6,10 @@
#
# ./blender.bin --background --python ./tools/utils_maintenance/blender_update_themes.py
__all__ = (
"main",
)
import bpy
import os

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import os
import sys

View file

@ -11,6 +11,10 @@ There may be times this is needed, however they can typically be removed
and any errors caused can be added to the headers which require the forward declarations.
"""
__all__ = (
"main",
)
import os
import sys
import re

View file

@ -11,6 +11,9 @@ While it can be called directly, you may prefer to run this from Blender's root
make format
"""
__all__ = (
"main",
)
import argparse
import multiprocessing

View file

@ -8,6 +8,9 @@ Sorts CMake path lists
- Don't cross blank newline boundaries.
- Don't cross different path prefix boundaries.
"""
__all__ = (
"main",
)
import os
import sys

View file

@ -11,6 +11,10 @@ Note: currently this is limited to paths in "source/" and "intern/",
we could change this if it's needed.
"""
__all__ = (
"main",
)
import argparse
import re
import subprocess

View file

@ -3,6 +3,10 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# pylint: disable=missing-function-docstring, missing-module-docstring, missing-class-docstring
__all__ = (
"main",
)
import datetime
import itertools
import json

View file

@ -2,6 +2,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"run",
)
from collections.abc import (
Callable,
Iterator,

View file

@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import os
from os.path import join

View file

@ -2,6 +2,12 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"PATHS",
"SOURCE_DIR",
)
import os
PATHS = (
"build_files/build_environment/cmake",