Skip to content

Commit

Permalink
Fix mypy warning and use felis.datamodel explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Oct 30, 2024
1 parent 0ec801d commit 13da0d7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python/lsst/dax/obscore/obscore_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@

import astropy.io.votable
import astropy.table
import felis.datamodel
import pyarrow
import sqlalchemy
import yaml
from felis.datamodel import FelisType
from felis.datamodel import Schema as FelisSchema
from lsst.daf.butler import Butler, DataCoordinate, Dimension, Registry, ddl
from lsst.daf.butler.formatters.parquet import arrow_to_numpy
from lsst.daf.butler.registry.obscore import (
Expand Down Expand Up @@ -71,11 +70,11 @@


@cache
def _get_obscore_schema() -> FelisSchema:
def _get_obscore_schema() -> felis.datamodel.Schema:
"""Read the ObsCore schema definition."""
obscore_defn = ResourcePath("resource://lsst.dax.obscore/configs/obscore_nominal.yaml").read()
obscore_data = yaml.safe_load(obscore_defn)
schema = FelisSchema.model_validate(obscore_data)
schema: felis.datamodel.Schema = felis.datamodel.Schema.model_validate(obscore_data)
return schema


Expand Down Expand Up @@ -356,7 +355,7 @@ def to_votable(self, limit: int | None = None) -> astropy.io.votable.tree.VOTabl
for arrow_field in self.schema:
if arrow_field.name in obscore_columns:
ffield = obscore_columns[arrow_field.name]
votable_datatype = FelisType.felis_type(ffield.datatype.value).votable_name
votable_datatype = felis.datamodel.FelisType.felis_type(ffield.datatype.value).votable_name
field = astropy.io.votable.tree.Field(
votable,
name=ffield.name,
Expand Down

0 comments on commit 13da0d7

Please sign in to comment.