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

References #90

Draft
wants to merge 13 commits into
base: dev
Choose a base branch
from
Draft

References #90

wants to merge 13 commits into from

Conversation

lepmik
Copy link
Member

@lepmik lepmik commented May 16, 2019

  • References and RegionReferences
  • Stored in datasets

@lepmik lepmik requested a review from dragly May 16, 2019 11:18
@codecov
Copy link

codecov bot commented May 16, 2019

Codecov Report

Merging #90 (58fdc2d) into dev (dd8f40f) will increase coverage by 0.44%.
The diff coverage is 97.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #90      +/-   ##
==========================================
+ Coverage   95.57%   96.02%   +0.44%     
==========================================
  Files          11       14       +3     
  Lines        1604     1935     +331     
==========================================
+ Hits         1533     1858     +325     
- Misses         71       77       +6     
Impacted Files Coverage Δ
tests/test_reference.py 76.19% <76.19%> (ø)
tests/test_links.py 97.95% <97.95%> (ø)
tests/test_dataframe.py 98.96% <98.96%> (ø)
tests/test_attr.py 98.59% <100.00%> (+0.06%) ⬆️
tests/test_dataset.py 100.00% <100.00%> (ø)
tests/test_group.py 95.80% <0.00%> (+0.34%) ⬆️
tests/test_file.py 98.14% <0.00%> (+0.74%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd8f40f...58fdc2d. Read the comment docs.

Copy link
Member

@dragly dragly left a comment

Choose a reason for hiding this comment

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

I had completely forgotten about this PR until I saw your latest commit @lepmik.

I glanced quickly over it now and spotted a few immediate issues that should be addressed. I am not sure if you are still planning to merge this? I figured I should ask before I continue the review.

Comment on lines +8 to +22
def special_dtype(**kwds):
""" Create a new h5py "special" type. Only one keyword may be given.
Legal keywords are:
vlen = basetype
Base type for HDF5 variable-length datatype. This can be Python
str type or instance of np.dtype.
Example: special_dtype( vlen=str )
enum = (basetype, values_dict)
Create a NumPy representation of an HDF5 enumerated type. Provide
a 2-tuple containing an (integer) base dtype and a dict mapping
string names to integer values.
ref = Reference | RegionReference
Create a NumPy representation of an HDF5 object or region reference
type.
"""
Copy link
Member

Choose a reason for hiding this comment

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

This code is copied from h5py. This file should therefore have a header stating that it originates from h5py and has a BSD license. Something similar to their own headers is fine, except it should not state that it is part of h5py, of course:

# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2019 Andrew Collette and contributors
#
# License:  Standard 3-clause BSD; see "license.txt" for full license terms
#           and contributor agreement.

In addition, we should add a third-party-licenses/h5py.txt file to the repo.

The mentions of HDF5 and h5py in the code itself should probably be replaced with exdir to avoid confusion.

Comment on lines +52 to +68
def check_string_dtype(dt):
"""If the dtype represents an HDF5 string, returns a string_info object.
The returned string_info object holds the encoding and the length.
The encoding can only be 'utf-8' or 'ascii'. The length may be None
for a variable-length string, or a fixed length in bytes.
Returns None if the dtype does not represent an HDF5 string.
"""
vlen_kind = check_vlen_dtype(dt)
if vlen_kind is unicode:
return string_info('utf-8', None)
elif vlen_kind is bytes:
return string_info('ascii', None)
elif dt.kind == 'S':
enc = (dt.metadata or {}).get('h5py_encoding', 'ascii')
return string_info(enc, dt.itemsize)
else:
return None
Copy link
Member

Choose a reason for hiding this comment

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

I think this is unused. We should probably remove unused functions unless they are supposed to be part of the public API.

Comment on lines +22 to +39
# TODO add the code below for testing true equality when parallelizing
# def __eq__(self, other):
# self[:]
# if isinstance(other, self.__class__):
# other[:]
# if self.__dict__.keys() != other.__dict__.keys():
# return False
#
# for key in self.__dict__:
# if key == "_data":
# if not np.array_equal(self.__dict__["_data"], other.__dict__["_data"]):
# return False
# else:
# if self.__dict__[key] != other.__dict__[key]:
# return False
# return True
# else:
# return False
Copy link
Member

Choose a reason for hiding this comment

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

We should probably remove TODOs before merging.

@lepmik
Copy link
Member Author

lepmik commented Feb 23, 2021

Not planning on working with this now, it was originally started upon to enable integration of exdir into NWB, so we can probably freeze this for the time being.

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