Skip to content

Commit

Permalink
Convert from using Undefined class to _UNDEFINED const
Browse files Browse the repository at this point in the history
  • Loading branch information
hschilling committed Aug 14, 2020
1 parent 71481d3 commit e541545
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions openmdao/utils/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

import numpy as np

from openmdao.solvers.solver import Solver
from openmdao.utils.options_dictionary import Undefined


def _new_setup(self):
import os
Expand Down Expand Up @@ -92,6 +89,4 @@ def default(self, obj):
return float(obj)
elif isinstance(obj, np.ndarray):
return obj.tolist()
elif isinstance(obj, Undefined):
return "undefined"
return json.JSONEncoder.default(self, obj)
4 changes: 2 additions & 2 deletions openmdao/visualization/n2_viewer/n2_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from openmdao.utils.mpi import MPI
from openmdao.visualization.html_utils import read_files, write_script, DiagramWriter
from openmdao.utils.general_utils import warn_deprecation
from openmdao.utils.options_dictionary import Undefined
from openmdao.core.constants import _UNDEFINED

_IND = 4 # HTML indentation (spaces)

Expand Down Expand Up @@ -197,7 +197,7 @@ def _get_tree_dict(system, component_execution_orders, component_execution_index
if k in ['linear_solver', 'nonlinear_solver']:
options[k] = system.options[k].SOLVER
else:
if isinstance(system.options._dict[k]['value'], Undefined):
if system.options._dict[k]['value'] == _UNDEFINED:
options[k] = str(system.options._dict[k]['value'])
else:
options[k] = system.options._dict[k]['value']
Expand Down
2 changes: 1 addition & 1 deletion openmdao/visualization/n2_viewer/tests/betz_tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
],
"options": {
"distributed": false,
"name": "undefined",
"name": "UNDEFINED",
"val": 1.0,
"shape": null,
"units": null,
Expand Down

0 comments on commit e541545

Please sign in to comment.