diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2022-10-04 13:30:04 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2022-10-06 15:34:32 +0200 |
| commit | 9eebf97e3d3fe8bff0d3c5ecdae39f15bd93f40b (patch) | |
| tree | 04b57dbd4183fd0f0b415a022e12cb72e29fdf16 /python/clippy/__init__.py | |
| parent | 53d8bf6d7a233ccc97e0f466374878f2b8e3f657 (diff) | |
lib: make cmd_element->attr a bitmask & clarify
It already "looks" like a bitmask, but we currently can't flag a command
both YANG and HIDDEN at the same time. It really should be a bitmask.
Also clarify DEPRECATED behaviour (or the absence thereof.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'python/clippy/__init__.py')
| -rw-r--r-- | python/clippy/__init__.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/python/clippy/__init__.py b/python/clippy/__init__.py index 344a1c91ee..c356a29d3f 100644 --- a/python/clippy/__init__.py +++ b/python/clippy/__init__.py @@ -17,8 +17,22 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import os, stat + +try: + from enum import IntFlag as _IntFlag +except ImportError: + # python <3.6 + from enum import IntEnum as _IntFlag # type: ignore + import _clippy -from _clippy import parse, Graph, GraphNode +from _clippy import ( + parse, + Graph, + GraphNode, + CMD_ATTR_YANG, + CMD_ATTR_HIDDEN, + CMD_ATTR_DEPRECATED, +) frr_top_src = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -78,3 +92,9 @@ def wrdiff(filename, buf, reffiles=[]): with open(newname, "w") as out: out.write(buf) os.rename(newname, filename) + + +class CmdAttr(_IntFlag): + YANG = CMD_ATTR_YANG + HIDDEN = CMD_ATTR_HIDDEN + DEPRECATED = CMD_ATTR_DEPRECATED |
