LSST Applications g0da5cf3356+25b44625d0,g17e5ecfddb+50a5ac4092,g1c76d35bf8+585f0f68a2,g295839609d+8ef6456700,g2e2c1a68ba+cc1f6f037e,g38293774b4+62d12e78cb,g3b44f30a73+2891c76795,g48ccf36440+885b902d19,g4b2f1765b6+0c565e8f25,g5320a0a9f6+bd4bf1dc76,g56364267ca+403c24672b,g56b687f8c9+585f0f68a2,g5c4744a4d9+78cd207961,g5ffd174ac0+bd4bf1dc76,g6075d09f38+3075de592a,g667d525e37+cacede5508,g6f3e93b5a3+da81c812ee,g71f27ac40c+cacede5508,g7212e027e3+eb621d73aa,g774830318a+18d2b9fa6c,g7985c39107+62d12e78cb,g79ca90bc5c+fa2cc03294,g881bdbfe6c+cacede5508,g91fc1fa0cf+82a115f028,g961520b1fb+2534687f64,g96f01af41f+f2060f23b6,g9ca82378b8+cacede5508,g9d27549199+78cd207961,gb065e2a02a+ad48cbcda4,gb1df4690d6+585f0f68a2,gb35d6563ee+62d12e78cb,gbc3249ced9+bd4bf1dc76,gbec6a3398f+bd4bf1dc76,gd01420fc67+bd4bf1dc76,gd59336e7c4+c7bb92e648,gf46e8334de+81c9a61069,gfed783d017+bd4bf1dc76,v25.0.1.rc3
LSST Data Management Base Package
Loading...
Searching...
No Matches
testMapper.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# LSST Data Management System
4# Copyright 2017 LSST Corporation.
5#
6# This product includes software developed by the
7# LSST Project (http://www.lsst.org/).
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the LSST License Statement and
20# the GNU General Public License along with this program. If not,
21# see <http://www.lsstcorp.org/LegalNotices/>.
22#
23
24import os
25
26from .. import ButlerLocation
27from .. import Mapper
28from .. import Storage
29from . import TestObject
30
31
32class EmptyTestMapper(Mapper):
33 """Class that can be used as a stub for a mapper."""
34
35 def __init__(self, root=None, parentRegistry=None, repositoryCfg=None, **kwargs):
36 self.root = root
37 self.kwargs = kwargs
38 pass
39
40
42
43 def __init__(self, root, **kwargs):
44 self.root = root
45 self.storage = Storage.makeFromURI(self.root)
46
47 def map_foo(self, dataId, write):
48 python = TestObject
49 persistable = None
50 storage = 'PickleStorage'
51 fileName = 'filename'
52 for key, value in sorted(dataId.items()):
53 fileName += '_' + key + str(value)
54 fileName += '.txt'
55 path = os.path.join(self.root, fileName)
56 if not write and not os.path.exists(path):
57 return None
58 return ButlerLocation(python, persistable, storage, path, dataId, self, self.storage)
def __init__(self, root=None, parentRegistry=None, repositoryCfg=None, **kwargs)
Definition: testMapper.py:35