-
Notifications
You must be signed in to change notification settings - Fork 1
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
calling .save() or is_present() methods of Resource raise exception #1
Comments
Just a brief update: I've found the problematic line and how to make it work, but I'm not 100% sure about the logic. The problematic line is this surfrdf/surf/query/__init__.py Lines 411 to 435 in 79ffca6
Take a [('?s', '?p', '?o'), u'(?s = <http://purl.org/hucit/kb/authors/927/cts_urn>)'] In the version of if type(statement) in [list, tuple] which for the statement above returns In version isinstance(statement, (list, tuple)) which now returns PS: the type of |
The big difference between the two is that isinstance takes into account
inheritance. Might have been an oversight from the developer or myself.
Le mer. 13 févr. 2019 à 10:12 PM, Matteo Romanello <[email protected]>
a écrit :
… Just a brief update: I've found the problematic line and how to make it
work, but I'm not 100% sure about the logic.
The problematic line is this if/else block:
https://github.com/PonteIneptique/surfrdf/blob/79ffca6bd71cf5b2558aa08373cf71572fa1e64a/surf/query/__init__.py#L411-L435
Take a statement like
[('?s', '?p', '?o'), u'(?s = <http://purl.org/hucit/kb/authors/927/cts_urn>)']
In the version of surf that still works (1.1.9) the type is checked using
if type(statement) in [list, tuple]
which for the statement above returns False.
In version 1.2.0 the line has been changed into
isinstance(statement, (list, tuple))
which now returns True for the same statement. If I change that line to
how it previously was, all works fine, but I do not understand why this
difference between isinstance and type.
PS: the type of statement is NamedGroup, which is a subclass of Group,
which is a subclass of list. Perhaps what's happening is that using
isinstance here has the side effect of capturing this inheritance between
classes (which is AFAIU unintentional)?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB1yZt1xRhQBxpJ_EqpnymdAfX0svyjPks5vNH_GgaJpZM4a538G>
.
|
changing type checking (see issue #1) as per Thibault's suggestion
For the full description see issue on upstream repo.
Here you can see an example of how the code fails (this refers to the Python3 branch of
hucitlib
and uses your py3-compliant version ofsurf
; however, I reproduce the same error withsurf==1.2.0
andhucitlib
master branch. Withsurf==1.1.9
all works fine).PS: the fact that the surf repo does not have releases makes it difficult for me to do some debugging with a locally modified version of 1.1.9 and 1.2.0, and compare the two behaviours.
The text was updated successfully, but these errors were encountered: