lsst.daf.persistence
13.0-30-gd2bda26
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Macros
python
lsst
daf
persistence
test
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
24
import
os
25
26
from
..
import
ButlerLocation
27
from
..
import
Mapper
28
from
..
import
Storage
29
from
.
import
TestObject
30
31
32
class
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.
kwargs
= kwargs
37
pass
38
39
40
class
MapperForTestWriting
(Mapper):
41
42
def
__init__
(self, root, **kwargs):
43
self.
root
= root
44
self.
storage
= Storage.makeFromURI(self.
root
)
45
46
def
map_foo
(self, dataId, write):
47
python = TestObject
48
persistable =
None
49
storage =
'PickleStorage'
50
fileName =
'filename'
51
for
key, value
in
sorted(dataId.items()):
52
fileName +=
'_'
+ key + str(value)
53
fileName +=
'.txt'
54
path = os.path.join(self.
root
, fileName)
55
if
not
write
and
not
os.path.exists(path):
56
return
None
57
return
ButlerLocation(python, persistable, storage, path, dataId, self, self.
storage
)
lsst::daf::persistence.test.testMapper.MapperForTestWriting.__init__
def __init__
Definition:
testMapper.py:42
lsst::daf::persistence.test.testMapper.EmptyTestMapper.__init__
def __init__
Definition:
testMapper.py:35
lsst::daf::persistence.test.testMapper.EmptyTestMapper.kwargs
kwargs
Definition:
testMapper.py:36
lsst::daf::persistence.test.testMapper.MapperForTestWriting.root
root
Definition:
testMapper.py:43
lsst::daf::persistence.test.testMapper.MapperForTestWriting.map_foo
def map_foo
Definition:
testMapper.py:46
lsst::daf::persistence.test.testMapper.MapperForTestWriting.storage
storage
Definition:
testMapper.py:44
lsst::daf::persistence.test.testMapper.EmptyTestMapper
Definition:
testMapper.py:32
lsst::daf::persistence.test.testMapper.MapperForTestWriting
Definition:
testMapper.py:40
Generated on Thu Aug 10 2017 07:45:24 for lsst.daf.persistence by
1.8.5