Move some rarely used import statements closer to where they are needed

Former-commit-id: a4785c178b5da044d1cf2ec2ecb2868ed8e3e877 [formerly 74f9f616f3]
Former-commit-id: c7c06f402627cc0169ed9e654086e89123639902
This commit is contained in:
2022-11-26 14:05:19 -05:00
parent 574637392a
commit b8dc5c4f89
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -2,11 +2,11 @@
from os import environ, listdir, remove, system, uname, walk from os import environ, listdir, remove, system, uname, walk
from os.path import expanduser from os.path import expanduser
from pathlib import Path from pathlib import Path
from random import randint, SystemRandom from random import randint
from shutil import get_terminal_size, move, rmtree from shutil import get_terminal_size, move, rmtree
import sshync import sshync
from sshypRemote import delete as offline_delete from sshypRemote import delete as offline_delete
from subprocess import CalledProcessError, DEVNULL, Popen, PIPE, run from subprocess import CalledProcessError, DEVNULL, PIPE, run
from sys import argv, exit as s_exit from sys import argv, exit as s_exit
@@ -98,6 +98,7 @@ def entry_name_fetch(_entry_name_location): # fetches and returns entry name fr
def string_gen(_complexity, _length): # generates and returns a random string based on input def string_gen(_complexity, _length): # generates and returns a random string based on input
from random import SystemRandom
import string import string
if _complexity == 's': if _complexity == 's':
_character_pool = string.ascii_letters + string.digits _character_pool = string.ascii_letters + string.digits
@@ -750,6 +751,7 @@ def gen(): # generates a password for a new or an existing entry
def copy_data(): # copies a specified field of an entry to the clipboard def copy_data(): # copies a specified field of an entry to the clipboard
from subprocess import Popen
if len(argument_list) < 4: if len(argument_list) < 4:
_entry_name = entry_name_fetch('entry to copy: ') _entry_name = entry_name_fetch('entry to copy: ')
else: else:
+1 -1
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from os import listdir, remove, walk from os import listdir, remove, walk
from os.path import expanduser from os.path import expanduser
from shutil import rmtree
def delete(_file_path, _target_database): # deletes an entry or folder def delete(_file_path, _target_database): # deletes an entry or folder
from shutil import rmtree
try: try:
if _file_path.endswith('/'): if _file_path.endswith('/'):
rmtree(f"{expanduser('~/.local/share/sshyp/')}{_file_path}") rmtree(f"{expanduser('~/.local/share/sshyp/')}{_file_path}")