Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/PLUGIN_DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ Collect raw output from niccli (Broadcom) and nicctl (Pensando) commands.
- **CMD_NICCLI_DISCOVERY_LEGACY**: `['niccli --listdev', 'niccli --list']`
- **CMD_NICCLI_DISCOVERY_NEW**: `['niccli --list_devices', 'niccli --list']`
- **CMD_NICCLI_DISCOVERY**: `['niccli --listdev', 'niccli --list']`
- **CMD_NICCLI_DISCOVERY_ALL**: `frozenset({'niccli --listdev', 'niccli --list', 'niccli --list_devices'})`
- **CMD_NICCLI_DISCOVERY_ALL**: `frozenset({'niccli --list', 'niccli --list_devices', 'niccli --listdev'})`
- **CMD_NICCLI_SUPPORT_RDMA_TEMPLATE_LEGACY**: `niccli -dev {device_num} nvm -getoption support_rdma -scope 0`
- **CMD_NICCLI_PERFORMANCE_PROFILE_TEMPLATE_LEGACY**: `niccli -dev {device_num} nvm -getoption performance_profile`
- **CMD_NICCLI_PCIE_RELAXED_ORDERING_TEMPLATE_LEGACY**: `niccli -dev {device_num} nvm -getoption pcie_relaxed_ordering`
Expand Down
17 changes: 16 additions & 1 deletion docs/generate_plugin_doc_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,21 @@ def annotations_for_model(model_cls: type) -> List[str]:
return [f"**{k}**: `{format_type_annotation(v)}`" for k, v in anns.items()]


def format_class_var_value(val: Any) -> str:
"""Stable string for docs. set/frozenset repr order depends on PYTHONHASHSEED."""
if isinstance(val, frozenset):
if not val:
return "frozenset()"
items = sorted(val, key=lambda x: (type(x).__name__, repr(x)))
return "frozenset({" + ", ".join(repr(x) for x in items) + "})"
if isinstance(val, set):
if not val:
return "set()"
items = sorted(val, key=lambda x: (type(x).__name__, repr(x)))
return "{" + ", ".join(repr(x) for x in items) + "}"
return str(val)


def class_vars_dump(cls: type, exclude: set) -> List[str]:
ignore = {"abc_impl", "_abc_impl", "__abstractmethods__"}
exclude = set(exclude) | ignore
Expand All @@ -427,7 +442,7 @@ def class_vars_dump(cls: type, exclude: set) -> List[str]:
else:
out.append(f"**{name}**: `{val}`")
else:
out.append(f"**{name}**: `{val}`")
out.append(f"**{name}**: `{format_class_var_value(val)}`")
return out


Expand Down
Loading