Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Patches: noerror option to code_assist
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ali Gholami Rudi  
View profile  
 More options Aug 29 2012, 5:53 am
From: Ali Gholami Rudi <aligr...@gmail.com>
Date: Wed, 29 Aug 2012 14:12:31 +0430
Local: Wed, Aug 29 2012 5:42 am
Subject: Re: Patches: noerror option to code_assist
Hi,

Anton Beloglazov <anton.belogla...@gmail.com> wrote:
> Nice generalization! I've tested your patch, and with a couple of
> modifications it works fine. I've added 'return' in the local_function
> definition, and made get_calltip a local_function as well. Here are the
> updated patches:

> For decorators.py:

> --- decorators-backup.py 2012-07-17 10:24:30.611629650 +1000
> +++ decorators.py 2012-08-29 10:39:11.867472050 +1000

> For interface.py:

> --- interface-backup.py 2012-07-17 10:24:30.611629650 +1000
> +++ interface.py 2012-08-29 10:42:22.736438024 +1000

I've CC'ed Anton Gritsay, the maintainer.  Anton, what do you think?
I think this patch and also my patch to make fixsyntax.py errors terser
(I've included the latter in this mail) look acceptable.

Thanks,
Ali

--- a/rope/contrib/fixsyntax.py 2012-08-27 19:42:30.516015457 +0430
+++ b/rope/contrib/fixsyntax.py 2012-08-27 19:45:00.236235582 +0430
@@ -15,7 +15,7 @@
     @utils.saveit
     def get_pymodule(self):
         """Get a `PyModule`"""
-        errors = []
+        msg = None
         code = self.code
         tries = 0
         while True:
@@ -27,19 +27,14 @@
                 return self.pycore.get_string_module(
                     code, resource=self.resource, force_errors=True)
             except exceptions.ModuleSyntaxError, e:
+                if msg is None:
+                    msg = '%s:%s %s' % (e.filename, e.lineno, e.message_)
                 if tries < self.maxfixes:
                     tries += 1
                     self.commenter.comment(e.lineno)
                     code = '\n'.join(self.commenter.lines)
-                    errors.append('  * line %s: %s ... fixed' % (e.lineno,
-                                                                 e.message_))
                 else:
-                    errors.append('  * line %s: %s ... raised!' % (e.lineno,
-                                                                   e.message_))
-                    new_message = ('\nSyntax errors in file %s:\n' % e.filename) \
-                                   + '\n'.join(errors)
-                    raise exceptions.ModuleSyntaxError(e.filename, e.lineno,
-                                                       new_message)
+                    raise exceptions.ModuleSyntaxError(e.filename, e.lineno, msg)

     @property
     @utils.saveit


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.