1717import os
1818import re
1919from abc import ABC , abstractmethod
20- from typing import Any , Callable , Dict , List , Optional , Union
20+ from collections .abc import Callable
21+ from typing import Any , Optional , Union
2122
2223from reportportal_client .helpers import gen_attributes
2324
@@ -36,7 +37,7 @@ class Entity:
3637 remove_origin : Optional [Any ]
3738 rp_item_id : Optional [str ]
3839 parent : Optional ["Entity" ]
39- skipped_keywords : List ["Keyword" ]
40+ skipped_keywords : list ["Keyword" ]
4041 posted : bool
4142
4243 def __init__ (self , entity_type : str , parent : Optional ["Entity" ]):
@@ -64,7 +65,7 @@ def rp_parent_item_id(self):
6465class LogMessage (str ):
6566 """Class represents Robot Framework messages."""
6667
67- attachment : Optional [Dict [str , str ]]
68+ attachment : Optional [dict [str , str ]]
6869 launch_log : bool
6970 item_id : Optional [str ]
7071 level : str
@@ -84,9 +85,9 @@ def __init__(self, message: str):
8485class Keyword (Entity ):
8586 """Class represents Robot Framework keyword."""
8687
87- robot_attributes : Dict [str , Any ]
88- args : List [str ]
89- assign : List [str ]
88+ robot_attributes : dict [str , Any ]
89+ args : list [str ]
90+ assign : list [str ]
9091 doc : str
9192 end_time : str
9293 keyword_name : str
@@ -95,11 +96,11 @@ class Keyword(Entity):
9596 name : str
9697 start_time : str
9798 status : str
98- tags : List [str ]
99+ tags : list [str ]
99100 type : str = "KEYWORD"
100- skipped_logs : List [LogMessage ]
101+ skipped_logs : list [LogMessage ]
101102
102- def __init__ (self , name : str , robot_attributes : Dict [str , Any ], parent : Entity ):
103+ def __init__ (self , name : str , robot_attributes : dict [str , Any ], parent : Entity ):
103104 """Initialize required attributes.
104105
105106 :param name: Name of the keyword
@@ -142,7 +143,7 @@ def get_type(self) -> str:
142143 else :
143144 return "STEP"
144145
145- def update (self , attributes : Dict [str , Any ]) -> "Keyword" :
146+ def update (self , attributes : dict [str , Any ]) -> "Keyword" :
146147 """Update keyword attributes on keyword finish.
147148
148149 :param attributes: Suite attributes passed through the listener
@@ -155,22 +156,22 @@ def update(self, attributes: Dict[str, Any]) -> "Keyword":
155156class Suite (Entity ):
156157 """Class represents Robot Framework test suite."""
157158
158- robot_attributes : Union [List [str ], Dict [str , Any ]]
159+ robot_attributes : Union [list [str ], dict [str , Any ]]
159160 doc : str
160161 end_time : str
161162 longname : str
162163 message : str
163- metadata : Dict [str , str ]
164+ metadata : dict [str , str ]
164165 name : str
165166 robot_id : str
166167 start_time : Optional [str ]
167168 statistics : str
168169 status : str
169- suites : List [str ]
170- tests : List [str ]
170+ suites : list [str ]
171+ tests : list [str ]
171172 total_tests : int
172173
173- def __init__ (self , name : str , robot_attributes : Dict [str , Any ], parent : Optional [Entity ] = None ):
174+ def __init__ (self , name : str , robot_attributes : dict [str , Any ], parent : Optional [Entity ] = None ):
174175 """Initialize required attributes.
175176
176177 :param name: Suite name
@@ -194,7 +195,7 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Optional
194195 self .total_tests = robot_attributes ["totaltests" ]
195196
196197 @property
197- def attributes (self ) -> Optional [List [ Dict [str , str ]]]:
198+ def attributes (self ) -> Optional [list [ dict [str , str ]]]:
198199 """Get Suite attributes."""
199200 if self .metadata is None or not self .metadata :
200201 return None
@@ -206,7 +207,7 @@ def source(self) -> str:
206207 if self .robot_attributes .get ("source" ) is not None :
207208 return os .path .relpath (self .robot_attributes ["source" ], os .getcwd ())
208209
209- def update (self , attributes : Dict [str , Any ]) -> "Suite" :
210+ def update (self , attributes : dict [str , Any ]) -> "Suite" :
210211 """Update suite attributes on suite finish.
211212
212213 :param attributes: Suite attributes passed through the listener
@@ -221,10 +222,10 @@ def update(self, attributes: Dict[str, Any]) -> "Suite":
221222class Launch (Suite ):
222223 """Class represents Robot Framework test suite."""
223224
224- launch_attributes : Optional [List [ Dict [str , str ]]]
225+ launch_attributes : Optional [list [ dict [str , str ]]]
225226 type : str = "LAUNCH"
226227
227- def __init__ (self , name : str , robot_attributes : Dict [str , Any ], launch_attributes : Optional [List [str ]]):
228+ def __init__ (self , name : str , robot_attributes : dict [str , Any ], launch_attributes : Optional [list [str ]]):
228229 """Initialize required attributes.
229230
230231 :param name: Launch name
@@ -236,7 +237,7 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], launch_attribute
236237 self .type = "LAUNCH"
237238
238239 @property
239- def attributes (self ) -> Optional [List [ Dict [str , str ]]]:
240+ def attributes (self ) -> Optional [list [ dict [str , str ]]]:
240241 """Get Launch attributes."""
241242 return self .launch_attributes
242243
@@ -245,9 +246,9 @@ class Test(Entity):
245246 """Class represents Robot Framework test case."""
246247
247248 _critical : str
248- _tags : List [str ]
249- robot_attributes : Dict [str , Any ]
250- test_attributes : Optional [List [ Dict [str , str ]]]
249+ _tags : list [str ]
250+ robot_attributes : dict [str , Any ]
251+ test_attributes : Optional [list [ dict [str , str ]]]
251252 doc : str
252253 end_time : str
253254 longname : str
@@ -258,7 +259,7 @@ class Test(Entity):
258259 status : str
259260 template : str
260261
261- def __init__ (self , name : str , robot_attributes : Dict [str , Any ], test_attributes : List [str ], parent : Entity ):
262+ def __init__ (self , name : str , robot_attributes : dict [str , Any ], test_attributes : list [str ], parent : Entity ):
262263 """Initialize required attributes.
263264
264265 :param name: Name of the test
@@ -287,12 +288,12 @@ def critical(self) -> bool:
287288 return self ._critical in ("yes" , True )
288289
289290 @property
290- def tags (self ) -> List [str ]:
291+ def tags (self ) -> list [str ]:
291292 """Get list of test tags excluding test_case_id."""
292293 return [tag for tag in self ._tags if not tag .startswith (TEST_CASE_ID_SIGN )]
293294
294295 @property
295- def attributes (self ) -> Optional [List [ Dict [str , str ]]]:
296+ def attributes (self ) -> Optional [list [ dict [str , str ]]]:
296297 """Get Test attributes."""
297298 return self .test_attributes + gen_attributes (self .tags )
298299
@@ -323,7 +324,7 @@ def test_case_id(self) -> Optional[str]:
323324 # generate it if not
324325 return "{0}:{1}" .format (self .source , self .name )
325326
326- def update (self , attributes : Dict [str , Any ]) -> "Test" :
327+ def update (self , attributes : dict [str , Any ]) -> "Test" :
327328 """Update test attributes on test finish.
328329
329330 :param attributes: Suite attributes passed through the listener
0 commit comments