From c9ef78752179a97b25471569df15ed9f769f9ae7 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Thu, 20 Apr 2023 22:52:52 +0200 Subject: [PATCH] added shebangs --- src/adder.py | 3 ++- src/args.py | 3 ++- src/class-incest.py | 1 + src/hello.py | 3 ++- src/my-curses.py | 25 +++++++++++++++++++++++++ src/randomString.py | 1 + src/simple-calc.py | 3 ++- 7 files changed, 35 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/adder.py mode change 100644 => 100755 src/args.py mode change 100644 => 100755 src/class-incest.py mode change 100644 => 100755 src/hello.py create mode 100755 src/my-curses.py mode change 100644 => 100755 src/randomString.py mode change 100644 => 100755 src/simple-calc.py diff --git a/src/adder.py b/src/adder.py old mode 100644 new mode 100755 index 97054d7..7927396 --- a/src/adder.py +++ b/src/adder.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import sys if __name__ == "__main__": @@ -6,4 +7,4 @@ if __name__ == "__main__": for arg in sys.argv: if(arg.isdecimal()): result += int(arg) - print(result) \ No newline at end of file + print(result) diff --git a/src/args.py b/src/args.py old mode 100644 new mode 100755 index cde3aec..777dc71 --- a/src/args.py +++ b/src/args.py @@ -1,6 +1,7 @@ +#!/usr/bin/env python3 import sys if __name__ == "__main__": print(f"Arguments count: {len(sys.argv)}") for i, arg in enumerate(sys.argv): - print(f"Argument {i:>6}: {arg}") \ No newline at end of file + print(f"Argument {i:>6}: {arg}") diff --git a/src/class-incest.py b/src/class-incest.py old mode 100644 new mode 100755 index 747486a..b188de7 --- a/src/class-incest.py +++ b/src/class-incest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 class Root(): a = "Root" def f(self): diff --git a/src/hello.py b/src/hello.py old mode 100644 new mode 100755 index 0f31502..4a01940 --- a/src/hello.py +++ b/src/hello.py @@ -1,6 +1,7 @@ +#!/usr/bin/env python3 print("hello world!\n") for i in range(10): if(i<9): print((i)*"hello-"+"hello") elif(i==0): - print("hello") \ No newline at end of file + print("hello") diff --git a/src/my-curses.py b/src/my-curses.py new file mode 100755 index 0000000..515c4a5 --- /dev/null +++ b/src/my-curses.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# stolen from stackoverflow: https://stackoverflow.com/questions/6840420/rewrite-multiple-lines-in-the-console +# breaks if filename is curses.py +import curses +import time + +def report_progress(filename, progress): + """progress: 0-10""" + stdscr.addstr(0, 0, "Moving file: {0}".format(filename)) + stdscr.addstr(1, 0, "Total progress: [{1:10}] {0}%".format(progress * 10, "#" * progress)) + stdscr.refresh() + +if __name__ == "__main__": + stdscr = curses.initscr() + curses.noecho() + curses.cbreak() + + try: + for i in range(10): + report_progress("file_{0}.txt".format(i), i+1) + time.sleep(0.5) + finally: + curses.echo() + curses.nocbreak() + curses.endwin() diff --git a/src/randomString.py b/src/randomString.py old mode 100644 new mode 100755 index f4285d9..f5b1583 --- a/src/randomString.py +++ b/src/randomString.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import random import string diff --git a/src/simple-calc.py b/src/simple-calc.py old mode 100644 new mode 100755 index decb6a3..6e38344 --- a/src/simple-calc.py +++ b/src/simple-calc.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import sys if __name__ == "__main__": @@ -62,4 +63,4 @@ if __name__ == "__main__": else: print(f"'{op}' is not a valid operator") sys.exit() - \ No newline at end of file +