(path: Path, linenos: bool)
| 104 | |
| 105 | |
| 106 | def _literal_include(path: Path, linenos: bool): |
| 107 | try: |
| 108 | language = { |
| 109 | ".py": "python", |
| 110 | ".js": "javascript", |
| 111 | ".json": "json", |
| 112 | }[path.suffix] |
| 113 | except KeyError: |
| 114 | msg = f"Unknown extension type {path.suffix!r}" |
| 115 | raise ValueError(msg) from None |
| 116 | |
| 117 | return _literal_include_template.format( |
| 118 | name=str(path.relative_to(SOURCE_DIR)), |
| 119 | language=language, |
| 120 | options=_join_options(_get_file_options(path)), |
| 121 | ) |
| 122 | |
| 123 | |
| 124 | def _join_options(option_strings: list[str]) -> str: |
no test coverage detected