Exemplo n.º 1
0
    def process_args(self, input_str):
        if input_str in self.defaults:
            sublime.status_message('You have to provide valid arguments'
                                   ' for this restructure. Cancelling...')
            return

        try:
            self.args.append(ast.literal_eval(input_str))
        except:
            sublime.error_message('Malformed string detected in Args.\n\n'
                                  'The Args value must be a Python dictionary')
            return

        with ropemate.context_for(self.view) as context:
            self.refactoring = Restructure(context.project, self.args[0],
                                           self.args[1], self.args[2])

            self.changes = self.refactoring.get_changes()

            try:
                context.project.do(self.changes)
                # sublime.error_message(self.changes.get_description())
                print "RESTRUCTURING CHANGES PERFORMED"
                print "-------------------------------"
                print self.changes.get_description()
                print "-------------------------------"
            except ModuleNotFoundError, e:
                sublime.error_message(e)
Exemplo n.º 2
0
def main():
    prj = Project(os.path.realpath("../shuup/core/models"))
    rst = Restructure(prj, "_(${str})", "")
    rst.template = LanguageTwist("./shuup_fi_to_en.po")

    twist_set = rst.get_changes()

    for chg in twist_set.changes:
        print(chg.get_description())  # noqa

    prj.do(twist_set)