Source code for fluent_compiler.resource

from __future__ import annotations

from dataclasses import dataclass


[docs] @dataclass class FtlResource: """ Represents an (unparsed) FTL file (contents and optional filename) """ text: str filename: str | None = None
[docs] @classmethod def from_string(cls, text: str) -> FtlResource: return cls(text)
[docs] @classmethod def from_file(cls, filename: str, encoding="utf-8"): with open(filename, "rb") as f: return cls(text=f.read().decode(encoding), filename=filename)