docs: add Triangle shape/empty/compute examples (#704) - #1211
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1211 +/- ##
=======================================
Coverage 91.25% 91.25%
=======================================
Files 91 91
Lines 5400 5400
Branches 691 691
=======================================
Hits 4928 4928
Misses 338 338
Partials 134 134
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| Examples | ||
| -------- | ||
| Numpy-backed Triangles are already materialized, so ``compute`` |
There was a problem hiding this comment.
not sure how useful this is. i would recommend using code-block to imitate realistic numba usage.
There was a problem hiding this comment.
compute() is the dask materialize path, not numba. The numpy identity doctest did not show that, so it is now a code-block of set_backend('dask') then compute(). Dask is optional and the dask backend is deprecated, which is why that sample is not a doctest.
| .. testcode:: | ||
|
|
||
| raa = cl.load_sample('raa') | ||
| print(raa.get_array_module().__name__) |
There was a problem hiding this comment.
an example using np and sp would be more instructive
There was a problem hiding this comment.
Updated to compare against np and sp with is, so it is clear get_array_module() returns those module objects.
| .. testcode:: | ||
|
|
||
| import numpy as np | ||
| mask = np.isnan(cl.load_sample('raa').nan_triangle[-1]) |
There was a problem hiding this comment.
just calling nan_triangle and printing it would be sufficient. no need for further manipulation.
There was a problem hiding this comment.
Dropped the boolean mask. The example now prints nan_triangle directly.
…module, and compute. Print the nan mask as-is, show numpy/sparse module identity, and document compute with a dask code sample instead of a numpy no-op doctest. Co-authored-by: Cursor <cursoragent@cursor.com>
| .. code-block:: python | ||
|
|
||
| tri = cl.load_sample('raa').set_backend('dask') | ||
| tri = tri.compute() |
There was a problem hiding this comment.
can you fake the output also?
There was a problem hiding this comment.
Added a pycon sample that shows tri.array_backend as 'numpy' after compute().
|
|
||
| .. currentmodule:: {{ module }} | ||
|
|
||
| {% set documented_attrs = ['shape', 'empty', 'dimensionality', 'nan_triangle'] %} |
There was a problem hiding this comment.
|
lastly, could you please take care of the ruff violation? |
… autosummary template. The ruff workflow lints touched files with per-file ignores cleared. The template now unions the documented Triangle attrs and arithmetic dunders so casact#1208, casact#1212, and casact#1213 do not clobber each other on merge. Co-authored-by: Cursor <cursoragent@cursor.com>
The last merge of casact#1208/casact#1211/casact#1212/casact#1213 would otherwise wipe documented indexers, shape attrs, or arithmetic dunders. Co-authored-by: Cursor <cursoragent@cursor.com>
isinstance() sent the dask stand-in down the pandas path and skipped the deprecation warning. E2 on base.py is fixed; the remaining type() compare is noqa'd because CI clears per-file ignores. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Merged The earlier E721 swap to E2 on |
Summary of Changes
ExamplesforTriangle.shape,.empty,.dimensionality,.nan_triangle,.compute, and.get_array_moduleinchainladder/core/base.py.Related GitHub Issue(s)
Additional Context for Reviewers
Bite-sized core-module follow-up for #704. Companions: #1208 (slice), #1209 (io), #1210 (display).
Checklist
Made with Cursor