##// END OF EJS Templates
Backport PR #14033: MAINT: reintroduce a OInfo get method for backward compatibility.
Matthias Bussonnier -
Show More
@@ -69,6 +69,23 b' class OInfo:'
69 69 parent: Any
70 70 obj: Any
71 71
72 def get(self, field):
73 """Get a field from the object for backward compatibility with before 8.12
74
75 see https://github.com/h5py/h5py/issues/2253
76 """
77 # We need to deprecate this at some point, but the warning will show in completion.
78 # Let's comment this for now and uncomment end of 2023 ish
79 # warnings.warn(
80 # f"OInfo dataclass with fields access since IPython 8.12 please use OInfo.{field} instead."
81 # "OInfo used to be a dict but a dataclass provide static fields verification with mypy."
82 # "This warning and backward compatibility `get()` method were added in 8.13.",
83 # DeprecationWarning,
84 # stacklevel=2,
85 # )
86 return getattr(self, field)
87
88
72 89 def pylight(code):
73 90 return highlight(code, PythonLexer(), HtmlFormatter(noclasses=True))
74 91
General Comments 0
You need to be logged in to leave comments. Login now