Skip to content

Commit d0ad13f

Browse files
authored
Update server.py
1 parent 65881e5 commit d0ad13f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

language_tool_python/server.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,7 @@ def _get_valid_spelling_file_path() -> str:
190190

191191
def _register_spellings(self, spellings):
192192
spelling_file_path = self._get_valid_spelling_file_path()
193-
with (
194-
open(spelling_file_path, "a+", encoding='utf-8')
195-
as spellings_file
196-
):
193+
with open(spelling_file_path, "a+", encoding='utf-8') as spellings_file:
197194
spellings_file.write(
198195
"\n" + "\n".join([word for word in spellings])
199196
)
@@ -204,8 +201,7 @@ def _unregister_spellings(self):
204201
spelling_file_path = self._get_valid_spelling_file_path()
205202
with (
206203
open(spelling_file_path, 'r+', encoding='utf-8')
207-
as spellings_file
208-
):
204+
) as spellings_file::
209205
spellings_file.seek(0, os.SEEK_END)
210206
for _ in range(len(self._new_spellings)):
211207
while spellings_file.read(1) != '\n':
@@ -245,8 +241,7 @@ def _query_server(self, url, params=None, num_tries=2):
245241
try:
246242
with (
247243
requests.get(url, params=params, timeout=self._TIMEOUT)
248-
as response
249-
):
244+
) as response:
250245
try:
251246
return response.json()
252247
except json.decoder.JSONDecodeError as e:

0 commit comments

Comments
 (0)