-
Notifications
You must be signed in to change notification settings - Fork 6
Improve typings of most of the important stuff #69
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
Conversation
villelaitila
left a comment
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.
Good work, improves the maintainability a lot
| """ | ||
| ignored_attributes = ignored_attributes or [] | ||
|
|
||
| extracted_paths = [] |
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.
Yes, can be removed, and also the for loop that iterates it.
src/sgraph/compare/modelcompare.py
Outdated
| def compare(self, path1, path2): | ||
| def compare(self, path1: str, path2: str): | ||
| #? What should be the correct implementation here? This doesn't seem to be correct. | ||
| model1 = SGraph(path1) |
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 think this would be the correct way in this function
model1 = SGraph.parse_xml_or_zipped_xml(path1)
model2 = SGraph.parse_xml_or_zipped_xml(path2)
src/sgraph/modelapi.py
Outdated
| raise ValueError("Either filepath or model must be provided") | ||
|
|
||
| self.egm = model | ||
| #? Is this intentionally "model" and not "self.model"? |
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.
good find, should be self.model
src/sgraph/modelapi.py
Outdated
| def getUsedElements(self, elem: SElement): | ||
| associations = [x for x in elem.outgoing] | ||
| return set(map(lambda x: x.fromElement, associations)) | ||
| #? Is this intentionally "fromElement" and not "toElement"? |
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.
Good find, should be otherwise
villelaitila
left a comment
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.
Good changes
src/sgraph/selementassociation.py
Outdated
| return {'existingOrNewAssociation': new_association, 'isNew': True} | ||
|
|
||
| def __init__(self, fr, to, deptype, depattrs=None): | ||
| #? Is it ok to update return value? The new one is the one described in the docstring |
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.
That's ok
Looking good 🎉
|
Add typings for most of the things. Needs to be tested thoroughly because there are couple of changes I had to make, to make the type checker happy.
Some types are still WIP 😄