|
27 | 27 | from abc import ABC, abstractmethod
|
28 | 28 | from collections.abc import Collection, Iterable, Sequence
|
29 | 29 | from dataclasses import dataclass
|
30 |
| -from typing import TYPE_CHECKING, cast |
| 30 | +from typing import TYPE_CHECKING |
31 | 31 |
|
32 | 32 | import astropy.time
|
33 |
| -from lsst.pex.config import Config |
34 |
| -from lsst.resources import ResourcePath, ResourcePathExpression |
| 33 | +from lsst.resources import ResourcePathExpression |
35 | 34 |
|
36 | 35 | from .apdb import ApdbConfig
|
37 |
| -from .apdbIndex import ApdbIndex |
38 | 36 | from .factory import make_apdb_replica
|
39 | 37 |
|
40 | 38 | if TYPE_CHECKING:
|
@@ -146,16 +144,7 @@ def from_uri(cls, uri: ResourcePathExpression) -> ApdbReplica:
|
146 | 144 | Instance of `ApdbReplica` class, the type of the returned instance
|
147 | 145 | is determined by configuration.
|
148 | 146 | """
|
149 |
| - if isinstance(uri, str) and uri.startswith("label:"): |
150 |
| - tag, _, label = uri.partition(":") |
151 |
| - index = ApdbIndex() |
152 |
| - # Current format for config files is "pex_config" |
153 |
| - format = "pex_config" |
154 |
| - uri = index.get_apdb_uri(label, format) |
155 |
| - path = ResourcePath(uri) |
156 |
| - config_str = path.read().decode() |
157 |
| - # Assume that this is ApdbConfig, make_apdb will raise if not. |
158 |
| - config = cast(ApdbConfig, Config._fromPython(config_str)) |
| 147 | + config = ApdbConfig.from_uri(uri) |
159 | 148 | return make_apdb_replica(config)
|
160 | 149 |
|
161 | 150 | @classmethod
|
|
0 commit comments