Skip to content

Commit ae0c5ae

Browse files
authored
Merge pull request #2032 from OpenC3/py_help
Fix python help()
2 parents db1008d + 4a175fa commit ae0c5ae

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

openc3/python/openc3/utilities/logger.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 OpenC3, Inc.
1+
# Copyright 2025 OpenC3, Inc.
22
# All Rights Reserved.
33
#
44
# This program is free software; you can modify and/or redistribute it
@@ -64,6 +64,10 @@ def __getattribute__(cls, func):
6464
if func in INSTANCE_ATTRS:
6565
return getattr(cls.instance(), func)
6666

67+
# Handle dunder methods to support help() and other introspection
68+
if func.startswith("__") and func.endswith("__"):
69+
return super().__getattribute__(func)
70+
6771
def method(*args, **kw_args):
6872
return getattr(cls.instance(), func)(*args, **kw_args)
6973

openc3/python/openc3/utilities/store_implementation.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 OpenC3, Inc.
1+
# Copyright 2025 OpenC3, Inc.
22
# All Rights Reserved.
33
#
44
# This program is free software; you can modify and/or redistribute it
@@ -72,6 +72,10 @@ def __getattribute__(cls, func):
7272
if func == "instance" or func == "instance_mutex" or func == "my_instance":
7373
return super().__getattribute__(func)
7474

75+
# Handle dunder methods to support help() and other introspection
76+
if func.startswith("__") and func.endswith("__"):
77+
return super().__getattribute__(func)
78+
7579
def method(*args, **kw_args):
7680
return getattr(cls.instance(), func)(*args, **kw_args)
7781

openc3/python/test/utilities/test_logger.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 OpenC3, Inc.
1+
# Copyright 2025 OpenC3, Inc.
22
# All Rights Reserved.
33
#
44
# This program is free software; you can modify and/or redistribute it
@@ -89,3 +89,6 @@ def test_error_prints_if_level_is_error_or_higher(self):
8989

9090
def test_fatal_only_prints_if_level_is_fatal(self):
9191
self.verify_output(Logger.FATAL, "fatal")
92+
93+
def test_help(self):
94+
help(Logger) # NOSONAR
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 OpenC3, Inc.
2+
# All Rights Reserved.
3+
#
4+
# This program is free software; you can modify and/or redistribute it
5+
# under the terms of the GNU Affero General Public License
6+
# as published by the Free Software Foundation; version 3 with
7+
# attribution addendums as found in the LICENSE.txt
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU Affero General Public License for more details.
13+
14+
# This file may also be used under the terms of a commercial license
15+
# if purchased from OpenC3, Inc.
16+
17+
import unittest
18+
from openc3.utilities.store_implementation import Store
19+
20+
21+
class TestStoreImplementation(unittest.TestCase):
22+
def test_help(self):
23+
help(Store) # NOSONAR

0 commit comments

Comments
 (0)