Skip to content

Commit c017fbb

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9f6b8fe commit c017fbb

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
# Generate the agglomerated changes (from the CHANGELOG) between fortls
2121
# and the fortran-language-server project
22-
with open("../CHANGELOG.md", "r") as f:
22+
with open("../CHANGELOG.md") as f:
2323
lns = f.readlines()
2424

2525
lns = lns[0 : lns.index("## 1.12.0\n")]

fortls/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import print_function
2-
31
import json
42
import os
53
import pprint
@@ -467,7 +465,7 @@ def debug_server_parser(args):
467465
config_exists = os.path.isfile(config_path)
468466
if config_exists:
469467
try:
470-
with open(config_path, "r") as fhandle:
468+
with open(config_path) as fhandle:
471469
config_dict = json.load(fhandle)
472470
pp_suffixes = config_dict.get("pp_suffixes", None)
473471
pp_defs = config_dict.get("pp_defs", {})

fortls/intrinsics.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def add_children(json_obj, fort_obj):
140140
os.path.dirname(os.path.abspath(__file__)), "statements.json"
141141
)
142142
statements = {"var_def": [], "int_stmnts": []}
143-
with open(json_file, "r", encoding="utf-8") as fid:
143+
with open(json_file, encoding="utf-8") as fid:
144144
intrin_file = json.load(fid)
145145
for key in statements:
146146
for name, json_obj in sorted(intrin_file[key].items()):
@@ -151,7 +151,7 @@ def add_children(json_obj, fort_obj):
151151
os.path.dirname(os.path.abspath(__file__)), "keywords.json"
152152
)
153153
keywords = {"var_def": [], "arg": [], "type_mem": [], "vis": [], "param": []}
154-
with open(json_file, "r", encoding="utf-8") as fid:
154+
with open(json_file, encoding="utf-8") as fid:
155155
intrin_file = json.load(fid)
156156
for key in keywords:
157157
for name, json_obj in sorted(intrin_file[key].items()):
@@ -162,7 +162,7 @@ def add_children(json_obj, fort_obj):
162162
os.path.dirname(os.path.abspath(__file__)), "intrinsic_funs.json"
163163
)
164164
int_funs = []
165-
with open(json_file, "r", encoding="utf-8") as fid:
165+
with open(json_file, encoding="utf-8") as fid:
166166
intrin_file = json.load(fid)
167167
for name, json_obj in sorted(intrin_file.items()):
168168
int_funs.append(create_int_object(name, json_obj, json_obj["type"]))
@@ -173,7 +173,7 @@ def add_children(json_obj, fort_obj):
173173
os.path.dirname(os.path.abspath(__file__)), "intrinsic_mods.json"
174174
)
175175
int_mods = []
176-
with open(json_file, "r", encoding="utf-8") as fid:
176+
with open(json_file, encoding="utf-8") as fid:
177177
intrin_file = json.load(fid)
178178
for key, json_obj in intrin_file.items():
179179
fort_obj = create_object(json_obj)

fortls/langserver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ def _load_config_file(self) -> None:
15081508
break
15091509

15101510
try:
1511-
with open(config_path, "r") as jsonfile:
1511+
with open(config_path) as jsonfile:
15121512
config_dict = json5.load(jsonfile)
15131513

15141514
# Include and Exclude directories

fortls/parse_fortran.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ def load_from_disk(self) -> tuple[str | None, bool | None]:
866866
"""
867867
contents: str
868868
try:
869-
with open(self.path, "r", encoding="utf-8", errors="replace") as f:
869+
with open(self.path, encoding="utf-8", errors="replace") as f:
870870
contents = re.sub(r"\t", r" ", f.read())
871871
except OSError:
872872
return "Could not read/decode file", None

0 commit comments

Comments
 (0)