/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
PhysicsTools/HeppyCore/python/utils/castorBaseDir.py
33 строки
1 KB
Shahzad Malik Muzaffar
[ANALYSIS] py2/3 compatibility:drop use of __future__
22 ноя 2024, 20:16
22 ноя 2024, 20:16
8d027cc
Код
Авторство
О чём код?
#!/usr/bin/env python import os, sys from . import eostools as castortools def getUserAndArea(user): """Factor out the magic user hack for use in other classes""" area = 'user' tokens = user.split('_') if tokens and len(tokens) > 1: user = tokens[0] area = tokens[1] return user, area def castorBaseDir( user=os.environ['USER'], area = None): """Gets the top level directory to use for writing for 'user'""" if area is None: user, area = getUserAndArea(user) d = 'root://eoscms.cern.ch//eos/cms/store/cmst3/%s/%s/CMG' % (area,user) exists = castortools.isDirectory( castortools.lfnToCastor(d) ) if exists: return d else: msg = "The directory '%s' does not exist. Please check the username and area (user/group). You may need to create the directory yourself." % d print(msg, file=sys.stderr) raise NameError(msg) def myCastorBaseDir(): """Gets the top level directory to use for writing for the current user""" return castorBaseDir()