class _Extract(Refactoring): saveall = False optionals = { 'similar': dialog.Boolean('Extract similar pieces: ', True), 'global_': dialog.Boolean('Make global: ') } kind = None constructor = rope.refactor.extract.ExtractVariable def __init__(self, *args): super(_Extract, self).__init__(*args) self.extractor = None def _create_refactoring(self): start, end = self.region self.extractor = self.constructor(self.project, self.resource, start, end) def _calculate_changes(self, values, task_handle): similar = values.get('similar') global_ = values.get('global_') return self.extractor.get_changes(values['name'], similar=similar, global_=global_) def _get_confs(self): return {'name': dialog.Data('Extracted %s name: ' % self.kind)}
def _get_optionals(self): opts = {'resources': self.resources_option} if self.inliner.get_kind() == 'parameter': opts['in_hierarchy'] = dialog.Boolean( 'Apply on all matching methods in class hierarchy: ', False) else: opts['remove'] = dialog.Boolean('Remove the definition: ', True) opts['only_current'] = dialog.Boolean('Inline this ' 'occurrence only: ') return opts
def _get_optionals(self): opts = {} opts['docs'] = dialog.Boolean('Search comments and docs: ', True) if self.renamer.is_method(): opts['in_hierarchy'] = dialog.Boolean('Rename methods in ' 'class hierarchy: ') opts['resources'] = self.resources_option opts['unsure'] = dialog.Data('Unsure occurrences: ', decode=self._decode_unsure, values=['ignore', 'match'], default='ignore') return opts
def _get_optionals(self): opts = {'resources': self.resources_option} if self.changer.is_method(): opts['in_hierarchy'] = dialog.Boolean('Rename methods in ' 'class hierarchy: ') return opts
def _get_optionals(self): return { 'global_factory': dialog.Boolean('Make global: ', True), 'resources': self.resources_option }