MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / format_notices

Function format_notices

scripts/generate_third_party_notices.py:182–238  ·  view source on GitHub ↗

Format the complete THIRD-PARTY-NOTICES file.

(
    rust_groups: list[dict],
    python_packages: list[dict],
)

Source from the content-addressed store, hash-verified

180
181
182def format_notices(
183 rust_groups: list[dict],
184 python_packages: list[dict],
185) -> str:
186 """Format the complete THIRD-PARTY-NOTICES file."""
187 lines: list[str] = [
188 "THIRD-PARTY SOFTWARE NOTICES AND INFORMATION",
189 "",
190 "This product includes third-party software components. The following",
191 "notices and licenses are provided in compliance with the terms of the",
192 "respective licenses.",
193 "",
194 "To regenerate: mise run notices",
195 "",
196 ]
197
198 # --- Rust section ---
199 if rust_groups:
200 rust_crate_count = sum(len(g["crates"]) for g in rust_groups)
201 lines.append(SEPARATOR)
202 lines.append(f"Rust Dependencies ({rust_crate_count} packages)")
203 lines.append(SEPARATOR)
204 lines.append("")
205
206 for group in rust_groups:
207 lines.append(SEPARATOR)
208 lines.append(f"License: {group['id']}")
209 lines.append(THIN_SEP)
210 lines.append("")
211 lines.append("Used by:")
212 for crate in group["crates"]:
213 repo = f" ({crate['repository']})" if crate["repository"] else ""
214 lines.append(f" - {crate['name']} {crate['version']}{repo}")
215 lines.append("")
216
217 if group["text"]:
218 lines.append(group["text"])
219 lines.append("")
220
221 # --- Python section ---
222 if python_packages:
223 lines.append(SEPARATOR)
224 lines.append(f"Python Dependencies ({len(python_packages)} packages)")
225 lines.append(SEPARATOR)
226 lines.append("")
227
228 for pkg in python_packages:
229 lines.append(SEPARATOR)
230 lines.append(f"{pkg['name']} {pkg['version']}")
231 lines.append(f"License: {pkg['license_id']}")
232 lines.append(THIN_SEP)
233 lines.append("")
234 if pkg["text"]:
235 lines.append(pkg["text"])
236 lines.append("")
237
238 return "\n".join(lines)
239

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected