Conversation
|
@JimHofman Looks like you still need to declare your newCmd as an extension in the config.yaml See: https://ait-core.readthedocs.io/en/master/extensions.html Config yaml would contain an entry that looks like: Would presumably need something similar for the table extension. |
|
I'll check that out Nick. I was sure I had added those. Hmmm. Thanks Nick. |
|
Hey @JimHofman, replying here with regards to the issue(s) you're running into with the table extension support. Thanks for throwing this branch up so we have something to dig through. It looks like you got the "general extension" stuff added and working correctly. That's why you can see log message indicating that the extension class has been added. However, it's not getting fully pulled in for a few reasons (I think). These functions are used by the custom YAML class handling stuff when processing the dictionary So, if you import the table dictionary you'll see a message indicating that the extension was loaded but it's never going to actually load your class because the above functions (and others in the code) are calling explicit class names instead of the "extensions classes". These Looking through the table code really quickly (so you should sanity check that I'm not missing something) I think you need to make the following modifications: |
|
Table extensions now work. Created a newTable.py to override FSWTabDict. class NewFSWTabDict(table.FSWTabDict): Used the following to instantiate and verify: |
ait/core/cmd.py
Outdated
| data = None | ||
| with open(name,'r') as f: | ||
| data = yaml.load(f) | ||
| data = yaml.load(f, Loader=yaml.Loader) |
There was a problem hiding this comment.
Why is this necessary?
There was a problem hiding this comment.
I took out loader=yaml.loader.
We might want to get rid of data=None and use a try/except around the open block.
ait/core/dtype.py
Outdated
| import re | ||
|
|
||
| from ait.core import cmd, dmc, log, util | ||
| from ait.core import cmd, dmc, log, util, table |
There was a problem hiding this comment.
table is not reference in this module
| defn = self.get(name, None) | ||
| if defn: | ||
| tab = FSWTab(defn, *args) | ||
| tab = createFSWTab(defn, *args) |
There was a problem hiding this comment.
createFSWTab method not defined
| if self.fswtabdict is None: | ||
| if self.dirty(): | ||
| self.fswtabdict = FSWTabDict(self.filename) | ||
| self.fswtabdict = createFSWTabDict(self.filename) |
There was a problem hiding this comment.
createFSWTabDict not defined
| fields['fswheaderdefns'] = fields.pop('header', None) | ||
| fields['coldefns'] = fields.pop('columns', None) | ||
| return FSWTabDefn(**fields) | ||
| return createFSWTabDefn(**fields) |
There was a problem hiding this comment.
createFSWTabDict not defined
config/config.yaml
Outdated
| ait.core.cmd.Cmd: ait.core.newCmd.NewCmd | ||
| ait.core.table.FSWTabDict: ait.core.newTable.NewFSWTabDict |
There was a problem hiding this comment.
These are testing codes?
There was a problem hiding this comment.
Yes that is for testing. I took it out.
|
Correct, the createXxx() methods are implicitly added here: Line 148 in 5b9a247 |
jasonmlkang
left a comment
There was a problem hiding this comment.
Please see comment. Thanks!
There was a problem hiding this comment.
This overwrites previous definition of YAMLCtor_include. Is this done on purpose?
There was a problem hiding this comment.
Sorry, my comment from last review was incorrect. The createFSWxxx method gets created in run-time during the extension process (i.e. util.__init_extensions__). So it is okay to call createFSWxxx method here. Please revert back to before this commit.
There was a problem hiding this comment.
Sorry, my comment from last review was incorrect. The createFSWxxx method gets created in run-time during the extension process (i.e. util.__init_extensions__). So it is okay to call createFSWxxx method here. Please revert back to before this commit.
ait/core/table.py
Outdated
| defn = self.get(name, None) | ||
| if defn: | ||
| tab = createFSWTab(defn, *args) | ||
| tab = FSWTab(defn, *args) |
There was a problem hiding this comment.
Sorry, my comment from last review was incorrect. The createFSWxxx method gets created in run-time during the extension process (i.e. util.__init_extensions__). So it is okay to call createFSWxxx method here. Please revert back to before this commit.
| if self.dirty(): | ||
| self.fswtabdict = createFSWTabDict(self.filename) | ||
| self.fswtabdict = FSWTabDict(self.filename) | ||
| self.update() |
There was a problem hiding this comment.
Sorry, my comment from last review was incorrect. The createFSWxxx method gets created in run-time during the extension process (i.e. util.__init_extensions__). So it is okay to call createFSWxxx method here. Please revert back to before this commit.
There was a problem hiding this comment.
Ok, I made the changes back and update utll.py
No description provided.