CMS 3D CMS Logo

ModulesProxy.py
Go to the documentation of this file.
1 import os
2 from os.path import sep, join
3 import importlib
4 
6  def __init__(self, package, name):
7  self._package = package
8  self._name = name
9  self._caller = None
10  def __call__(self,**kwargs):
11  if not self._caller:
12  self._caller = getattr(importlib.import_module(self._package+'.'+self._name),self._name)
13  return self._caller(**kwargs)
14 
15 
16 def _setupProxies(fullName:str):
17  _cmssw_package_name='.'.join(fullName.split(sep)[-3:-1])
18  basename = fullName.split(sep)[-1]
19  pathname = fullName[:-1*len(basename)]
20  proxies = dict()
21  for filename in ( x for x in os.listdir(pathname) if (len(x) > 3 and x[-3:] == '.py' and x != basename and ((len(x) < 6) or (x[-6:] != 'cfi.py')))):
22  name = filename[:-3]
23  proxies[name] = _ModuleProxy(_cmssw_package_name, name)
24  return proxies
def __init__(self, package, name)
Definition: ModulesProxy.py:6
def __call__(self, kwargs)
Definition: ModulesProxy.py:10
static std::string join(char **cmd)
Definition: RemoteFile.cc:21