1 """module irafnames.py -- define how names of IRAF packages and tasks get
2 included in the user's namespace. Uses a plug-in strategy so behavior can
3 be changed.
4
5 $Id: irafnames.py 1463 2011-06-24 22:58:30Z stsci_embray $
6
7 R. White, 1999 March 26
8 """
9 from __future__ import division
10
11 import __main__
12 from stsci.tools import irafglobals
13 import iraf
14
16 """Add a task object to the module namespace
17
18 Skip if there is a collision with another name
19 unless it is an IrafTask
20 """
21 name = task.getName()
22 if hasattr(module, name):
23 p = getattr(module, name)
24 else:
25 p = None
26 if (p is None) or isinstance(p, irafglobals.IrafTask):
27 setattr(module, name, task)
28 else:
29 if irafglobals.Verbose>0:
30 print "Warning: " + module.__name__ + "." + \
31 name + " was not redefined as Iraf Task"
32
33
34
40
41
42
43
47
48
49
53
54
55
60
64
68
72
73
74
75
76
77 setCleanStrategy()
78