1+ from __future__ import annotations
2+
13import json
24import pathlib
35import typing as t
@@ -22,11 +24,11 @@ class ConfigReader:
2224 '{\n "session_name": "my session"\n}'
2325 """
2426
25- def __init__ (self , content : " RawConfigData" ) -> None :
27+ def __init__ (self , content : RawConfigData ) -> None :
2628 self .content = content
2729
2830 @staticmethod
29- def _load (fmt : " FormatLiteral" , content : str ) -> dict [str , t .Any ]:
31+ def _load (fmt : FormatLiteral , content : str ) -> dict [str , t .Any ]:
3032 """Load raw config data and directly return it.
3133
3234 >>> ConfigReader._load("json", '{ "session_name": "my session" }')
@@ -49,7 +51,7 @@ def _load(fmt: "FormatLiteral", content: str) -> dict[str, t.Any]:
4951 raise NotImplementedError (msg )
5052
5153 @classmethod
52- def load (cls , fmt : " FormatLiteral" , content : str ) -> " ConfigReader" :
54+ def load (cls , fmt : FormatLiteral , content : str ) -> ConfigReader :
5355 """Load raw config data into a ConfigReader instance (to dump later).
5456
5557 >>> cfg = ConfigReader.load("json", '{ "session_name": "my session" }')
@@ -118,7 +120,7 @@ def _from_file(cls, path: pathlib.Path) -> dict[str, t.Any]:
118120 )
119121
120122 @classmethod
121- def from_file (cls , path : pathlib .Path ) -> " ConfigReader" :
123+ def from_file (cls , path : pathlib .Path ) -> ConfigReader :
122124 r"""Load data from file path.
123125
124126 **YAML file**
@@ -159,8 +161,8 @@ def from_file(cls, path: pathlib.Path) -> "ConfigReader":
159161
160162 @staticmethod
161163 def _dump (
162- fmt : " FormatLiteral" ,
163- content : " RawConfigData" ,
164+ fmt : FormatLiteral ,
165+ content : RawConfigData ,
164166 indent : int = 2 ,
165167 ** kwargs : t .Any ,
166168 ) -> str :
@@ -187,7 +189,7 @@ def _dump(
187189 msg = f"{ fmt } not supported in config"
188190 raise NotImplementedError (msg )
189191
190- def dump (self , fmt : " FormatLiteral" , indent : int = 2 , ** kwargs : t .Any ) -> str :
192+ def dump (self , fmt : FormatLiteral , indent : int = 2 , ** kwargs : t .Any ) -> str :
191193 r"""Dump via ConfigReader instance.
192194
193195 >>> cfg = ConfigReader({ "session_name": "my session" })
0 commit comments