Skip to content

Commit 825e4e9

Browse files
committed
[mypy] renames temp var to unique value to work around mypy issue in other/scoring_algorithm
reusing loop variables with the same name and different types gives this very confusing mypy error response. pyright correctly infers the types without issue. ``` scoring_algorithm.py:58: error: Incompatible types in assignment (expression has type "float", variable has type "List[float]") scoring_algorithm.py:60: error: Unsupported operand types for - ("List[float]" and "float") scoring_algorithm.py:65: error: Incompatible types in assignment (expression has type "float", variable has type "List[float]") scoring_algorithm.py:67: error: Unsupported operand types for - ("List[float]" and "float") Found 4 errors in 1 file (checked 1 source file) ```
1 parent 67b3331 commit 825e4e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

other/scoring_algorithm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def procentual_proximity(source_data: list[list[float]], weights: list[int]) ->
3737

3838
# getting data
3939
data_lists: list[list[float]] = []
40-
for item in source_data:
41-
for i in range(len(item)):
40+
for data in source_data:
41+
for i in range(len(data)):
4242
try:
43-
data_lists[i].append(float(item[i]))
43+
data_lists[i].append(float(data[i]))
4444
except IndexError:
4545
# generate corresponding number of lists
4646
data_lists.append([])
47-
data_lists[i].append(float(item[i]))
47+
data_lists[i].append(float(data[i]))
4848

4949
score_lists: list[list[float]] = []
5050
# calculating each score

0 commit comments

Comments
 (0)