-
Notifications
You must be signed in to change notification settings - Fork 62
ModelicaSystem - remove xml_file as class variable #321
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
f431876
to
c80d31d
Compare
@ondras12345 do you have an idea why the last commit is needed to make mypy happy? on my local checks there was no problem; I do not understand the background of the error in line 1528: |
OMPython/OMPython/ModelicaSystem.py Line 1481 in f958964
Here, n is a str. Its scope is not limited to that for loop, so it still exists when you get here:OMPython/OMPython/ModelicaSystem.py Lines 1523 to 1528 in f958964
mypy does not know the type of result , so it assumes it is compatible with the previous (inferred) type of n . And when you try to pass that to LinearizationResult , it gives you the
This is my best guess. It looks like there is now an option in mypy to allow variable redefinition, but I'm not sure if it would help in this case. If you want to try it, add this to
|
@ondras12345 Thanks for your analyses - I now also see the problem in the usage of However, did you notice, that current master (3e9c55b) does pass mypy without error and commit f958964 from this PR fails? There are no changes in this part of the code! I plan to update this PR to include PR #321 - it removes the first use of OMPython/OMPython/ModelicaSystem.py Lines 1478 to 1482 in f958964
will be changed to
|
c80d31d
to
3ba84ab
Compare
Even with PR #321 this needed some additional checks as the variable
and
See commit 3ba84ab |
No idea why this is happening. We specify an exact version of mypy, so it shouldn't be that the new CI run pulled a newer version: OMPython/.pre-commit-config.yaml Lines 29 to 30 in 3e9c55b
And we use OMPython/.github/workflows/Test.yml Lines 38 to 39 in 3e9c55b
so it should check all files in each run. |
I don't think it's worth doing renames like this just to please mypy. If |
The rename is not the only point of the commit / PR #321 - it does change other parts of the code at the same place and the rename is just an additional modification at the same point |
3ba84ab
to
f958964
Compare
@syntron as we discussed earlier, a lot of changes are done and it is a good idea to make a new OMPython release. Can you please add the milestone to your PR so I know which ones I should review for release 4.0.0 |
@adeas31 Sorry for the many PRs - I was focused on getting ModelicSystem running in docker and WSL that the other stuff was moved aside. This is currently done and defined in issue #315. Besides that, some smaller (independent) changes exist which are in my fork but do not have at PR at the moment. I will add these also to the issue #315 such that it gives an overview. Regarding milestones, I will indicate it also at this place. From my side, the release could be done now. The OMCPath / ModelicaSystemDoE stuff could then be defined in a 4.1.0 release. I will check all smaller changes if it would makes sense to include them in a 4.0.0 release and mark them accordingly. See also issue #254 |
Great! I like all the work you are doing. |
read the file content and work on this string see: https://stackoverflow.com/questions/647071/python-xml-elementtree-from-a-string-source
… this code (int or str)
56de1e7
to
fa1f453
Compare
cleanup handling of the xml file & remove another class variable
preparation for OMCPath (PR #317)
needs also PR #321