Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit ead1572

Browse files
committed
first commit
1 parent 3b5fced commit ead1572

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/common/utils.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,7 @@ def escape_if_OSX(file_name):
5252
return file_name
5353

5454

55-
def print_for_unimplemented_functions(function_name, one_more_call=False):
56-
# Frame 0 is this function call
57-
# Frame 1 is the call that calls this function, which is a microbit function
58-
# Frame 2 is the call that calls the microbit function, which is in the user's file
59-
# If one_more_call is True, then there is another frame between what was originally supposed to be frame 1 and 2.
60-
frame_no = 2 if not one_more_call else 3
61-
line_number = sys._getframe(frame_no).f_lineno
62-
user_file_name = sys._getframe(frame_no).f_code.co_filename
55+
def print_for_unimplemented_functions(function_name):
6356
print(
64-
f"'{function_name}' on line {line_number} in {user_file_name} is not implemented in the simulator but it will work on the actual device!"
57+
f"'{function_name}' is not implemented in the simulator but it will work on the actual device!"
6558
)

src/micropython/microbit/__model/microbit_model.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,11 @@ def __init__(self):
3030

3131
def panic(self, n):
3232
# Due to the shim, there is another call frame.
33-
utils.print_for_unimplemented_functions(
34-
MicrobitModel.panic.__name__, one_more_call=True
35-
)
33+
utils.print_for_unimplemented_functions(MicrobitModel.panic.__name__)
3634

3735
def reset(self):
3836
# Due to the shim, there is another call frame.
39-
utils.print_for_unimplemented_functions(
40-
MicrobitModel.reset.__name__, one_more_call=True
41-
)
37+
utils.print_for_unimplemented_functions(MicrobitModel.reset.__name__)
4238

4339
def sleep(self, n):
4440
time.sleep(n / 1000)

0 commit comments

Comments
 (0)