Skip to content

nbautoexport.sentinel

ExportFormat (str, Enum)

An enumeration.

Source code in nbautoexport/sentinel.py
class ExportFormat(str, Enum):
    asciidoc = "asciidoc"
    html = "html"
    latex = "latex"
    markdown = "markdown"
    notebook = "notebook"
    pdf = "pdf"
    rst = "rst"
    script = "script"
    slides = "slides"

    @classmethod
    def has_value(cls, value: str) -> bool:
        return any(level for level in cls if level.value == value)

OrganizeBy (str, Enum)

An enumeration.

Source code in nbautoexport/sentinel.py
class OrganizeBy(str, Enum):
    notebook = "notebook"
    extension = "extension"

install_sentinel(directory, config, overwrite)

Writes the configuration file to a specified directory.

Source code in nbautoexport/sentinel.py
def install_sentinel(directory: Path, config: NbAutoexportConfig, overwrite: bool):
    """Writes the configuration file to a specified directory."""
    sentinel_path = directory / SAVE_PROGRESS_INDICATOR_FILE

    if sentinel_path.exists() and (not overwrite):
        raise FileExistsError(
            f"""Detected existing autoexport configuration at {sentinel_path}. """
            """If you wish to overwrite, use the --overwrite flag."""
        )
    else:
        logger.info(f"Creating configuration file at {sentinel_path}")
        logger.info(f"\n{config.json(indent=2)}")
        with sentinel_path.open("w", encoding="utf-8") as fp:
            fp.write(config.json(indent=2))
Back to top