29 """"Base class for a mapper to find repository configurations within a butler repository.
33 cfg is 'wet paint' and very likely to change. Use of it in production code other than via the 'old
34 butler' API is strongly discouraged.
45 if 'policy' in self.__dict__
and 'storageCfg' in self.__dict__:
46 return 'RepositoryMapper(policy=%s, storageCfg=%s)' % (self.
policy, self.storageCfg)
48 return 'uninitialized RepositoryMapper'
51 """Map a location for a cfg file.
53 :param dataId: keys & values to be applied to the template.
54 :param write: True if this map is being done do perform a write operation, else assumes read. Will
55 verify location exists if write is True.
56 :return: a butlerLocation that describes the mapped location.
59 template = self.
policy[
'repositories.cfg.template']
60 location = template % dataId
61 if not write
and not self.
storage.exists(location):
64 pythonType=self.
policy[
'repositories.cfg.python'],
66 storageName=self.
policy[
'repositories.cfg.storage'],
67 locationList=(self.
storage.locationWithRoot(location),),
78 template = self.
policy[
'repositories.repo.template']
79 location = template % dataId
80 if self.
storage.exists(location):
82 pythonType=self.
policy[
'repositories.repo.python'],
85 locationList=(location,),