##// END OF EJS Templates
Reworking object look up code to use existing inspect functionality.
George Titsworth -
Show More
@@ -3157,23 +3157,10 b' class InteractiveShell(SingletonConfigurable):'
3157 raise ValueError("'%s' is a directory, not a regular file." % target)
3157 raise ValueError("'%s' is a directory, not a regular file." % target)
3158
3158
3159 if search_ns:
3159 if search_ns:
3160 obj = None
3160 # Inspect namespace to load object source
3161 parts = target.split(".")
3161 object_info = self.object_inspect(target, detail_level=1)
3162 try:
3162 if object_info['found'] and object_info['source']:
3163 if len(parts) >= 1:
3163 return object_info['source']
3164 obj = self.user_ns[parts[0]]
3165
3166 for new_obj in parts[1:]:
3167 obj = getattr(obj, new_obj)
3168
3169 if obj:
3170
3171 code = oinspect.getsource(obj)
3172 return code
3173 except Exception:
3174 # Either the value wa't in th user_ns or the objects could
3175 # not be inspected. It still might load below, so just pass.
3176 pass
3177
3164
3178 try: # User namespace
3165 try: # User namespace
3179 codeobj = eval(target, self.user_ns)
3166 codeobj = eval(target, self.user_ns)
General Comments 0
You need to be logged in to leave comments. Login now