Skip to content

Commit

Permalink
undo unnecessary change
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharsadhwani committed Nov 14, 2023
1 parent c3fd6b0 commit ebe2f5f
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions frontmatter/default_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,30 +296,27 @@ def export(self, metadata: dict[str, object], **kwargs: object) -> str:
return u(metadata_str)


class _TOMLHandler(BaseHandler):
"""
Load and export TOML metadata.
By default, split based on ``+++``.
"""
if toml:

FM_BOUNDARY = re.compile(r"^\+{3,}\s*$", re.MULTILINE)
START_DELIMITER = END_DELIMITER = "+++"
class TOMLHandler(BaseHandler):
"""
Load and export TOML metadata.
def load(self, fm: str, **kwargs: object) -> Any:
assert toml is not None
return toml.loads(fm, **kwargs)
By default, split based on ``+++``.
"""

def export(self, metadata: dict[str, object], **kwargs: object) -> str:
"Turn metadata into TOML"
assert toml is not None
metadata_str = toml.dumps(metadata)
return u(metadata_str)
FM_BOUNDARY = re.compile(r"^\+{3,}\s*$", re.MULTILINE)
START_DELIMITER = END_DELIMITER = "+++"

def load(self, fm: str, **kwargs: object) -> Any:
assert toml is not None
return toml.loads(fm, **kwargs)

_TOMLHandler.__name__ = "TOMLHandler"
def export(self, metadata: dict[str, object], **kwargs: object) -> str:
"Turn metadata into TOML"
assert toml is not None
metadata_str = toml.dumps(metadata)
return u(metadata_str)

if toml:
TOMLHandler: Type[_TOMLHandler] | None = _TOMLHandler
else:
TOMLHandler = None
TOMLHandler: Type[TOMLHandler] | None = None # type: ignore[no-redef]

0 comments on commit ebe2f5f

Please sign in to comment.