1- from typing import TYPE_CHECKING , Any , Callable , Dict , List , Tuple , Union , cast
1+ from typing import TYPE_CHECKING , Any , Callable , Literal , Union , cast
22
33import babel
44import babel .numbers
55import babel .plural
66from fluent .syntax import ast as FTL
7- from typing_extensions import Literal
87
98from .builtins import BUILTINS
109from .prepare import Compiler
@@ -34,16 +33,16 @@ class FluentBundle:
3433
3534 def __init__ (
3635 self ,
37- locales : List [str ],
38- functions : Union [Dict [str , Callable [..., "FluentType" ]], None ] = None ,
36+ locales : list [str ],
37+ functions : Union [dict [str , Callable [..., "FluentType" ]], None ] = None ,
3938 use_isolating : bool = True ,
4039 ):
4140 self .locales = locales
4241 self ._functions = {** BUILTINS , ** (functions or {})}
4342 self .use_isolating = use_isolating
44- self ._messages : Dict [str , Union [FTL .Message , FTL .Term ]] = {}
45- self ._terms : Dict [str , Union [FTL .Message , FTL .Term ]] = {}
46- self ._compiled : Dict [str , Message ] = {}
43+ self ._messages : dict [str , Union [FTL .Message , FTL .Term ]] = {}
44+ self ._terms : dict [str , Union [FTL .Message , FTL .Term ]] = {}
45+ self ._compiled : dict [str , Message ] = {}
4746 # The compiler is not typed, and this cast is only valid for the public API
4847 self ._compiler = cast (
4948 Callable [[Union [FTL .Message , FTL .Term ]], Message ], Compiler ()
@@ -90,8 +89,8 @@ def _lookup(self, entry_id: str, term: bool = False) -> Message:
9089 return self ._compiled [compiled_id ]
9190
9291 def format_pattern (
93- self , pattern : Pattern , args : Union [Dict [str , Any ], None ] = None
94- ) -> Tuple [Union [str , "FluentNone" ], List [Exception ]]:
92+ self , pattern : Pattern , args : Union [dict [str , Any ], None ] = None
93+ ) -> tuple [Union [str , "FluentNone" ], list [Exception ]]:
9594 if args is not None :
9695 fluent_args = {
9796 argname : native_to_fluent (argvalue )
@@ -100,7 +99,7 @@ def format_pattern(
10099 else :
101100 fluent_args = {}
102101
103- errors : List [Exception ] = []
102+ errors : list [Exception ] = []
104103 env = ResolverEnvironment (
105104 context = self , current = CurrentEnvironment (args = fluent_args ), errors = errors
106105 )
0 commit comments