Skip to content

Commit 392020a

Browse files
committed
Change USE_info to use sets
1 parent 4def731 commit 392020a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 2.0.1
44

5+
### Changed
6+
7+
- Changed `USE_info` named tuple to storing use modules as `sets` instead of `lists`
8+
59
### Fixed
610

711
- Fixed some mutable default argument warnings in methods and classes

fortls/objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import copy
44
import os
55
import re
6-
from typing import Dict, NamedTuple, List, Pattern
6+
from typing import Dict, NamedTuple, List, Set, Pattern
77
from dataclasses import dataclass
88

99
from fortls.constants import (
@@ -56,7 +56,7 @@
5656
)
5757
USE_info = NamedTuple(
5858
"USE_info",
59-
[("mod_name", str), ("only_list", List[str]), ("rename_map", Dict[str, str])],
59+
[("mod_name", str), ("only_list", Set[str]), ("rename_map", Dict[str, str])],
6060
)
6161
GEN_info = NamedTuple(
6262
"GEN_info",

fortls/parse_fortran.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,13 @@ def read_use_stmt(line: str):
596596

597597
trailing_line = line[use_match.end(0) :].lower()
598598
use_mod = use_match.group(2)
599-
only_list: list[str] = []
599+
only_list: set[str] = set()
600600
rename_map: dict[str, str] = {}
601601
if use_match.group(3):
602602
for only_stmt in trailing_line.split(","):
603603
only_split = only_stmt.split("=>")
604604
only_name = only_split[0].strip()
605-
only_list.append(only_name)
605+
only_list.add(only_name)
606606
if len(only_split) == 2:
607607
rename_map[only_name] = only_split[1].strip()
608608
return "use", USE_info(use_mod, only_list, rename_map)

0 commit comments

Comments
 (0)