11# -*- coding: utf-8 -*-
2- """LanguageTool through server mode."""
32
4- # © 2012 spirit <hiddenspirit@gmail.com>
5- # https://bitbucket.org/spirit/language_tool
3+ # © 2012 spirit <hiddenspirit@gmail.com>
4+ # © 2013-2014 Steven Myint
65#
7- # This program is free software: you can redistribute it and/or modify it
8- # under the terms of the GNU Lesser General Public License as published
9- # by the Free Software Foundation, either version 3 of the License,
10- # or (at your option) any later version.
6+ # This program is free software: you can redistribute it and/or modify it
7+ # under the terms of the GNU Lesser General Public License as published
8+ # by the Free Software Foundation, either version 3 of the License,
9+ # or (at your option) any later version.
1110#
12- # This program is distributed in the hope that it will be useful,
13- # but WITHOUT ANY WARRANTY; without even the implied warranty
14- # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15- # See the GNU Lesser General Public License for more details.
11+ # This program is distributed in the hope that it will be useful,
12+ # but WITHOUT ANY WARRANTY; without even the implied warranty
13+ # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ # See the GNU Lesser General Public License for more details.
1615#
17- # You should have received a copy of the GNU Lesser General Public License
18- # along with this program. If not, see <http://www.gnu.org/licenses/>.
16+ # You should have received a copy of the GNU Lesser General Public License
17+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+ """LanguageTool through server mode."""
1920
2021import atexit
2122import glob
@@ -477,7 +478,7 @@ def get_languages() -> set:
477478def get_directory ():
478479 """Get LanguageTool directory."""
479480 try :
480- language_tool_dir = cache ['language_tool_dir ' ]
481+ language_check_dir = cache ['language_check_dir ' ]
481482 except KeyError :
482483 def version_key (string ):
483484 return [int (e ) if e .isdigit () else e
@@ -492,19 +493,19 @@ def get_lt_dir(base_dir):
492493 return max (paths , key = version_key ) if paths else None
493494
494495 base_dir = os .path .dirname (sys .argv [0 ])
495- language_tool_dir = get_lt_dir (base_dir )
496- if not language_tool_dir :
496+ language_check_dir = get_lt_dir (base_dir )
497+ if not language_check_dir :
497498 try :
498499 base_dir = os .path .dirname (os .path .abspath (__file__ ))
499500 except NameError :
500501 pass
501502 else :
502- language_tool_dir = get_lt_dir (base_dir )
503- if not language_tool_dir :
503+ language_check_dir = get_lt_dir (base_dir )
504+ if not language_check_dir :
504505 raise PathError ('can’t find LanguageTool directory in {!r}'
505506 .format (base_dir ))
506- cache ['language_tool_dir ' ] = language_tool_dir
507- return language_tool_dir
507+ cache ['language_check_dir ' ] = language_check_dir
508+ return language_check_dir
508509
509510
510511def set_directory (path = None ):
@@ -513,11 +514,11 @@ def set_directory(path=None):
513514 terminate_server ()
514515 cache .clear ()
515516 if path :
516- cache ['language_tool_dir ' ] = path
517+ cache ['language_check_dir ' ] = path
517518 try :
518519 get_jar_info ()
519520 except Error :
520- cache ['language_tool_dir ' ] = old_path
521+ cache ['language_check_dir ' ] = old_path
521522 raise
522523
523524
0 commit comments