File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
runtime/chalicelib/send_manager Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ import pathlib
2+ import typing
3+
4+ import chalicelib .send_manager .__interface__ as send_mgr_interface
5+ import chalicelib .util .import_util as import_util
6+
7+ _SendManagerCollectionType = dict [str , send_mgr_interface .SendManagerInterface ]
8+ send_managers : _SendManagerCollectionType = {}
9+
10+ for _path in pathlib .Path (__file__ ).parent .glob ("*.py" ):
11+ if _path .stem .startswith ("__" ) or not (
12+ _patterns := typing .cast (
13+ _SendManagerCollectionType ,
14+ getattr (import_util .load_module (_path ), "send_manager_patterns" , None ),
15+ )
16+ ):
17+ continue
18+
19+ if _duplicated := send_managers .keys () & _patterns .keys ():
20+ raise ValueError (f"Send manager { _duplicated } is already registered" )
21+
22+ send_managers .update (_patterns )
You can’t perform that action at this time.
0 commit comments