MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / _section_from_path

Function _section_from_path

Scripts/emit_docs.py:158–177  ·  view source on GitHub ↗

Derive the docs section label directly from the source relative_path. Strips the leading 'Mujoco/' prefix and the filename, then joins remaining folders. e.g. 'Mujoco/Components/Geometry/MjGeom.h' → 'Components/Geometry' 'Mujoco/Core/MjArticulation.h' → 'Core'

(rel_path: str)

Source from the content-addressed store, hash-verified

156
157
158def _section_from_path(rel_path: str) -> str:
159 """
160 Derive the docs section label directly from the source relative_path.
161 Strips the leading 'Mujoco/' prefix and the filename, then joins remaining folders.
162 e.g. 'Mujoco/Components/Geometry/MjGeom.h''Components/Geometry'
163 'Mujoco/Core/MjArticulation.h''Core'
164 'URLabGameMode.h''Other'
165 """
166 parts = rel_path.replace('\\', '/').split('/')
167 # Drop filename (last element)
168 folders = parts[:-1]
169 # Strip leading 'Mujoco' folder
170 if folders and folders[0].lower() == 'mujoco':
171 folders = folders[1:]
172 # Strip leading 'Public' if present
173 if folders and folders[0].lower() == 'public':
174 folders = folders[1:]
175 if not folders:
176 return 'Other'
177 return '/'.join(folders)
178
179
180def _safe_folder(section: str) -> str:

Callers 1

emit_docsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected