Page MenuHomeDevCentral

No OneTemporary

diff --git a/setup.cfg b/setup.cfg
index b5dac4b..5520824 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,33 +1,33 @@
[metadata]
name = merge-dictionaries
-version = 0.2.1
+version = 0.2.2
author = Sébastien Santoro
author_email = dereckson@espace-win.org
description = Merge dictionaries
long_description = file: README.md
long_description_content_type = text/markdown
license = BSD-2-Clause
license_files = LICENSE
url = https://devcentral.nasqueron.org/source/merge-dictionaries/
project_urls =
Bug Tracker = https://devcentral.nasqueron.org/tag/development_tools/
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Environment :: Console
Intended Audience :: Developers
Topic :: Software Development :: Build Tools
[options]
package_dir =
= src
packages = find:
scripts =
bin/merge-dictionaries
python_requires = >=3.6
install_requires =
PyYAML>=6.0,<7.0
[options.packages.find]
where = src
diff --git a/src/mergedictionaries/sources/jetbrains.py b/src/mergedictionaries/sources/jetbrains.py
index d8cd73a..7f148aa 100644
--- a/src/mergedictionaries/sources/jetbrains.py
+++ b/src/mergedictionaries/sources/jetbrains.py
@@ -1,53 +1,57 @@
# -------------------------------------------------------------
# Merge dictionaries :: Sources :: JetBrains IDEs
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Find application-level dictionaries
# from JetBrains IDEs
# License: BSD-2-Clause
# -------------------------------------------------------------
import os
from xml.etree import ElementTree
DICTIONARY_FILENAMES = ["cachedDictionary.xml", "spellchecker-dictionary.xml"]
def get_configuration_path():
"""Find JetBrains configuration folder for Windows and UNIX systems."""
try:
return os.environ["APPDATA"] + "/JetBrains"
except KeyError:
return os.environ["HOME"] + "/.config/JetBrains"
def find_application_level_dictionaries():
# We're looking for paths like:
# ~/.config/JetBrains/PyCharm2021.3/options/cachedDictionary.xml
base_path = get_configuration_path()
+ if not os.path.exists(base_path):
+ # No JetBrains IDE configuration folder detected
+ return []
+
return [
candidate
for candidate in [
os.path.join(base_path, entry.name, "options", filename)
for filename in DICTIONARY_FILENAMES
for entry in os.scandir(base_path)
if entry.is_dir()
]
if os.path.exists(candidate)
]
def extract_words(dictionary_path):
tree = ElementTree.parse(dictionary_path)
return [word.text for word in tree.getroot()[0][0]]
def extract_words_from_all_dictionaries():
return {
word
for dictionary_path in find_application_level_dictionaries()
for word in extract_words(dictionary_path)
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 02:18 (20 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259374
Default Alt Text
(3 KB)

Event Timeline