DeprecatedDictConstant
- class omni.graph.tools.DeprecatedDictConstant(name: str, new_value: dict, message: str, deprecation_level: Optional[DeprecationLevel] = None)
Bases:
dict
Class that lets you show a warning or error when attempting to use a deprecated dict constant value.
Usage:
> # Original usage of a dictionary > MY_DICT = {"setting"": True} > print(f"Setting is {MY_DICT['setting']}") Setting is True > # Deprecation declaration > MY_DICT = DeprecatedDictConstant("MY_DICT", {}, "Please delete references to it.") > print(f"Setting is {MY_DICT['setting']}") ERROR: Dictionary constant 'MY_DICT' can no longer be used. Please delete references to it. KeyError: "setting"
Methods
__init__
(name, new_value, message[, ...])Construct a dictionary constant that will print a message if it is used :param name: Name of the dictionary constant.
- __init__(name: str, new_value: dict, message: str, deprecation_level: Optional[DeprecationLevel] = None)
Construct a dictionary constant that will print a message if it is used :param name: Name of the dictionary constant. Should match what was formerly exported as part of the API :param new_value: The value to return if the dictionary is requested :param message: Message to emit if the dictionary is used :param deprecation_level: How serious the deprecation message should be. None means use the default