Skip to content
Snippets Groups Projects
Commit 58bcc00c authored by Rajmund Hruška's avatar Rajmund Hruška
Browse files

Feature: Rename _CESNETDict to MentatDict. (Redmine issue: #6800)

parent 987c868c
No related branches found
No related tags found
No related merge requests found
......@@ -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', {})
......
......@@ -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),
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment