From 5d0abb0537d8a2c563eac00838b20ffe121060aa Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 15 Jun 2023 17:02:44 -0400 Subject: [PATCH] Fixed potential variable undefined errors Former-commit-id: 65168e24ed228816d4089241d4086317488fd696 Former-commit-id: 5c46855d45488b2ec5fd8b53040237fc224b45d4 --- lib/stweak.py | 2 +- port-jobs/CLIPBOARD.py | 2 +- port-jobs/UNAME.py | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/stweak.py b/lib/stweak.py index a361f9a..73857a7 100644 --- a/lib/stweak.py +++ b/lib/stweak.py @@ -238,7 +238,7 @@ def refresh_encryption(): _proceed = curses_radio(('yes', 'no'), "are you sure you wish to re-encrypt all entries with this key?" "\n\n\n\n\nWARNING: proceeding with this action will remove/overwrite" " any directories matching the following:" - f"\n\n{home}/.local/share/sshyp.old\n{home}/.local/share/sshyp.new\n\n") + f"\n\n{home}/.local/share/sshyp.old\n{home}/.local/share/sshyp.new\n\n") if _proceed != 0: return 3 diff --git a/port-jobs/CLIPBOARD.py b/port-jobs/CLIPBOARD.py index 489ebb8..406ad5e 100755 --- a/port-jobs/CLIPBOARD.py +++ b/port-jobs/CLIPBOARD.py @@ -3,7 +3,7 @@ import re from sys import argv, exit as s_exit # read arguments -arguments = argv[1:] +arguments, replacement = argv[1:], None # define replacement text depending on arguments if len(arguments) > 0: diff --git a/port-jobs/UNAME.py b/port-jobs/UNAME.py index 929be2a..c110204 100755 --- a/port-jobs/UNAME.py +++ b/port-jobs/UNAME.py @@ -3,7 +3,7 @@ import re from sys import argv, exit as s_exit # read arguments -arguments = argv[1:] +arguments, replacement = argv[1:], None # define replacement text depending on arguments if len(arguments) > 0: @@ -25,6 +25,8 @@ for target in targets: # determine text to end regex with if target[2] == '': regend = '\n' + else: + regend = '' # compile regex and modify text regex = re.compile(f"# PORT START {target[0]}.*?# PORT END {target[0]}{regend}", re.DOTALL) new_text = re.sub(regex, target[2], text)