From 0e1c251ce70b24137bbb9215d20c4fe7a97c35d9 Mon Sep 17 00:00:00 2001 From: Arcmyx Official Date: Fri, 10 Apr 2026 16:27:41 +0000 Subject: [PATCH 1/4] Add tests/pynamics-ansi.py --- tests/pynamics-ansi.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/pynamics-ansi.py diff --git a/tests/pynamics-ansi.py b/tests/pynamics-ansi.py new file mode 100644 index 0000000..bf36746 --- /dev/null +++ b/tests/pynamics-ansi.py @@ -0,0 +1,23 @@ +# Escape codes: +# event 0: notify +# event 1: +lvldict = { + 0: "FATAL", + 1: "ALERT", + 2: "CRIT", + 3: "ERR", + 4: "WARNING", + 5: "NOTICE", + 6: "INFO", + 7: "DEBUG" +} +def sendCommand(eventnum, level, msg): + print(f"\x1b[?PYN;{eventnum.str()};{lvldict[level]};{msg}~") +sendCommand(0, 0, "UNRECOVERABLE MICROPYTHON ERROR!!!!! EXITING PROGRAM VERY MUCH UNGRACEFULLY") +sendCommand(0, 1, "hey you should probably know that your RAM is corrupted and you cant buy more because of the shortage") +sendCommand(0, 2, "so the program is running but everything deleted so its kinda frying ur motors") +sendCommand(0, 3, "syntax error you failure. use a linter") +sendCommand(0, 4, "wanted to just say that your motor is kinda being slow") +sendCommand(0, 5, "so your motor is like 1% slower than it should be but really no one cares") +sendCommand(0, 6, "hey everything in the program is going well just in case nothing in your life is") +sendCommand(0, 7, "nobody cares about me but you should know that") \ No newline at end of file -- 2.49.1 From 3b541f92f9f1a3c5454276e9eeca546519e5b5fc Mon Sep 17 00:00:00 2001 From: Arcmyx Official Date: Fri, 10 Apr 2026 16:29:41 +0000 Subject: [PATCH 2/4] Update tests/pynamics-ansi.py --- tests/pynamics-ansi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pynamics-ansi.py b/tests/pynamics-ansi.py index bf36746..f5f7aa2 100644 --- a/tests/pynamics-ansi.py +++ b/tests/pynamics-ansi.py @@ -13,10 +13,10 @@ lvldict = { } def sendCommand(eventnum, level, msg): print(f"\x1b[?PYN;{eventnum.str()};{lvldict[level]};{msg}~") -sendCommand(0, 0, "UNRECOVERABLE MICROPYTHON ERROR!!!!! EXITING PROGRAM VERY MUCH UNGRACEFULLY") -sendCommand(0, 1, "hey you should probably know that your RAM is corrupted and you cant buy more because of the shortage") -sendCommand(0, 2, "so the program is running but everything deleted so its kinda frying ur motors") -sendCommand(0, 3, "syntax error you failure. use a linter") +sendCommand(0, 0, "hey you should probably know that your RAM is corrupted and you cant buy more because of the shortage. byeeeee") +sendCommand(0, 1, "UNRECOVERABLE PYTHON ERROR!!!!! Exiting gracefully... JUST KIDDING WHAT DID YOU THINK IT WAS GONNA DO") +sendCommand(0, 2, "so the program is running but it just started looping on the motor frying bit of your program.") +sendCommand(0, 3, "syntax error, you failure!!!! use an error checker") sendCommand(0, 4, "wanted to just say that your motor is kinda being slow") sendCommand(0, 5, "so your motor is like 1% slower than it should be but really no one cares") sendCommand(0, 6, "hey everything in the program is going well just in case nothing in your life is") -- 2.49.1 From b3716b8cdeb4397b2a52c4f140bc953ebd6955bb Mon Sep 17 00:00:00 2001 From: Arcmyx Official Date: Fri, 10 Apr 2026 16:41:10 +0000 Subject: [PATCH 3/4] Update tests/pynamics-logger.py --- tests/pynamics-ansi.py | 23 --------------- tests/pynamics-logger.py | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 23 deletions(-) delete mode 100644 tests/pynamics-ansi.py create mode 100644 tests/pynamics-logger.py diff --git a/tests/pynamics-ansi.py b/tests/pynamics-ansi.py deleted file mode 100644 index f5f7aa2..0000000 --- a/tests/pynamics-ansi.py +++ /dev/null @@ -1,23 +0,0 @@ -# Escape codes: -# event 0: notify -# event 1: -lvldict = { - 0: "FATAL", - 1: "ALERT", - 2: "CRIT", - 3: "ERR", - 4: "WARNING", - 5: "NOTICE", - 6: "INFO", - 7: "DEBUG" -} -def sendCommand(eventnum, level, msg): - print(f"\x1b[?PYN;{eventnum.str()};{lvldict[level]};{msg}~") -sendCommand(0, 0, "hey you should probably know that your RAM is corrupted and you cant buy more because of the shortage. byeeeee") -sendCommand(0, 1, "UNRECOVERABLE PYTHON ERROR!!!!! Exiting gracefully... JUST KIDDING WHAT DID YOU THINK IT WAS GONNA DO") -sendCommand(0, 2, "so the program is running but it just started looping on the motor frying bit of your program.") -sendCommand(0, 3, "syntax error, you failure!!!! use an error checker") -sendCommand(0, 4, "wanted to just say that your motor is kinda being slow") -sendCommand(0, 5, "so your motor is like 1% slower than it should be but really no one cares") -sendCommand(0, 6, "hey everything in the program is going well just in case nothing in your life is") -sendCommand(0, 7, "nobody cares about me but you should know that") \ No newline at end of file diff --git a/tests/pynamics-logger.py b/tests/pynamics-logger.py new file mode 100644 index 0000000..3309e35 --- /dev/null +++ b/tests/pynamics-logger.py @@ -0,0 +1,62 @@ +# Event codes: +#0: notify +#1: prgm_start +#2: prgm_end +#3: prgm_crash +#4: snsr_data +#5: mtr_data +#6: perf_smpl +#7: get_time + +lvldict = { + 0: "FATAL", + 1: "ALERT", + 2: "CRIT", + 3: "ERR", + 4: "WARNING", + 5: "NOTICE", + 6: "INFO", + 7: "DEBUG" +} +stpwtchtime = StopWatch() +stpwtchtime.pause() + +def start(): + self.time.reset() + self.time.resume() + +def log(self, message, level, origin): + if level <= self.verboseness: + ms = self.time.time() + timestamp = "{:02d}:{:02d}.{:03d}".format( + (ms // 60000) % 60, + (ms // 1000) % 60, + ms % 1000 + ) + label = self.lvldict.get(level, "UNKNOWN") + padding = " " * (7 - len(label)) + print("[{}] {}{} [{}] {}".format(timestamp, label, padding, origin, message)) + +def sendCommand(eventnum, level, msg, origin): + print(f"\x1b[?PYN;{str(eventnum)};{lvldict[level]};{msg}~") +def notify(level, msg, origin): + print(f"\x1b[?PYN;0;{lvldict[level]};{msg}~") +def fatal(self, message, origin): notify(message, 0, origin) +def alert(self, message, origin): notify(message, 1, origin) +def crit(self, message, origin): notify(message, 2, origin) +def err(self, message, origin): notify(message, 3, origin) +def warning(self, message, origin): notify(message, 4, origin) +def notice(self, message, origin): notify(message, 5, origin) +def info(self, message, origin): notify(message, 6, origin) +def debug(self, message, origin): notify(message, 7, origin) +def crash(self, message, origin): + sendCommand(3, 0, "program kinda crashed bc you suck at coding", origin) + raise FatalLoggerError("[FATAL] [{}] {}".format(origin, message)) +sendCommand(0, 0, "hey you should probably know that your RAM is corrupted and you cant buy more because of the shortage. byeeeee", "test prgm") +sendCommand(0, 1, "UNRECOVERABLE PYTHON ERROR!!!!! Exiting gracefully... JUST KIDDING WHAT DID YOU THINK IT WAS GONNA DO", "test prgm") +sendCommand(0, 2, "so the program is running but it just started looping on the motor frying bit of your program.", "test prgm") +sendCommand(0, 3, "syntax error, you failure!!!! use an error checker", "test prgm") +sendCommand(0, 4, "wanted to just say that your motor is kinda being slow", "test prgm") +sendCommand(0, 5, "so your motor is like 1% slower than it should be but really no one cares", "test prgm") +sendCommand(0, 6, "hey everything in the program is going well just in case nothing in your life is", "test prgm") +sendCommand(0, 7, "nobody cares about me but you should know that", "test prgm") \ No newline at end of file -- 2.49.1 From 181d7d35c71513ace7e599937849cba1794209c7 Mon Sep 17 00:00:00 2001 From: Arcmyx Official Date: Fri, 10 Apr 2026 16:42:16 +0000 Subject: [PATCH 4/4] Update tests/pynamics-logger.py --- tests/pynamics-logger.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/pynamics-logger.py b/tests/pynamics-logger.py index 3309e35..375ad2c 100644 --- a/tests/pynamics-logger.py +++ b/tests/pynamics-logger.py @@ -7,7 +7,7 @@ #5: mtr_data #6: perf_smpl #7: get_time - +#8: breakpoint lvldict = { 0: "FATAL", 1: "ALERT", @@ -59,4 +59,6 @@ sendCommand(0, 3, "syntax error, you failure!!!! use an error checker", "test pr sendCommand(0, 4, "wanted to just say that your motor is kinda being slow", "test prgm") sendCommand(0, 5, "so your motor is like 1% slower than it should be but really no one cares", "test prgm") sendCommand(0, 6, "hey everything in the program is going well just in case nothing in your life is", "test prgm") -sendCommand(0, 7, "nobody cares about me but you should know that", "test prgm") \ No newline at end of file +sendCommand(0, 7, "nobody cares about me but you should know that", "test prgm") +def breakpoint(): + #send a command 8 and also get all important info about the code here and print \ No newline at end of file -- 2.49.1