Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gordonwatts opened this issue Jan 25, 2025 · 0 comments
Open

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

gordonwatts opened this issue Jan 25, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@gordonwatts
Copy link
Member

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?

@gordonwatts gordonwatts added the bug Something isn't working label Jan 25, 2025
@gordonwatts gordonwatts self-assigned this Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant