From 44ab0a32838ecdfb8520ef4e51d0ff8631e5cb06 Mon Sep 17 00:00:00 2001 From: duvvuvenkataramana Date: Wed, 22 Oct 2025 01:20:32 +0530 Subject: [PATCH 1/3] Add my_script.py to fix issue #994 --- my_script.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 my_script.py diff --git a/my_script.py b/my_script.py new file mode 100644 index 00000000..0bab214c --- /dev/null +++ b/my_script.py @@ -0,0 +1,7 @@ +# reverse_string.py +def reverse_string(s): + return s[::-1] + +if __name__ == "__main__": + text = input("Enter a string: ") + print("Reversed:", reverse_string(text)) From 943f0b8d53449f7f70a8e1ef1518e97607f7e459 Mon Sep 17 00:00:00 2001 From: duvvuvenkataramana Date: Wed, 22 Oct 2025 04:06:30 +0530 Subject: [PATCH 2/3] Update multiple scripts: added fixes and improvements --- alarm_clock/AlarmClock.py | 1 - audio_sticky_notes/main.py | 2 -- auto_clicker/autoclicker.py | 1 - auto_sms/main.py | 3 -- book_manager/bookman.py | 5 --- corona_tracker_visualizer/corona_tracker.py | 3 -- discord_github_bot/bot.py | 1 - interview_automater/app.py | 11 ------ jpg_to_png/jpg_to_png.py | 2 -- json_to_md/script.py | 3 -- mp4_to_mp3_convertor/main.py | 1 - multimode-calculator/calculator.py | 38 --------------------- music_player/player.py | 2 -- password_manager/password_manager.py | 1 - polygon_detector/polygon_detect.py | 1 - qrcode_generator/qr_generator.py | 2 -- qrcode_scanner/scanner.py | 1 - quick_painter/main.py | 2 -- sort_vizualizer/main.py | 1 - stop_watch/Stopwatch.py | 4 --- sudoku_solver/solve_sudoku.py | 3 -- text_encryptor/aes_enc_dec.py | 1 - tkinter_python_gui/USWeatherForecast.py | 1 - 23 files changed, 90 deletions(-) diff --git a/alarm_clock/AlarmClock.py b/alarm_clock/AlarmClock.py index 8d06e03d..3dccf69d 100644 --- a/alarm_clock/AlarmClock.py +++ b/alarm_clock/AlarmClock.py @@ -6,7 +6,6 @@ def snooze(t): - global set_time HH_MM = set_time.split(':') HH_MM[1] = str(int(HH_MM[1]) + t) set_time = ':'.join(HH_MM) diff --git a/audio_sticky_notes/main.py b/audio_sticky_notes/main.py index b51fcbc9..4a9bd890 100644 --- a/audio_sticky_notes/main.py +++ b/audio_sticky_notes/main.py @@ -7,14 +7,12 @@ def makenew(): def maker(wins): - global numofwindows subprocess.Popen(["python.exe", "note.py", str(numofwindows)], shell=True) numofwindows = 1 + wins maintain() def maintain(): - global numofwindows storage = open("assets\\storage", "w") storage.write(str(numofwindows)) storage.close() diff --git a/auto_clicker/autoclicker.py b/auto_clicker/autoclicker.py index f0091fe7..df4785ce 100644 --- a/auto_clicker/autoclicker.py +++ b/auto_clicker/autoclicker.py @@ -27,7 +27,6 @@ def choose_delay(): def key_press(key): - global running, pause if key == start_or_pause_key: pause = not pause diff --git a/auto_sms/main.py b/auto_sms/main.py index bd265785..43c20fe6 100644 --- a/auto_sms/main.py +++ b/auto_sms/main.py @@ -3,9 +3,6 @@ import requests # Variables -global apiKey -global SID -global senderID apiKey = "" # enter your api key SID = "" # enter your SID number senderID = "" # enter the senderID registered diff --git a/book_manager/bookman.py b/book_manager/bookman.py index aa41d686..148b854f 100644 --- a/book_manager/bookman.py +++ b/book_manager/bookman.py @@ -20,7 +20,6 @@ class Ui_MainWindow(object): def setupUi(self, MainWindow): - global books MainWindow.setObjectName("MainWindow") MainWindow.resize(1037, 622) self.centralwidget = QtWidgets.QWidget(MainWindow) @@ -133,7 +132,6 @@ def retranslateUi(self, MainWindow): def show_all(self): self.list_1.clear() - global books # print(books) for item in books: newitem = QtWidgets.QListWidgetItem( @@ -147,7 +145,6 @@ def show_all(self): self.lineEdit.clear() def search_books(self): - global books results = [] searchtext = self.lineEdit.text() field = [self.radioButton_1.isChecked(), self.radioButton_2.isChecked( @@ -167,7 +164,6 @@ def search_books(self): self.list_1.addItem(newitem) def add_books(self): - global books res = self.open_dialog_box() name = res[0].split('/')[-1] Dialog2 = QtWidgets.QDialog() @@ -196,7 +192,6 @@ def open_dialog_box(self): # print(filename) def open_properties(self, item): - global books lines = item.text().split('\n') final = [] for index, i in enumerate(lines): diff --git a/corona_tracker_visualizer/corona_tracker.py b/corona_tracker_visualizer/corona_tracker.py index 8016eec1..9ec86454 100644 --- a/corona_tracker_visualizer/corona_tracker.py +++ b/corona_tracker_visualizer/corona_tracker.py @@ -339,9 +339,6 @@ def refresh(): def main_ui(): """Main user interface""" - global root - global frame_stat - global frame_data root = tk.Tk() diff --git a/discord_github_bot/bot.py b/discord_github_bot/bot.py index b9e022e2..b184bee9 100644 --- a/discord_github_bot/bot.py +++ b/discord_github_bot/bot.py @@ -26,7 +26,6 @@ def get_github_notifications(): # Notification Sender function async def send_notification(context): # Check if channel is present in guild - global already_sent channel = discord_get( context.guild.text_channels, name=config.DISCORD_CHANNEL, diff --git a/interview_automater/app.py b/interview_automater/app.py index b8dcc5b5..f986a1dd 100644 --- a/interview_automater/app.py +++ b/interview_automater/app.py @@ -15,7 +15,6 @@ # Defining global variables -global name, score score = 0 @@ -81,7 +80,6 @@ def update_name(name, n_clicks): [Input('a1', 'value')] ) def q1(a1): - global score if a1 is None: raise PreventUpdate else: @@ -107,7 +105,6 @@ def q1(a1): [Input('a2', 'value')] ) def q2(a2): - global score if a2 is None: raise PreventUpdate else: @@ -135,7 +132,6 @@ def q2(a2): [Input('a3', 'value')] ) def q3(a3): - global score if a3 is None: raise PreventUpdate else: @@ -177,7 +173,6 @@ def q3(a3): [Input('a4', 'value')] ) def q4(a4): - global score if a4 is None: raise PreventUpdate else: @@ -210,7 +205,6 @@ def q4(a4): [Input('a5', 'value')] ) def q5(a5): - global score if a5 is None: raise PreventUpdate else: @@ -235,7 +229,6 @@ def q5(a5): [Input('a6', 'value')] ) def q6(a6): - global score if a6 is None: raise PreventUpdate else: @@ -263,7 +256,6 @@ def q6(a6): [Input('a7', 'value')] ) def q7(a7): - global score if a7 is None: raise PreventUpdate else: @@ -291,7 +283,6 @@ def q7(a7): [Input('a8', 'value')] ) def q8(a8): - global score if a8 is None: raise PreventUpdate else: @@ -321,7 +312,6 @@ def q8(a8): [Input('a9', 'value')] ) def q9(a9): - global score if a9 is None: raise PreventUpdate else: @@ -357,7 +347,6 @@ def q9(a9): [Input('a10', 'value')] ) def q10(a10): - global score if a10 is None: raise PreventUpdate else: diff --git a/jpg_to_png/jpg_to_png.py b/jpg_to_png/jpg_to_png.py index 0af56802..b4ba154f 100644 --- a/jpg_to_png/jpg_to_png.py +++ b/jpg_to_png/jpg_to_png.py @@ -23,7 +23,6 @@ # function to convert file from jpg to png def jpg_to_png(): - global im1 import_filename = fd.askopenfilename() if import_filename.endswith('.jpg'): @@ -42,7 +41,6 @@ def jpg_to_png(): # function to convert png file to jpg def png_to_jpg(): - global im1 import_filename = fd.askopenfilename() if import_filename.endswith('.png'): diff --git a/json_to_md/script.py b/json_to_md/script.py index 10bdab52..2781b056 100644 --- a/json_to_md/script.py +++ b/json_to_md/script.py @@ -68,13 +68,11 @@ def build_value_chain(key, value, depth): def add_header(value, depth): chain = build_header_chain(depth) - global markdown markdown += chain.replace('value', value.title()) def add_value(key, value, depth): chain = build_value_chain(key, value, depth) - global markdown markdown += chain @@ -87,7 +85,6 @@ def convert(input_file, output_file, options): json_data = load_json(input_file) depth = 0 parse_json(json_data, depth, options) - global markdown markdown = markdown.replace('#######', '######') write_out(markdown, output_file) diff --git a/mp4_to_mp3_convertor/main.py b/mp4_to_mp3_convertor/main.py index 114abf28..6ae0564a 100644 --- a/mp4_to_mp3_convertor/main.py +++ b/mp4_to_mp3_convertor/main.py @@ -33,7 +33,6 @@ def mp4_choose(): - global filename, onlyfilename filename = filedialog.askopenfilename(initialdir="/", title="Choose MP4", filetypes=(("Text files", "*.Mp4*"), diff --git a/multimode-calculator/calculator.py b/multimode-calculator/calculator.py index 1a4cf576..969861ab 100644 --- a/multimode-calculator/calculator.py +++ b/multimode-calculator/calculator.py @@ -11,8 +11,6 @@ def sin(): - global sign - global num sign = "sin" num = float(e.get()) e.delete(0, len(e.get())) @@ -22,8 +20,6 @@ def sin(): def cos(): - global sign - global num sign = "cos" num = float(e.get()) e.delete(0, len(e.get())) @@ -33,8 +29,6 @@ def cos(): def tan(): - global sign - global num sign = "tan" num = float(e.get()) e2.delete(0, len(e2.get())) @@ -44,8 +38,6 @@ def tan(): def tan_inv(): - global sign - global num sign = "tan_inv" num = float(e.get()) e.delete(0, len(e.get())) @@ -55,8 +47,6 @@ def tan_inv(): def cos_inv(): - global sign - global num sign = "cos_inv" num = float(e.get()) e.delete(0, len(e.get())) @@ -66,8 +56,6 @@ def cos_inv(): def sin_inv(): - global sign - global num sign = "sin_inv" num = float(e.get()) e.delete(0, len(e.get())) @@ -77,9 +65,7 @@ def sin_inv(): def exp(): - global num num = e.get() - global sign sign = "exp" e.delete(0, len(e.get())) e2.delete(0, len(e2.get())) @@ -88,8 +74,6 @@ def exp(): def fact(): - global num - global sign num = int(e.get()) sign = "fact" e2.insert(len(e.get()), "!") @@ -97,9 +81,7 @@ def fact(): def sqrt(): - global num num = float(e.get()) - global sign sign = "sqrt" e2.delete(0, len(e2.get())) e2.insert(0, "sqrt(" + str(num) + ")") @@ -108,9 +90,7 @@ def sqrt(): def cube(): - global num num = float(e.get()) - global sign sign = "cube" e2.delete(0, len(e2.get())) e2.insert(len(e.get()), str(num) + "^3") @@ -119,9 +99,7 @@ def cube(): def n_pow(): - global f_num f_num = e.get() - global sign sign = "n_pow" e2.delete(0, len(e2.get())) e.delete(0, len(e.get())) @@ -129,8 +107,6 @@ def n_pow(): def inv(): - global num - global sign sign = "inv" num = float(e.get()) e2.insert(len(e2.get()), "^(-1)") @@ -138,10 +114,8 @@ def inv(): def rem(): - global f_num e2.delete(0, len(e2.get())) f_num = float(e.get()) - global sign sign = "rem" e2.insert(0, str(f_num) + " % ") e.delete(0, len(e.get())) @@ -159,9 +133,7 @@ def show(number): def addition(): first_num = e.get() e2.delete(0, len(e2.get())) - global sign sign = "addition" - global f_num f_num = float(first_num) e2.insert(0, str(f_num) + " + ") e.delete(0, len(e.get())) @@ -170,9 +142,7 @@ def addition(): def subtraction(): first_num = e.get() e2.delete(0, len(e2.get())) - global sign sign = "subtraction" - global f_num f_num = float(first_num) e2.insert(0, str(f_num) + " - ") e.delete(0, len(e.get())) @@ -181,9 +151,7 @@ def subtraction(): def multiplication(): first_num = e.get() e2.delete(0, len(e2.get())) - global sign sign = "multiplication" - global f_num f_num = float(first_num) e2.insert(0, str(f_num) + " * ") e.delete(0, len(e.get())) @@ -192,9 +160,7 @@ def multiplication(): def division(): first_num = e.get() e2.delete(0, len(e2.get())) - global sign sign = "division" - global f_num f_num = float(first_num) e2.insert(0, str(f_num) + " / ") e.delete(0, len(e.get())) @@ -330,7 +296,6 @@ def clear(): def create_frame(mode): - global frame try: frame.destroy() @@ -341,8 +306,6 @@ def create_frame(mode): frame = tk.Label(root, background="sky blue") frame.grid(row=1, column=0, columnspan=3, padx=10, pady=10) - global e - global e2 e2 = tk.Entry( frame, font=("Helvetica", 9), width=40, borderwidth=2 ) @@ -704,7 +667,6 @@ def create_frame(mode): root.configure(background="sky blue") """ - global frame frame = tk.Label(root) frame.grid(row=1, column=0, columnspan=2) """ diff --git a/music_player/player.py b/music_player/player.py index 57fee19d..564772e7 100644 --- a/music_player/player.py +++ b/music_player/player.py @@ -14,7 +14,6 @@ def pick_music(): - global music_path, label_text # Get chosen files path music_path = filedialog.askopenfilename( filetypes=(("mp3 files", "*.mp3"), ("waw files", "*.waw"))) @@ -27,7 +26,6 @@ def pick_music(): def play_music(): - global p # If song playing try to stop try: p.stop() diff --git a/password_manager/password_manager.py b/password_manager/password_manager.py index 7e5feaf6..608f0e86 100755 --- a/password_manager/password_manager.py +++ b/password_manager/password_manager.py @@ -410,7 +410,6 @@ def exit_program(sig, frame): if __name__ == '__main__': - global args # The program arguments parser = argparse.ArgumentParser(description="Password Manager CLI") # -p | --password PASSWORD diff --git a/polygon_detector/polygon_detect.py b/polygon_detector/polygon_detect.py index 3764b845..0921392b 100644 --- a/polygon_detector/polygon_detect.py +++ b/polygon_detector/polygon_detect.py @@ -9,7 +9,6 @@ def scan_image(img_file_path): - global shapes img = cv2.imread(img_file_path) gimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) diff --git a/qrcode_generator/qr_generator.py b/qrcode_generator/qr_generator.py index df819ec2..9a4fa8f2 100644 --- a/qrcode_generator/qr_generator.py +++ b/qrcode_generator/qr_generator.py @@ -34,7 +34,6 @@ # Function to clear screen def clear(): - global main, root main.destroy() main = tkinter.Frame(root, padx=10, pady=10) main.pack(padx=10, pady=10) @@ -49,7 +48,6 @@ def clear(): # Function to open File explorer to upload file def openFE(): - global my_image root.filename = filedialog.askopenfilename( initialdir='/home', title="Select file", diff --git a/qrcode_scanner/scanner.py b/qrcode_scanner/scanner.py index 30ef6633..763ef80c 100644 --- a/qrcode_scanner/scanner.py +++ b/qrcode_scanner/scanner.py @@ -11,7 +11,6 @@ def open(): - global my_image root.filename = filedialog.askopenfilename( initialdir='/home', title="Select file", diff --git a/quick_painter/main.py b/quick_painter/main.py index d745a522..5cee5cf5 100644 --- a/quick_painter/main.py +++ b/quick_painter/main.py @@ -19,7 +19,6 @@ def ButtonColor(): - global color colortemp = (colorchooser.askcolor(title="Choose Color"))[1] color = colortemp @@ -53,7 +52,6 @@ def ButtonClear(): def cursor(event): - global cursor_ if cursor_ not in canvas.find_all(): cursor_ = canvas.create_oval(event.x - 10, event.y - 10, event.x + 10, event.y + 10, width=0, fill='cyan') canvas.coords(cursor_, event.x - 10, event.y - 10, event.x + 10, event.y + 10) diff --git a/sort_vizualizer/main.py b/sort_vizualizer/main.py index b1c74ffb..0cf7cf84 100644 --- a/sort_vizualizer/main.py +++ b/sort_vizualizer/main.py @@ -49,7 +49,6 @@ def drawRect(array, color): # generate random elements for the array and # draw their rectangles on the canvas def Generate(): - global array try: minVal = int(minEntry.get()) maxVal = int(maxEntry.get()) diff --git a/stop_watch/Stopwatch.py b/stop_watch/Stopwatch.py index 69f72fb4..2482cf76 100644 --- a/stop_watch/Stopwatch.py +++ b/stop_watch/Stopwatch.py @@ -9,7 +9,6 @@ def counter_label(label): def count(): if running: - global counter # To manage the initial delay. if counter == 66600: @@ -36,7 +35,6 @@ def count(): # start function of the stopwatch def Start(label): - global running running = True counter_label(label) start['state'] = 'disabled' @@ -46,7 +44,6 @@ def Start(label): # Stop function of the stopwatch def Stop(): - global running start['state'] = 'normal' stop['state'] = 'disabled' reset['state'] = 'normal' @@ -55,7 +52,6 @@ def Stop(): # Reset function of the stopwatch def Reset(label): - global counter counter = 66600 # If reset is pressed after pressing stop. diff --git a/sudoku_solver/solve_sudoku.py b/sudoku_solver/solve_sudoku.py index 0a60c9e6..acbcc0be 100644 --- a/sudoku_solver/solve_sudoku.py +++ b/sudoku_solver/solve_sudoku.py @@ -1,6 +1,5 @@ def is_number_valid(row, col, num): # function to find if the number is valid or not in the respective space - global grid # making grid as global variable for i in range(0, 9): # for loop to find if the number is present in the row or not if grid[row][i] == num: @@ -21,7 +20,6 @@ def is_number_valid(row, col, num): def print_board(): # function to print the puzzle after solving - global grid # global variables for i in range(len(grid)): # for loop to print the board if i % 3 == 0 and i != 0: print("- - - - - - - - - - - - - ") @@ -38,7 +36,6 @@ def print_board(): # function to print the puzzle after solving def solve_sudoku(): # function to solve sudoku problem - global grid for row in range(9): # for loop to find 0 in the row and column for col in range(9): diff --git a/text_encryptor/aes_enc_dec.py b/text_encryptor/aes_enc_dec.py index 55ea8614..223d7ed7 100644 --- a/text_encryptor/aes_enc_dec.py +++ b/text_encryptor/aes_enc_dec.py @@ -16,7 +16,6 @@ def GetKey(): - global KEY tempKey = input("Enter password(min length: 8, max length: 32)") while (len(tempKey.strip()) < 8 or len(tempKey.strip()) > 32 or ' ' in tempKey): if (' ' in tempKey): diff --git a/tkinter_python_gui/USWeatherForecast.py b/tkinter_python_gui/USWeatherForecast.py index 62544f91..4cacf737 100644 --- a/tkinter_python_gui/USWeatherForecast.py +++ b/tkinter_python_gui/USWeatherForecast.py @@ -92,7 +92,6 @@ def NewEntry(data, city): # Function to add a new city to the list of weather forecasts def addWeather(): - global newTable if newTable: city = cityEntry.get() location = city + ",us" From c4c8f62b0e1a82cb9f73292efbe3f828da4ffc31 Mon Sep 17 00:00:00 2001 From: duvvuvenkataramana Date: Wed, 22 Oct 2025 04:22:13 +0530 Subject: [PATCH 3/3] Fix Flake8 errors: remove unused variables and assign newTable properly --- stop_watch/Stopwatch.py | 4 ++-- tkinter_python_gui/USWeatherForecast.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stop_watch/Stopwatch.py b/stop_watch/Stopwatch.py index 2482cf76..a7126647 100644 --- a/stop_watch/Stopwatch.py +++ b/stop_watch/Stopwatch.py @@ -3,7 +3,7 @@ from datetime import datetime counter = 66600 -running = False +running = def counter_label(label): @@ -11,7 +11,7 @@ def count(): if running: # To manage the initial delay. - if counter == 66600: + if counter == display = "Starting" else: tt = datetime.fromtimestamp(counter) diff --git a/tkinter_python_gui/USWeatherForecast.py b/tkinter_python_gui/USWeatherForecast.py index 4cacf737..dfae5fe9 100644 --- a/tkinter_python_gui/USWeatherForecast.py +++ b/tkinter_python_gui/USWeatherForecast.py @@ -85,7 +85,7 @@ def NewEntry(data, city): cityEntry.grid(column=1, row=2, pady=20) # Global variables to update button text and check if table exists -newTable = True +newTable = [] button_text = tk.StringVar() button_text.set("Get Weather")