diff --git a/lib/mentat/idea/internal.py b/lib/mentat/idea/internal.py index 48d77f7ff5a46a108e3195e72bcab22f9f6c92e8..641c0803f623becc91655c9b0870cc658b434f88 100644 --- a/lib/mentat/idea/internal.py +++ b/lib/mentat/idea/internal.py @@ -50,12 +50,12 @@ import pynspect.rules import pynspect.compilers -def cesnet_dict_typedef(flavour, list_flavour, errors_list, abuses_list, addon=None): +def mentat_dict_typedef(flavour, list_flavour, errors_list, abuses_list, addon=None): """ Typedef generator helper for easy usage of custom definitions at multiple places. """ - cesnet_def = { + mentat_def = { "InspectionErrors": { "description": "List of event pecularities found during inspection", "type": errors_list @@ -94,17 +94,17 @@ def cesnet_dict_typedef(flavour, list_flavour, errors_list, abuses_list, addon=N } } if addon is not None: - cesnet_def.update(addon) - return cesnet_def + mentat_def.update(addon) + return mentat_def -class CESNETDict(typedcols.TypedDict): # pylint: disable=locally-disabled,too-many-ancestors +class MentatDict(typedcols.TypedDict): # pylint: disable=locally-disabled,too-many-ancestors """ This type definition represents a custom subdictionary under key *_Mentat*/*_CESNET* in message root dictionary. """ allow_unknown = True - typedef = cesnet_dict_typedef( + typedef = mentat_dict_typedef( idea.lite.idea_types, idea.lite.idea_lists, typedcols.typed_list("InspectionErrorsList", str), @@ -112,7 +112,7 @@ class CESNETDict(typedcols.TypedDict): # pylint: disable=locally-disabled,too-m ) -def internal_base_addon_typedef(flavour, list_flavour, cesnet_dict, addon=None): # pylint: disable=locally-disabled,unused-argument +def internal_base_addon_typedef(flavour, list_flavour, mentat_dict, addon=None): # pylint: disable=locally-disabled,unused-argument """ Typedef generator helper for easy usage of custom definitions at multiple places. @@ -128,11 +128,11 @@ def internal_base_addon_typedef(flavour, list_flavour, cesnet_dict, addon=None): }, "_Mentat": { "description": "Custom CESNET/Mentat abominations to IDEA definition", - "type": cesnet_dict + "type": mentat_dict }, "_CESNET": { "description": "Custom CESNET/Mentat abominations to IDEA definition", - "type": cesnet_dict + "type": mentat_dict } } if addon is not None: @@ -161,7 +161,7 @@ class Idea(idea.lite.Idea): # pylint: disable=locally-disabled,too-many-ancesto internal_base_addon_typedef( idea.lite.idea_types, idea.lite.idea_lists, - CESNETDict + MentatDict ) ) @@ -210,7 +210,7 @@ class Idea(idea.lite.Idea): # pylint: disable=locally-disabled,too-many-ancesto :return: The value of _Mentat if present, otherwise the value of _CESNET if present. If neither of those keys exist then empty dictionary is returned. - :rtype: cesnet_dict + :rtype: mentat_dict """ return self.get('_Mentat') if '_Mentat' in self else self.get('_CESNET', {}) diff --git a/lib/mentat/idea/jsondict.py b/lib/mentat/idea/jsondict.py index 5ae144eff28c03c372cd89003b03c568b20e7048..c39c5ca18f8dc18fa09a47291caaac198e5e99f0 100644 --- a/lib/mentat/idea/jsondict.py +++ b/lib/mentat/idea/jsondict.py @@ -166,12 +166,12 @@ class NodeDict(typedcols.TypedDict): # pylint: disable=locally-disabled,too-man allow_unknown = True typedef = idea.base.node_dict_typedef(json_idea_types, json_idea_lists) -class CESNETDict(typedcols.TypedDict): # pylint: disable=locally-disabled,too-many-ancestors +class MentatDict(typedcols.TypedDict): # pylint: disable=locally-disabled,too-many-ancestors """ Typed dictionary representing *_Mentat*/*_CESNET* substructure in IDEA message structure. """ allow_unknown = True - typedef = mentat.idea.internal.cesnet_dict_typedef( + typedef = mentat.idea.internal.mentat_dict_typedef( json_idea_types, json_idea_lists, simplify(typedcols.typed_list("InspectionErrorsList", str)), @@ -187,7 +187,7 @@ class CESNETDict(typedcols.TypedDict): # pylint: disable=locally-disabled,too-m json_idea_addon = mentat.idea.internal.internal_base_addon_typedef( # pylint: disable=locally-disabled,invalid-name json_idea_types, json_idea_lists, - simplify(CESNETDict), + simplify(MentatDict), )