-
Notifications
You must be signed in to change notification settings - Fork 31
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
Format update #35
Format update #35
Conversation
src/complexify.py
Outdated
import os | ||
import glob | ||
import re | ||
from stat import * # noqa: F403 |
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.
Could you not tell what the star imports were?
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.
Never mind I see you fixed this later on.
@@ -148,9 +148,9 @@ def reg_file_comp(ref_file, comp_file): | |||
str1 = "@value 3.141592653589793 1e-12 1e-12" | |||
str2 = "@value 3.141592653589999 1e-12 1e-12" | |||
|
|||
print("This comp should be True: ", reg_comp(str1, str2)) | |||
print("This comp should be True: ", _reg_str_comp(str1, str2)) |
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 forget, why is this change necessary?
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.
reg_comp
does not exist anymore - I believed you renamed it to _reg_str_comp
, but this was not caught as an error because we never run python mdo_regression_helper.py
idwarp/MultiUnstructuredMesh.py
Outdated
import numpy as np | ||
from pprint import pprint | ||
from mpi4py import MPI | ||
from .MExt import MExt | ||
from petsc4py import PETSc | ||
|
||
try: | ||
from cgnsutilities import cgns_utils as cs |
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 actually reminds me, we changed the file names, so this should probably be updated to
from cgnsutilities import cgnsutilities as cs
@@ -277,7 +277,6 @@ def write_output(filename, lines): | |||
try: | |||
g = open(newname, "w") | |||
except IOError as err: | |||
f.close() |
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 suspect this was supposed to be g.close()
I think? Not really sure.
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, that was my guess too... but then I realized that it did not make sense to close something that was never opened, so I removed it altogether. I can put g.close()
back in, but one way or the other that except is going to exit the run - more or less gracefully
So I am a tiny bit uneasy about fixing See for example this file. |
Yeah, I was a bit uneasy too but I gave it a shot. I will revert it back as you suggest |
I will fix |
Sure, instead of reverting commits you can just copy/paste what we had before and do a single commit that way. |
That's the only way I am able to do it ahaha |
@nwu63 this should fix it? |
Good except you still need to run |
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 with me but I'd prefer someone else to also take a look.
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.
Few minor things, otherwise looks good.
idwarp/MultiUnstructuredMesh.py
Outdated
@@ -121,7 +124,7 @@ def __init__(self, CGNSFile, optionsDict, comm=None, dtype='d'): | |||
self.warp | |||
except AttributeError: | |||
curDir = os.path.dirname(os.path.realpath(__file__)) | |||
self.warp = MExt('idwarp', [curDir], debug=debug)._module | |||
self.warp = MExt("idwarp", [curDir])._module |
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.
To maintain consistency please keep this argument and add a default value debug=False
in the __init__
function.
idwarp/MultiUnstructuredMesh.py
Outdated
@@ -763,12 +762,12 @@ def warpMesh(self): | |||
""" | |||
|
|||
# Get proc ID | |||
myID = self.comm.Get_rank() | |||
self.myID = self.comm.Get_rank() |
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.
Instead of overwriting the value (which is set once in the __init__
function) please just remove this line (and the ones below).
idwarp/MultiUnstructuredMesh.py
Outdated
print('| All IDWarp Options: |') | ||
print('+---------------------------------------+') | ||
print("") | ||
print(" Options of mesh", mesh, "of", len(self.meshes)) |
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 will print out the handle to the mesh object. Not sure this is the desired behavior.
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.
Few minor things, otherwise looks good. Do we want to add the black/flake8 commit to a git blame ignore file?
@nwu63 what is our final position on this? I have one I can add now, but we realized that such file is only useful locally.. other ppl must initialize it in their git option for it to work, and still it is not effective on the browser interface. Your call guys! |
Yeah personally I don't see much value in it since git cannot pick it out automatically, and it just sort of clutters the repo. Most tools can |
Purpose
I re-formatted the code, as per this issue.
The first two commits are the
black
and manualflake8
fixes respectively.I committed separately a few fixes that I would like the reviewers to double check carefully, to be sure that the code behaviour is not changing
Type of change
Checklist
flake8
andblack
to make sure the code adheres to PEP-8 and is consistently formatted