Beispiel #1
0
    def __init__(self):

        global completer
        completer = self

        if hasattr(Completer, '__init__'):
            Completer.__init__(self)
        self.completionChar = None
        self.taskpat = re.compile(r"(\?|(?:\w+))[ \t]+(?=$|[\w.<>|/~'" +
                                  r'"])')
        # executive commands dictionary (must be set by user)
        self.executiveDict = minmatch.MinMatchDict()
Beispiel #2
0
 def _moduleInit(self):
     global the_iraf_module
     self.__dict__['module'] = the_iraf_module
     self.__dict__['__name__'] = the_iraf_module.__name__
     # create minmatch dictionary of current module contents
     self.__dict__['mmdict'] = minmatch.MinMatchDict(vars(self.module))
Beispiel #3
0
    # in PY3K, UnboundMethodType is simply FunctionType
    _methodTypes += (types.UnboundMethodType, )

_listTypes = (list, tuple, dict)

_numericTypes = (float, int, long, complex)
if 'bool' in globals():
    _numericTypes = _numericTypes + (bool, )

_allSingleTypes = _functionTypes + _methodTypes + _listTypes + _numericTypes

# set up minimum-match dictionary with function keywords

kwnames = ('variables', 'functions', 'modules', 'tasks', 'packages', 'hidden',
           'padchars', 'regexp', 'html')
_kwdict = minmatch.MinMatchDict()
for key in kwnames:
    _kwdict.add(key, key)
del kwnames, key

# additional keywords for IRAF help task

irafkwnames = ('file_template', 'all', 'parameter', 'section', 'option',
               'page', 'nlpp', 'lmargin', 'rmargin', 'curpack', 'device',
               'helpdb', 'mode')
_irafkwdict = {}
for key in irafkwnames:
    _kwdict.add(key, key)
    _irafkwdict[key] = 1
del irafkwnames, key
Beispiel #4
0
 def executive(self, elist):
     """Add list of executive commands (assumed to start with '.')"""
     self.executiveDict = minmatch.MinMatchDict()
     for cmd in elist:
         self.executiveDict.add(cmd, 1)
Beispiel #5
0
    lab2char[lab] = char
    lab2char[f"Control-{ichar}"] = char
    lab2char[fr"\C-{ichar}"] = char
char2lab["\t"] = "tab"
lab2char["tab"] = "\t"
char2lab["\033"] = "esc"
lab2char["esc"] = "\033"
lab2char["escape"] = "\033"
lab2char[r"\e"] = "\033"

# commands that take a taskname as argument
taskArgDict = minmatch.MinMatchDict({
    'unlearn': 1,
    'eparam': 1,
    'lparam': 1,
    'dparam': 1,
    'update': 1,
    'help': 1,
    'prcache': 1,
    'flprcache': 1,
})

# commands that take a package name as argument
pkgArgDict = {
    '?': 1,
}

completer = None


class IrafCompleter(Completer):