Skip to content

Commit dc7b704

Browse files
committed
Argument type update
1 parent c4833f3 commit dc7b704

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## [Unreleased]
44
### Added
55
- `CONTENT_TYPE_TO_EXTENSIONS` constant in `helpers` module, by @HardNorth
6+
### Changed
7+
- `helpers.gen_attributes` now accepts `Iterable[str]` argument instead of `List[str]`, by @HardNorth
68

79
## [5.5.5]
810
### Added

reportportal_client/helpers.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import uuid
2424
from platform import machine, processor, system
2525
from types import MappingProxyType
26-
from typing import Optional, Any, List, Dict, Callable, Tuple, Union, TypeVar, Generic
26+
from typing import Optional, Any, List, Dict, Callable, Tuple, Union, TypeVar, Generic, Iterable
2727

2828
from reportportal_client.core.rp_file import RPFile
2929

@@ -144,15 +144,15 @@ def dict_to_payload(dictionary: Optional[dict]) -> Optional[List[dict]]:
144144
return result
145145

146146

147-
def gen_attributes(rp_attributes: List[str]) -> List[Dict[str, str]]:
147+
def gen_attributes(rp_attributes: Iterable[str]) -> List[Dict[str, str]]:
148148
"""Generate list of attributes for the API request.
149149
150150
Example of input list:
151151
['tag_name:tag_value1', 'tag_value2']
152152
Output of the function for the given input list:
153153
[{'key': 'tag_name', 'value': 'tag_value1'}, {'value': 'tag_value2'}]
154154
155-
:param rp_attributes: List of attributes(tags)
155+
:param rp_attributes: Iterable of attributes(tags)
156156
:return: Correctly created list of dictionaries
157157
to be passed to RP
158158
"""
@@ -168,8 +168,7 @@ def gen_attributes(rp_attributes: List[str]) -> List[Dict[str, str]]:
168168
if all(attr_dict.values()):
169169
attrs.append(attr_dict)
170170
continue
171-
logger.debug('Failed to process "{0}" attribute, attribute value'
172-
' should not be empty.'.format(rp_attr))
171+
logger.debug(f'Failed to process "{rp_attr}" attribute, attribute value should not be empty.')
173172
return attrs
174173

175174

0 commit comments

Comments
 (0)