Skip to content

Commit d1e133f

Browse files
committed
Remove get_languages_from_dir().
1 parent a54de9d commit d1e133f

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

‎language_tool/__init__.py‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -505,31 +505,11 @@ def get_languages() -> set:
505505
try:
506506
languages = cache["languages"]
507507
except KeyError:
508-
try:
509-
languages = LanguageTool._get_languages()
510-
except Error:
511-
languages = get_languages_from_dir()
508+
languages = LanguageTool._get_languages()
512509
cache["languages"] = languages
513510
return languages
514511

515512

516-
def get_languages_from_dir() -> set:
517-
"""Get supported languages (by scanning the LanguageTool directory).
518-
"""
519-
rules_path = os.path.join(get_directory(), "rules")
520-
languages = {fn for fn in os.listdir(rules_path)
521-
if os.path.isdir(os.path.join(rules_path, fn)) and
522-
LANGUAGE_RE.match(fn)}
523-
variants = []
524-
for language in languages:
525-
d = os.path.join(rules_path, language)
526-
for fn in os.listdir(d):
527-
if os.path.isdir(os.path.join(d, fn)) and LANGUAGE_RE.match(fn):
528-
variants.append(fn)
529-
languages.update(variants)
530-
return languages
531-
532-
533513
def get_directory():
534514
"""Get LanguageTool directory.
535515
"""

0 commit comments

Comments
 (0)