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

refactor[next]: NamedRange/NamedIndex tuple to NamedTuple #1490

Merged
merged 25 commits into from
Mar 21, 2024

Conversation

nfarabullini
Copy link
Contributor

@nfarabullini nfarabullini commented Mar 13, 2024

Change NamedRange and NamedIndex from being a plain tuple to a NamedTuple for cleaner element access.

@nfarabullini nfarabullini marked this pull request as draft March 13, 2024 14:26
@havogt havogt changed the title edits for NamedRange class refactor[next]: NamedRange tuple to dataclass Mar 13, 2024
src/gt4py/next/common.py Outdated Show resolved Hide resolved
@@ -301,15 +309,14 @@ def is_int_index(p: Any) -> TypeGuard[IntIndex]:

def is_named_range(v: AnyIndexSpec) -> TypeGuard[NamedRange]:
Copy link
Contributor

Choose a reason for hiding this comment

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

in the end this function can be removed and replaced by just an isinstance check

@havogt havogt changed the title refactor[next]: NamedRange tuple to dataclass refactor[next]: NamedRange tuple to NamedTuple Mar 19, 2024
@havogt havogt marked this pull request as ready for review March 19, 2024 13:57
@havogt havogt changed the title refactor[next]: NamedRange tuple to NamedTuple refactor[next]: NamedRange/NamedIndex tuple to NamedTuple Mar 20, 2024
@havogt havogt requested a review from egparedes March 20, 2024 08:06
Copy link
Contributor

@egparedes egparedes left a comment

Choose a reason for hiding this comment

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

Only minor questions and comments.

src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
@@ -484,10 +493,10 @@ def __and__(self, other: Domain) -> Domain:
_broadcast_ranges(broadcast_dims, other.dims, other.ranges),
)
)
return Domain(dims=broadcast_dims, ranges=intersected_ranges)
return Domain(dims=broadcast_dims, ranges=intersected_ranges) # TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

Incomplete TODO

src/gt4py/next/embedded/common.py Outdated Show resolved Hide resolved
src/gt4py/next/embedded/common.py Outdated Show resolved Hide resolved
src/gt4py/next/iterator/embedded.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
Copy link
Contributor

@egparedes egparedes left a comment

Choose a reason for hiding this comment

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

It looks good.

@havogt havogt merged commit e344afd into GridTools:main Mar 21, 2024
31 checks passed
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