Skip to content

Commit b12447a

Browse files
authored
Merge pull request PowerGridModel#1195 from kornerc/sonarcloud-python
Fix 2 Python SonarQube code smells
2 parents 48ecefe + ef33db4 commit b12447a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/power_grid_model/_core/power_grid_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def as_enum_value(key_enum: str, type_: type[IntEnum]):
238238
if key_enum in kwargs:
239239
value_enum = kwargs[key_enum]
240240
if isinstance(value_enum, str):
241-
kwargs[key_enum] = type_[value_enum]
241+
kwargs[key_enum] = type_[value_enum] # NOSONAR(S5864) IntEnum has __getitem__
242242

243243
as_enum_value("calculation_method", CalculationMethod)
244244
as_enum_value("tap_changing_strategy", TapChangingStrategy)

src/power_grid_model/validation/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def __init__(self, fields: list[tuple[ComponentType, str]], ids: list[tuple[Comp
194194
fields: List of field names, formatted as tuples (component, field)
195195
ids: List of component IDs (not row indices), formatted as tuples (component, id)
196196
"""
197-
self.component = sorted(set(component for component, _ in fields), key=str)
197+
self.component = sorted({component for component, _ in fields}, key=str)
198198
self.field = sorted(fields)
199199
self.ids = sorted(ids)
200200

0 commit comments

Comments
 (0)