-
Notifications
You must be signed in to change notification settings - Fork 12
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
add @mandresm contributions to the fix #1281
Conversation
Hey @pgierz ! This is a PR to your original branch with hopefully a few improvements. Feel free to merge if you like it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I have a question. See below:
if isinstance(result, list) and date_operation: | ||
result = result[ | ||
-1 | ||
] # should be extended in the future - here: if list (= if diff between dates) than result in seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this only the case for dates? I didn't know that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was the case for every list, but I think the only way we had of generating lists from a string on the past was via Date operations (because date objects don't contain this functionality so that functionality ended up here, somehow)
entry = ListWithProvenance(result, None) | ||
entry.set_provenance(rhs.provenance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might not understand something about provenance 100% yet, but why not this version:
entry = ListWithProvenance(result, None) | |
entry.set_provenance(rhs.provenance) | |
entry = ListWithProvenance(result, rhs.provenance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For providing provenance values during instanciation of ListWithProvenance
(or DictWithProvenance
) the provenance needs to have the same structure as the original list or dict. That is to say, if you have a dict
with some key-values, what you need to give in the second argument of the instancing is also a dict
with the same keys, but the values are provenances. set_provenance
is used to assign the same unique provenance to a whole list/or dict with provenance, which is what we want in this case (we are expanding a string into a list so we want to assign a single provenance information to the new elements of the list.
This is tested and produces a list such as discussed in #1279