HDFStore.__contains__ bug due to use of regex #2694

Closed
bsdfish opened this Issue Jan 14, 2013 · 5 comments

Comments

Projects
None yet
3 participants

bsdfish commented Jan 14, 2013

HDFStore.contains takes the node name and uses it as a pattern to search for. That crashes if the name of the node isn't a valid regex, for example "node1(()" and doesn't function correctly if the node name is a valid regex but doesn't necessarily match itself.

Contributor

jreback commented Jan 14, 2013

easy fix, the reason for the regex is to allow you to pass w/o the leading '/'.....
out of curiosity, why would name a group like that?

Contributor

jreback commented Jan 14, 2013

and pytables gives a NaturalNameWarning on this in any event (it still works though)

Contributor

jreback commented Jan 14, 2013

fixed

bsdfish commented Jan 14, 2013

I'm caching values w/ keys based on function calls, so perfectly valid names are 'foo(3)' or maybe 'bar("(()")' if someone ever decides to pass a string "(()" into the function. I can work around using hashes, etc but this makes it easy to follow.

Contributor

jreback commented Jan 14, 2013

sounds good
btw u can suppress the natural name warning easily if u want (see test_pytables.py)

@jreback jreback added a commit to jreback/pandas that referenced this issue Jan 15, 2013

@jreback jreback BUG: fix for GH #2694 (natural naming issue on __contains__) 50eb561

wesm closed this Jan 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment