18
18
from openc3 .utilities .string import build_timestamped_filename
19
19
from openc3 .utilities .bucket_utilities import BucketUtilities
20
20
from openc3 .script .storage import _get_storage_file
21
- import re
22
21
import linecache
23
22
24
23
@@ -435,7 +434,11 @@ def unique_filename(self):
435
434
return "Untitled" + str (RunningScript .id )
436
435
437
436
def stop_message_log (self ):
438
- metadata = {"id" : self .id , "user" : self .details ["user" ], "scriptname" : self .unique_filename ()}
437
+ metadata = {
438
+ "id" : self .id ,
439
+ "user" : self .details ["user" ],
440
+ "scriptname" : self .unique_filename (),
441
+ }
439
442
if RunningScript .my_message_log :
440
443
RunningScript .my_message_log .stop (True , metadata = metadata )
441
444
RunningScript .my_message_log = None
@@ -448,7 +451,7 @@ def set_filename(self, filename):
448
451
449
452
# Deal with breakpoints created under the previous filename.
450
453
bkpt_filename = self .unique_filename ()
451
- if not bkpt_filename in RunningScript .breakpoints :
454
+ if bkpt_filename not in RunningScript .breakpoints :
452
455
RunningScript .breakpoints [bkpt_filename ] = RunningScript .breakpoints [
453
456
self .filename
454
457
]
@@ -539,7 +542,7 @@ def exception_instrumentation(self, filename, line_number):
539
542
if (
540
543
exc_type == StopScript
541
544
or exc_type == SkipScript
542
- or exc_type == SkipTestCase # DEPRECATED but still valid
545
+ or exc_type == SkipTestCase # DEPRECATED but still valid
543
546
or not self .use_instrumentation
544
547
):
545
548
raise exc_value
@@ -597,20 +600,20 @@ def debug(self, debug_text):
597
600
598
601
@classmethod
599
602
def set_breakpoint (cls , filename , line_number ):
600
- if not filename in cls .breakpoints :
603
+ if filename not in cls .breakpoints :
601
604
cls .breakpoints [filename ] = {}
602
605
cls .breakpoints [filename ][line_number ] = True
603
606
604
607
@classmethod
605
608
def clear_breakpoint (cls , filename , line_number ):
606
- if not filename in cls .breakpoints :
609
+ if filename not in cls .breakpoints :
607
610
cls .breakpoints [filename ] = {}
608
611
if line_number in cls .breakpoints [filename ]:
609
612
del cls .breakpoints [filename ][line_number ]
610
613
611
614
@classmethod
612
615
def clear_breakpoints (cls , filename = None ):
613
- if filename == None or filename == "" :
616
+ if filename is None or filename == "" :
614
617
cls .breakpoints = {}
615
618
else :
616
619
if filename in cls .breakpoints :
@@ -679,7 +682,7 @@ def handle_output_io(self, filename=None, line_number=None):
679
682
out_line = json_hash ["log" ]
680
683
if "message" in json_hash :
681
684
out_line = json_hash ["message" ]
682
- except :
685
+ except Exception :
683
686
# Regular output
684
687
pass
685
688
@@ -722,10 +725,6 @@ def handle_output_io(self, filename=None, line_number=None):
722
725
# Add to the message log
723
726
self .message_log ().write (lines_to_write )
724
727
725
- def graceful_kill (self ):
726
- # Just to avoid warning
727
- pass
728
-
729
728
def wait_for_go_or_stop (self , error = None , prompt = None ):
730
729
count = - 1
731
730
self .go = False
@@ -1098,7 +1097,7 @@ def run_text(
1098
1097
def handle_potential_tab_change (self , filename ):
1099
1098
# Make sure the correct file is shown in script runner
1100
1099
if self .current_file != filename :
1101
- if not filename in self .call_stack :
1100
+ if filename not in self .call_stack :
1102
1101
self .call_stack .append (filename )
1103
1102
self .load_file_into_script (filename )
1104
1103
self .current_file = filename
0 commit comments