Draft
Conversation
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CollectionBase Design — Derived from EasyList
Overview
This document proposes the design for a new
CollectionBaseclass that:EasyListrather than re-implementingMutableSequencefrom scratch.EasyList(sequence operations, type protection, deduplication, serialization).and
NotarizedDicthave already been removed before this class is introduced.Context
Goal
Define a single
CollectionBasethat:EasyListas the complete MutableSequence implementation.dataproperty and supports the legacy_convert_to_dictencoder path.Preconditions
This design assumes the following changes land first:
DescriptorBase,DescriptorNumber, andParameterare migrated onto theNewBasehierarchy.global_object.mapedge management at the collection layer has been migrated away.Under those assumptions, inheriting from
EasyListis structurally valid. The remaining design work is aboutcompatibility and migration, not object-model mismatch.
Inheritance Hierarchy
CollectionBasedoes not inherit fromModelBase.The parameter-aggregation logic (
get_all_variablesetc.) is implemented directly onCollectionBase, iteratingself._datarather than inspecting class attributes withdir().What EasyList Provides Directly
EasyListalready covers almost all of the sequence machinery. The items below should stay inherited unlessbackward-compatibility requires a thin adapter.
__getitem__,__setitem__,__delitem__,__len__,insertappend,extend,remove,pop,index,count,clear,__iter____getitem__(int),__getitem__(slice),__getitem__(str)byunique_name__contains__(item),__contains__(str)__reversed__sort(key, reverse)protected_typesconstructor argumentunique_name,display_name(fromNewBase)__repr__to_dict(),from_dict()What CollectionBase Must Add
1. Parameter / Variable Aggregation
These mirror the methods on
ModelBase, but aggregate across the list of items rather thanacross the attribute names of a single object.
The
DescriptorBaseleaf fallback should be treated as required, not optional. A collection of rawparameters or descriptors is a first-class use case.
2.
dataProperty3. Legacy Serialization (
_convert_to_dict)The compatibility layer should be deliberate and temporary.
Migration Notes
Sequencing
Recommended order of work:
NewBasemigration for variable classes.CollectionBaseon top ofEasyListwith the minimum compatibility surface.