Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11724220
resolvehash.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
resolvehash.py
View Options
# -------------------------------------------------------------
# Resolve hash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Query various sources with a known hash
# like Phabricator, Gerrit or GitHub to offer
# hash information URL from a VCS hash.
# License: BSD-2-Clause
# -------------------------------------------------------------
import
os
import
yaml
from
resolvehash.search
import
VcsHashSearch
# -------------------------------------------------------------
# Configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
get_configuration_path
():
return
os
.
environ
[
"HOME"
]
+
"/.config/resolve-hash.conf"
def
parse_config
():
configuration_path
=
get_configuration_path
()
if
not
os
.
path
.
exists
(
configuration_path
):
return
{}
with
open
(
get_configuration_path
())
as
fd
:
return
yaml
.
safe_load
(
fd
)
# -------------------------------------------------------------
# Hash search wrapper
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
get_search_classes
():
return
[
VcsHashSearch
,
]
def
find_hash
(
config
,
needle_hash
):
for
search_class
in
get_search_classes
():
result
=
search_class
(
config
,
needle_hash
)
.
search
()
if
result
is
not
None
:
return
result
[
"url"
]
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Thu, Sep 18, 13:31 (15 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2990904
Default Alt Text
resolvehash.py (1 KB)
Attached To
Mode
rRESOLVEHASH Resolve hash
Attached
Detach File
Event Timeline
Log In to Comment