-
Notifications
You must be signed in to change notification settings - Fork 3
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
restructured API response #4
Conversation
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.
Just two small comments that I think should be easy to address. Once they're complete, you can then focus about adapting to the new API structure! Thanks!
model/node_differ.py
Outdated
curr_text = curr_text[c["curr"]['offset']:c["curr"]['offset']+c["curr"]['size']].replace("\n", "\\n") | ||
is_edit_type_found,wikitext,edit_type = is_edit_type(prev_text,c['prev']['type']) | ||
#check if edit_type in edit types dictionary | ||
if edit_types.get(edit_type,{}) and is_edit_type_found: |
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'm not sure the is_edit_type_found
variable is having an effect right now. My understanding is that if it's False, you probably don't want to do increment any counts (just continue). If I'm reading the code right, currently if it's False, it still leads to a clause that updates the edit_types dictionary. So maybe instead just add something like: if is_edit_type_found: continue
after running the is_edit_type
function. Then you don't have to include it in any of the other if/else statements. This applies to each of the insert/remove/change clauses (not just this specific one).
model/node_differ.py
Outdated
is_edit_type_found,wikitext,edit_type = is_edit_type(prev_text,c['prev']['type']) | ||
#check if edit_type in edit types dictionary | ||
if edit_types.get(edit_type,{}) and is_edit_type_found: | ||
if edit_types.get(edit_type,{}).get('change'): |
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.
this whole if/else block can be simplified I think to the following: edit_types[edit_type]['change'] = edit_types[edit_type].get('change', 0) + 1
Again, same goes for the corresponding insert/remove clauses higher up in the code
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.
Thanks for the review, Isaac! I'd implement these changes.
update tree differ to do moves and merge text changes into single blo…
Some quick high-level thoughts:
|
That was a mistake. I'd fix and make a commit. |
Thanks! Merging |
No description provided.