Skip to content

Commit 9e8b291

Browse files
[Data] - Make AggregateFnV2 generic over accumulator/result (Generic[AggType, U]) (#57281)
## Why are these changes needed? The current Generic types in `AggregateFnV2` are not tied to the class, so they are not picked up properly by static type checkers such as mypy. <!-- Please give a short summary of the change and the problem this solves. --> By adding the Generic[] in the class definition, we get full type checking support. ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run pre-commit jobs to lint the changes in this PR. ([pre-commit setup](https://docs.ray.io/en/latest/ray-contribute/getting-involved.html#lint-and-formatting)) - [N/A] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [N/A] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur <atte.book@gmail.com> Co-authored-by: Goutam <goutam@anyscale.com>
1 parent 232341d commit 9e8b291

File tree

2 files changed

+135
-72
lines changed

2 files changed

+135
-72
lines changed

doc/source/conf.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
# If extensions (or modules to document with autodoc) are in another directory,
3333
# add these directories to sys.path here. If the directory is relative to the
3434
# documentation root, use os.path.abspath to make it absolute, like shown here.
35-
assert not os.path.exists("../../python/ray/_raylet.so"), (
36-
"_raylet.so should not be imported for the purpose for doc build, "
37-
"please rename the file to _raylet.so.bak and try again."
38-
)
35+
assert not os.path.exists(
36+
"../../python/ray/_raylet.so"
37+
), "_raylet.so should not be imported for the purpose for doc build, please rename the file to _raylet.so.bak and try again."
3938
sys.path.insert(0, os.path.abspath("../../python/"))
4039

4140
# -- General configuration ------------------------------------------------
@@ -130,6 +129,9 @@
130129
nitpicky = True
131130
nitpick_ignore_regex = [
132131
("py:obj", "ray.actor.T"),
132+
("py:obj", "ray.data.aggregate.AccumulatorType"),
133+
("py:obj", "ray.data.aggregate.SupportsRichComparisonType"),
134+
("py:obj", "ray.data.aggregate.AggOutputType"),
133135
("py:class", ".*"),
134136
# Workaround for https://github.com/sphinx-doc/sphinx/issues/10974
135137
("py:obj", "ray\\.data\\.datasource\\.datasink\\.WriteReturnType"),

0 commit comments

Comments
 (0)