Skip to content
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

reusing OpenMDAO _ReprClass #724

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions dymos/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,7 @@
import numpy as np

from .constants import INF_BOUND


class _ReprClass(object):
"""
Class for defining objects with a simple constant string __repr__.

This is useful for constants used in arg lists when you want them to appear in
automatically generated source documentation as a certain string instead of python's
default representation.
"""

def __init__(self, repr_string):
"""
Initialize the __repr__ string.

Parameters
----------
repr_string : str
The string to be returned by __repr__
"""
self._repr_string = repr_string

def __repr__(self):
"""
Return our _repr_string.

Returns
-------
str
Whatever string we were initialized with.
"""
return self._repr_string

def __str__(self):
return self._repr_string
from openmdao.core.constants import _ReprClass


# unique object to check if default is given (when None is an allowed value)
Expand Down