|
27 | 27 | BASE_URL = os.environ.get('LTP_DOWNLOAD_HOST', 'https://www.languagetool.org/download/')
|
28 | 28 | FILENAME = 'LanguageTool-{version}.zip'
|
29 | 29 |
|
30 |
| -LTP_DOWNLOAD_VERSION = '6.5' |
| 30 | +LTP_DOWNLOAD_VERSION = '6.6' |
31 | 31 |
|
32 | 32 | JAVA_VERSION_REGEX = re.compile(
|
33 | 33 | r'^(?:java|openjdk) version "(?P<major1>\d+)(|\.(?P<major2>\d+)\.[^"]+)"',
|
@@ -74,7 +74,7 @@ def confirm_java_compatibility() -> bool:
|
74 | 74 | :return: True if the Java version is compatible.
|
75 | 75 | :rtype: bool
|
76 | 76 | """
|
77 |
| - |
| 77 | + |
78 | 78 | java_path = which('java')
|
79 | 79 | if not java_path:
|
80 | 80 | raise ModuleNotFoundError(
|
@@ -109,7 +109,7 @@ def get_common_prefix(z: zipfile.ZipFile) -> Optional[str]:
|
109 | 109 | :return: The common prefix of all file names in the zip archive, or None if there is no common prefix.
|
110 | 110 | :rtype: Optional[str]
|
111 | 111 | """
|
112 |
| - |
| 112 | + |
113 | 113 | name_list = z.namelist()
|
114 | 114 | if name_list and all(n.startswith(name_list[0]) for n in name_list[1:]):
|
115 | 115 | return name_list[0]
|
@@ -152,7 +152,7 @@ def unzip_file(temp_file: str, directory_to_extract_to: str) -> None:
|
152 | 152 | :param directory_to_extract_to: The directory where the contents of the zip file will be extracted.
|
153 | 153 | :type directory_to_extract_to: str
|
154 | 154 | """
|
155 |
| - |
| 155 | + |
156 | 156 | logger.info(f'Unzipping {temp_file.name} to {directory_to_extract_to}.')
|
157 | 157 | with zipfile.ZipFile(temp_file.name, 'r') as zip_ref:
|
158 | 158 | zip_ref.extractall(directory_to_extract_to)
|
@@ -184,11 +184,11 @@ def download_lt(language_tool_version: Optional[str] = LTP_DOWNLOAD_VERSION) ->
|
184 | 184 | """
|
185 | 185 | Downloads and extracts the specified version of LanguageTool.
|
186 | 186 | This function checks for Java compatibility, creates the necessary download
|
187 |
| - directory if it does not exist, and downloads the specified version of |
| 187 | + directory if it does not exist, and downloads the specified version of |
188 | 188 | LanguageTool if it is not already present.
|
189 |
| - |
190 |
| - :param language_tool_version: The version of LanguageTool to download. If not |
191 |
| - specified, the default version defined by |
| 189 | +
|
| 190 | + :param language_tool_version: The version of LanguageTool to download. If not |
| 191 | + specified, the default version defined by |
192 | 192 | LTP_DOWNLOAD_VERSION is used.
|
193 | 193 | :type language_tool_version: Optional[str]
|
194 | 194 | :raises AssertionError: If the download folder is not a directory.
|
|
0 commit comments