44import shlex
55import subprocess
66import sys
7- from typing import Any , ClassVar , Dict , List , NamedTuple , Optional , Tuple
7+ from typing import Any , ClassVar , NamedTuple
88
99from pytest_embedded .app import App
1010
@@ -26,8 +26,8 @@ class IdfApp(App):
2626 flash_settings (dict[str, Any]): dict of flash settings
2727 """
2828
29- XTENSA_TARGETS : ClassVar [List [str ]] = ['esp32' , 'esp32s2' , 'esp32s3' ]
30- RISCV32_TARGETS : ClassVar [List [str ]] = [
29+ XTENSA_TARGETS : ClassVar [list [str ]] = ['esp32' , 'esp32s2' , 'esp32s3' ]
30+ RISCV32_TARGETS : ClassVar [list [str ]] = [
3131 'esp32c3' ,
3232 'esp32c2' ,
3333 'esp32c6' ,
@@ -44,7 +44,7 @@ class IdfApp(App):
4444 def __init__ (
4545 self ,
4646 * args ,
47- part_tool : Optional [ str ] = None ,
47+ part_tool : str | None = None ,
4848 ** kwargs ,
4949 ):
5050 super ().__init__ (* args , ** kwargs )
@@ -95,7 +95,7 @@ def parttool_path(self) -> str:
9595 raise ValueError ('Partition Tool not found. (Default: $IDF_PATH/components/partition_table/gen_esp32part.py)' )
9696
9797 @property
98- def sdkconfig (self ) -> Dict [str , Any ]:
98+ def sdkconfig (self ) -> dict [str , Any ]:
9999 """
100100 Returns:
101101 dict contains all k-v pairs from the sdkconfig file
@@ -143,7 +143,7 @@ def is_xtensa(self):
143143 return False
144144
145145 @property
146- def partition_table (self ) -> Dict [str , Any ]:
146+ def partition_table (self ) -> dict [str , Any ]:
147147 """
148148 Returns:
149149 partition table dict generated by the partition tool
@@ -187,14 +187,14 @@ def partition_table(self) -> Dict[str, Any]:
187187 self ._partition_table = partition_table
188188 return self ._partition_table
189189
190- def _get_elf_file (self ) -> Optional [ str ] :
190+ def _get_elf_file (self ) -> str | None :
191191 for fn in os .listdir (self .binary_path ):
192192 if os .path .splitext (fn )[- 1 ] == '.elf' :
193193 return os .path .realpath (os .path .join (self .binary_path , fn ))
194194
195195 return None
196196
197- def _get_bin_file (self ) -> Optional [ str ] :
197+ def _get_bin_file (self ) -> str | None :
198198 for fn in os .listdir (self .binary_path ):
199199 if os .path .splitext (fn )[- 1 ] == '.bin' :
200200 return os .path .realpath (os .path .join (self .binary_path , fn ))
@@ -229,7 +229,7 @@ def write_flash_args(self):
229229
230230 def _parse_flash_args_json (
231231 self ,
232- ) -> Tuple [ Dict [str , Any ], List [FlashFile ], Dict [str , str ]]:
232+ ) -> tuple [ dict [str , Any ], list [FlashFile ], dict [str , str ]]:
233233 flash_args_json_filepath = None
234234 for fn in os .listdir (self .binary_path ):
235235 if fn == self .FLASH_ARGS_JSON_FILENAME :
@@ -242,7 +242,7 @@ def _parse_flash_args_json(
242242 with open (flash_args_json_filepath ) as fr :
243243 flash_args = json .load (fr )
244244
245- def _is_encrypted (_flash_args : Dict [str , Any ], _offset : int , _file_path : str ):
245+ def _is_encrypted (_flash_args : dict [str , Any ], _offset : int , _file_path : str ):
246246 for entry in _flash_args .values ():
247247 try :
248248 if (entry ['offset' ], entry ['file' ]) == (_offset , _file_path ):
@@ -268,7 +268,7 @@ def _is_encrypted(_flash_args: Dict[str, Any], _offset: int, _file_path: str):
268268
269269 return flash_args , flash_files , flash_settings
270270
271- def get_sha256 (self , filepath : str ) -> Optional [ str ] :
271+ def get_sha256 (self , filepath : str ) -> str | None :
272272 """
273273 Get the sha256 of the file
274274
0 commit comments