Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F25244499
delete_words.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
delete_words.py
View Options
#!/usr/bin/env python3
# -------------------------------------------------------------
# Delete words from all dictionaries
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Delete words from all dictionaries from
# all currently found sources.
# License: BSD-2-Clause
# -------------------------------------------------------------
from
mergedictionaries
import
sources
,
write
from
mergedictionaries.sources
import
GitRepository
class
DeleteAction
:
def
__init__
(
self
,
context
):
self
.
git_config
=
context
[
"config"
]
.
get
(
"git"
,
[])
if
"git"
not
in
context
:
context
[
"git"
]
=
[]
self
.
git_cached_repos
=
context
[
"git"
]
def
run
(
self
,
words
):
for
source
in
self
.
get_sources
():
for
arg
in
source
[
"query"
]():
source
[
"delete"
](
words
,
arg
)
def
get_sources
(
self
):
return
[
{
"query"
:
sources
.
jetbrains
.
find_application_level_dictionaries
,
"delete"
:
lambda
words
,
file
:
write
.
jetbrains
.
delete_words
(
file
,
words
),
},
{
"query"
:
self
.
query_git_repositories
,
"delete"
:
lambda
words
,
repo
:
write
.
git
.
delete_words
(
repo
,
words
),
},
]
def
query_git_repositories
(
self
):
return
[
GitRepository
(
git_repo_url
,
self
.
git_cached_repos
)
for
git_repo_url
in
self
.
git_config
]
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Thu, Apr 9, 02:47 (11 m, 55 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3603870
Default Alt Text
delete_words.py (1 KB)
Attached To
Mode
rMD Merge dev dictionaries
Attached
Detach File
Event Timeline
Log In to Comment