Updated docstrings longer than 72 characters

This commit is contained in:
2Shirt 2018-12-27 20:51:56 -07:00
parent 387062074a
commit c501c8b23f
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
10 changed files with 30 additions and 18 deletions

View file

@ -170,7 +170,13 @@ def backup_browsers():
function=archive_browser, name=name)
def clean_chromium_profile(profile):
"""Renames profile, creates a new folder, and copies the user data to it."""
"""Recreate profile with only the essential user data.
This is done by renaming the existing profile, creating a new folder
with the original name, then copying the essential files from the
backup folder. This way the original state is preserved in case
something goes wrong.
"""
if profile is None:
raise Exception
backup_path = '{path}_{Date}.bak'.format(
@ -203,7 +209,13 @@ def clean_internet_explorer(**kwargs):
pass
def clean_mozilla_profile(profile):
"""Renames profile, creates a new folder, and copies the user data to it."""
"""Recreate profile with only the essential user data.
This is done by renaming the existing profile, creating a new folder
with the original name, then copying the essential files from the
backup folder. This way the original state is preserved in case
something goes wrong.
"""
if profile is None:
raise Exception
backup_path = '{path}_{Date}.bak'.format(
@ -229,7 +241,7 @@ def clean_mozilla_profile(profile):
f.write('user_pref("{}", {});\n'.format(k, v))
def get_browser_details(name):
"""Get install status and profile details for all supported browsers."""
"""Get installation and profile details for all supported browsers."""
browser = SUPPORTED_BROWSERS[name].copy()
# Update user_data_path

View file

@ -94,7 +94,7 @@ def abort():
exit_script()
def ask(prompt='Kotaero!'):
"""Prompt the user with a Y/N question, log answer, and return a bool."""
"""Prompt the user with a Y/N question, returns bool."""
answer = None
prompt = '{} [Y/N]: '.format(prompt)
while answer is None:
@ -110,7 +110,7 @@ def ask(prompt='Kotaero!'):
return answer
def choice(choices, prompt='Kotaero!'):
"""Prompt the user with a choice question, log answer, and returns str."""
"""Prompt the user with a choice question, returns str."""
answer = None
choices = [str(c) for c in choices]
choices_short = {c[:1].upper(): c for c in choices}
@ -252,7 +252,7 @@ def get_ticket_number():
return ticket_number
def human_readable_size(size, decimals=0):
"""Convert size in bytes to a human-readable format and return a str."""
"""Convert size from bytes to a human-readable format, returns str."""
# Prep string formatting
width = 3+decimals
if decimals > 0:

View file

@ -117,7 +117,7 @@ SEM_NOOPENFILEERRORBOX = 0x8000
SEM_FAIL = SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS
def cleanup_transfer(dest_path):
"""Fix attributes and move extraneous items outside the Transfer folder."""
"""Fix attributes and move excluded items to separate folder."""
try:
# Remove dest_path if empty
os.rmdir(dest_path)
@ -221,7 +221,7 @@ def fix_path_sep(path_str):
return re.sub(r'(\\|/)+', lambda s: os.sep, path_str)
def is_valid_wim_file(item):
"""Checks if the provided os.DirEntry is a valid WIM file, returns bool."""
"""Checks if the item is a valid WIM file, returns bool."""
valid = bool(item.is_file() and REGEX_WIM_FILE.search(item.name))
if valid:
extract_item('wimlib', silent=True)

View file

@ -255,7 +255,7 @@ class ImageObj(BaseObj):
self.path))
def set_details(self):
"""Setup loopback device, set details via lsblk, then detach device."""
"""Set details using a temp loopback device."""
self.type = 'image'
self.loop_dev = setup_loopback_device(self.path)
self.details = get_device_details(self.loop_dev)

View file

@ -164,7 +164,7 @@ def get_installed_office():
return programs
def get_shell_path(folder, user='current'):
"""Get shell path using SHGetKnownFolderPath via knownpaths, returns str.
"""Get shell path using knownpaths, returns str.
NOTE: Only works for the current user.
Code based on https://gist.github.com/mkropat/7550097

View file

@ -43,7 +43,7 @@ def run_chkdsk_offline():
raise GenericError
def run_dism(repair=False):
"""Run DISM /RestoreHealth, then /CheckHealth, and then report errors."""
"""Run DISM to either scan or repair component store health."""
if global_vars['OS']['Version'] in ('8', '8.1', '10'):
if repair:
# Restore Health

View file

@ -167,7 +167,7 @@ def monitor_sensors(monitor_pane, monitor_file):
break
def save_average_temp(sensor_data, temp_label, seconds=10):
"""Calculate average temps and record under temp_label, returns dict."""
"""Save average temps under temp_label, returns dict."""
clear_temps(sensor_data)
# Get temps

View file

@ -181,11 +181,11 @@ def config_classicstart():
popen_program(cs_exe)
def config_explorer_system():
"""Configure Windows Explorer for all users via Registry settings."""
"""Configure Windows Explorer for all users."""
write_registry_settings(SETTINGS_EXPLORER_SYSTEM, all_users=True)
def config_explorer_user():
"""Configure Windows Explorer for current user via Registry settings."""
"""Configure Windows Explorer for current user."""
write_registry_settings(SETTINGS_EXPLORER_USER, all_users=False)
def disable_windows_telemetry():
@ -241,7 +241,7 @@ def install_adobe_reader():
run_program(cmd)
def install_chrome_extensions():
"""Update registry to install Google Chrome extensions for all users."""
"""Install Google Chrome extensions for all users."""
write_registry_settings(SETTINGS_GOOGLE_CHROME, all_users=True)
def install_classicstart_skin():
@ -258,7 +258,7 @@ def install_classicstart_skin():
shutil.copy(source, dest)
def install_firefox_extensions():
"""Update registry to install Firefox extensions for all users."""
"""Install Firefox extensions for all users."""
dist_path = r'{PROGRAMFILES}\Mozilla Firefox\distribution\extensions'.format(
**global_vars['Env'])
source_path = r'{CBinDir}\FirefoxExtensions.7z'.format(**global_vars)

View file

@ -156,7 +156,7 @@ def format_mbr(disk):
run_diskpart(script)
def mount_windows_share():
"""Mount the Windows images share unless labeled as already mounted."""
"""Mount the Windows images share unless already mounted."""
if not WINDOWS_SERVER['Mounted']:
# Mounting read-write in case a backup was done in the same session
# and the server was left mounted read-write. This avoids throwing an

View file

@ -250,7 +250,7 @@ def menu_root():
sys.exit()
def menu_setup():
"""Format a disk (MBR/GPT), apply a Windows image, and setup boot files."""
"""Format a disk, apply a Windows image, and create boot files."""
errors = False
other_results = {
'Error': {