* Speed up dir() calls on Application and WindowSpecification isntances (by raising AttributeError for __method__ and __member__ attribute checks.
This commit is contained in:
parent
afe3ca0070
commit
4430620e07
@ -211,6 +211,13 @@ class WindowSpecification(object):
|
||||
sets the appropriate criteria for the control.
|
||||
"""
|
||||
|
||||
# dir (and possibly other code introspection asks for the following
|
||||
# members, these are deprecated and I am not using them so just
|
||||
# raise an attribute error immediately
|
||||
if attr in ('__members__', '__methods__'):
|
||||
raise AttributeError(
|
||||
"Application object has no attribute '%s'"% attr)
|
||||
|
||||
from pywinauto.controls.win32_controls import DialogWrapper
|
||||
|
||||
# if we already have 2 levels of criteria (dlg, conrol)
|
||||
@ -1016,6 +1023,13 @@ class Application(object):
|
||||
def __getattr__(self, key):
|
||||
"Find the spedified dialog of the application"
|
||||
|
||||
# dir (and possibly other code introspection asks for the following
|
||||
# members, these are deprecated and I am not using them so just
|
||||
# raise an attribute error immediately
|
||||
if key in ('__members__', '__methods__'):
|
||||
raise AttributeError(
|
||||
"Application object has no attribute '%s'"% key)
|
||||
|
||||
# delegate all functionality to item access
|
||||
return self[key]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user