Skip to content

Commit 05080ec

Browse files
dbiebercopybara-github
authored andcommitted
Don't show properties on uninstantiated classes outside verbose mode / completion scripts.
PiperOrigin-RevId: 260042848 Change-Id: Ia773c9922a1138693b8fb17d7f5595289ea5d35b
1 parent 8de8836 commit 05080ec

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

fire/completion.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ def MemberVisible(component, name, member, class_attrs=None, verbose=False):
328328
if class_attrs is None:
329329
class_attrs = GetClassAttrsDict(class_attrs)
330330
class_attr = class_attrs.get(name)
331-
if class_attr and class_attr.kind == 'method':
331+
if class_attr and class_attr.kind in ('method', 'property'):
332+
# methods and properties should be accessed on instantiated objects,
333+
# not uninstantiated classes.
332334
return False
333335
if (six.PY2 and inspect.isfunction(component)
334336
and name in ('func_closure', 'func_code', 'func_defaults',

fire/helptext_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,10 @@ def testUsageOutputNone(self):
427427
textwrap.dedent(expected_output).lstrip('\n'),
428428
usage_output)
429429

430-
@testutils.skip('Only passes in Python 3 for now.')
431430
def testInitRequiresFlagSyntaxSubclassNamedTuple(self):
432431
component = tc.SubPoint
433432
t = trace.FireTrace(component, name='SubPoint')
434-
usage_output = helptext.UsageText(component, trace=t, verbose=True)
433+
usage_output = helptext.UsageText(component, trace=t, verbose=False)
435434
expected_output = 'Usage: SubPoint --x=X --y=Y'
436435
self.assertIn(expected_output, usage_output)
437436

0 commit comments

Comments
 (0)