type hint for SomeType*2 is list[SomeType] but could be Iterable[SomeType]
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 35
- Forks
- 14
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 1
Description
We have
CoincidenceEvent: !record
fields:
# identifiers of the two detecting elements (see doc for DetectionBin)
detectionBins: DetectionBin*2
This generates in types.py
class CoincidenceEvent:
"""All information about a coincidence event specified as indices (i.e. discretized)."""
detection_bins: list[DetectionBin]
def __init__(self, *,
detection_bins: typing.Optional[list[DetectionBin]] = None,
tof_idx: yardl.UInt32 = 0,
):
self.detection_bins = detection_bins if detection_bins is not None else [DetectionBin() for _ in range(2)]
In my python code, I actually used a tuple as opposed to a list (I find that more intuitive for a list of 2 items), and everything works fine. However, pyright complains of course.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the YAML definition for CoincidenceEvent and the generated types.py output shown in the issue. Trace where DetectionBin*2 is converted into the Python type annotation, then check the generator's existing tests for collection types. Done means the generated annotation accurately accepts the intended iterable values and the relevant generation tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100