Skip to content

Commit

Permalink
feat(mrml-python): add initial pyi file
Browse files Browse the repository at this point in the history
Signed-off-by: Jérémie Drouet <[email protected]>
  • Loading branch information
jdrouet committed Apr 20, 2024
1 parent 756a9a0 commit a56fe68
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions packages/mrml-python/mrml.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
from typing import Any, Dict, Optional, Set, Union

class NoopIncludeLoaderOptions:
"""No-operation loader options class, which requires no specific configuration."""

pass

class MemoryIncludeLoaderOptions:
"""MemoryIncludeLoaderOptions stores mappings for in-memory data using a dictionary."""
def __init__(self, data: Dict[str, str]) -> None: ...

class LocalIncludeLoaderOptions:
"""LocalIncludeLoaderOptions configures a loader with a filesystem path."""
def __init__(self, path: str) -> None: ...

class HttpIncludeLoaderOptionsMode:
"""HttpIncludeLoaderOptionsMode is an enumeration for HTTP loader behavior modes."""

Allow: "HttpIncludeLoaderOptionsMode"
Deny: "HttpIncludeLoaderOptionsMode"

class HttpIncludeLoaderOptions:
"""HttpIncludeLoaderOptions defines options for an HTTP include loader, including mode and a list of URLs."""
def __init__(self, mode: HttpIncludeLoaderOptionsMode, list: Set[str]) -> None: ...

class ParserIncludeLoaderOptions:
"""ParserIncludeLoaderOptions is a union type that can represent any type of include loader options."""
def __init__(
self,
loader: Union[
NoopIncludeLoaderOptions,
MemoryIncludeLoaderOptions,
LocalIncludeLoaderOptions,
HttpIncludeLoaderOptions,
],
) -> None: ...
def build(self) -> Any:
"""Build method constructs the actual loader object, might return different types based on the loader configuration."""
...

def noop_loader() -> ParserIncludeLoaderOptions:
"""Factory function to create a no-operation loader."""
...

def memory_loader(data: Optional[Dict[str, str]] = None) -> ParserIncludeLoaderOptions:
"""Factory function to create a memory loader with optional data."""
...

def local_loader(data: Optional[str] = None) -> ParserIncludeLoaderOptions:
"""Factory function to create a local loader, converting a string path to a Path object internally."""
...

def http_loader(
mode: Optional[HttpIncludeLoaderOptionsMode] = None, list: Optional[Set[str]] = None
) -> ParserIncludeLoaderOptions:
"""Factory function to create an HTTP loader with optional mode and list of URLs."""
...

class ParserOptions:
"""ParserOptions configures parser behavior, primarily by specifying the include loader to use."""
def __init__(
self, include_loader: Optional[ParserIncludeLoaderOptions] = None
) -> None: ...

class RenderOptions:
"""RenderOptions configures rendering behavior, including whether to disable comments and how to handle social icons and fonts."""
def __init__(
self,
disable_comments: bool = False,
social_icon_origin: Optional[str] = None,
fonts: Optional[Dict[str, str]] = None,
) -> None: ...

def to_html(
input: str,
parser_options: Optional[ParserOptions] = None,
render_options: Optional[RenderOptions] = None,
) -> str:
"""Function to convert input a MJML string to HTML using optional parser and render configurations."""
...

0 comments on commit a56fe68

Please sign in to comment.