Skip to content

Commit 472e94d

Browse files
authored
updated black formatting (#156)
1 parent eb6bbd2 commit 472e94d

19 files changed

+71
-46
lines changed

examples/snopt_bugfix.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def objfunc(xdict):
2323

2424

2525
def sens(xdict, funcs):
26-
"""f(x,y) = (x-3)^2 + xy + (y+4)^2 - 3
27-
"""
26+
"""f(x,y) = (x-3)^2 + xy + (y+4)^2 - 3"""
2827
x = xdict["x"]
2928
y = xdict["y"]
3029
funcsSens = {}

pyoptsparse/postprocessing/OptView_baseclass.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ def DetermineMajorIterations(self, db, OpenMDAO):
253253
self.iter_type[:] = 1.0
254254

255255
def SaveDBData(self, db, data_all, data_major, OpenMDAO, data_str):
256-
""" Method to save the information within the database corresponding
257-
to a certain key to the relevant dictionaries within the Display
258-
object. This method is called twice, once for the design variables
259-
and the other for the outputs. """
256+
"""Method to save the information within the database corresponding
257+
to a certain key to the relevant dictionaries within the Display
258+
object. This method is called twice, once for the design variables
259+
and the other for the outputs."""
260260

261261
# Loop over each optimization iteration
262262
for i, iter_type in enumerate(self.iter_type):
@@ -297,8 +297,8 @@ def SaveDBData(self, db, data_all, data_major, OpenMDAO, data_str):
297297
data_major[new_key].append(data)
298298

299299
def SaveOpenMDAOData(self, db):
300-
""" Examine the OpenMDAO dict and save tags if the variables are
301-
objectives (o), constraints (c), or design variables (dv). """
300+
"""Examine the OpenMDAO dict and save tags if the variables are
301+
objectives (o), constraints (c), or design variables (dv)."""
302302

303303
# Loop over each key in the metadata db
304304
for tag in db:

pyoptsparse/postprocessing/OptView_dash.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ def DetermineMajorIterations(self, db, OpenMDAO):
250250
self.iter_type[:] = 1.0
251251

252252
def SaveDBData(self, db, data_all, data_major, OpenMDAO, data_str):
253-
""" Method to save the information within the database corresponding
254-
to a certain key to the relevant dictionaries within the Display
255-
object. This method is called twice, once for the design variables
256-
and the other for the outputs. """
253+
"""Method to save the information within the database corresponding
254+
to a certain key to the relevant dictionaries within the Display
255+
object. This method is called twice, once for the design variables
256+
and the other for the outputs."""
257257

258258
# Loop over each optimization iteration
259259
for i, iter_type in enumerate(self.iter_type):
@@ -294,8 +294,8 @@ def SaveDBData(self, db, data_all, data_major, OpenMDAO, data_str):
294294
data_major[new_key].append(data)
295295

296296
def SaveOpenMDAOData(self, db):
297-
""" Examine the OpenMDAO dict and save tags if the variables are
298-
objectives (o), constraints (c), or design variables (dv). """
297+
"""Examine the OpenMDAO dict and save tags if the variables are
298+
objectives (o), constraints (c), or design variables (dv)."""
299299

300300
# Loop over each key in the metadata db
301301
for tag in db:

pyoptsparse/pyCONMIN/pyCONMIN.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __call__(
110110
storeSens : bool
111111
Flag sepcifying if sensitivities are to be stored in hist.
112112
This is necessay for hot-starting only.
113-
"""
113+
"""
114114

115115
self.callCounter = 0
116116
self.storeSens = storeSens

pyoptsparse/pyIPOPT/pyIPOPT.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def __call__(
413413
storeSens : bool
414414
Flag sepcifying if sensitivities are to be stored in hist.
415415
This is necessay for hot-starting only.
416-
"""
416+
"""
417417

418418
self.callCounter = 0
419419
self.storeSens = storeSens

pyoptsparse/pyNSGA2/pyNSGA2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __call__(self, optProb, storeHistory=None, hotStart=None, **kwargs):
8787
-----
8888
The kwargs are there such that the sens= argument can be
8989
supplied (but ignored here in nsga2)
90-
"""
90+
"""
9191

9292
# ======================================================================
9393
# NSGA-II - Objective/Constraint Values Function

pyoptsparse/pyOpt_constraint.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ def finalize(self, variables, dvOffset, index):
345345
dvGroup, self.name
346346
)
347347
+ "Expecting a Jacobian of size ({}, {}) but received a Jacobian of size ({}, {}).".format(
348-
self.ncon, ndvs, self.jac[dvGroup]["shape"][0], self.jac[dvGroup]["shape"][1],
348+
self.ncon,
349+
ndvs,
350+
self.jac[dvGroup]["shape"][0],
351+
self.jac[dvGroup]["shape"][1],
349352
)
350353
)
351354
)

pyoptsparse/pyOpt_gradient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __call__(self, x, funcs):
9898
9999
fail : bool
100100
Flag for failure. It currently always returns False
101-
"""
101+
"""
102102

103103
# Since this is *very* dumb loop over all the design
104104
# variables, it is easier to just loop over the x values as an

pyoptsparse/pyOpt_optimization.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def checkVarName(self, varName):
109109
validName : str
110110
A valid variable name. May be the same as varName it that
111111
was, in fact, a valid name.
112-
"""
112+
"""
113113
if varName not in self.variables:
114114
return varName
115115
else:
@@ -137,7 +137,7 @@ def checkConName(self, conName):
137137
validName : str
138138
A valid constraint name. May be the same as conName it that
139139
was, in fact, a valid name.
140-
"""
140+
"""
141141
if conName not in self.constraints:
142142
return conName
143143
else:
@@ -348,7 +348,7 @@ def delVar(self, name):
348348
----------
349349
name : str
350350
Name of variable or variable group to remove
351-
"""
351+
"""
352352
try:
353353
self.variables.pop(name)
354354
except KeyError:
@@ -924,7 +924,7 @@ def getOrdering(self, conOrder, oneSided, noEquality=False):
924924
Flag to split equality constraints into two inequality
925925
constraints. Some optimizers (CONMIN for example) can't do
926926
equality constraints explicitly.
927-
"""
927+
"""
928928

929929
# Now for the fun part determine what *actual* order the
930930
# constraints need to be in: We recognize the following
@@ -1312,7 +1312,7 @@ def evaluateLinearConstraints(self, x, fcon):
13121312
fcon : dict
13131313
Dictionary of the constraints. The linear constraints are
13141314
to be added to this dictionary.
1315-
"""
1315+
"""
13161316

13171317
# This is actually pretty easy; it's just a matvec with the
13181318
# proper linearJacobian entry we've already computed

pyoptsparse/pyOpt_optimizer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _masterFunc(self, x, evaluate):
191191
This list contains at least one of 'fobj', 'fcon', 'gobj'
192192
or 'gcon'. This list tells this function which of the
193193
values is required on return
194-
"""
194+
"""
195195

196196
# We are hot starting, we should be able to read the required
197197
# information out of the hot start file, process it and then
@@ -814,7 +814,7 @@ def setOption(self, name, value=None):
814814
Name of the option to set
815815
value : varies
816816
Variable value to set.
817-
"""
817+
"""
818818

819819
if name in self.options["defaults"]:
820820
if type(value) == self.options["defaults"][name][0]:
@@ -850,7 +850,7 @@ def getOption(self, name):
850850
-------
851851
value : varies
852852
value of option for 'name'
853-
"""
853+
"""
854854

855855
if name in self.options["defaults"]:
856856
return self.options[name][1]
@@ -874,7 +874,7 @@ def getInform(self, infocode=None):
874874
----------
875875
infocode : int
876876
Integer information code
877-
"""
877+
"""
878878

879879
if infocode is None:
880880
return self.informs
@@ -906,7 +906,7 @@ def OPT(optName, *args, **kwargs):
906906
-------
907907
opt : pyOpt_optimizer inherited optimizer
908908
The desired optimizer
909-
"""
909+
"""
910910

911911
optName = optName.lower()
912912
optList = ["snopt", "ipopt", "slsqp", "nlpqlp", "conmin", "nsga2", "psqp", "alpso", "paropt"]

0 commit comments

Comments
 (0)