From cc2fa7e464860a57ba685463b7a971ad50ed568b Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Wed, 26 May 2021 23:48:38 +0530 Subject: [PATCH 01/17] Update README.rst --- README.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 58cf6abba975b3..713fc2c7bd9491 100644 --- a/README.rst +++ b/README.rst @@ -110,17 +110,17 @@ The entire Python directory is cleaned of temporary files that may have resulted from a previous compilation. An instrumented version of the interpreter is built, using suitable compiler -flags for each flavour. Note that this is just an intermediary step. The -binary resulting from this step is not good for real life workloads as it has +flags for each flavor. Note that this is just an intermediary step. The +binary resulting from this step is not good for real-life workloads as it has profiling instructions embedded inside. After the instrumented interpreter is built, the Makefile will run a training -workload. This is necessary in order to profile the interpreter execution. -Note also that any output, both stdout and stderr, that may appear at this step +workload. This is necessary to profile the interpreter's execution. +Note also that any output, both stdout, and stderr, that may appear at this step is suppressed. The final step is to build the actual interpreter, using the information -collected from the instrumented one. The end result will be a Python binary +collected from the instrumented one. The result will be a Python binary that is optimized; suitable for distribution or production installation. From 8642a86cd506f05187da95978e4474defe2824e9 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 26 May 2021 18:29:49 +0000 Subject: [PATCH 02/17] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst diff --git a/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst b/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst new file mode 100644 index 00000000000000..b8174baa4263b3 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst @@ -0,0 +1 @@ +updated and corrected readme with some grammatical mistakes \ No newline at end of file From d25a681a77f79b77c8827094dfed612512e3b384 Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Fri, 28 May 2021 07:54:16 +0530 Subject: [PATCH 03/17] Update README.rst Co-authored-by: Zachary Ware --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 713fc2c7bd9491..3f7e5273af43d5 100644 --- a/README.rst +++ b/README.rst @@ -115,7 +115,7 @@ binary resulting from this step is not good for real-life workloads as it has profiling instructions embedded inside. After the instrumented interpreter is built, the Makefile will run a training -workload. This is necessary to profile the interpreter's execution. +workload which is necessary to profile the interpreter's execution. Note also that any output, both stdout, and stderr, that may appear at this step is suppressed. From 79d0debf31fe9746712b8fbe33dc48a826e6a849 Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Fri, 28 May 2021 09:05:56 +0530 Subject: [PATCH 04/17] Update 2021-05-26-18-29-48.bpo-39798.D4UZnR.rst --- .../next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst b/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst index b8174baa4263b3..af66bba567355b 100644 --- a/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst +++ b/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst @@ -1 +1 @@ -updated and corrected readme with some grammatical mistakes \ No newline at end of file +updated readme by correcting few grammatical mistakes From 08399cb542c241356638004bcbe8df190e5e76a4 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 28 May 2021 15:31:59 -0400 Subject: [PATCH 05/17] Update 2021-05-26-18-29-48.bpo-39798.D4UZnR.rst Not needed. --- .../next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst b/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst index af66bba567355b..8b137891791fe9 100644 --- a/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst +++ b/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst @@ -1 +1 @@ -updated readme by correcting few grammatical mistakes + From 8911bb66ea2068798bb22ad51216df8c898cd6da Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 28 May 2021 15:35:07 -0400 Subject: [PATCH 06/17] Update 2021-05-26-18-29-48.bpo-39798.D4UZnR.rst From efc7bd4b266505621a7e014ca619555a302d14d9 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 28 May 2021 15:35:33 -0400 Subject: [PATCH 07/17] Update 2021-05-26-18-29-48.bpo-39798.D4UZnR.rst From a74a67051dad05af2f50aa980b7842fd3ee338c4 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 28 May 2021 15:36:46 -0400 Subject: [PATCH 08/17] Delete 2021-05-26-18-29-48.bpo-39798.D4UZnR.rst --- .../next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst diff --git a/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst b/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst deleted file mode 100644 index 8b137891791fe9..00000000000000 --- a/Misc/NEWS.d/next/Documentation/2021-05-26-18-29-48.bpo-39798.D4UZnR.rst +++ /dev/null @@ -1 +0,0 @@ - From 35ace7fe05ab33e5dedc65d628e6c2f028209e52 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 28 May 2021 15:39:18 -0400 Subject: [PATCH 09/17] Update README.rst --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 3f7e5273af43d5..bc89d041426b02 100644 --- a/README.rst +++ b/README.rst @@ -115,8 +115,8 @@ binary resulting from this step is not good for real-life workloads as it has profiling instructions embedded inside. After the instrumented interpreter is built, the Makefile will run a training -workload which is necessary to profile the interpreter's execution. -Note also that any output, both stdout, and stderr, that may appear at this step +workload. This is necessary in order to profile the interpreter's execution. +Note also that any output, both stdout and stderr, that may appear at this step is suppressed. The final step is to build the actual interpreter, using the information From b503274c6d9383c5367ca69287a43226866956c2 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 28 May 2021 15:40:41 -0400 Subject: [PATCH 10/17] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index bc89d041426b02..898680af095dee 100644 --- a/README.rst +++ b/README.rst @@ -120,7 +120,7 @@ Note also that any output, both stdout and stderr, that may appear at this step is suppressed. The final step is to build the actual interpreter, using the information -collected from the instrumented one. The result will be a Python binary +collected from the instrumented one. The end result will be a Python binary that is optimized; suitable for distribution or production installation. From 50f4172c392c670cee774cadf3ea1b5c04eec8ea Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Sat, 28 Aug 2021 18:34:16 +0530 Subject: [PATCH 11/17] Create theme-change --- Lib/tkinter/theme-change | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Lib/tkinter/theme-change diff --git a/Lib/tkinter/theme-change b/Lib/tkinter/theme-change new file mode 100644 index 00000000000000..1951990fa1f8b6 --- /dev/null +++ b/Lib/tkinter/theme-change @@ -0,0 +1,47 @@ +import tkinter as tk + +# create window +window = tk.Tk() +window.geometry('500x500') +window['bg'] = '#cce' +window.resizable(height=False, width=False) +window.wm_attributes('-alpha', 0.95) +# label +label = tk.Label(text='Change theme', font='Consolas 20') + + +# funcs +def white(): + window['bg'] = '#000' + btn_black['bg'] = 'white' + btn_black['fg'] = 'black' + btn_white['bg'] = 'black' + btn_white['fg'] = 'white' + btn_white["relief"] = "solid" + + +def black(): + window['bg'] = 'white' + btn_black['bg'] = 'white' + btn_black['fg'] = 'black' + btn_white['bg'] = 'black' + btn_white['fg'] = 'white' + + +# buttons +label.pack() +btn_black = tk.Button(text='Black Theme', command=white) +btn_black["bg"] = "grey" +btn_black["border"] = "0" +btn_black['font'] = 'Arial 13' +btn_black['fg'] = '#eee' +btn_black.place(x=20, y=80, width=200, height=60) + +btn_white = tk.Button(text='White Theme', command=black) +btn_white["bg"] = "grey" +btn_white["border"] = "0" +btn_white['font'] = 'Arial 13' +btn_white['fg'] = '#eee' +btn_white.place(x=280, y=80, width=200, height=60) + +window.mainloop() From d32e9f31c17dcf357defe059c5f4e3531acb3038 Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Sat, 28 Aug 2021 18:35:13 +0530 Subject: [PATCH 12/17] Rename theme-change to theme-change.py --- Lib/tkinter/{theme-change => theme-change.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Lib/tkinter/{theme-change => theme-change.py} (100%) diff --git a/Lib/tkinter/theme-change b/Lib/tkinter/theme-change.py similarity index 100% rename from Lib/tkinter/theme-change rename to Lib/tkinter/theme-change.py From 42a8a416dd5ade58ef4690db3900872ce14dda8a Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 28 Aug 2021 13:40:41 +0000 Subject: [PATCH 13/17] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst diff --git a/Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst b/Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst new file mode 100644 index 00000000000000..68f4dd47777c7a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst @@ -0,0 +1 @@ +theme-change.py created for tkinter lib \ No newline at end of file From d2896ab1f0a2faea2ff65f8dee7cec56cca764db Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Sun, 29 Aug 2021 22:58:54 +0530 Subject: [PATCH 14/17] Create RatinMaze.py --- Tools/demo/RatinMaze.py | 110 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 Tools/demo/RatinMaze.py diff --git a/Tools/demo/RatinMaze.py b/Tools/demo/RatinMaze.py new file mode 100644 index 00000000000000..ccbcc249372692 --- /dev/null +++ b/Tools/demo/RatinMaze.py @@ -0,0 +1,110 @@ +def solve_maze(maze: list) -> bool: + """ + This method solves the "rat in maze" problem. + In this problem we have some n by n matrix, a start point and an end point. + We want to go from the start to the end. In this matrix zeroes represent walls + and ones paths we can use. + Parameters : + maze(2D matrix) : maze + Returns: + Return: True if the maze has a solution or False if it does not. + >>> maze = [[0, 1, 0, 1, 1], + ... [0, 0, 0, 0, 0], + ... [1, 0, 1, 0, 1], + ... [0, 0, 1, 0, 0], + ... [1, 0, 0, 1, 0]] + >>> solve_maze(maze) + [1, 0, 0, 0, 0] + [1, 1, 1, 1, 0] + [0, 0, 0, 1, 0] + [0, 0, 0, 1, 1] + [0, 0, 0, 0, 1] + True + >>> maze = [[0, 1, 0, 1, 1], + ... [0, 0, 0, 0, 0], + ... [0, 0, 0, 0, 1], + ... [0, 0, 0, 0, 0], + ... [0, 0, 0, 0, 0]] + >>> solve_maze(maze) + [1, 0, 0, 0, 0] + [1, 0, 0, 0, 0] + [1, 0, 0, 0, 0] + [1, 0, 0, 0, 0] + [1, 1, 1, 1, 1] + True + >>> maze = [[0, 0, 0], + ... [0, 1, 0], + ... [1, 0, 0]] + >>> solve_maze(maze) + [1, 1, 1] + [0, 0, 1] + [0, 0, 1] + True + >>> maze = [[0, 1, 0], + ... [0, 1, 0], + ... [1, 0, 0]] + >>> solve_maze(maze) + No solution exists! + False + >>> maze = [[0, 1], + ... [1, 0]] + >>> solve_maze(maze) + No solution exists! + False + """ + size = len(maze) + # We need to create solution object to save path. + solutions = [[0 for _ in range(size)] for _ in range(size)] + solved = run_maze(maze, 0, 0, solutions) + if solved: + print("\n".join(str(row) for row in solutions)) + else: + print("No solution exists!") + return solved + + +def run_maze(maze, i, j, solutions): + """ + This method is recursive starting from (i, j) and going in one of four directions: + up, down, left, right. + If a path is found to destination it returns True otherwise it returns False. + Parameters: + maze(2D matrix) : maze + i, j : coordinates of matrix + solutions(2D matrix) : solutions + Returns: + Boolean if path is found True, Otherwise False. + """ + size = len(maze) + # Final check point. + if i == j == (size - 1): + solutions[i][j] = 1 + return True + + lower_flag = (not (i < 0)) and (not (j < 0)) # Check lower bounds + upper_flag = (i < size) and (j < size) # Check upper bounds + + if lower_flag and upper_flag: + # check for already visited and block points. + block_flag = (not (solutions[i][j])) and (not (maze[i][j])) + if block_flag: + # check visited + solutions[i][j] = 1 + + # check for directions + if ( + run_maze(maze, i + 1, j, solutions) + or run_maze(maze, i, j + 1, solutions) + or run_maze(maze, i - 1, j, solutions) + or run_maze(maze, i, j - 1, solutions) + ): + return True + + solutions[i][j] = 0 + return False + + +if __name__ == "__main__": + import doctest + + doctest.testmod() From 26f3738d073e790a36722daa7d5278f26d715d32 Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Sun, 29 Aug 2021 23:19:49 +0530 Subject: [PATCH 15/17] Delete theme-change.py --- Lib/tkinter/theme-change.py | 47 ------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 Lib/tkinter/theme-change.py diff --git a/Lib/tkinter/theme-change.py b/Lib/tkinter/theme-change.py deleted file mode 100644 index 1951990fa1f8b6..00000000000000 --- a/Lib/tkinter/theme-change.py +++ /dev/null @@ -1,47 +0,0 @@ -import tkinter as tk - -# create window -window = tk.Tk() -window.geometry('500x500') -window['bg'] = '#cce' -window.resizable(height=False, width=False) -window.wm_attributes('-alpha', 0.95) -# label -label = tk.Label(text='Change theme', font='Consolas 20') - - -# funcs -def white(): - window['bg'] = '#000' - btn_black['bg'] = 'white' - btn_black['fg'] = 'black' - btn_white['bg'] = 'black' - btn_white['fg'] = 'white' - btn_white["relief"] = "solid" - - -def black(): - window['bg'] = 'white' - btn_black['bg'] = 'white' - btn_black['fg'] = 'black' - btn_white['bg'] = 'black' - btn_white['fg'] = 'white' - - -# buttons -label.pack() -btn_black = tk.Button(text='Black Theme', command=white) -btn_black["bg"] = "grey" -btn_black["border"] = "0" -btn_black['font'] = 'Arial 13' -btn_black['fg'] = '#eee' -btn_black.place(x=20, y=80, width=200, height=60) - -btn_white = tk.Button(text='White Theme', command=black) -btn_white["bg"] = "grey" -btn_white["border"] = "0" -btn_white['font'] = 'Arial 13' -btn_white['fg'] = '#eee' -btn_white.place(x=280, y=80, width=200, height=60) - -window.mainloop() From 2ce48aacf24839ec2f9cfb7749cf5ea36ef30ec7 Mon Sep 17 00:00:00 2001 From: Ayush Parikh Date: Sun, 29 Aug 2021 23:20:23 +0530 Subject: [PATCH 16/17] Delete 2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst --- .../NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst diff --git a/Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst b/Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst deleted file mode 100644 index 68f4dd47777c7a..00000000000000 --- a/Misc/NEWS.d/next/Library/2021-08-28-13-40-40.bpo-45037.vNCGoJ.rst +++ /dev/null @@ -1 +0,0 @@ -theme-change.py created for tkinter lib \ No newline at end of file From 7e3b67fe43bc47f52cfcf2a630e7a49e94209b51 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 29 Aug 2021 17:56:41 +0000 Subject: [PATCH 17/17] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Tools-Demos/2021-08-29-17-56-41.bpo-45047.65rFIn.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Tools-Demos/2021-08-29-17-56-41.bpo-45047.65rFIn.rst diff --git a/Misc/NEWS.d/next/Tools-Demos/2021-08-29-17-56-41.bpo-45047.65rFIn.rst b/Misc/NEWS.d/next/Tools-Demos/2021-08-29-17-56-41.bpo-45047.65rFIn.rst new file mode 100644 index 00000000000000..dc4b68a945d366 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/2021-08-29-17-56-41.bpo-45047.65rFIn.rst @@ -0,0 +1 @@ +Rat in a Maze Problem \ No newline at end of file