[Yt-svn] yt: Override dir(amods) to provide a list of non-loaded, but loa...

hg at spacepope.org hg at spacepope.org
Sat Sep 25 18:21:57 PDT 2010


hg Repository: yt
details:   yt/rev/d7e28cdce956
changeset: 3416:d7e28cdce956
user:      Matthew Turk <matthewturk at gmail.com>
date:
Sat Sep 25 18:21:52 2010 -0700
description:
Override dir(amods) to provide a list of non-loaded, but loadable, analysis modules

diffstat:

 yt/analysis_modules/list_modules.py |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r 2026a9e7f7ca -r d7e28cdce956 yt/analysis_modules/list_modules.py
--- a/yt/analysis_modules/list_modules.py	Sat Sep 25 18:09:56 2010 -0700
+++ b/yt/analysis_modules/list_modules.py	Sat Sep 25 18:21:52 2010 -0700
@@ -49,4 +49,10 @@
             raise AttributeError(attr)
         return getattr(self, attr)
 
+    def __dir__(self):
+        # This is a badly behaving object.  I was unable to get this line:
+        #return super(AnalysisModuleLoader, self).__dir__() + self.available_modules
+        # to work, so we simply return only the methods we know about.
+        return ["available_modules"] + self.available_modules
+
 amods = AnalysisModuleLoader()



More information about the yt-svn mailing list