3ec09f7296
PiperOrigin-RevId: 868229512 Change-Id: I790bc08fc8b0745583a2f92d9ee2c5a19ba558ea
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
# Copyright 2026 DeepMind Technologies Limited
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
# ==============================================================================
|
|
"""Group report section that contains multiple child sections."""
|
|
|
|
from typing import Any
|
|
|
|
from mujoco.sysid.report.sections.base import ReportSection
|
|
|
|
|
|
class GroupSection(ReportSection):
|
|
"""A report section that groups multiple other sections together."""
|
|
|
|
def __init__(
|
|
self,
|
|
title: str,
|
|
sections: list[ReportSection],
|
|
anchor: str = "",
|
|
collapsible: bool = True,
|
|
):
|
|
super().__init__(collapsible=collapsible)
|
|
self._title = title
|
|
self.sections = sections
|
|
self._anchor = anchor
|
|
|
|
@property
|
|
def title(self) -> str:
|
|
return self._title
|
|
|
|
@property
|
|
def anchor(self) -> str:
|
|
return self._anchor
|
|
|
|
@property
|
|
def template_filename(self) -> str:
|
|
return "group.html"
|
|
|
|
def header_includes(self) -> set[str]:
|
|
includes = set()
|
|
for section in self.sections:
|
|
includes.update(section.header_includes())
|
|
return includes
|
|
|
|
def get_context(self) -> dict[str, Any]:
|
|
return {
|
|
"title": self.title,
|
|
"anchor": self.anchor,
|
|
}
|