Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56946358
git.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
989 B
Referenced Files
None
Subscribers
None
git.py
View Options
# -------------------------------------------------------------
# Merge dictionaries :: Publishers :: Git repository
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Find application-level dictionaries
# from Git repository
# License: BSD-2-Clause
# -------------------------------------------------------------
import
os
from
tempfile
import
NamedTemporaryFile
from
mergedictionaries.sources
import
GitRepository
def
build_temporary_dictionary
(
words
):
fd
=
NamedTemporaryFile
(
delete
=
False
)
for
word
in
words
:
fd
.
write
(
f
"{word}
\n
"
.
encode
(
"utf-8"
))
fd
.
close
()
return
fd
.
name
def
write
(
words
,
target_repos
,
cached_repos
):
if
not
target_repos
:
return
tmp_dictionary_path
=
build_temporary_dictionary
(
words
)
for
repo
in
target_repos
:
GitRepository
(
repo
,
cached_repos
)
.
publish
(
tmp_dictionary_path
)
os
.
unlink
(
tmp_dictionary_path
)
File Metadata
Details
Attached
Mime Type
text/x-script.python
Expires
Fri, Nov 13, 10:14 (6 d, 22 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4248488
Default Alt Text
git.py (989 B)
Attached To
Mode
rMD Merge dev dictionaries
Attached
Detach File
Event Timeline
Log In to Comment