PyAPI: use keyword only arguments

Use keyword only arguments for the following functions.

- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
This commit is contained in:
Campbell Barton 2021-06-08 18:03:14 +10:00
parent c18ff180e3
commit f29a738e23
48 changed files with 163 additions and 140 deletions

View File

@ -29,7 +29,7 @@ with offscreen.bind():
amount = 10
for i in range(-amount, amount + 1):
x_pos = i / amount
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, 200)
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, segments=200)
# Drawing the generated texture in 3D space

View File

@ -34,7 +34,9 @@ with offscreen.bind():
for i in range(RING_AMOUNT):
draw_circle_2d(
(random.uniform(-1, 1), random.uniform(-1, 1)),
(1, 1, 1, 1), random.uniform(0.1, 1), 20)
(1, 1, 1, 1), random.uniform(0.1, 1),
segments=20,
)
buffer = fb.read_color(0, 0, WIDTH, HEIGHT, 4, 0, 'UBYTE')

View File

@ -132,7 +132,7 @@ def init():
_workaround_buggy_drivers()
path = os.path.dirname(__file__)
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path='')))
_cycles.init(path, user_path, bpy.app.background)
_parse_command_line()

View File

@ -49,16 +49,16 @@ def _initialize():
def paths():
# RELEASE SCRIPTS: official scripts distributed in Blender releases
addon_paths = _bpy.utils.script_paths("addons")
addon_paths = _bpy.utils.script_paths(subdir="addons")
# CONTRIB SCRIPTS: good for testing but not official scripts yet
# if folder addons_contrib/ exists, scripts in there will be loaded too
addon_paths += _bpy.utils.script_paths("addons_contrib")
addon_paths += _bpy.utils.script_paths(subdir="addons_contrib")
return addon_paths
def modules_refresh(module_cache=addons_fake_modules):
def modules_refresh(*, module_cache=addons_fake_modules):
global error_encoding
import os
@ -203,9 +203,9 @@ def modules_refresh(module_cache=addons_fake_modules):
del modules_stale
def modules(module_cache=addons_fake_modules, *, refresh=True):
def modules(*, module_cache=addons_fake_modules, refresh=True):
if refresh or ((module_cache is addons_fake_modules) and modules._is_first):
modules_refresh(module_cache)
modules_refresh(module_cache=module_cache)
modules._is_first = False
mod_list = list(module_cache.values())
@ -512,7 +512,7 @@ def _blender_manual_url_prefix():
return "https://docs.blender.org/manual/en/" + manual_version
def module_bl_info(mod, info_basis=None):
def module_bl_info(mod, *, info_basis=None):
if info_basis is None:
info_basis = {
"name": "",

View File

@ -134,7 +134,7 @@ def _disable(template_id, *, handle_error=None):
print("\tapp_template_utils.disable", template_id)
def import_from_path(path, ignore_not_found=False):
def import_from_path(path, *, ignore_not_found=False):
import os
from importlib import import_module
base_module, template_id = path.rsplit(os.sep, 2)[-2:]
@ -148,9 +148,9 @@ def import_from_path(path, ignore_not_found=False):
raise ex
def import_from_id(template_id, ignore_not_found=False):
def import_from_id(template_id, *, ignore_not_found=False):
import os
path = next(iter(_bpy.utils.app_template_paths(template_id)), None)
path = next(iter(_bpy.utils.app_template_paths(path=template_id)), None)
if path is None:
if ignore_not_found:
return None
@ -163,7 +163,7 @@ def import_from_id(template_id, ignore_not_found=False):
return import_from_path(path, ignore_not_found=ignore_not_found)
def activate(template_id=None):
def activate(*, template_id=None):
template_id_prev = _app_template["id"]
# not needed but may as well avoids redundant
@ -190,4 +190,4 @@ def reset(*, reload_scripts=False):
# TODO reload_scripts
activate(template_id)
activate(template_id=template_id)

View File

@ -26,7 +26,7 @@ __all__ = (
)
def generate(context, space_type, use_fallback_keys=True, use_reset=True):
def generate(context, space_type, *, use_fallback_keys=True, use_reset=True):
"""
Keymap for popup toolbar, currently generated each time.
"""

View File

@ -17,7 +17,7 @@
# ##### END GPL LICENSE BLOCK #####
def keyconfig_data_oskey_from_ctrl(keyconfig_data_src, filter_fn=None):
def keyconfig_data_oskey_from_ctrl(keyconfig_data_src, *, filter_fn=None):
keyconfig_data_dst = []
for km_name, km_parms, km_items_data_src in keyconfig_data_src:
km_items_data_dst = km_items_data_src.copy()
@ -61,4 +61,4 @@ def keyconfig_data_oskey_from_ctrl_for_macos(keyconfig_data_src):
return False
return True
return keyconfig_data_oskey_from_ctrl(keyconfig_data_src, filter_fn)
return keyconfig_data_oskey_from_ctrl(keyconfig_data_src, filter_fn=filter_fn)

View File

@ -19,7 +19,7 @@
# <pep8-80 compliant>
def url_prefill_from_blender(addon_info=None):
def url_prefill_from_blender(*, addon_info=None):
import bpy
import gpu
import struct

View File

@ -56,7 +56,7 @@ def _getattr_bytes(var, attr):
return var.path_resolve(attr, False).as_bytes()
def abspath(path, start=None, library=None):
def abspath(path, *, start=None, library=None):
"""
Returns the absolute path relative to the current blend file
using the "//" prefix.
@ -92,7 +92,7 @@ def abspath(path, start=None, library=None):
return path
def relpath(path, start=None):
def relpath(path, *, start=None):
"""
Returns the path relative to the current blend file using the "//" prefix.
@ -134,7 +134,7 @@ def is_subdir(path, directory):
return False
def clean_name(name, replace="_"):
def clean_name(name, *, replace="_"):
"""
Returns a name with characters replaced that
may cause problems under various circumstances,
@ -311,7 +311,7 @@ def resolve_ncase(path):
return ncase_path if found else path
def ensure_ext(filepath, ext, case_sensitive=False):
def ensure_ext(filepath, ext, *, case_sensitive=False):
"""
Return the path with the extension added if it is not already set.
@ -332,7 +332,7 @@ def ensure_ext(filepath, ext, case_sensitive=False):
return filepath + ext
def module_names(path, recursive=False):
def module_names(path, *, recursive=False):
"""
Return a list of modules which can be imported from *path*.
@ -361,7 +361,7 @@ def module_names(path, recursive=False):
if isfile(fullpath):
modules.append((filename, fullpath))
if recursive:
for mod_name, mod_path in module_names(directory, True):
for mod_name, mod_path in module_names(directory, recursive=True):
modules.append(("%s.%s" % (filename, mod_name),
mod_path,
))

View File

@ -81,7 +81,7 @@ _script_module_dirs = "startup", "modules"
_is_factory_startup = _bpy.app.factory_startup
def execfile(filepath, mod=None):
def execfile(filepath, *, mod=None):
"""
Execute a file path as a Python script.
@ -193,7 +193,7 @@ _global_loaded_modules = [] # store loaded module names for reloading.
import bpy_types as _bpy_types # keep for comparisons, never ever reload this.
def load_scripts(reload_scripts=False, refresh_scripts=False):
def load_scripts(*, reload_scripts=False, refresh_scripts=False):
"""
Load scripts and run each modules register function.
@ -357,7 +357,7 @@ def script_path_pref():
return _os.path.normpath(path) if path else None
def script_paths(subdir=None, user_pref=True, check_all=False, use_user=True):
def script_paths(*, subdir=None, user_pref=True, check_all=False, use_user=True):
"""
Returns a list of valid script paths.
@ -446,16 +446,16 @@ def refresh_script_paths():
_sys_path_ensure_append(path)
def app_template_paths(subdir=None):
def app_template_paths(*, path=None):
"""
Returns valid application template paths.
:arg subdir: Optional subdir.
:type subdir: string
:arg path: Optional subdir.
:type path: string
:return: app template paths.
:rtype: generator
"""
subdir_args = (subdir,) if subdir is not None else ()
subdir_args = (path,) if path is not None else ()
# Note: keep in sync with: Blender's 'BKE_appdir_app_template_any'.
# Uses 'BLENDER_USER_SCRIPTS', 'BLENDER_SYSTEM_SCRIPTS'
# ... in this case 'system' accounts for 'local' too.
@ -463,9 +463,9 @@ def app_template_paths(subdir=None):
(_user_resource, "bl_app_templates_user"),
(system_resource, "bl_app_templates_system"),
):
path = resource_fn('SCRIPTS', _os.path.join("startup", module_name, *subdir_args))
if path and _os.path.isdir(path):
yield path
path_test = resource_fn('SCRIPTS', path=_os.path.join("startup", module_name, *subdir_args))
if path_test and _os.path.isdir(path_test):
yield path_test
def preset_paths(subdir):
@ -478,7 +478,7 @@ def preset_paths(subdir):
:rtype: list
"""
dirs = []
for path in script_paths("presets", check_all=True):
for path in script_paths(subdir="presets", check_all=True):
directory = _os.path.join(path, subdir)
if not directory.startswith(path):
raise Exception("invalid subdir given %r" % subdir)
@ -532,7 +532,7 @@ def is_path_builtin(path):
return False
def smpte_from_seconds(time, fps=None, fps_base=None):
def smpte_from_seconds(time, *, fps=None, fps_base=None):
"""
Returns an SMPTE formatted string from the *time*:
``HH:MM:SS:FF``.
@ -552,7 +552,7 @@ def smpte_from_seconds(time, fps=None, fps_base=None):
)
def smpte_from_frame(frame, fps=None, fps_base=None):
def smpte_from_frame(frame, *, fps=None, fps_base=None):
"""
Returns an SMPTE formatted string from the *frame*:
``HH:MM:SS:FF``.
@ -585,7 +585,7 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
))
def time_from_frame(frame, fps=None, fps_base=None):
def time_from_frame(frame, *, fps=None, fps_base=None):
"""
Returns the time from a frame number .
@ -610,7 +610,7 @@ def time_from_frame(frame, fps=None, fps_base=None):
return timedelta(0, frame / fps)
def time_to_frame(time, fps=None, fps_base=None):
def time_to_frame(time, *, fps=None, fps_base=None):
"""
Returns a float frame number from a time given in seconds or
as a datetime.timedelta object.
@ -639,7 +639,7 @@ def time_to_frame(time, fps=None, fps_base=None):
return time * fps
def preset_find(name, preset_path, display_name=False, ext=".py"):
def preset_find(name, preset_path, *, display_name=False, ext=".py"):
if not name:
return None
@ -676,7 +676,7 @@ def keyconfig_init():
keyconfig_set(filepath)
def keyconfig_set(filepath, report=None):
def keyconfig_set(filepath, *, report=None):
from os.path import basename, splitext
if _bpy.app.debug_python:
@ -712,14 +712,14 @@ def keyconfig_set(filepath, report=None):
return True
def user_resource(resource_type, path="", create=False):
def user_resource(resource_type, *, path="", create=False):
"""
Return a user resource path (normally from the users home directory).
:arg type: Resource type in ['DATAFILES', 'CONFIG', 'SCRIPTS', 'AUTOSAVE'].
:type type: string
:arg subdir: Optional subdirectory.
:type subdir: string
:arg path: Optional subdirectory.
:type path: string
:arg create: Treat the path as a directory and create
it if its not existing.
:type create: boolean
@ -727,7 +727,7 @@ def user_resource(resource_type, path="", create=False):
:rtype: string
"""
target_path = _user_resource(resource_type, path)
target_path = _user_resource(resource_type, path=path)
if create:
# should always be true.

View File

@ -447,7 +447,7 @@ def path_reference(
"""
import os
is_relative = filepath.startswith("//")
filepath_abs = bpy.path.abspath(filepath, base_src, library)
filepath_abs = bpy.path.abspath(filepath, start=base_src, library=library)
filepath_abs = os.path.normpath(filepath_abs)
if mode in {'ABSOLUTE', 'RELATIVE', 'STRIP'}:

View File

@ -64,7 +64,7 @@ def region_2d_to_vector_3d(region, rv3d, coord):
return view_vector
def region_2d_to_origin_3d(region, rv3d, coord, clamp=None):
def region_2d_to_origin_3d(region, rv3d, coord, *, clamp=None):
"""
Return the 3d view origin from the region relative 2d coords.
@ -167,7 +167,7 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location):
)[0]
def location_3d_to_region_2d(region, rv3d, coord, default=None):
def location_3d_to_region_2d(region, rv3d, coord, *, default=None):
"""
Return the *region* relative 2d location of a 3d position.

View File

@ -150,7 +150,11 @@ class Object(bpy_types.ID):
class WindowManager(bpy_types.ID):
__slots__ = ()
def popup_menu(self, draw_func, title="", icon='NONE'):
def popup_menu(
self, draw_func, *,
title="",
icon='NONE',
):
import bpy
popup = self.popmenu_begin__internal(title, icon=icon)
@ -176,7 +180,11 @@ class WindowManager(bpy_types.ID):
finally:
self.popover_end__internal(popup, keymap=keymap)
def popup_menu_pie(self, event, draw_func, title="", icon='NONE'):
def popup_menu_pie(
self, event, draw_func, *,
title="",
icon='NONE',
):
import bpy
pie = self.piemenu_begin__internal(title, icon=icon, event=event)
@ -392,7 +400,7 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
self.tail = self.head + vec
self.roll = other.roll
def transform(self, matrix, scale=True, roll=True):
def transform(self, matrix, *, scale=True, roll=True):
"""
Transform the the bones head, tail, roll and envelope
(when the matrix has a scale component).
@ -739,7 +747,7 @@ class Operator(StructRNA, metaclass=RNAMeta):
return delattr(properties, attr)
return super().__delattr__(attr)
def as_keywords(self, ignore=()):
def as_keywords(self, *, ignore=()):
"""Return a copy of the properties as a dictionary"""
ignore = ignore + ("rna_type",)
return {attr: getattr(self, attr)

View File

@ -86,7 +86,7 @@ def get_doc(obj):
return result and RE_EMPTY_LINE.sub('', result.rstrip()) or ''
def get_argspec(func, strip_self=True, doc=None, source=None):
def get_argspec(func, *, strip_self=True, doc=None, source=None):
"""Get argument specifications.
:param strip_self: strip `self` from argspec

View File

@ -143,7 +143,7 @@ def complete(line):
"""
import inspect
def try_import(mod, only_modules=False):
def try_import(mod, *, only_modules=False):
def is_importable(module, attr):
if only_modules:
@ -184,7 +184,7 @@ def complete(line):
mod = words[1].split('.')
if len(mod) < 2:
return filter_prefix(get_root_modules(), words[-1])
completion_list = try_import('.'.join(mod[:-1]), True)
completion_list = try_import('.'.join(mod[:-1]), only_modules=True)
completion_list = ['.'.join(mod[:-1] + [el]) for el in completion_list]
return filter_prefix(completion_list, words[-1])
if len(words) >= 3 and words[0] == 'from':

View File

@ -62,7 +62,7 @@ def complete_names(word, namespace):
return sorted(set(completer.matches))
def complete_indices(word, namespace, obj=None, base=None):
def complete_indices(word, namespace, *, obj=None, base=None):
"""Complete a list or dictionary with its indices:
* integer numbers for list
@ -117,7 +117,7 @@ def complete_indices(word, namespace, obj=None, base=None):
return matches
def complete(word, namespace, private=True):
def complete(word, namespace, *, private=True):
"""Complete word within a namespace with the standard rlcompleter
module. Also supports index or key access [].
@ -191,7 +191,7 @@ def complete(word, namespace, private=True):
# an extra char '[', '(' or '.' will be added
if hasattr(obj, '__getitem__') and not is_struct_seq(obj):
# list or dictionary
matches = complete_indices(word, namespace, obj)
matches = complete_indices(word, namespace, obj=obj)
elif hasattr(obj, '__call__'):
# callables
matches = [word + '(']

View File

@ -87,7 +87,7 @@ def complete(line, cursor, namespace, private):
matches.sort()
else:
from . import complete_namespace
matches = complete_namespace.complete(word, namespace, private)
matches = complete_namespace.complete(word, namespace, private=private)
else:
# for now we don't have completers for strings
# TODO: add file auto completer for strings
@ -96,7 +96,7 @@ def complete(line, cursor, namespace, private):
return matches, word
def expand(line, cursor, namespace, private=True):
def expand(line, cursor, namespace, *, private=True):
"""This method is invoked when the user asks autocompletion,
e.g. when Ctrl+Space is clicked.
@ -150,5 +150,5 @@ def expand(line, cursor, namespace, private=True):
line = line[:cursor] + prefix + line[cursor:]
cursor += len(prefix.encode('utf-8'))
if no_calltip and prefix.endswith('('):
return expand(line, cursor, namespace, private)
return expand(line, cursor, namespace, private=private)
return line, cursor, scrollback

View File

@ -21,7 +21,7 @@ __all__ = (
)
def batch_for_shader(shader, type, content, indices=None):
def batch_for_shader(shader, type, content, *, indices=None):
"""
Return a batch already configured and compatible with the shader.

View File

@ -16,7 +16,7 @@
#
# ***** END GPL LICENSE BLOCK *****
def draw_circle_2d(position, color, radius, segments=32):
def draw_circle_2d(position, color, radius, *, segments=32):
"""
Draw a circle.

View File

@ -25,7 +25,7 @@ class NodeCategory:
def poll(cls, _context):
return True
def __init__(self, identifier, name, description="", items=None):
def __init__(self, identifier, name, *, description="", items=None):
self.identifier = identifier
self.name = name
self.description = description
@ -43,7 +43,7 @@ class NodeCategory:
class NodeItem:
def __init__(self, nodetype, label=None, settings=None, poll=None):
def __init__(self, nodetype, *, label=None, settings=None, poll=None):
if settings is None:
settings = {}
@ -92,7 +92,7 @@ class NodeItem:
class NodeItemCustom:
def __init__(self, poll=None, draw=None):
def __init__(self, *, poll=None, draw=None):
self.poll = poll
self.draw = draw

View File

@ -30,7 +30,7 @@ ARRAY_TYPES = (list, tuple, IDPropertyArray, Vector)
MAX_DISPLAY_ROWS = 4
def rna_idprop_ui_get(item, create=True):
def rna_idprop_ui_get(item, *, create=True):
try:
return item['_RNA_UI']
except:
@ -59,9 +59,9 @@ def rna_idprop_ui_prop_update(item, prop):
prop_rna.update()
def rna_idprop_ui_prop_get(item, prop, create=True):
def rna_idprop_ui_prop_get(item, prop, *, create=True):
rna_ui = rna_idprop_ui_get(item, create)
rna_ui = rna_idprop_ui_get(item, create=create)
if rna_ui is None:
return None
@ -73,8 +73,8 @@ def rna_idprop_ui_prop_get(item, prop, create=True):
return rna_ui[prop]
def rna_idprop_ui_prop_clear(item, prop, remove=True):
rna_ui = rna_idprop_ui_get(item, False)
def rna_idprop_ui_prop_clear(item, prop, *, remove=True):
rna_ui = rna_idprop_ui_get(item, create=False)
if rna_ui is None:
return
@ -143,7 +143,7 @@ def rna_idprop_ui_prop_default_set(item, prop, value):
pass
if defvalue:
rna_ui = rna_idprop_ui_prop_get(item, prop, True)
rna_ui = rna_idprop_ui_prop_get(item, prop, create=True)
rna_ui["default"] = defvalue
else:
rna_ui = rna_idprop_ui_prop_get(item, prop)
@ -181,7 +181,7 @@ def rna_idprop_ui_create(
rna_idprop_ui_prop_update(item, prop)
# Clear the UI settings
rna_ui_group = rna_idprop_ui_get(item, True)
rna_ui_group = rna_idprop_ui_get(item, create=True)
rna_ui_group[prop] = {}
rna_ui = rna_ui_group[prop]
@ -210,7 +210,7 @@ def rna_idprop_ui_create(
return rna_ui
def draw(layout, context, context_member, property_type, use_edit=True):
def draw(layout, context, context_member, property_type, *, use_edit=True):
def assign_props(prop, val, key):
prop.data_path = context_member

View File

@ -245,9 +245,10 @@ def rna2xml(
fw("%s</%s>\n" % (root_ident, root_node))
def xml2rna(root_xml,
root_rna=None, # must be set
):
def xml2rna(
root_xml, *,
root_rna=None, # must be set
):
def rna2xml_node(xml_node, value):
# print("evaluating:", xml_node.nodeName)
@ -394,7 +395,7 @@ def xml_file_run(context, filepath, rna_map):
xml2rna(xml_node, root_rna=value)
def xml_file_write(context, filepath, rna_map, skip_typemap=None):
def xml_file_write(context, filepath, rna_map, *, skip_typemap=None):
file = open(filepath, "w", encoding="utf-8")
fw = file.write

View File

@ -219,7 +219,7 @@ class MeshSelectNext(Operator):
if find_adjacent.select_next(bm, self.report):
bm.select_flush_mode()
bmesh.update_edit_mesh(me, False)
bmesh.update_edit_mesh(me, loop_triangles=False)
return {'FINISHED'}
@ -244,7 +244,7 @@ class MeshSelectPrev(Operator):
if find_adjacent.select_prev(bm, self.report):
bm.select_flush_mode()
bmesh.update_edit_mesh(me, False)
bmesh.update_edit_mesh(me, loop_triangles=False)
return {'FINISHED'}

View File

@ -114,9 +114,7 @@ class AddPresetBase:
filename = self.as_filename(name)
target_path = os.path.join("presets", self.preset_subdir)
target_path = bpy.utils.user_resource('SCRIPTS',
target_path,
create=True)
target_path = bpy.utils.user_resource('SCRIPTS', path=target_path, create=True)
if not target_path:
self.report({'WARNING'}, "Failed to create presets path")

View File

@ -90,7 +90,7 @@ class PREFERENCES_OT_copy_prev(Operator):
@classmethod
def _old_version_path(cls, version):
return bpy.utils.resource_path('USER', version[0], version[1])
return bpy.utils.resource_path('USER', major=version[0], minor=version[1])
@classmethod
def previous_version(cls):
@ -226,7 +226,11 @@ class PREFERENCES_OT_keyconfig_import(Operator):
config_name = basename(self.filepath)
path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", "keyconfig"), create=True)
path = bpy.utils.user_resource(
'SCRIPTS',
path=os.path.join("presets", "keyconfig"),
create=True,
)
path = os.path.join(path, config_name)
try:
@ -529,7 +533,11 @@ class PREFERENCES_OT_theme_install(Operator):
xmlfile = self.filepath
path_themes = bpy.utils.user_resource('SCRIPTS', "presets/interface_theme", create=True)
path_themes = bpy.utils.user_resource(
'SCRIPTS',
path=os.path.join("presets", "interface_theme"),
create=True,
)
if not path_themes:
self.report({'ERROR'}, "Failed to get themes path")
@ -622,8 +630,8 @@ class PREFERENCES_OT_addon_install(Operator):
pyfile = self.filepath
if self.target == 'DEFAULT':
# don't use bpy.utils.script_paths("addons") because we may not be able to write to it.
path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True)
# Don't use `bpy.utils.script_paths(path="addons")` because we may not be able to write to it.
path_addons = bpy.utils.user_resource('SCRIPTS', path="addons", create=True)
else:
path_addons = context.preferences.filepaths.script_directory
if path_addons:
@ -882,7 +890,8 @@ class PREFERENCES_OT_app_template_install(Operator):
filepath = self.filepath
path_app_templates = bpy.utils.user_resource(
'SCRIPTS', os.path.join("startup", "bl_app_templates_user"),
'SCRIPTS',
path=os.path.join("startup", "bl_app_templates_user"),
create=True,
)
@ -988,7 +997,7 @@ class PREFERENCES_OT_studiolight_install(Operator):
prefs = context.preferences
path_studiolights = os.path.join("studiolights", self.type.lower())
path_studiolights = bpy.utils.user_resource('DATAFILES', path_studiolights, create=True)
path_studiolights = bpy.utils.user_resource('DATAFILES', path=path_studiolights, create=True)
if not path_studiolights:
self.report({'ERROR'}, "Failed to create Studio Light path")
return {'CANCELLED'}
@ -1034,7 +1043,11 @@ class PREFERENCES_OT_studiolight_new(Operator):
wm = context.window_manager
filename = bpy.path.ensure_ext(self.filename, ".sl")
path_studiolights = bpy.utils.user_resource('DATAFILES', os.path.join("studiolights", "studio"), create=True)
path_studiolights = bpy.utils.user_resource(
'DATAFILES',
path=os.path.join("studiolights", "studio"),
create=True,
)
if not path_studiolights:
self.report({'ERROR'}, "Failed to get Studio Light path")
return {'CANCELLED'}

View File

@ -223,7 +223,7 @@ def extend(obj, EXTEND_MODE):
for f_triple in walk_face(f_act):
apply_uv(*f_triple)
bmesh.update_edit_mesh(me, False)
bmesh.update_edit_mesh(me, loop_triangles=False)
return STATUS_OK

View File

@ -1100,7 +1100,7 @@ class WM_OT_path_open(Operator):
return {'FINISHED'}
def _wm_doc_get_id(doc_id, do_url=True, url_prefix="", report=None):
def _wm_doc_get_id(doc_id, *, do_url=True, url_prefix="", report=None):
def operator_exists_pair(a, b):
# Not fast, this is only for docs.
@ -1190,7 +1190,7 @@ class WM_OT_doc_view_manual(Operator):
doc_id: doc_id
@staticmethod
def _find_reference(rna_id, url_mapping, verbose=True):
def _find_reference(rna_id, url_mapping, *, verbose=True):
if verbose:
print("online manual check for: '%s'... " % rna_id)
from fnmatch import fnmatchcase
@ -1526,7 +1526,7 @@ class WM_OT_properties_edit(Operator):
self.default = ""
# setup defaults
prop_ui = rna_idprop_ui_prop_get(item, prop, False) # don't create
prop_ui = rna_idprop_ui_prop_get(item, prop, create=False)
if prop_ui:
self.min = prop_ui.get("min", -1000000000)
self.max = prop_ui.get("max", 1000000000)
@ -1910,7 +1910,7 @@ class WM_OT_toolbar(Operator):
return context.space_data is not None
@staticmethod
def keymap_from_toolbar(context, space_type, use_fallback_keys=True, use_reset=True):
def keymap_from_toolbar(context, space_type, *, use_fallback_keys=True, use_reset=True):
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
from bl_keymap_utils import keymap_from_toolbar
@ -2211,7 +2211,7 @@ class WM_OT_batch_rename(Operator):
actions: CollectionProperty(type=BatchRenameAction)
@staticmethod
def _data_from_context(context, data_type, only_selected, check_context=False):
def _data_from_context(context, data_type, only_selected, *, check_context=False):
mode = context.mode
scene = context.scene

View File

@ -284,7 +284,7 @@ class TEXT_MT_templates_py(Menu):
def draw(self, _context):
self.path_menu(
bpy.utils.script_paths("templates_py"),
bpy.utils.script_paths(subdir="templates_py"),
"text.open",
props_default={"internal": True},
filter_ext=lambda ext: (ext.lower() == ".py")
@ -296,7 +296,7 @@ class TEXT_MT_templates_osl(Menu):
def draw(self, _context):
self.path_menu(
bpy.utils.script_paths("templates_osl"),
bpy.utils.script_paths(subdir="templates_osl"),
"text.open",
props_default={"internal": True},
filter_ext=lambda ext: (ext.lower() == ".osl")

View File

@ -218,7 +218,7 @@ class ToolSelectPanelHelper:
assert(type(icon_name) is str)
icon_value = _icon_cache.get(icon_name)
if icon_value is None:
dirname = bpy.utils.system_resource('DATAFILES', "icons")
dirname = bpy.utils.system_resource('DATAFILES', path="icons")
filename = os.path.join(dirname, icon_name + ".dat")
try:
icon_value = bpy.app.icons.new_triangles_from_file(filename)

View File

@ -434,7 +434,7 @@ class _defs_view3d_select:
from gpu_extras.presets import draw_circle_2d
props = tool.operator_properties("view3d.select_circle")
radius = props.radius
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
return dict(
idname="builtin.select_circle",
@ -1813,7 +1813,7 @@ class _defs_image_uv_select:
from gpu_extras.presets import draw_circle_2d
props = tool.operator_properties("uv.select_circle")
radius = props.radius
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
return dict(
idname="builtin.select_circle",
@ -1858,7 +1858,7 @@ class _defs_image_uv_sculpt:
if brush is None:
return
radius = brush.size
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
return generate_from_enum_ex(
context,
@ -2150,7 +2150,7 @@ class _defs_gpencil_edit:
from gpu_extras.presets import draw_circle_2d
props = tool.operator_properties("gpencil.select_circle")
radius = props.radius
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
return dict(
idname="builtin.select_circle",
@ -2372,7 +2372,7 @@ class _defs_node_select:
from gpu_extras.presets import draw_circle_2d
props = tool.operator_properties("node.select_circle")
radius = props.radius
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
return dict(
idname="builtin.select_circle",

View File

@ -1815,7 +1815,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
addon_user_dirs = tuple(
p for p in (
os.path.join(prefs.filepaths.script_directory, "addons"),
bpy.utils.user_resource('SCRIPTS', "addons"),
bpy.utils.user_resource('SCRIPTS', path="addons"),
)
if p
)

View File

@ -7002,7 +7002,7 @@ class VIEW3D_PT_context_properties(Panel):
if member:
# Draw with no edit button
rna_prop_ui.draw(self.layout, context, member, object, False)
rna_prop_ui.draw(self.layout, context, member, object, use_edit=False)
# Grease Pencil Object - Multiframe falloff tools

View File

@ -34,7 +34,7 @@ class SortedNodeCategory(NodeCategory):
if isinstance(items, list):
items = sorted(items, key=lambda item: item.label.lower())
super().__init__(identifier, name, description, items)
super().__init__(identifier, name, description=description, items=items)
class CompositorNodeCategory(SortedNodeCategory):

View File

@ -20,4 +20,4 @@ for v in bm.verts:
# Show the updates in the viewport
# and recalculate n-gon tessellation.
bmesh.update_edit_mesh(me, True)
bmesh.update_edit_mesh(me, loop_triangles=True)

View File

@ -125,7 +125,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"O|O&O&:update_edit_mesh",
"O|$O&O&:update_edit_mesh",
(char **)kwlist,
&py_me,
PyC_ParseBool,

View File

@ -1103,7 +1103,7 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"OO|O&O&:from_object",
"OO|$O&O&:from_object",
(char **)kwlist,
&py_object,
&py_depsgraph,
@ -1204,7 +1204,7 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"O|O&O&i:from_mesh",
"O|$O&O&i:from_mesh",
(char **)kwlist,
&py_mesh,
PyC_ParseBool,
@ -1304,7 +1304,7 @@ static PyObject *bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"O!|O!:transform",
"O!|$O!:transform",
(char **)kwlist,
&matrix_Type,
&mat,
@ -1366,7 +1366,7 @@ static PyObject *bpy_bmesh_calc_volume(BPy_BMElem *self, PyObject *args, PyObjec
BPY_BM_CHECK_OBJ(self);
if (!PyArg_ParseTupleAndKeywords(
args, kw, "|O!:calc_volume", (char **)kwlist, &PyBool_Type, &is_signed)) {
args, kw, "|$O!:calc_volume", (char **)kwlist, &PyBool_Type, &is_signed)) {
return NULL;
}
@ -1858,7 +1858,7 @@ static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"|O&O&:BMFace.copy",
"|$O&O&:BMFace.copy",
(char **)kwlist,
PyC_ParseBool,
&do_verts,
@ -2654,7 +2654,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
if (args != NULL) {
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"|OO&:BMElemSeq.sort",
"|$OO&:BMElemSeq.sort",
(char **)kwlist,
&keyfunc,
PyC_ParseBool,

View File

@ -450,7 +450,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"O!O!O!|OO&O!:face_split",
"O!O!O!|$OO&O!:face_split",
(char **)kwlist,
&BPy_BMFace_Type,
&py_face,

View File

@ -106,7 +106,7 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw)
struct PyC_StringEnum method = {method_items, FAST};
static const char *_keywords[] = {"size", "method", NULL};
static _PyArg_Parser _parser = {"(ii)|O&:resize", _keywords, 0};
static _PyArg_Parser _parser = {"(ii)|$O&:resize", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &size[0], &size[1], PyC_ParseStringEnum, &method)) {
return NULL;
@ -510,7 +510,7 @@ static PyObject *M_imbuf_write(PyObject *UNUSED(self), PyObject *args, PyObject
const char *filepath = NULL;
static const char *_keywords[] = {"image", "filepath", NULL};
static _PyArg_Parser _parser = {"O!|s:write", _keywords, 0};
static _PyArg_Parser _parser = {"O!|$s:write", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &Py_ImBuf_Type, &py_imb, &filepath)) {
return NULL;
}

View File

@ -194,7 +194,7 @@ static PyObject *pygpu_offscreen_unbind(BPyGPUOffScreen *self, PyObject *args, P
BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
static const char *_keywords[] = {"restore", NULL};
static _PyArg_Parser _parser = {"|O&:unbind", _keywords, 0};
static _PyArg_Parser _parser = {"|$O&:unbind", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, PyC_ParseBool, &restore)) {
return NULL;
}

View File

@ -118,7 +118,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
bool local = false;
static const char *_keywords[] = {"absolute", "packed", "local", NULL};
static _PyArg_Parser _parser = {"|O&O&O&:blend_paths", _keywords, 0};
static _PyArg_Parser _parser = {"|$O&O&O&:blend_paths", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args,
kw,
&_parser,
@ -164,8 +164,8 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
const char *path;
static const char *_keywords[] = {"type", "subdir", NULL};
static _PyArg_Parser _parser = {"O&|s:user_resource", _keywords, 0};
static const char *_keywords[] = {"type", "path", NULL};
static _PyArg_Parser _parser = {"O&|$s:user_resource", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, PyC_ParseStringEnum, &type, &subdir)) {
return NULL;
}
@ -201,7 +201,7 @@ static PyObject *bpy_system_resource(PyObject *UNUSED(self), PyObject *args, PyO
const char *path;
static const char *_keywords[] = {"type", "path", NULL};
static _PyArg_Parser _parser = {"O&|s:system_resource", _keywords, 0};
static _PyArg_Parser _parser = {"O&|$s:system_resource", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, PyC_ParseStringEnum, &type, &subdir)) {
return NULL;
}
@ -239,7 +239,7 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
const char *path;
static const char *_keywords[] = {"type", "major", "minor", NULL};
static _PyArg_Parser _parser = {"O&|ii:resource_path", _keywords, 0};
static _PyArg_Parser _parser = {"O&|$ii:resource_path", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, PyC_ParseStringEnum, &type, &major, &minor)) {
return NULL;

View File

@ -195,7 +195,7 @@ static PyObject *bpy_lib_load(BPy_PropertyRNA *self, PyObject *args, PyObject *k
bool is_rel = false, is_link = false, use_assets_only = false;
static const char *_keywords[] = {"filepath", "link", "relative", "assets_only", NULL};
static _PyArg_Parser _parser = {"s|O&O&O&:load", _keywords, 0};
static _PyArg_Parser _parser = {"s|$O&O&O&:load", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args,
kw,
&_parser,

View File

@ -245,7 +245,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
"options",
NULL,
};
static _PyArg_Parser _parser = {"OOO!O|O!:subscribe_rna", _keywords, 0};
static _PyArg_Parser _parser = {"OOO!O|$O!:subscribe_rna", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args,
kw,
&_parser,

View File

@ -324,7 +324,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
if (pyrna_struct_keyframe_parse(&self->ptr,
args,
kw,
"s|ifsO!:bpy_struct.keyframe_insert()",
"s|$ifsO!:bpy_struct.keyframe_insert()",
"bpy_struct.keyframe_insert()",
&path_full,
&index,
@ -443,7 +443,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
if (pyrna_struct_keyframe_parse(&self->ptr,
args,
kw,
"s|ifsO!:bpy_struct.keyframe_delete()",
"s|$ifsO!:bpy_struct.keyframe_delete()",
"bpy_struct.keyframe_insert()",
&path_full,
&index,

View File

@ -171,7 +171,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
IDUserMapData data_cb = {NULL};
static const char *_keywords[] = {"subset", "key_types", "value_types", NULL};
static _PyArg_Parser _parser = {"|O$O!O!:user_map", _keywords, 0};
static _PyArg_Parser _parser = {"|$OO!O!:user_map", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, &subset, &PySet_Type, &key_types, &PySet_Type, &val_types)) {
return NULL;

View File

@ -183,7 +183,7 @@ static PyObject *bpyunits_to_value(PyObject *UNUSED(self), PyObject *args, PyObj
"str_ref_unit",
NULL,
};
static _PyArg_Parser _parser = {"sss#|z:to_value", _keywords, 0};
static _PyArg_Parser _parser = {"sss#|$z:to_value", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &usys_str, &ucat_str, &inpt, &str_len, &uref)) {
return NULL;
@ -260,7 +260,7 @@ static PyObject *bpyunits_to_string(PyObject *UNUSED(self), PyObject *args, PyOb
"compatible_unit",
NULL,
};
static _PyArg_Parser _parser = {"ssd|iO&O&:to_string", _keywords, 0};
static _PyArg_Parser _parser = {"ssd|$iO&O&:to_string", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args,
kw,
&_parser,

View File

@ -222,7 +222,7 @@ static PyObject *py_kdtree_find(PyKDTree *self, PyObject *args, PyObject *kwargs
const char *keywords[] = {"co", "filter", NULL};
if (!PyArg_ParseTupleAndKeywords(
args, kwargs, "O|O:find", (char **)keywords, &py_co, &py_filter)) {
args, kwargs, "O|$O:find", (char **)keywords, &py_co, &py_filter)) {
return NULL;
}

View File

@ -59,7 +59,8 @@ def _init_addon_blacklist():
def addon_modules_sorted():
modules = addon_utils.modules({})
# Pass in an empty module cache to prevent `addon_utils` local module cache being manipulated.
modules = addon_utils.modules(module_cache={})
modules[:] = [
mod for mod in modules
if not (mod.__file__.startswith(BLACKLIST_DIRS))

View File

@ -26,12 +26,12 @@ class TestBpyPath(unittest.TestCase):
self.assertEqual(ensure_ext('', ''), '')
self.assertEqual(ensure_ext('', '.blend'), '.blend')
# Test case-sensitive behaviour.
self.assertEqual(ensure_ext('demo', '.blend', True), 'demo.blend')
self.assertEqual(ensure_ext('demo.BLEND', '.blend', True), 'demo.BLEND.blend')
self.assertEqual(ensure_ext('demo', 'Blend', True), 'demoBlend')
self.assertEqual(ensure_ext('demoBlend', 'blend', True), 'demoBlendblend')
self.assertEqual(ensure_ext('demo', '', True), 'demo')
# Test case-sensitive behavior.
self.assertEqual(ensure_ext('demo', '.blend', case_sensitive=True), 'demo.blend')
self.assertEqual(ensure_ext('demo.BLEND', '.blend', case_sensitive=True), 'demo.BLEND.blend')
self.assertEqual(ensure_ext('demo', 'Blend', case_sensitive=True), 'demoBlend')
self.assertEqual(ensure_ext('demoBlend', 'blend', case_sensitive=True), 'demoBlendblend')
self.assertEqual(ensure_ext('demo', '', case_sensitive=True), 'demo')
if __name__ == '__main__':