Skip to content

Make Setas a descriptor; add ColumnHeadersDescriptor; merge stable#35

Merged
gb119 merged 4 commits into
stablefrom
copilot/implement-setas-as-descriptor
Mar 21, 2026
Merged

Make Setas a descriptor; add ColumnHeadersDescriptor; merge stable#35
gb119 merged 4 commits into
stablefrom
copilot/implement-setas-as-descriptor

Conversation

Copilot AI commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

The setas attribute was implemented as a @property in two separate places (DataArray, DataFilePropertyMixin), scattering the get/set logic outside the Setas class. column_headers had the same problem. This PR makes Setas itself a Python descriptor and introduces ColumnHeadersDescriptor, then merges the stable branch (which independently made DataArray a descriptor for the data attribute).

Setas as a descriptor (setas.py)

  • Added __set_name__, __get__, __set__ to Setas.
  • __get__ retrieves the per-instance Setas stored as _setas, shape-syncing on access.
  • __set__ delegates to Setas.__call__, preserving all existing assignment call-convention logic.
  • New optional source kwarg: Setas(source="_data") makes get/set forward through getattr(obj, source).setas — used by DataFilePropertyMixin to reach its inner DataArray.

ColumnHeadersDescriptor (setas.py)

New slim descriptor exposing column_headers uniformly via obj.setas.column_headers.

DataArray (array.py)

Replaced the setas and column_headers @property pairs with class-level descriptors:

class DataArray(ma.MaskedArray):
    setas = _setas()                        # Setas descriptor; private store: _setas
    column_headers = ColumnHeadersDescriptor()

Also incorporates DataArray.__set_name__/__get__/__set__ from stable, enabling DataArray itself to act as a descriptor for the data attribute on DataFilePropertyMixin.

DataFilePropertyMixin (property.py)

Replaced the setas, column_headers, and data @property definitions with class-level descriptors:

class DataFilePropertyMixin:
    setas = Setas(source="_data")       # delegates to self._data.setas
    column_headers = ColumnHeadersDescriptor()
    data = DataArray([])                # DataArray descriptor; private store: _data

The data descriptor's __set__ handles the shape normalisation and setas/column-header preservation previously done by the @property data setter.

Merge with stable

One conflict in property.py resolved by keeping our setas/column_headers descriptors and stable's data = DataArray([]) form, dropping both the old @property data getter/setter and the intermediate @property column_headers.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

- Add __set_name__, __get__, __set__ to Setas; optional source= parameter
  enables the delegating pattern used by DataFilePropertyMixin.
- Add ColumnHeadersDescriptor that forwards column_headers through setas.
- Replace setas and column_headers @Property definitions in DataArray
  and DataFilePropertyMixin with class-level descriptor instances.
- All 17 core tests pass; 0 CodeQL alerts.

Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Agent-Logs-Url: https://github.com/stonerlab/Stoner-PythonCode/sessions/aad8e39f-bc8b-4a7d-a751-a42960d3c001
Copilot AI changed the title [WIP] Refactor setas attribute to use descriptor pattern Make Setas a descriptor; add ColumnHeadersDescriptor Mar 21, 2026
Copilot AI requested a review from gb119 March 21, 2026 16:08
@gb119 gb119 changed the base branch from main to stable March 21, 2026 16:13
Resolve conflict in Stoner/core/property.py by combining:
- Our Setas(source="_data") and ColumnHeadersDescriptor() class-level
  descriptors for setas and column_headers
- Stable's DataArray([]) class-level descriptor for data (replaces
  the @Property data getter/setter)

The DataArray descriptor protocol (__set_name__, __get__, __set__)
brought in from stable handles the data normalisation previously
done by the @Property setter in DataFilePropertyMixin.

Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Agent-Logs-Url: https://github.com/stonerlab/Stoner-PythonCode/sessions/99c326bd-f943-4982-bcb3-efcaa9f75225
Copilot AI changed the title Make Setas a descriptor; add ColumnHeadersDescriptor Make Setas a descriptor; add ColumnHeadersDescriptor; merge stable Mar 21, 2026
@github-actions

Copy link
Copy Markdown

Test Results

    4 files  ±0      4 suites  ±0   25m 51s ⏱️ +9s
  332 tests ±0    332 ✅ ±0  0 💤 ±0  0 ❌ ±0 
1 328 runs  ±0  1 328 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit c9ed35e. ± Comparison against base commit fd2aae8.

@gb119 gb119 marked this pull request as ready for review March 21, 2026 17:16
@gb119 gb119 merged commit c7940c9 into stable Mar 21, 2026
16 checks passed
@gb119 gb119 deleted the copilot/implement-setas-as-descriptor branch March 28, 2026 18:18
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.

2 participants