Skip to content

Conversation

@uenoku
Copy link
Member

@uenoku uenoku commented Jul 16, 2025

This commit implements slice indexing functionality for the LongestPathCollection class, allowing users to access multiple timing paths using Python's standard slice notation. The implementation handles all slice types including negative indices, step values, and empty slices through Python's built-in slice.indices() method.

…on bindings

This commit implements slice indexing functionality for the LongestPathCollection
class, allowing users to access multiple timing paths using Python's standard
slice notation. The implementation handles all slice types including negative
indices, step values, and empty slices through Python's built-in slice.indices()
method.
@uenoku uenoku changed the title [AIG] Add slice indexing support to LongestPathCollection in AIG Pyth… [AIG] Add slice indexing support to LongestPathCollection in AIG python on bindings Jul 16, 2025
@uenoku uenoku requested a review from Copilot July 16, 2025 07:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements slice indexing support for the LongestPathCollection class in the AIG Python bindings, allowing users to access multiple timing paths using Python's standard slice notation (e.g., collection[:2] or collection[:-2]).

  • Adds slice indexing functionality to the __getitem__ method
  • Updates type hints to support both integer and slice indices
  • Adds test coverage for slice operations including negative indices

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/Bindings/Python/dialects/aig.py Implements slice indexing in __getitem__ method with updated type hints and documentation
integration_test/Bindings/Python/dialects/aig.py Updates existing test to use slice notation directly and adds negative slice test

Comment on lines +293 to +295
def __getitem__(
self, index: Union[slice,
int]) -> Union[DataflowPath, List[DataflowPath]]:
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The type annotation formatting should follow PEP 8 style. Consider placing the Union types on the same line or using proper indentation for better readability: index: Union[slice, int]

Suggested change
def __getitem__(
self, index: Union[slice,
int]) -> Union[DataflowPath, List[DataflowPath]]:
def __getitem__(self, index: Union[slice, int]) -> Union[DataflowPath, List[DataflowPath]]:

Copilot uses AI. Check for mistakes.
@uenoku uenoku requested review from fabianschuiki and maerhart July 16, 2025 08:29
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@uenoku uenoku merged commit 1f671d6 into main Jul 16, 2025
7 checks passed
@uenoku uenoku deleted the dev/hidetou/slice branch July 16, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants