Skip to content

settings

Settings

Source code in mkreports/md/settings.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@dataclass
class Settings:
    mkdocs: Dict[str, Any] = field(default_factory=dict)
    page: Dict[str, Any] = field(default_factory=dict)

    def __add__(self, other: "Settings"):
        """
        Merges mkdocs and mkreports.

        For mkdocs, nav will never be merged and an error thrown if attempted.
        """
        if "nav" in self.mkdocs and "nav" in other.mkdocs:
            raise ValueError(
                "Merging of Requirements with 'nav' in mkdocs not supported."
            )
        return Settings(
            mkdocs=merge_settings(self.mkdocs, other.mkdocs),
            page=merge_settings(self.page, other.page),
        )

__add__(other)

Merges mkdocs and mkreports.

For mkdocs, nav will never be merged and an error thrown if attempted.

Source code in mkreports/md/settings.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def __add__(self, other: "Settings"):
    """
    Merges mkdocs and mkreports.

    For mkdocs, nav will never be merged and an error thrown if attempted.
    """
    if "nav" in self.mkdocs and "nav" in other.mkdocs:
        raise ValueError(
            "Merging of Requirements with 'nav' in mkdocs not supported."
        )
    return Settings(
        mkdocs=merge_settings(self.mkdocs, other.mkdocs),
        page=merge_settings(self.page, other.page),
    )

strategy_append_new(config, path, base, nxt)

prepend nxt to base.

Source code in mkreports/md/settings.py
41
42
43
44
def strategy_append_new(config, path, base, nxt):
    """prepend nxt to base."""
    del config, path
    return base + [x for x in nxt if x not in base]