Coverage for python/lsst/daf/butler/core/fileDataset.py : 67%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of daf_butler.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
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 GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
22from __future__ import annotations
24__all__ = ["FileDataset"]
26from dataclasses import dataclass
27from typing import (
28 List,
29 Optional,
30 Union,
31)
34from .datasets import DatasetRef
35from .formatter import FormatterParameter
38@dataclass
39class FileDataset:
40 """A struct that represents a dataset exported to a file.
41 """
42 __slots__ = ("refs", "path", "formatter")
44 refs: List[DatasetRef]
45 """Registry information about the dataset. (`list` of `DatasetRef`).
46 """
48 path: str
49 """Path to the dataset (`str`).
51 If the dataset was exported with ``transfer=None`` (i.e. in-place),
52 this is relative to the datastore root (only datastores that have a
53 well-defined root in the local filesystem can be expected to support
54 in-place exports). Otherwise this is relative to the directory passed
55 to `Datastore.export`.
56 """
58 formatter: Optional[FormatterParameter]
59 """A `Formatter` class or fully-qualified name.
60 """
62 def __init__(self, path: str, refs: Union[DatasetRef, List[DatasetRef]], *,
63 formatter: Optional[FormatterParameter] = None):
64 self.path = path
65 if isinstance(refs, DatasetRef):
66 refs = [refs]
67 self.refs = refs
68 self.formatter = formatter