Show More
@@ -244,8 +244,8 b' class DisplayHook(Configurable):' | |||
|
244 | 244 | |
|
245 | 245 | def flush(self): |
|
246 | 246 | if not self.do_full_cache: |
|
247 |
raise ValueError |
|
|
248 | "if full caching is not enabled!" | |
|
247 | raise ValueError("You shouldn't have reached the cache flush " | |
|
248 | "if full caching is not enabled!") | |
|
249 | 249 | # delete auto-generated vars from global namespace |
|
250 | 250 | |
|
251 | 251 | for n in range(1,self.prompt_count + 1): |
@@ -906,7 +906,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
906 | 906 | def _set_call_pdb(self,val): |
|
907 | 907 | |
|
908 | 908 | if val not in (0,1,False,True): |
|
909 |
raise ValueError |
|
|
909 | raise ValueError('new call_pdb value must be boolean') | |
|
910 | 910 | |
|
911 | 911 | # store value in instance |
|
912 | 912 | self._call_pdb = val |
@@ -54,7 +54,7 b' class Logger(object):' | |||
|
54 | 54 | # logmode is a validated property |
|
55 | 55 | def _set_mode(self,mode): |
|
56 | 56 | if mode not in ['append','backup','global','over','rotate']: |
|
57 |
raise ValueError |
|
|
57 | raise ValueError('invalid log mode %s given' % mode) | |
|
58 | 58 | self._logmode = mode |
|
59 | 59 | |
|
60 | 60 | def _get_mode(self): |
@@ -131,8 +131,8 b' class Logger(object):' | |||
|
131 | 131 | """Switch logging on/off. val should be ONLY a boolean.""" |
|
132 | 132 | |
|
133 | 133 | if val not in [False,True,0,1]: |
|
134 | raise ValueError, \ | |
|
135 | 'Call switch_log ONLY with a boolean argument, not with:',val | |
|
134 | raise ValueError('Call switch_log ONLY with a boolean argument, ' | |
|
135 | 'not with: %s' % val) | |
|
136 | 136 | |
|
137 | 137 | label = {0:'OFF',1:'ON',False:'OFF',True:'ON'} |
|
138 | 138 |
@@ -568,7 +568,7 b' class Magics(object):' | |||
|
568 | 568 | |
|
569 | 569 | mode = kw.get('mode','string') |
|
570 | 570 | if mode not in ['string','list']: |
|
571 |
raise ValueError |
|
|
571 | raise ValueError('incorrect mode given: %s' % mode) | |
|
572 | 572 | # Get options |
|
573 | 573 | list_all = kw.get('list_all',0) |
|
574 | 574 | posix = kw.get('posix', os.name == 'posix') |
@@ -1103,8 +1103,8 b' class FormattedTB(VerboseTB, ListTB):' | |||
|
1103 | 1103 | len(self.valid_modes) |
|
1104 | 1104 | self.mode = self.valid_modes[new_idx] |
|
1105 | 1105 | elif mode not in self.valid_modes: |
|
1106 |
raise ValueError |
|
|
1107 | 'Valid modes: '+str(self.valid_modes) | |
|
1106 | raise ValueError('Unrecognized mode in FormattedTB: <'+mode+'>\n' | |
|
1107 | 'Valid modes: '+str(self.valid_modes)) | |
|
1108 | 1108 | else: |
|
1109 | 1109 | self.mode = mode |
|
1110 | 1110 | # include variable details only in 'Verbose' mode |
@@ -217,7 +217,7 b' def knownfailureif(fail_condition, msg=None):' | |||
|
217 | 217 | import nose |
|
218 | 218 | def knownfailer(*args, **kwargs): |
|
219 | 219 | if fail_val(): |
|
220 |
raise KnownFailureTest |
|
|
220 | raise KnownFailureTest(msg) | |
|
221 | 221 | else: |
|
222 | 222 | return f(*args, **kwargs) |
|
223 | 223 | return nose.tools.make_decorator(f)(knownfailer) |
@@ -608,11 +608,11 b' class spawnb(object):' | |||
|
608 | 608 | |
|
609 | 609 | parent_fd, child_fd = os.openpty() |
|
610 | 610 | if parent_fd < 0 or child_fd < 0: |
|
611 |
raise ExceptionPexpect |
|
|
611 | raise ExceptionPexpect("Error! Could not open pty with os.openpty().") | |
|
612 | 612 | |
|
613 | 613 | pid = os.fork() |
|
614 | 614 | if pid < 0: |
|
615 |
raise ExceptionPexpect |
|
|
615 | raise ExceptionPexpect("Error! Failed os.fork().") | |
|
616 | 616 | elif pid == 0: |
|
617 | 617 | # Child. |
|
618 | 618 | os.close(parent_fd) |
@@ -655,7 +655,7 b' class spawnb(object):' | |||
|
655 | 655 | fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY); |
|
656 | 656 | if fd >= 0: |
|
657 | 657 | os.close(fd) |
|
658 |
raise ExceptionPexpect |
|
|
658 | raise ExceptionPexpect("Error! Failed to disconnect from controlling tty. It is still possible to open /dev/tty.") | |
|
659 | 659 | except: |
|
660 | 660 | # Good! We are disconnected from a controlling tty. |
|
661 | 661 | pass |
@@ -663,14 +663,14 b' class spawnb(object):' | |||
|
663 | 663 | # Verify we can open child pty. |
|
664 | 664 | fd = os.open(child_name, os.O_RDWR); |
|
665 | 665 | if fd < 0: |
|
666 |
raise ExceptionPexpect |
|
|
666 | raise ExceptionPexpect("Error! Could not open child pty, " + child_name) | |
|
667 | 667 | else: |
|
668 | 668 | os.close(fd) |
|
669 | 669 | |
|
670 | 670 | # Verify we now have a controlling tty. |
|
671 | 671 | fd = os.open("/dev/tty", os.O_WRONLY) |
|
672 | 672 | if fd < 0: |
|
673 |
raise ExceptionPexpect |
|
|
673 | raise ExceptionPexpect("Error! Could not open controlling tty, /dev/tty") | |
|
674 | 674 | else: |
|
675 | 675 | os.close(fd) |
|
676 | 676 |
@@ -375,8 +375,7 b' class BackgroundJobBase(threading.Thread):' | |||
|
375 | 375 | stat_dead_c = -1 |
|
376 | 376 | |
|
377 | 377 | def __init__(self): |
|
378 | raise NotImplementedError, \ | |
|
379 | "This class can not be instantiated directly." | |
|
378 | raise NotImplementedError("This class can not be instantiated directly.") | |
|
380 | 379 | |
|
381 | 380 | def _init(self): |
|
382 | 381 | """Common initialization for all BackgroundJob objects""" |
@@ -36,7 +36,7 b' def getargspec(obj):' | |||
|
36 | 36 | elif inspect.ismethod(obj): |
|
37 | 37 | func_obj = obj.im_func |
|
38 | 38 | else: |
|
39 |
raise TypeError |
|
|
39 | raise TypeError('arg is not a Python function') | |
|
40 | 40 | args, varargs, varkw = inspect.getargs(func_obj.func_code) |
|
41 | 41 | return args, varargs, varkw, func_obj.func_defaults |
|
42 | 42 |
@@ -33,8 +33,8 b' def mutex_opts(dict,ex_op):' | |||
|
33 | 33 | Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]""" |
|
34 | 34 | for op1,op2 in ex_op: |
|
35 | 35 | if op1 in dict and op2 in dict: |
|
36 |
raise ValueError |
|
|
37 | 'Options '+op1+' and '+op2+' are mutually exclusive.' | |
|
36 | raise ValueError('\n*** ERROR in Arguments *** '\ | |
|
37 | 'Options '+op1+' and '+op2+' are mutually exclusive.') | |
|
38 | 38 | |
|
39 | 39 | |
|
40 | 40 | class EvalDict: |
@@ -145,7 +145,7 b' class ColorSchemeTable(dict):' | |||
|
145 | 145 | |
|
146 | 146 | if scheme_list: |
|
147 | 147 | if default_scheme == '': |
|
148 |
raise ValueError |
|
|
148 | raise ValueError('you must specify the default color scheme') | |
|
149 | 149 | for scheme in scheme_list: |
|
150 | 150 | self.add_scheme(scheme) |
|
151 | 151 | self.set_active_scheme(default_scheme) |
@@ -157,7 +157,7 b' class ColorSchemeTable(dict):' | |||
|
157 | 157 | def add_scheme(self,new_scheme): |
|
158 | 158 | """Add a new color scheme to the table.""" |
|
159 | 159 | if not isinstance(new_scheme,ColorScheme): |
|
160 |
raise ValueError |
|
|
160 | raise ValueError('ColorSchemeTable only accepts ColorScheme instances') | |
|
161 | 161 | self[new_scheme.name] = new_scheme |
|
162 | 162 | |
|
163 | 163 | def set_active_scheme(self,scheme,case_sensitive=0): |
@@ -176,8 +176,8 b' class ColorSchemeTable(dict):' | |||
|
176 | 176 | try: |
|
177 | 177 | scheme_idx = valid_schemes.index(scheme_test) |
|
178 | 178 | except ValueError: |
|
179 |
raise ValueError |
|
|
180 | '\nValid schemes: '+str(scheme_names).replace("'', ",'') | |
|
179 | raise ValueError('Unrecognized color scheme: ' + scheme + \ | |
|
180 | '\nValid schemes: '+str(scheme_names).replace("'', ",'')) | |
|
181 | 181 | else: |
|
182 | 182 | active = scheme_names[scheme_idx] |
|
183 | 183 | self.active_scheme_name = active |
General Comments 0
You need to be logged in to leave comments.
Login now