Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9347206
common.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
695 B
Subscribers
None
common.py
View Options
# Copyright (C) 2019-2020 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import
hashlib
from
typing
import
Any
,
Dict
,
Tuple
TOKEN_BEGIN
=
-
(
2
**
63
)
"""Minimum value returned by the CQL function token()"""
TOKEN_END
=
2
**
63
-
1
"""Maximum value returned by the CQL function token()"""
def
hash_url
(
url
:
str
)
->
bytes
:
return
hashlib
.
sha1
(
url
.
encode
(
"ascii"
))
.
digest
()
def
remove_keys
(
d
:
Dict
[
str
,
Any
],
keys
:
Tuple
[
str
,
...
])
->
Dict
[
str
,
Any
]:
return
{
k
:
v
for
(
k
,
v
)
in
d
.
items
()
if
k
not
in
keys
}
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Fri, Jul 4, 5:08 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3393150
Attached To
rDSTO Storage manager
Event Timeline
Log In to Comment