Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema inference enhancements #1037

Merged
merged 11 commits into from
Aug 29, 2024
Merged

Schema inference enhancements #1037

merged 11 commits into from
Aug 29, 2024

Conversation

CodyCBakerPhD
Copy link
Member

@CodyCBakerPhD CodyCBakerPhD commented Aug 28, 2024

@h-mayorquin Thanks for reporting the bug

Correcting a typo, enhancing warning info, and debugging exclusion interaction here

@CodyCBakerPhD CodyCBakerPhD self-assigned this Aug 28, 2024
@h-mayorquin
Copy link
Collaborator

Oh, thanks for taking over the fixing. Let me know when is ready and I can run in the current example to see if it becomes clearer.

Current example for future reference:

/home/heberto/development/neuroconv/src/neuroconv/basedatainterface.py:81: UserWarning: The argument_name 'nwbfile' from the docstring not occur in the method signature, possibly due to a typo.
  return get_json_schema_from_method_signature(self.add_to_nwbfile, exclude=["nwbfile", "metadata"])
/home/heberto/development/neuroconv/src/neuroconv/basedatainterface.py:81: UserWarning: The argument_name 'metadata' from the docstring not occur in the method signature, possibly due to a typo.
  return get_json_schema_from_method_signature(self.add_to_nwbfile, exclude=["nwbfile", "metadata"])
/home/heberto/development/neuroconv/src/neuroconv/basedatainterface.py:81: UserWarning: The argument_name 'The default is False (append mode).' from the docstring not occur in the method signature, possibly due to a typo.
  return get_json_schema_from_method_signature(self.add_to_nwbfile, exclude=["nwbfile", "metadata"])

@CodyCBakerPhD CodyCBakerPhD marked this pull request as ready for review August 28, 2024 18:19
@CodyCBakerPhD
Copy link
Member Author

@h-mayorquin I am unable to reproduce the The argument_name 'The default is False (append mode).' case

Can you give this a try and see how it works?

@@ -315,7 +315,6 @@ def add_to_nwbfile(

metadata['Ecephys']['ElectricalSeries'] = dict(name=my_name, description=my_description)

The default is False (append mode).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CodyCBakerPhD it seems that it came from here. Let me test, anyway, this was an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would be correct!

https://github.com/catalystneuro/neuroconv/blob/main/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py#L318 would be interpreted as an argument not the description of the argument it is attached to

@h-mayorquin
Copy link
Collaborator

h-mayorquin commented Aug 28, 2024

After my last changes and yours now I don't get any of those warnings but I saw the tests are failing. Let's see how they do on this run.

@CodyCBakerPhD
Copy link
Member Author

@h-mayorquin Tests passing now

Might be worth cutting a hotfix release for this

@h-mayorquin
Copy link
Collaborator

@h-mayorquin Tests passing now

Might be worth cutting a hotfix release for this

Yeah, why not, plus I know how to fix images so they display correctly in pipy and I forgot to do it in the latest release.

https://pypi.org/project/ndx-binned-spikes/

@h-mayorquin h-mayorquin enabled auto-merge (squash) August 28, 2024 21:22
@@ -102,6 +102,9 @@ def get_json_schema_from_method_signature(method: Callable, exclude: Optional[li
exclude = exclude or []
exclude += ["self", "cls"]

split_qualname = method.__qualname__.split(".")[-2:]
method_display = ".".join(split_qualname) if "<" not in split_qualname[0] else method.__name__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the < case for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes <locals> (local namespaces domain) shows up for basic functions. Think it depends on how those functions are defined/imported, but it happens in the tests and I think would happen if you locally defined a data interface in the same script you are trying to run this with

@h-mayorquin h-mayorquin merged commit a8d702d into main Aug 29, 2024
35 checks passed
@h-mayorquin h-mayorquin deleted the fix_warning branch August 29, 2024 13:35
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.42%. Comparing base (8522241) to head (31b7d86).
Report is 77 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1037   +/-   ##
=======================================
  Coverage   90.41%   90.42%           
=======================================
  Files         129      129           
  Lines        7919     7924    +5     
=======================================
+ Hits         7160     7165    +5     
  Misses        759      759           
Flag Coverage Δ
unittests 90.42% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...erfaces/ecephys/baserecordingextractorinterface.py 92.78% <ø> (ø)
src/neuroconv/nwbconverter.py 94.81% <100.00%> (+0.03%) ⬆️
src/neuroconv/tools/testing/mock_interfaces.py 100.00% <ø> (ø)
src/neuroconv/utils/json_schema.py 96.87% <100.00%> (+0.08%) ⬆️

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