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

Correctly make Zip type following work #150

Open
gordonwatts opened this issue Sep 12, 2024 · 0 comments
Open

Correctly make Zip type following work #150

gordonwatts opened this issue Sep 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@gordonwatts
Copy link
Member

The Zip predicate can be used in various places in an uproot call:

def test_dictionary_Zip_key():
    "Check that type follow from a dictionary through a Zip works"

    s = ast_lambda(
        """({
        'jet_pt':  e.Jets().Select(lambda j: j.pt()),
        'jet_eta': e.Jets().Select(lambda j: j.eta())}
        .Zip()
        .Select(lambda j: j.pt()))"""
    )
    objs = ObjectStream[Event](ast.Name(id="e", ctx=ast.Load()))

    new_objs, new_s, expr_type = remap_by_types(objs, "e", Event, s)

    assert expr_type == Any

Here it is taking a dictionary of two List[float]'s and turning it into a List[Dict[str, float]] - or, rather, internally, as the temp dataclass that a dict becomes.

The code for Zip to type follow should be added. It would have to be added in the process_method_call code, and probably some reasonably major surgery would be needed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant