Skip to content

Feature: Refactor tree.py (organize, reformat) and add missing getters/setters - #3079

Open
WhoBrokeTheBuild wants to merge 4 commits into
MDSplus:alphafrom
WhoBrokeTheBuild:slw-refactor-python-tree
Open

Feature: Refactor tree.py (organize, reformat) and add missing getters/setters#3079
WhoBrokeTheBuild wants to merge 4 commits into
MDSplus:alphafrom
WhoBrokeTheBuild:slw-refactor-python-tree

Conversation

@WhoBrokeTheBuild

@WhoBrokeTheBuild WhoBrokeTheBuild commented Aug 3, 2026

Copy link
Copy Markdown
Member

Reformat functions with broken/confusing formatting

Organize similar functions together

Change all NCI Derived Property functions to call getters/setters, rather than the other way around

Remove erroneous def compression_method which overshadowed compression_method = Nci._nciProp...

Set a default = True for all flag setters so that node.setWriteOnce() works, rather than having to say node.setWriteOnce(True)

Group all DBI related things into these sections, ordered by their position in the property section

  • DBI Properties
  • DBI Properties getters/setters

Group all NCI related things into these sections, ordered by their position in the flags/properties sections

  • NCI Flags e.g. .no_write_model
  • NCI Flags getters/setters e.g. .isNoWriteModel()
  • NCI Properties e.g. .brother
  • NCI Properties getters/setters e.g. `.getBrother()
  • NCI Derived Properties e.g. .descendants, .on, .local_path
  • NCI Derived Properties getters/setters e.g. .getDescendants(), .isOn(), .getLocalPath()

Add missing getters for Tree:

  • index -> getIndex()
  • number_opened -> getNumOpened()
  • max_open -> getMaxOpen()
  • dispatch_table -> hasDispatchTable()

Add missing getters for TreeNode:

  • mclass -> getClassID()
  • dtype -> getDtypeID()
  • data_in_nci -> isDataInNci()
  • rfa -> getRFA()`
  • flags -> getFlags()
  • error_on_put -> hadErrorOnPut()
  • cached -> isCached()
  • data_in_nci -> isDataInNci()
  • compression_method -> getCompressionMethodID()
  • compression_method_str -> getCompressionMethod()
  • subtree -> isSubtree()

Add missing setters for TreeNode:

  • disabled -> setDisabled()
  • parent_disabled -> setParentDisabled()

Add aliases for TreeNode properties:

  • conglomerate_elt = conglomerate_element_index
  • number_of_elts = number_of_conglomerate_elements
  • getConglomerateElt() = getConglomerateElementIndex()
  • getConglomerateNodes() = getConglomerateElements()
  • getNumElts() = getNumElements()

This is the first in a series of PRs to cleanup and improve the python package, and include some of the features originally written for mdsthin

Apologies for the effort that will be required to review this, reordering functions makes for a terrible diff

Reformat functions with broken/confusing formatting

Organize similar functions together

Change all NCI Derived Property functions to call getters/setters, rather than the other way around

Group all DBI related things into these sections, ordered by their position in the property section
* DBI Properties
* DBI Properties getters/setters

Group all NCI related things into these sections, ordered by their position in the flags/properties sections
* NCI Flags
   e.g. `.no_write_model`
* NCI Flags getters/setters
   e.g. `.isNoWriteModel()`
* NCI Properties
   e.g. `.brother`
* NCI Properties getters/setters
   e.g. `.getBrother()
* NCI Derived Properties
   e.g. `.descendants`, `.on`, `.local_path`
* NCI Derived Properties getters/setters
   e.g. `.getDescendants()`,  `.isOn()`, `.getLocalPath()`

Add getters for Tree:
* index -> getIndex()
* number_opened -> getNumOpened()
* max_open -> getMaxOpen()
* dispatch_table -> hasDispatchTable()

Add getters for TreeNode:
* mclass -> getClassID()
* dtype -> getDtypeID()
* data_in_nci -> isDataInNci()
* rfa -> getRFA()
* compression_method -> getCompressionMethodID()

Add aliases for TreeNode properties:
* conglomerate_elt = conglomerate_element_index
* number_of_elts = number_of_conglomerate_elements
* getConglomerateElt() = getConglomerateElementIndex()
* getConglomerateNodes() = getConglomerateElements()
* getNumElts = getNumElements

This is the first in a series of PRs to cleanup and improve the python package, and include some of the features originally written for mdsthin
@WhoBrokeTheBuild WhoBrokeTheBuild self-assigned this Aug 3, 2026
@WhoBrokeTheBuild WhoBrokeTheBuild added feature Indicates new feature requests or implementations refactor Relates to refactoring or code quality improvements api/python Relates to the Python API labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api/python Relates to the Python API feature Indicates new feature requests or implementations refactor Relates to refactoring or code quality improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant