mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Skip & Log properties with 'None' as default value
This commit is contained in:
parent
2be3257e3c
commit
bcac6c4287
@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import logging
|
||||
from collections.abc import Iterator
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Generic, Type, TypeVar
|
||||
@ -33,6 +34,11 @@ class UnitProperty(Generic[ValueT]):
|
||||
for name, attr in inspect.getmembers(props, inspect.isclass):
|
||||
if name.startswith("__"):
|
||||
continue
|
||||
attr_values = getattr(attr, "Values", None)
|
||||
if attr_values is None and unit_type.property_defaults[name] is None:
|
||||
msg = f"Skipping property '{name}' for '{unit_type.id}': default value is None."
|
||||
logging.warning(msg)
|
||||
continue
|
||||
yield cls.property_from(attr, unit_type.property_defaults[name])
|
||||
|
||||
@classmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user