Repository navigation
fix(session): load and save data variables with function-based adapters - #150
Draft
ehennestad wants to merge 1 commit into
Draft
ehennestad wants to merge 1 commit into
ehennestad wants to merge 1 commit into
Conversation
A function-based file adapter, such as MatFile of the core module, is a folder with a fileadapter.json and read and write functions, not a class. VariableModel.updateVariableDataType got a variable's data type by creating the adapter class, so adding a variable with such an adapter failed, and Session.loadData called the folder's package name as a function. The DSM converter gives a .mat file pattern the first adapter that lists .mat, which is MatFile. The data type now comes from the adapter list, which reads it from fileadapter.json. Session wraps a function-based adapter in DynamicFileAdapter, as nansen.load does. DynamicFileAdapter.readData and writeData accept the variable name that FileAdapter.load and save pass on, so Session.saveData no longer fails with "Too many input arguments". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ehennestad
added this pull request to stack #122
September 19, 2026 16:41
Contributor
Test Results447 tests 447 ✅ 1m 21s ⏱️ Results for commit 1e9259e. |
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.
Mechanism
A function-based file adapter, such as
MatFileof the core module, is a folder withfileadapter.jsonand read and write functions.nansen.loadwraps it inDynamicFileAdapter, andlistFileAdapterslists it withIsDynamictrue.Problem
VariableModel.updateVariableDataTypeobtained a variable's data type by constructing the adapter class, which fails for a folder, so a variable with such an adapter could not be added.Session.getFileAdapterFcncalled the folder's package name as a function.DynamicFileAdapter.writeDatadid not accept the variable name thatFileAdapter.savepasses, soSession.saveDatafailed with "Too many input arguments". The DSM converter gives every.matpattern the first adapter that lists.mat, which isMatFile.Changes
updateVariableDataTypeandupdateDefaultValuesreadDataTypefrom the adapter list, which takes it fromfileadapter.json.Session.getFileAdapterFcnreturns aDynamicFileAdapterconstructor for a function-based adapter.DynamicFileAdapter.readDataandwriteDataaccept the arguments thatFileAdapter.loadandsavepass on.FunctionBasedFileAdapterTest(data type, load, save).🤖 Generated with Claude Code