🤖 implement copilot suggestions

This commit is contained in:
Ondrej Samohel 2025-11-27 10:56:02 +01:00
parent 1f88b0031d
commit 67364633f0
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
3 changed files with 24 additions and 24 deletions

View file

@ -758,18 +758,6 @@ class CreateContext:
"Skipping abstract Creator '%s'", str(creator_class)
)
for creator_class in report.plugins:
if not creator_class.product_base_type:
message = (f"Provided creator {creator_class!r} doesn't have "
"product base type attribute defined. This will be "
"required in future.")
warn(
message,
DeprecationWarning,
stacklevel=2
)
self.log.warning(message)
creator_identifier = creator_class.identifier
if creator_identifier in creators:
self.log.warning(
@ -783,19 +771,17 @@ class CreateContext:
creator_class.host_name
and creator_class.host_name != self.host_name
):
self.log.info((
"Creator's host name \"{}\""
" is not supported for current host \"{}\""
).format(creator_class.host_name, self.host_name))
self.log.info(
(
'Creator\'s host name "{}"'
' is not supported for current host "{}"'
).format(creator_class.host_name, self.host_name)
)
continue
# TODO report initialization error
try:
creator = creator_class(
project_settings,
self,
self.headless
)
creator = creator_class(project_settings, self, self.headless)
except Exception:
self.log.error(
f"Failed to initialize plugin: {creator_class}",
@ -803,6 +789,19 @@ class CreateContext:
)
continue
if not creator.product_base_type:
message = (
f"Provided creator {creator!r} doesn't have "
"product base type attribute defined. This will be "
"required in future."
)
warn(
message,
DeprecationWarning,
stacklevel=2
)
self.log.warning(message)
if not creator.enabled:
disabled_creators[creator_identifier] = creator
continue

View file

@ -290,7 +290,8 @@ class BaseCreator(ABC):
def identifier(self):
"""Identifier of creator (must be unique).
Default implementation returns plugin's product type.
Default implementation returns plugin's product base type, or falls back
to product type if product base type is not set.
"""
identifier = self.product_base_type
@ -388,7 +389,7 @@ class BaseCreator(ABC):
product_type (Optional[str]): Product type, object attribute
'product_type' is used if not passed.
product_base_type (Optional[str]): Product base type, object
attribute 'product_type' is used if not passed.
attribute 'product_base_type' is used if not passed.
Returns:
CreatedInstance: Created instance.

View file

@ -197,7 +197,7 @@ def get_product_name(
"task": task_value,
"product": {
"type": product_type,
"baseType": product_base_type or product_type,
"basetype": product_base_type or product_type,
}
}