def on_init(self, context): self.__current_sources = [] for [name, args] in [[x['name'], x['args']] for x in context['sources']]: if name not in self.__sources: self.error('Source "' + name + '" is not found.') continue source = self.__sources[name] source.context = copy.deepcopy(context) source.context['args'] = args source.context['is_async'] = False source.context['all_candidates'] = [] source.context['candidates'] = [] # Set the source attributes. source.matchers = get_custom_source( self.__custom, source.name, 'matchers', source.matchers) source.sorters = get_custom_source( self.__custom, source.name, 'sorters', source.sorters) source.converters = get_custom_source( self.__custom, source.name, 'converters', source.converters) source.vars.update( get_custom_source(self.__custom, source.name, 'vars', source.vars)) if hasattr(source, 'on_init'): source.on_init(source.context) self.__current_sources.append(source)
def on_init(self, context): self.__current_sources = [] for [name, args] in [[x['name'], x['args']] for x in context['sources']]: if name not in self.__sources: self.error('Source "' + name + '" is not found.') continue source = self.__sources[name] source.context = copy.deepcopy(context) source.context['args'] = args if hasattr(source, 'on_init'): source.on_init(source.context) self.__current_sources.append(source)
def on_init(self, context): self._current_sources = [] index = 0 for [name, args] in [[x['name'], x['args']] for x in context['sources']]: if name not in self._sources: raise NameError('Source "' + name + '" is not found.') source = copy.copy(self._sources[name]) source.context = copy.copy(context) source.context['args'] = args source.context['is_async'] = False source.context['is_interactive'] = False source.context['all_candidates'] = [] source.context['candidates'] = [] source.index = index # Set the source attributes. source.matchers = get_custom_source(self._custom, source.name, 'matchers', source.matchers) source.sorters = get_custom_source(self._custom, source.name, 'sorters', source.sorters) source.converters = get_custom_source(self._custom, source.name, 'converters', source.converters) source.vars.update( get_custom_source(self._custom, source.name, 'vars', source.vars)) if not source.context['args']: source.context['args'] = get_custom_source( self._custom, source.name, 'args', []) if hasattr(source, 'on_init'): source.on_init(source.context) self._current_sources.append(source) index += 1 for filter in [ x for x in self._filters.values() if x.vars and x.name in self._custom['filter'] ]: filter.vars.update(self._custom['filter'][filter.name])
def on_init(self, context): self._current_sources = [] index = 0 for [name, args] in [[x['name'], x['args']] for x in context['sources']]: if name not in self._sources: raise NameError('Source "' + name + '" is not found.') source = copy.copy(self._sources[name]) source.context = copy.copy(context) source.context['args'] = args source.context['is_async'] = False source.context['is_skipped'] = False source.context['is_interactive'] = False source.context['all_candidates'] = [] source.context['candidates'] = [] source.context['prev_time'] = time.time() source.index = index # Set the source attributes. self._set_source_attribute(source, 'matchers') self._set_source_attribute(source, 'sorters') self._set_source_attribute(source, 'converters') self._set_source_attribute(source, 'max_candidates') source.vars.update( get_custom_source(self._custom, source.name, 'vars', source.vars)) if not source.context['args']: source.context['args'] = get_custom_source( self._custom, source.name, 'args', []) if hasattr(source, 'on_init'): source.on_init(source.context) self._current_sources.append(source) index += 1 for filter in [x for x in self._filters.values() if x.vars and x.name in self._custom['filter']]: filter.vars.update(self._custom['filter'][filter.name])
def on_init(self, context): self.__current_sources = [] for [name, args] in [[x['name'], x['args']] for x in context['sources']]: if name not in self.__sources: self.error('Source "' + name + '" is not found.') continue source = self.__sources[name] source.context = copy.deepcopy(context) source.context['args'] = args source.context['is_async'] = False source.context['all_candidates'] = [] source.context['candidates'] = [] # Set the source attributes. source.matchers = get_custom_source( self.__custom, source.name, 'matchers', source.matchers) source.sorters = get_custom_source( self.__custom, source.name, 'sorters', source.sorters) source.converters = get_custom_source( self.__custom, source.name, 'converters', source.converters) source.vars.update( get_custom_source(self.__custom, source.name, 'vars', source.vars)) if not source.context['args']: source.context['args'] = get_custom_source( self.__custom, source.name, 'args', []) if hasattr(source, 'on_init'): source.on_init(source.context) self.__current_sources.append(source) for filter in [x for x in self.__filters.values() if x.vars and x.name in self.__custom['filter']]: filter.vars.update(self.__custom['filter'][filter.name])