Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F28987658
jetbrains.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
jetbrains.py
View Options
# -------------------------------------------------------------
# Merge dictionaries :: Publishers :: JetBrains IDEs
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Find application-level dictionaries
# from JetBrains IDEs
# License: BSD-2-Clause
# -------------------------------------------------------------
from
mergedictionaries.sources
import
jetbrains
as
jetbrains_source
from
mergedictionaries.output
import
jetbrains
as
jetbrains_output
from
mergedictionaries.utils.collections
import
remove_words
def
write
(
words
):
contents
=
jetbrains_output
.
dump
(
words
)
for
file_path
in
jetbrains_source
.
find_application_level_dictionaries
():
with
open
(
file_path
,
"w"
)
as
fd
:
fd
.
write
(
contents
)
fd
.
write
(
"
\n
"
)
def
delete_words
(
file_path
,
words_to_delete
):
current_words
=
jetbrains_source
.
extract_words
(
file_path
)
if
not
any
(
word
in
current_words
for
word
in
words_to_delete
):
# Nothing to do, the dictionary is already up to date.
return
words
=
remove_words
(
current_words
,
words_to_delete
)
contents
=
jetbrains_output
.
dump
(
words
)
with
open
(
file_path
,
"w"
)
as
fd
:
fd
.
write
(
contents
)
fd
.
write
(
"
\n
"
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Sun, May 17, 19:25 (10 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3723285
Default Alt Text
jetbrains.py (1 KB)
Attached To
Mode
rMD Merge dev dictionaries
Attached
Detach File
Event Timeline
Log In to Comment