22from collections .abc import AsyncGenerator
33from dataclasses import dataclass
44from dataclasses import field
5- from typing import Any
6- from typing import NotRequired
7- from typing import Self
8- from typing import TypedDict
5+ from typing import Any , List , Dict , Optional
96
107import core .logging .logger_constants as log_const
118from core .basic_models .actions .basic_actions import Action
1512from scenarios .user .user_model import User
1613
1714
18- class _ServiceVersionMetadata (TypedDict ):
19- name : str
20- pronounce_as : NotRequired [str ]
21-
22-
23- _VersionType = str | None
15+ _VersionType = Optional [str ]
2416
2517
2618@dataclass
@@ -29,7 +21,7 @@ class ServiceVersions:
2921 dp_static_version : _VersionType = field (metadata = {"name" : "Dialog Policy static" })
3022
3123 @classmethod
32- def init_from_user (cls , user : User ) -> Self :
24+ def init_from_user (cls , user : User ) -> "ServiceVersions" :
3325 return cls (
3426 dp_code_version = user .settings .version .code_version ,
3527 dp_static_version = user .settings .version .static_version ,
@@ -45,10 +37,10 @@ class ShowVersionsAction(Action):
4537 }
4638
4739 async def run (
48- self ,
49- user : User ,
50- text_preprocessing_result : BaseTextPreprocessingResult ,
51- params : dict [ str , Any ] | None = None ,
40+ self ,
41+ user : User ,
42+ text_preprocessing_result : BaseTextPreprocessingResult ,
43+ params : Optional [ Dict [ str , Any ]] = None ,
5244 ) -> AsyncGenerator [Command , None ]:
5345 params = {** (params or {}), ** user .parametrizer .collect (text_preprocessing_result )}
5446
@@ -74,7 +66,7 @@ async def run(
7466 )
7567
7668 @staticmethod
77- def _get_items (versions : ServiceVersions ) -> list [ dict [str , dict [str , str ]]]:
69+ def _get_items (versions : ServiceVersions ) -> List [ Dict [str , Dict [str , str ]]]:
7870 parts = [
7971 f"**Dialog Policy**\n код: { versions .dp_code_version } \n статики: { versions .dp_static_version } \n \n " ,
8072 ]
@@ -102,6 +94,6 @@ def _version_to_ssml(version: str) -> str:
10294 return "bad format"
10395 ssml_groups = [f'<say-as interpret-as="digits">{ gr } </say-as>' for gr in match .groups ()]
10496 return (
105- '<say-as interpret-as="characters">D</say-as>-'
106- + f"{ ssml_groups [0 ]} .{ ssml_groups [1 ]} .{ ssml_groups [2 ]} -{ ssml_groups [3 ]} "
97+ '<say-as interpret-as="characters">D</say-as>-' +
98+ f"{ ssml_groups [0 ]} .{ ssml_groups [1 ]} .{ ssml_groups [2 ]} -{ ssml_groups [3 ]} "
10799 )
0 commit comments