Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:18

0001 #!/usr/bin/env python
0002 # Licensed under the Apache License, Version 2.0 (the "License");
0003 # you may not use this file except in compliance with the License.
0004 # You may obtain a copy of the License at
0005 # http://www.apache.org/licenses/LICENSE-2.0
0006 #
0007 # Authors:
0008 # - Wen Guan, wen.guan@cern.ch, 2017-2018
0009 
0010 import hashlib
0011 
0012 
0013 def get_rucio_path(scope, name):
0014     """
0015     Construct Rucio standard path using the scope and the LFN
0016     """
0017 
0018     s = '%s:%s' % (scope, name)
0019     hash_hex = hashlib.md5(s.encode('utf-8')).hexdigest()  # Python 2/3
0020 
0021     paths = scope.split('.') + [hash_hex[0:2], hash_hex[2:4], name]
0022 
0023     return '/'.join(paths)