Skip to content

Immediate error message, not a delayed one, for type error #161

@gordonwatts

Description

@gordonwatts

The following code contains a type-related error:

from typing import Iterable
from func_adl_servicex_xaodr22 import FuncADLQueryPHYSLITE, cpp_vfloat
from func_adl_servicex_xaodr22.type_support import cpp_type

cpp_vfloat = cpp_type[Iterable[float]]("float", float, "std::vector<float>")


query = (
    FuncADLQueryPHYSLITE()
    .Select(lambda e: e.Vertices("BPHY4Quads"))
    .Select(
        lambda vtxs: {
            "x": vtxs.Select(lambda v: v.x()),
            "QUAD_Muon0": vtxs.Select(
                lambda v: v.auxdataConst[cpp_vfloat]("MuonLinks")[0].pt()
            ),
        }
    )
)

Specifically, the cpp_vloat correctly has trouble with accessing pt for a float. So pylance gives you a red squiggle. However, you can run this cell just fine. When you get around to deliver, then you get an actual exception that says you can't access pt. Shouldn't that exception happen here, near the line of code that caused it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions